private static boolean isProductInventoryAvailableByFacility(String productId,String inventoryFacilityId,BigDecimal quantity,LocalDispatcher dispatcher){
  BigDecimal availableToPromise=null;
  try {
    Map<String,Object> result=dispatcher.runSync("getInventoryAvailableByFacility",UtilMisc.toMap("productId",productId,"facilityId",inventoryFacilityId));
    availableToPromise=(BigDecimal)result.get("availableToPromiseTotal");
    if (availableToPromise == null) {
      Debug.logWarning("The getInventoryAvailableByFacility service returned a null availableToPromise, the error message was:\n" + result.get(ModelService.ERROR_MESSAGE),module);
      return false;
    }
  }
 catch (  GenericServiceException e) {
    Debug.logWarning(e,"Error invoking getInventoryAvailableByFacility service in isCatalogInventoryAvailable",module);
    return false;
  }
  if (availableToPromise.compareTo(quantity) >= 0) {
    if (Debug.infoOn())     Debug.logInfo("Inventory IS available in facility with id " + inventoryFacilityId + " for product id "+ productId+ "; desired quantity is "+ quantity+ ", available quantity is "+ availableToPromise,module);
    return true;
  }
 else {
    if (Debug.infoOn())     Debug.logInfo("Returning false because there is insufficient inventory available in facility with id " + inventoryFacilityId + " for product id "+ productId+ "; desired quantity is "+ quantity+ ", available quantity is "+ availableToPromise,module);
    return false;
  }
}

private static boolean isProductInventoryAvailableByFacility ( String productId , String inventoryFacilityId , BigDecimal quantity , LocalDispatcher dispatcher ) { BigDecimal availableToPromise = null ; try { Map < String , Object > result = dispatcher . runSync ( "getInventoryAvailableByFacility" , UtilMisc . toMap ( "productId" , productId , "facilityId" , inventoryFacilityId ) ) ; availableToPromise = ( BigDecimal ) result . get ( "availableToPromiseTotal" ) ; if ( availableToPromise == null ) { Debug . logWarning ( "The getInventoryAvailableByFacility service returned a null availableToPromise, the error message was:\n" + result . get ( ModelService . ERROR_MESSAGE ) , module ) ; return false ; } } catch ( GenericServiceException e ) { Debug . logWarning ( e , "Error invoking getInventoryAvailableByFacility service in isCatalogInventoryAvailable" , module ) ; return false ; } if ( availableToPromise . compareTo ( quantity ) >= 0 ) { if ( Debug . infoOn ( ) ) Debug . logInfo ( "Inventory IS available in facility with id " + inventoryFacilityId + " for product id " + productId + "; desired quantity is " + quantity + ", available quantity is " + availableToPromise , module ) ; return true ; } else { if ( Debug . infoOn ( ) ) Debug . logInfo ( "Returning false because there is insufficient inventory available in facility with id " + inventoryFacilityId + " for product id " + productId + "; desired quantity is " + quantity + ", available quantity is " + availableToPromise , module ) ; return false ; } }
invokes the getinventoryavailablebyfacility service , returns true if specified quantity is available , else false this is only used in the related method that uses a productconfigwrapper , until that is refactored into a service as well . . .
