本文整理汇总了Java中javolution.util.FastMap.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java FastMap.newInstance方法的具体用法?Java FastMap.newInstance怎么用?Java FastMap.newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javolution.util.FastMap
的用法示例。
在下文中一共展示了FastMap.newInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSelected
import javolution.util.FastMap; //导入方法依赖的package包/类
public void setSelected(int question, int option, int component, String componentOption) throws Exception {
// set variant products
ConfigOption theOption = getItemOtion(question, option);
List<GenericValue> components = theOption.getComponents();
GenericValue oneComponent = components.get(component);
if (theOption.isVirtualComponent(oneComponent)) {
if (theOption.componentOptions == null) {
theOption.componentOptions = FastMap.newInstance();
}
theOption.componentOptions.put(oneComponent.getString("productId"), componentOption);
// recalculate option price
theOption.recalculateOptionPrice(this);
}
}
示例2: createInvoiceTerms
import javolution.util.FastMap; //导入方法依赖的package包/类
private static void createInvoiceTerms(Delegator delegator, LocalDispatcher dispatcher, String invoiceId, List<GenericValue> terms, GenericValue userLogin, Locale locale) {
if (terms != null) {
for (GenericValue term : terms) {
Map<String, Object> createInvoiceTermContext = FastMap.newInstance();
createInvoiceTermContext.put("invoiceId", invoiceId);
createInvoiceTermContext.put("invoiceItemSeqId", "_NA_");
createInvoiceTermContext.put("termTypeId", term.get("termTypeId"));
createInvoiceTermContext.put("termValue", term.get("termValue"));
createInvoiceTermContext.put("termDays", term.get("termDays"));
if (!"BillingAccountTerm".equals(term.getEntityName())) {
createInvoiceTermContext.put("textValue", term.get("textValue"));
createInvoiceTermContext.put("description", term.get("description"));
}
createInvoiceTermContext.put("uomId", term.get("uomId"));
createInvoiceTermContext.put("userLogin", userLogin);
Map<String, Object> createInvoiceTermResult = null;
try {
createInvoiceTermResult = dispatcher.runSync("createInvoiceTerm", createInvoiceTermContext);
} catch (GenericServiceException e) {
Debug.logError(e, "Service/other problem creating InvoiceItem from order header adjustment", module);
}
if (ServiceUtil.isError(createInvoiceTermResult)) {
Debug.logError("Service/other problem creating InvoiceItem from order header adjustment", module);
}
}
}
}
示例3: buildRequestPrefix
import javolution.util.FastMap; //导入方法依赖的package包/类
public static String buildRequestPrefix(Delegator delegator, Locale locale, String webSiteId, String https) {
Map<String, Object> prefixValues = FastMap.newInstance();
String prefix;
NotificationServices.setBaseUrl(delegator, webSiteId, prefixValues);
if (https != null && https.equalsIgnoreCase("true")) {
prefix = (String) prefixValues.get("baseSecureUrl");
} else {
prefix = (String) prefixValues.get("baseUrl");
}
if (UtilValidate.isEmpty(prefix)) {
if (https != null && https.equalsIgnoreCase("true")) {
prefix = UtilProperties.getMessage("content", "baseSecureUrl", locale);
} else {
prefix = UtilProperties.getMessage("content", "baseUrl", locale);
}
}
return prefix;
}
示例4: makeNode
import javolution.util.FastMap; //导入方法依赖的package包/类
public static Map<String, Object> makeNode(GenericValue thisContent) {
Map<String, Object> thisNode = null;
if (thisContent == null) {
return thisNode;
}
thisNode = FastMap.newInstance();
thisNode.put("value", thisContent);
String contentId = (String)thisContent.get("contentId");
thisNode.put("contentId", contentId);
thisNode.put("contentTypeId", thisContent.get("contentTypeId"));
thisNode.put("isReturnBeforePick", Boolean.FALSE);
thisNode.put("isReturnAfterPick", Boolean.FALSE);
thisNode.put("isPick", Boolean.TRUE);
thisNode.put("isFollow", Boolean.TRUE);
if (thisContent.getModelEntity().getField("caContentAssocTypeId") != null) {
thisNode.put("contentAssocTypeId", thisContent.get("caContentAssocTypeId"));
thisNode.put("mapKey", thisContent.get("caMapKey"));
thisNode.put("fromDate", thisContent.get("caFromDate"));
}
return thisNode;
}
示例5: doExpressCheckout
import javolution.util.FastMap; //导入方法依赖的package包/类
public static Map<String, Object> doExpressCheckout(String productStoreId, String orderId, GenericValue paymentPref, GenericValue userLogin, Delegator delegator, LocalDispatcher dispatcher) {
CheckoutType checkoutType = determineCheckoutType(delegator, productStoreId);
if (!checkoutType.equals(CheckoutType.NONE)) {
String serviceName = null;
if (checkoutType.equals(CheckoutType.PAYFLOW)) {
serviceName = "payflowDoExpressCheckout";
} else if (checkoutType.equals(CheckoutType.STANDARD)) {
serviceName = "payPalDoExpressCheckout";
}
Map<String, Object> inMap = FastMap.newInstance();
inMap.put("userLogin", userLogin);
inMap.put("orderPaymentPreference", paymentPref);
Map<String, Object> result = null;
try {
result = dispatcher.runSync(serviceName, inMap);
} catch (GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
return result;
}
return ServiceUtil.returnSuccess();
}
示例6: completePackage
import javolution.util.FastMap; //导入方法依赖的package包/类
public static Map<String, Object> completePackage(DispatchContext dctx, Map<String, ? extends Object> context) {
WeightPackageSession weightPackageSession = (WeightPackageSession) context.get("weightPackageSession");
Locale locale = (Locale) context.get("locale");
Delegator delegator = dctx.getDelegator();
String orderId = (String) context.get("orderId");
String shipmentId = (String) context.get("shipmentId");
String invoiceId = (String) context.get("invoiceId");
String dimensionUomId = (String) context.get("dimensionUomId");
String weightUomId = (String) context.get("weightUomId");
BigDecimal estimatedShippingCost = (BigDecimal) context.get("estimatedShippingCost");
BigDecimal newEstimatedShippingCost = (BigDecimal) context.get("newEstimatedShippingCost");
if (UtilValidate.isEmpty(newEstimatedShippingCost)) {
newEstimatedShippingCost = ZERO;
}
weightPackageSession.setDimensionUomId(dimensionUomId);
weightPackageSession.setWeightUomId(weightUomId);
weightPackageSession.setShipmentId(shipmentId);
weightPackageSession.setInvoiceId(invoiceId);
weightPackageSession.setEstimatedShipCost(estimatedShippingCost);
weightPackageSession.setActualShipCost(newEstimatedShippingCost);
Map<String, Object> response = FastMap.newInstance();
try {
String getActualShippingQuoteFromUps = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipping", "N", delegator);
String result = weightPackageSession.complete(orderId, locale, getActualShippingQuoteFromUps);
if ("showWarningForm".equals(result)) {
response.put("showWarningForm", true);
} else if ("success".equals(result)) {
response.put("shipmentId", shipmentId);
} else {
response = ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoItemsCurrentlySetToBeShippedCannotComplete", locale));
}
} catch (GeneralException e) {
return ServiceUtil.returnError(e.getMessage(), e.getMessageList());
}
return response;
}
示例7: getTaxAuthorities
import javolution.util.FastMap; //导入方法依赖的package包/类
private static void getTaxAuthorities(Delegator delegator, GenericValue shippingAddress, Set<GenericValue> taxAuthoritySet, boolean useCache) throws GenericEntityException {
Map<String, String> geoIdByTypeMap = FastMap.newInstance();
if (shippingAddress != null) {
if (UtilValidate.isNotEmpty(shippingAddress.getString("countryGeoId"))) {
geoIdByTypeMap.put("COUNTRY", shippingAddress.getString("countryGeoId"));
}
if (UtilValidate.isNotEmpty(shippingAddress.getString("stateProvinceGeoId"))) {
geoIdByTypeMap.put("STATE", shippingAddress.getString("stateProvinceGeoId"));
}
if (UtilValidate.isNotEmpty(shippingAddress.getString("countyGeoId"))) {
geoIdByTypeMap.put("COUNTY", shippingAddress.getString("countyGeoId"));
}
String postalCodeGeoId = ContactMechWorker.getPostalAddressPostalCodeGeoId(shippingAddress, delegator);
if (UtilValidate.isNotEmpty(postalCodeGeoId)) {
geoIdByTypeMap.put("POSTAL_CODE", postalCodeGeoId);
}
} else {
Debug.logWarning("shippingAddress was null, adding nothing to taxAuthoritySet", module);
}
//Debug.logInfo("Tax calc geoIdByTypeMap before expand:" + geoIdByTypeMap + "; this is for shippingAddress=" + shippingAddress, module);
// get the most granular, or all available, geoIds and then find parents by GeoAssoc with geoAssocTypeId="REGIONS" and geoIdTo=<granular geoId> and find the GeoAssoc.geoId
geoIdByTypeMap = GeoWorker.expandGeoRegionDeep(geoIdByTypeMap, delegator);
//Debug.logInfo("Tax calc geoIdByTypeMap after expand:" + geoIdByTypeMap, module);
List<GenericValue> taxAuthorityRawList = EntityQuery.use(delegator)
.from("TaxAuthority").where(EntityCondition.makeCondition("taxAuthGeoId", EntityOperator.IN, geoIdByTypeMap.values())).cache(useCache).queryList();
taxAuthoritySet.addAll(taxAuthorityRawList);
//Debug.logInfo("Tax calc taxAuthoritySet after expand:" + taxAuthoritySet, module);
}
示例8: getPartyFromEmail
import javolution.util.FastMap; //导入方法依赖的package包/类
public static Map<String, Object> getPartyFromEmail(DispatchContext dctx, Map<String, ? extends Object> context) {
Map<String, Object> result = FastMap.newInstance();
Delegator delegator = dctx.getDelegator();
Collection<Map<String, GenericValue>> parties = FastList.newInstance();
String email = (String) context.get("email");
Locale locale = (Locale) context.get("locale");
if (email.length() == 0) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"partyservices.required_parameter_email_cannot_be_empty", locale));
}
try {
List<GenericValue> c = EntityQuery.use(delegator).from("PartyAndContactMech")
.where(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityOperator.LIKE, EntityFunction.UPPER(("%" + email.toUpperCase()) + "%")))
.orderBy("infoString")
.filterByDate()
.queryList();
if (Debug.verboseOn()) Debug.logVerbose("List: " + c, module);
if (Debug.infoOn()) Debug.logInfo("PartyFromEmail number found: " + c.size(), module);
if (c != null) {
for (GenericValue pacm: c) {
GenericValue party = delegator.makeValue("Party", UtilMisc.toMap("partyId", pacm.get("partyId"), "partyTypeId", pacm.get("partyTypeId")));
parties.add(UtilMisc.<String, GenericValue>toMap("party", party));
}
}
} catch (GenericEntityException e) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"partyservices.cannot_get_party_entities_read",
UtilMisc.toMap("errMessage", e.getMessage()), locale));
}
if (parties.size() > 0)
result.put("parties", parties);
return result;
}
示例9: quickRunProductionRunTask
import javolution.util.FastMap; //导入方法依赖的package包/类
/**
* Quick runs a ProductionRun task to the completed status, also issuing components
* if necessary.
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters.
* @return Map with the result of the service, the output parameters.
*/
public static Map<String, Object> quickRunProductionRunTask(DispatchContext ctx, Map<String, ? extends Object> context) {
Map<String, Object> result = ServiceUtil.returnSuccess();
Delegator delegator = ctx.getDelegator();
LocalDispatcher dispatcher = ctx.getDispatcher();
Locale locale = (Locale) context.get("locale");
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productionRunId = (String) context.get("productionRunId");
String taskId = (String) context.get("taskId");
try {
Map<String, Object> serviceContext = FastMap.newInstance();
Map<String, Object> resultService = null;
GenericValue task = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", taskId).queryOne();
String currentStatusId = task.getString("currentStatusId");
String prevStatusId = "";
while (!"PRUN_COMPLETED".equals(currentStatusId)) {
serviceContext.put("productionRunId", productionRunId);
serviceContext.put("workEffortId", taskId);
serviceContext.put("issueAllComponents", Boolean.TRUE);
serviceContext.put("userLogin", userLogin);
resultService = dispatcher.runSync("changeProductionRunTaskStatus", serviceContext);
currentStatusId = (String)resultService.get("newStatusId");
if (currentStatusId.equals(prevStatusId)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToProgressTaskStatus", UtilMisc.toMap("prevStatusId", prevStatusId, "taskId", taskId), locale));
} else {
prevStatusId = currentStatusId;
}
serviceContext.clear();
}
} catch (Exception e) {
Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale));
}
return result;
}
示例10: startNextDay
import javolution.util.FastMap; //导入方法依赖的package包/类
/** Used to move in a TechDataCalenda, produce the Timestamp for the begining of the next day available and its associated capacity.
* If the dateFrom (param in) is not in an available TechDataCalendar period, the return value is the next day available
*
* @param techDataCalendar The TechDataCalendar cover
* @param dateFrom the date
* @return a map with Timestamp dateTo, Double nextCapacity
*/
public static Map<String, Object> startNextDay(GenericValue techDataCalendar, Timestamp dateFrom) {
Map<String, Object> result = FastMap.newInstance();
Timestamp dateTo = null;
GenericValue techDataCalendarWeek = null;
// TODO read TechDataCalendarExcWeek to manage execption week (maybe it's needed to refactor the entity definition
try {
techDataCalendarWeek = techDataCalendar.getRelatedOne("TechDataCalendarWeek", true);
} catch (GenericEntityException e) {
Debug.logError("Pb reading Calendar Week associated with calendar"+e.getMessage(), module);
return ServiceUtil.returnError("Pb reading Calendar Week associated with calendar");
}
// TODO read TechDataCalendarExcDay to manage execption day
Calendar cDateTrav = Calendar.getInstance();
cDateTrav.setTime(dateFrom);
Map<String, Object> position = dayStartCapacityAvailable(techDataCalendarWeek, cDateTrav.get(Calendar.DAY_OF_WEEK));
Time startTime = (Time) position.get("startTime");
int moveDay = ((Integer) position.get("moveDay")).intValue();
dateTo = (moveDay == 0) ? dateFrom : UtilDateTime.getDayStart(dateFrom,moveDay);
Timestamp startAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateTo).getTime() + startTime.getTime() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET));
if (dateTo.before(startAvailablePeriod)) {
dateTo = startAvailablePeriod;
}
else {
dateTo = UtilDateTime.getNextDayStart(dateTo);
cDateTrav.setTime(dateTo);
position = dayStartCapacityAvailable(techDataCalendarWeek, cDateTrav.get(Calendar.DAY_OF_WEEK));
startTime = (Time) position.get("startTime");
moveDay = ((Integer) position.get("moveDay")).intValue();
if (moveDay != 0) dateTo = UtilDateTime.getDayStart(dateTo,moveDay);
dateTo.setTime(dateTo.getTime() + startTime.getTime() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET));
}
result.put("dateTo",dateTo);
result.put("nextCapacity",position.get("capacity"));
return result;
}
示例11: getOrderItemAttributes
import javolution.util.FastMap; //导入方法依赖的package包/类
public Map<String, String> getOrderItemAttributes() {
Map<String, String> attrs = FastMap.newInstance();
if (orderItemAttributes != null) {
attrs.putAll(orderItemAttributes);
}
return attrs;
}
示例12: prepareInventoryItem
import javolution.util.FastMap; //导入方法依赖的package包/类
public static Map<String, Object> prepareInventoryItem(String productId,
BigDecimal quantityOnHand, String inventoryItemId) {
Map<String, Object> fields = FastMap.newInstance();
fields.put("inventoryItemId", inventoryItemId);
fields.put("inventoryItemTypeId", "NON_SERIAL_INV_ITEM");
fields.put("productId", productId);
fields.put("ownerPartyId", "Company");
fields.put("facilityId", "ScipioShopWarehouse");
fields.put("quantityOnHandTotal", quantityOnHand);
fields.put("availableToPromiseTotal", quantityOnHand);
return fields;
}
示例13: ccAuthCapture
import javolution.util.FastMap; //导入方法依赖的package包/类
public static Map<String, Object> ccAuthCapture(DispatchContext ctx, Map<String, Object> context) {
Delegator delegator = ctx.getDelegator();
Locale locale = (Locale) context.get("locale");
Map<String, Object> results = ServiceUtil.returnSuccess();
Map<String, Object> request = FastMap.newInstance();
Properties props = buildAIMProperties(context, delegator);
buildMerchantInfo(context, props, request);
buildGatewayResponeConfig(context, props, request);
buildCustomerBillingInfo(context, props, request);
buildEmailSettings(context, props, request);
buildInvoiceInfo(context, props, request);
props.put("transType", "AUTH_CAPTURE");
buildAuthTransaction(context, props, request);
Map<String, Object> validateResults = validateRequest(context, props, request);
String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE);
if (ModelService.RESPOND_ERROR.equals(respMsg)) {
results.put(ModelService.ERROR_MESSAGE, "Validation Failed - invalid values");
return results;
}
Map<String, Object> reply = processCard(request, props, locale);
//now we need to process the result
processAuthCaptureTransResult(request, reply, results);
// if there is no captureRefNum, then the capture failed
if (results.get("captureRefNum") == null) {
return ServiceUtil.returnError((String) results.get("captureMessage"));
}
return results;
}
示例14: quickRunAllProductionRunTasks
import javolution.util.FastMap; //导入方法依赖的package包/类
/**
* Quick runs all the tasks of a ProductionRun to the completed status,
* also issuing components if necessary.
* @param ctx The DispatchContext that this service is operating in.
* @param context Map containing the input parameters.
* @return Map with the result of the service, the output parameters.
*/
public static Map<String, Object> quickRunAllProductionRunTasks(DispatchContext ctx, Map<String, ? extends Object> context) {
Map<String, Object> result = ServiceUtil.returnSuccess();
Delegator delegator = ctx.getDelegator();
LocalDispatcher dispatcher = ctx.getDispatcher();
Locale locale = (Locale) context.get("locale");
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productionRunId = (String) context.get("productionRunId");
ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (!productionRun.exist()) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale));
}
List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks();
GenericValue oneTask = null;
String taskId = null;
for (int i = 0; i < tasks.size(); i++) {
oneTask = tasks.get(i);
taskId = oneTask.getString("workEffortId");
try {
Map<String, Object> serviceContext = FastMap.newInstance();
serviceContext.put("productionRunId", productionRunId);
serviceContext.put("taskId", taskId);
serviceContext.put("userLogin", userLogin);
dispatcher.runSync("quickRunProductionRunTask", serviceContext);
} catch (GenericServiceException e) {
Debug.logError(e, "Problem calling the quickRunProductionRunTask service", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale));
}
}
return result;
}
示例15: testStockMoves
import javolution.util.FastMap; //导入方法依赖的package包/类
public void testStockMoves() throws Exception {
Map<String, Object> fsmnCtx = FastMap.newInstance();
Map<?,?> stockMoveHandled = null;
List<?> warningList = FastList.newInstance();
fsmnCtx.put("facilityId", "ScipioShopWarehouse");
fsmnCtx.put("userLogin", userLogin);
Map<String, Object> respMap1 = dispatcher.runSync("findStockMovesNeeded", fsmnCtx);
stockMoveHandled = UtilGenerics.checkMap(respMap1.get("stockMoveHandled"));
warningList = UtilGenerics.checkList(respMap1.get("warningMessageList"));
assertNull(warningList);
if (stockMoveHandled != null) {
fsmnCtx.put("stockMoveHandled", stockMoveHandled);
}
Map<String, Object> respMap2 = dispatcher.runSync("findStockMovesRecommended", fsmnCtx);
warningList = UtilGenerics.checkList(respMap2.get("warningMessageList"));
assertNull(warningList);
Map<String, Object> ppsmCtx = FastMap.newInstance();
ppsmCtx.put("productId", "CAM-2644");
ppsmCtx.put("facilityId", "ScipioShopWarehouse");
ppsmCtx.put("locationSeqId","TLTLTLUL01");
ppsmCtx.put("targetLocationSeqId", "TLTLTLLL01");
ppsmCtx.put("quantityMoved", new BigDecimal("5"));
ppsmCtx.put("userLogin", userLogin);
dispatcher.runSync("processPhysicalStockMove", ppsmCtx);
}