You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/03/22 00:44:25 UTC
svn commit: r757089 [4/6] - in /ofbiz/trunk/applications/product/src: ./
org/ofbiz/product/catalog/ org/ofbiz/product/category/
org/ofbiz/product/config/ org/ofbiz/product/feature/
org/ofbiz/product/image/ org/ofbiz/product/inventory/ org/ofbiz/product...
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -126,18 +126,18 @@
return productSearchOptions.getResultSortOrder();
}
public static void setResultSortOrder(ResultSortOrder resultSortOrder, HttpSession session) {
- ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
+ ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
productSearchOptions.resultSortOrder = resultSortOrder;
productSearchOptions.changed = true;
}
-
+
public static void clearSearchOptions(HttpSession session) {
- ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
+ ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
productSearchOptions.constraintList = null;
productSearchOptions.topProductCategoryId = null;
productSearchOptions.resultSortOrder = null;
}
-
+
public void clearViewInfo() {
this.viewIndex = null;
this.viewSize = null;
@@ -180,7 +180,7 @@
public Integer getViewSize() {
return viewSize;
}
-
+
/**
* @param viewSize The viewSize to set.
*/
@@ -188,7 +188,7 @@
setPreviousViewSize(getViewSize());
this.viewSize = viewSize;
}
-
+
/**
* @param viewSize The viewSize to set.
*/
@@ -205,14 +205,14 @@
}
}
}
-
+
/**
* @return Returns the paging.
*/
public String getPaging() {
return paging;
}
-
+
/**
* @param paging The paging to set.
*/
@@ -222,7 +222,7 @@
}
this.paging = paging;
}
-
+
/**
* @return Returns the previousViewSize.
*/
@@ -239,13 +239,13 @@
this.previousViewSize = previousViewSize;
}
}
-
+
public String getTopProductCategoryId() {
return topProductCategoryId;
}
public static void setTopProductCategoryId(String topProductCategoryId, HttpSession session) {
- ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
+ ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
productSearchOptions.setTopProductCategoryId(topProductCategoryId);
}
@@ -283,7 +283,7 @@
}
public static ProductSearchOptions getProductSearchOptions(HttpSession session) {
- ProductSearchOptions productSearchOptions = (ProductSearchOptions) session.getAttribute("_PRODUCT_SEARCH_OPTIONS_CURRENT_");
+ ProductSearchOptions productSearchOptions = (ProductSearchOptions) session.getAttribute("_PRODUCT_SEARCH_OPTIONS_CURRENT_");
if (productSearchOptions == null) {
productSearchOptions = new ProductSearchOptions();
session.setAttribute("_PRODUCT_SEARCH_OPTIONS_CURRENT_", productSearchOptions);
@@ -292,16 +292,16 @@
}
public static void checkSaveSearchOptionsHistory(HttpSession session) {
- ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
+ ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
// if the options have changed since the last search, add it to the beginning of the search options history
if (productSearchOptions.changed) {
- List<ProductSearchOptions> optionsHistoryList = getSearchOptionsHistoryList(session);
+ List<ProductSearchOptions> optionsHistoryList = getSearchOptionsHistoryList(session);
optionsHistoryList.add(0, new ProductSearchOptions(productSearchOptions));
productSearchOptions.changed = false;
}
}
public static List<ProductSearchOptions> getSearchOptionsHistoryList(HttpSession session) {
- List<ProductSearchOptions> optionsHistoryList = UtilGenerics.checkList(session.getAttribute("_PRODUCT_SEARCH_OPTIONS_HISTORY_"));
+ List<ProductSearchOptions> optionsHistoryList = UtilGenerics.checkList(session.getAttribute("_PRODUCT_SEARCH_OPTIONS_HISTORY_"));
if (optionsHistoryList == null) {
optionsHistoryList = FastList.newInstance();
session.setAttribute("_PRODUCT_SEARCH_OPTIONS_HISTORY_", optionsHistoryList);
@@ -311,7 +311,7 @@
public static void clearSearchOptionsHistoryList(HttpSession session) {
session.removeAttribute("_PRODUCT_SEARCH_OPTIONS_HISTORY_");
}
-
+
public static void setCurrentSearchFromHistory(int index, boolean removeOld, HttpSession session) {
List<ProductSearchOptions> searchOptionsHistoryList = getSearchOptionsHistoryList(session);
if (index < searchOptionsHistoryList.size()) {
@@ -332,17 +332,17 @@
clearSearchOptionsHistoryList(session);
return "success";
}
-
+
public static String setCurrentSearchFromHistory(HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
String searchHistoryIndexStr = request.getParameter("searchHistoryIndex");
String removeOldStr = request.getParameter("removeOld");
-
+
if (UtilValidate.isEmpty(searchHistoryIndexStr)) {
request.setAttribute("_ERROR_MESSAGE_", "No search history index passed, cannot set current search to previous.");
return "error";
}
-
+
try {
int searchHistoryIndex = Integer.parseInt(searchHistoryIndexStr);
boolean removeOld = true;
@@ -354,10 +354,10 @@
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
}
-
+
return "success";
}
-
+
/** A ControlServlet event method used to check to see if there is an override for any of the current keywords in the search */
public static final String checkDoKeywordOverride(HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
@@ -442,14 +442,14 @@
// if the search options have changed since the last search, put at the beginning of the options history list
checkSaveSearchOptionsHistory(session);
-
+
return ProductSearch.searchProducts(productSearchConstraintList, resultSortOrder, delegator, visitId);
}
public static void searchClear(HttpSession session) {
ProductSearchOptions.clearSearchOptions(session);
}
-
+
public static List<String> searchGetConstraintStrings(boolean detailed, HttpSession session, GenericDelegator delegator) {
Locale locale = UtilHttp.getLocale(session);
ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
@@ -494,7 +494,7 @@
public static void processSearchParameters(Map<String, Object> parameters, HttpServletRequest request) {
GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
- Boolean alreadyRun = (Boolean) request.getAttribute("processSearchParametersAlreadyRun");
+ Boolean alreadyRun = (Boolean) request.getAttribute("processSearchParametersAlreadyRun");
if (Boolean.TRUE.equals(alreadyRun)) {
// even if already run, check the VIEW_SIZE and VIEW_INDEX again, just for kicks
ProductSearchOptions productSearchOptions = getProductSearchOptions(request.getSession());
@@ -505,13 +505,13 @@
} else {
request.setAttribute("processSearchParametersAlreadyRun", Boolean.TRUE);
}
-
+
//Debug.logInfo("Processing Product Search parameters: " + parameters, module);
-
+
HttpSession session = request.getSession();
boolean constraintsChanged = false;
GenericValue productStore = ProductStoreWorker.getProductStore(request);
-
+
// clear search? by default yes, but if the clearSearch parameter is N then don't
String clearSearchString = (String) parameters.get("clearSearch");
if (!"N".equals(clearSearchString)) {
@@ -528,7 +528,7 @@
}
}
}
-
+
String prioritizeCategoryId = null;
if (UtilValidate.isNotEmpty((String) parameters.get("PRIORITIZE_CATEGORY_ID"))) {
prioritizeCategoryId = (String) parameters.get("PRIORITIZE_CATEGORY_ID");
@@ -539,7 +539,7 @@
ProductSearchOptions.setTopProductCategoryId(prioritizeCategoryId, session);
constraintsChanged = true;
}
-
+
// if there is another category, add a constraint for it
if (UtilValidate.isNotEmpty((String) parameters.get("SEARCH_CATEGORY_ID"))) {
String searchCategoryId = (String) parameters.get("SEARCH_CATEGORY_ID");
@@ -549,7 +549,7 @@
searchAddConstraint(new ProductSearch.CategoryConstraint(searchCategoryId, !"N".equals(searchSubCategories), exclude), session);
constraintsChanged = true;
}
-
+
for (int catNum = 1; catNum < 10; catNum++) {
if (UtilValidate.isNotEmpty((String) parameters.get("SEARCH_CATEGORY_ID" + catNum))) {
String searchCategoryId = (String) parameters.get("SEARCH_CATEGORY_ID" + catNum);
@@ -574,15 +574,15 @@
}
// if there is any category selected try to use catalog and add a constraint for it
- if (UtilValidate.isNotEmpty((String) parameters.get("SEARCH_CATALOG_ID"))) {
+ if (UtilValidate.isNotEmpty((String) parameters.get("SEARCH_CATALOG_ID"))) {
String searchCatalogId = (String) parameters.get("SEARCH_CATALOG_ID");
if (searchCatalogId != null && !searchCatalogId.equalsIgnoreCase("")) {
List<GenericValue> categories = CategoryWorker.getRelatedCategoriesRet(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, searchCatalogId), true, false, true);
searchAddConstraint(new ProductSearch.CatalogConstraint(searchCatalogId, categories), session);
- constraintsChanged = true;
+ constraintsChanged = true;
}
- }
-
+ }
+
// if keywords were specified, add a constraint for them
if (UtilValidate.isNotEmpty((String) parameters.get("SEARCH_STRING"))) {
String keywordString = (String) parameters.get("SEARCH_STRING");
@@ -690,7 +690,7 @@
searchAddConstraint(new ProductSearch.SupplierConstraint(supplierPartyId), session);
constraintsChanged = true;
}
-
+
// add a list price range to the search
if (UtilValidate.isNotEmpty((String) parameters.get("LIST_PRICE_LOW")) || UtilValidate.isNotEmpty((String) parameters.get("LIST_PRICE_HIGH"))) {
BigDecimal listPriceLow = null;
@@ -717,15 +717,15 @@
String listPriceRangeStr = (String) parameters.get("LIST_PRICE_RANGE");
if (UtilValidate.isEmpty(listPriceRangeStr)) listPriceRangeStr = (String) parameters.get("S_LPR");
int underscoreIndex = listPriceRangeStr.indexOf("_");
- String listPriceLowStr;
- String listPriceHighStr;
+ String listPriceLowStr;
+ String listPriceHighStr;
if (underscoreIndex >= 0) {
- listPriceLowStr = listPriceRangeStr.substring(0, listPriceRangeStr.indexOf("_"));
- listPriceHighStr = listPriceRangeStr.substring(listPriceRangeStr.indexOf("_") + 1);
+ listPriceLowStr = listPriceRangeStr.substring(0, listPriceRangeStr.indexOf("_"));
+ listPriceHighStr = listPriceRangeStr.substring(listPriceRangeStr.indexOf("_") + 1);
} else {
// no underscore: assume it is a low range with no high range, ie the ending underscore was left off
- listPriceLowStr = listPriceRangeStr;
- listPriceHighStr = null;
+ listPriceLowStr = listPriceRangeStr;
+ listPriceHighStr = null;
}
BigDecimal listPriceLow = null;
@@ -748,7 +748,7 @@
searchAddConstraint(new ProductSearch.ListPriceRangeConstraint(listPriceLow, listPriceHigh, listPriceCurrency), session);
constraintsChanged = true;
}
-
+
// check the ProductStore to see if we should add the ExcludeVariantsConstraint
if (productStore != null && !"N".equals(productStore.getString("prodSearchExcludeVariants"))) {
searchAddConstraint(new ProductSearch.ExcludeVariantsConstraint(), session);
@@ -759,7 +759,7 @@
searchAddConstraint(new ProductSearch.AvailabilityDateConstraint(), session);
constraintsChanged = true;
}
-
+
if (UtilValidate.isNotEmpty((String) parameters.get("SEARCH_GOOD_IDENTIFICATION_TYPE")) ||
UtilValidate.isNotEmpty((String) parameters.get("SEARCH_GOOD_IDENTIFICATION_VALUE"))) {
String include = (String) parameters.get("SEARCH_GOOD_IDENTIFICATION_INCL");
@@ -770,8 +770,8 @@
if ("N".equalsIgnoreCase(include)) {
inc = Boolean.FALSE;
}
-
- searchAddConstraint(new ProductSearch.GoodIdentificationConstraint((String)parameters.get("SEARCH_GOOD_IDENTIFICATION_TYPE"),
+
+ searchAddConstraint(new ProductSearch.GoodIdentificationConstraint((String)parameters.get("SEARCH_GOOD_IDENTIFICATION_TYPE"),
(String) parameters.get("SEARCH_GOOD_IDENTIFICATION_VALUE"), inc), session);
constraintsChanged = true;
}
@@ -783,7 +783,7 @@
searchAddConstraint(viewAllowConstraint, session);
// not consider this a change for now, shouldn't change often: constraintsChanged = true;
}
-
+
// set the sort order
String sortOrder = (String) parameters.get("sortOrder");
if (UtilValidate.isEmpty(sortOrder)) sortOrder = (String) parameters.get("S_O");
@@ -807,7 +807,7 @@
searchSetSortOrder(new ProductSearch.SortProductPrice(priceTypeId, ascending), session);
}
}
-
+
ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
if (constraintsChanged) {
// query changed, clear out the VIEW_INDEX & VIEW_SIZE
@@ -832,29 +832,29 @@
HttpSession session = request.getSession();
ProductSearchOptions productSearchOptions = getProductSearchOptions(session);
-
+
String addOnTopProdCategoryId = productSearchOptions.getTopProductCategoryId();
-
+
Integer viewIndexInteger = productSearchOptions.getViewIndex();
if (viewIndexInteger != null) {
viewIndex = viewIndexInteger.intValue();
}
-
+
Integer viewSizeInteger = productSearchOptions.getViewSize();
if (viewSizeInteger != null) {
viewSize = viewSizeInteger.intValue();
}
-
+
Integer previousViewSizeInteger = productSearchOptions.getPreviousViewSize();
if (previousViewSizeInteger != null) {
previousViewSize = previousViewSizeInteger.intValue();
}
-
+
String pag = productSearchOptions.getPaging();
if (paging != null) {
paging = pag;
}
-
+
lowIndex = viewIndex * viewSize;
highIndex = (viewIndex + 1) * viewSize;
@@ -955,7 +955,7 @@
return result;
}
-
+
public static String makeSearchParametersString(HttpSession session) {
return makeSearchParametersString(getProductSearchOptions(session));
}
@@ -1013,7 +1013,7 @@
/* No way to specify parameters for these right now, so table until later
} else if (psc instanceof ProductSearch.FeatureSetConstraint) {
ProductSearch.FeatureSetConstraint fsc = (ProductSearch.FeatureSetConstraint) psc;
- */
+ */
} else if (psc instanceof ProductSearch.FeatureCategoryConstraint) {
ProductSearch.FeatureCategoryConstraint pfcc = (ProductSearch.FeatureCategoryConstraint) psc;
featureCategoriesCount++;
@@ -1098,7 +1098,7 @@
}
}
}
-
+
String topProductCategoryId = productSearchOptions.getTopProductCategoryId();
if (topProductCategoryId != null) {
searchParamString.append("&S_TPC");
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -314,7 +314,7 @@
} catch (Exception e) {
return ServiceUtil.returnError(e.getMessage());
}
-
+
result.put("variantSample", sample);
result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
@@ -692,21 +692,21 @@
java.util.StringTokenizer st = new java.util.StringTokenizer(productFeatureIds, "|");
while (st.hasMoreTokens()) {
String productFeatureId = st.nextToken();
-
+
GenericValue productFeature = delegator.findByPrimaryKey("ProductFeature", UtilMisc.toMap("productFeatureId", productFeatureId));
-
+
GenericValue productFeatureAppl = delegator.makeValue("ProductFeatureAppl",
UtilMisc.toMap("productId", variantProductId, "productFeatureId", productFeatureId,
"productFeatureApplTypeId", "STANDARD_FEATURE", "fromDate", UtilDateTime.nowTimestamp()));
-
+
// set the default seq num if it's there...
if (productFeature != null) {
productFeatureAppl.set("sequenceNum", productFeature.get("defaultSequenceNum"));
}
-
+
productFeatureAppl.create();
}
-
+
} catch (GenericEntityException e) {
Debug.logError(e, "Entity error creating quick add variant data", module);
Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString());
@@ -719,14 +719,14 @@
return result;
}
- /**
+ /**
* This will create a virtual product and return its ID, and associate all of the variants with it.
- * It will not put the selectable features on the virtual or standard features on the variant.
+ * It will not put the selectable features on the virtual or standard features on the variant.
*/
public static Map<String, Object> quickCreateVirtualWithVariants(DispatchContext dctx, Map<String, ? extends Object> context) {
GenericDelegator delegator = dctx.getDelegator();
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-
+
// get the various IN attributes
String variantProductIdsBag = (String) context.get("variantProductIdsBag");
String productFeatureIdOne = (String) context.get("productFeatureIdOne");
@@ -734,11 +734,11 @@
String productFeatureIdThree = (String) context.get("productFeatureIdThree");
Map<String, Object> successResult = ServiceUtil.returnSuccess();
-
+
try {
// Generate new virtual productId, prefix with "VP", put in successResult
String productId = (String) context.get("productId");
-
+
if (UtilValidate.isEmpty(productId)) {
productId = "VP" + delegator.getNextSeqId("VirtualProduct");
// Create new virtual product...
@@ -759,7 +759,7 @@
product.create();
}
successResult.put("productId", productId);
-
+
// separate variantProductIdsBag into a Set of variantProductIds
//note: can be comma, tab, or white-space delimited
Set<String> prelimVariantProductIds = FastSet.newInstance();
@@ -786,12 +786,12 @@
// whoops, nothing found... return error
return ServiceUtil.returnError("Error creating a virtual with variants: the ID [" + variantProductId + "] is not a valid Product.productId or a GoodIdentification.idValue");
}
-
+
if (goodIdentificationList.size() > 1) {
// what to do here? for now just log a warning and add all of them as variants; they can always be dissociated later
Debug.logWarning("Warning creating a virtual with variants: the ID [" + variantProductId + "] was not a productId and resulted in [" + goodIdentificationList.size() + "] GoodIdentification records: " + goodIdentificationList, module);
}
-
+
for (GenericValue goodIdentification: goodIdentificationList) {
GenericValue giProduct = goodIdentification.getRelatedOne("Product");
if (giProduct != null) {
@@ -809,18 +809,18 @@
productFeatureIds.add(productFeatureIdOne);
productFeatureIds.add(productFeatureIdTwo);
productFeatureIds.add(productFeatureIdThree);
-
+
for (String featureProductId: featureProductIds) {
for (String productFeatureId: productFeatureIds) {
if (UtilValidate.isNotEmpty(productFeatureId)) {
- GenericValue productFeatureAppl = delegator.makeValue("ProductFeatureAppl",
+ GenericValue productFeatureAppl = delegator.makeValue("ProductFeatureAppl",
UtilMisc.toMap("productId", featureProductId, "productFeatureId", productFeatureId,
"productFeatureApplTypeId", "STANDARD_FEATURE", "fromDate", nowTimestamp));
productFeatureAppl.create();
}
}
}
-
+
for (GenericValue variantProduct: variantProductsById.values()) {
// for each variant product set: isVirtual=N, isVariant=Y, introductionDate=now
variantProduct.set("isVirtual", "N");
@@ -829,7 +829,7 @@
variantProduct.store();
// for each variant product create associate with the new virtual as a PRODUCT_VARIANT
- GenericValue productAssoc = delegator.makeValue("ProductAssoc",
+ GenericValue productAssoc = delegator.makeValue("ProductAssoc",
UtilMisc.toMap("productId", productId, "productIdTo", variantProduct.get("productId"),
"productAssocTypeId", "PRODUCT_VARIANT", "fromDate", nowTimestamp));
productAssoc.create();
@@ -838,7 +838,7 @@
String errMsg = "Error creating new virtual product from variant products: " + e.toString();
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
- }
+ }
return successResult;
}
@@ -905,22 +905,22 @@
return ServiceUtil.returnSuccess();
}
-
+
public static Map<String, Object> addAdditionalViewForProduct(DispatchContext dctx, Map<String, ? extends Object> context)
throws IOException, JDOMException {
-
+
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericDelegator delegator = dctx.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productId = (String) context.get("productId");
String productContentTypeId = (String) context.get("productContentTypeId");
ByteBuffer imageData = (ByteBuffer) context.get("uploadedFile");
-
+
if (UtilValidate.isNotEmpty((String) context.get("_uploadedFile_fileName"))) {
String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
String imageUrlPrefix = UtilProperties.getPropertyValue("catalog", "image.url.prefix");
-
+
FlexibleStringExpander filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
String id = productId + "_View_" + productContentTypeId.charAt(productContentTypeId.length() - 1);
String fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "type", "additional", "id", id));
@@ -930,7 +930,7 @@
filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1);
}
-
+
List<GenericValue> fileExtension = FastList.newInstance();
try {
fileExtension = delegator.findByAnd("FileExtension", UtilMisc.toMap("mimeTypeId", (String) context.get("_uploadedFile_contentType")));
@@ -938,14 +938,14 @@
Debug.logError(e, module);
ServiceUtil.returnError(e.getMessage());
}
-
+
GenericValue extension = EntityUtil.getFirst(fileExtension);
if (extension != null) {
filenameToUse += "." + extension.getString("fileExtensionId");
}
-
+
File file = new File(imageServerPath + "/" + filePathPrefix + filenameToUse);
-
+
try {
RandomAccessFile out = new RandomAccessFile(file, "rw");
out.write(imageData.array());
@@ -957,7 +957,7 @@
Debug.logError(e, module);
return ServiceUtil.returnError("Unable to write binary data to: " + file.getAbsolutePath());
}
-
+
/* scale Image in different sizes */
String viewNumber = String.valueOf(productContentTypeId.charAt(productContentTypeId.length() - 1));
ScaleImage imageTransform = new ScaleImage();
@@ -972,25 +972,25 @@
String errMsg = "Errors occur in parsing ImageProperties.xml : " + e.toString();
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
- }
-
+ }
+
String imageUrl = imageUrlPrefix + "/" + filePathPrefix + filenameToUse;
-
+
if (UtilValidate.isNotEmpty(imageUrl) && imageUrl.length() > 0) {
String contentId = (String) context.get("contentId");
-
+
Map<String, Object> dataResourceCtx = FastMap.newInstance();
dataResourceCtx.put("objectInfo", imageUrl);
dataResourceCtx.put("dataResourceName", (String) context.get("_uploadedFile_fileName"));
dataResourceCtx.put("userLogin", userLogin);
-
+
Map<String, Object> productContentCtx = FastMap.newInstance();
productContentCtx.put("productId", productId);
productContentCtx.put("productContentTypeId", productContentTypeId);
productContentCtx.put("fromDate", (Timestamp) context.get("fromDate"));
productContentCtx.put("thruDate", (Timestamp) context.get("thruDate"));
productContentCtx.put("userLogin", userLogin);
-
+
if (UtilValidate.isNotEmpty(contentId)) {
GenericValue content = null;
try {
@@ -999,7 +999,7 @@
Debug.logError(e, module);
ServiceUtil.returnError(e.getMessage());
}
-
+
if (content != null) {
GenericValue dataResource = null;
try {
@@ -1008,7 +1008,7 @@
Debug.logError(e, module);
ServiceUtil.returnError(e.getMessage());
}
-
+
if (dataResource != null) {
dataResourceCtx.put("dataResourceId", dataResource.getString("dataResourceId"));
try {
@@ -1026,7 +1026,7 @@
Debug.logError(e, module);
ServiceUtil.returnError(e.getMessage());
}
-
+
Map<String, Object> contentCtx = FastMap.newInstance();
contentCtx.put("contentId", contentId);
contentCtx.put("dataResourceId", dataResourceResult.get("dataResourceId"));
@@ -1038,7 +1038,7 @@
ServiceUtil.returnError(e.getMessage());
}
}
-
+
productContentCtx.put("contentId", contentId);
try {
dispatcher.runSync("updateProductContent", productContentCtx);
@@ -1068,7 +1068,7 @@
Debug.logError(e, module);
ServiceUtil.returnError(e.getMessage());
}
-
+
productContentCtx.put("contentId", contentResult.get("contentId"));
try {
dispatcher.runSync("createProductContent", productContentCtx);
@@ -1081,44 +1081,44 @@
}
return ServiceUtil.returnSuccess();
}
-
+
/**
* Finds productId(s) corresponding to a product reference, productId or a GoodIdentification idValue
* @param dctx
* @param context
- * @param context.productId use to search with productId or goodIdentification.idValue
+ * @param context.productId use to search with productId or goodIdentification.idValue
* @return a GenericValue with a productId and a List of complementary productId found
*/
- public static Map<String, Object> findProductById(DispatchContext ctx, Map<String, Object> context) {
+ public static Map<String, Object> findProductById(DispatchContext ctx, Map<String, Object> context) {
GenericDelegator delegator = ctx.getDelegator();
String idToFind = (String) context.get("idToFind");
String goodIdentificationTypeId = (String) context.get("goodIdentificationTypeId");
String searchProductFirstContext = (String) context.get("searchProductFirst");
String searchAllIdContext = (String) context.get("searchAllId");
-
+
boolean searchProductFirst = UtilValidate.isNotEmpty(searchProductFirstContext) && "N".equals(searchProductFirstContext) ? false : true;
boolean searchAllId = UtilValidate.isNotEmpty(searchAllIdContext)&& "Y".equals(searchAllIdContext) ? true : false;
-
+
GenericValue product = null;
List<GenericValue> productsFound = null;
try {
- productsFound = ProductWorker.findProductsById(delegator, idToFind, goodIdentificationTypeId, searchProductFirst, searchAllId);
+ productsFound = ProductWorker.findProductsById(delegator, idToFind, goodIdentificationTypeId, searchProductFirst, searchAllId);
} catch (GenericEntityException e) {
Debug.logError(e, module);
ServiceUtil.returnError(e.getMessage());
}
-
- if (UtilValidate.isNotEmpty(productsFound)) {
+
+ if (UtilValidate.isNotEmpty(productsFound)) {
// gets the first productId of the List
product = EntityUtil.getFirst(productsFound);
// remove this productId
productsFound.remove(0);
}
-
+
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("product", product);
result.put("productsList", productsFound);
-
+
return result;
}
}
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -53,7 +53,7 @@
* Product Worker class to reduce code in JSPs.
*/
public class ProductWorker {
-
+
public static final String module = ProductWorker.class.getName();
public static final String resource = "ProductUiLabels";
@@ -71,9 +71,9 @@
if ("SERVICE".equals(productTypeId) || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) {
// don't charge shipping on services or digital goods
return false;
- }
+ }
Boolean chargeShipping = product.getBoolean("chargeShipping");
-
+
if (chargeShipping == null) {
return true;
} else {
@@ -127,7 +127,7 @@
return true;
}
}
-
+
} else {
throw new IllegalArgumentException("product and postalAddress cannot be null.");
}
@@ -138,7 +138,7 @@
String errMsg = "";
if (product != null) {
Boolean taxable = product.getBoolean("taxable");
-
+
if (taxable == null) {
return true;
} else {
@@ -148,7 +148,7 @@
throw new IllegalArgumentException(errMsg);
}
}
-
+
/** @deprecated */
public static void getProduct(PageContext pageContext, String attributeName, String productId) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
@@ -174,14 +174,14 @@
public static String getInstanceAggregatedId(GenericDelegator delegator, String instanceProductId) throws GenericEntityException {
GenericValue instanceProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", instanceProductId));
-
+
if (UtilValidate.isNotEmpty(instanceProduct) && "AGGREGATED_CONF".equals(instanceProduct.getString("productTypeId"))) {
- GenericValue productAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelatedByAnd("AssocProductAssoc",
+ GenericValue productAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelatedByAnd("AssocProductAssoc",
UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"))));
if (UtilValidate.isNotEmpty(productAssoc)) {
return productAssoc.getString("productId");
}
- }
+ }
return null;
}
@@ -197,18 +197,18 @@
}
return null;
}
-
+
public static List<GenericValue> getAggregatedAssocs(GenericDelegator delegator, String aggregatedProductId) throws GenericEntityException {
GenericValue aggregatedProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", aggregatedProductId));
-
+
if (UtilValidate.isNotEmpty(aggregatedProduct) && "AGGREGATED".equals(aggregatedProduct.getString("productTypeId"))) {
- List<GenericValue> productAssocs = EntityUtil.filterByDate(aggregatedProduct.getRelatedByAnd("MainProductAssoc",
+ List<GenericValue> productAssocs = EntityUtil.filterByDate(aggregatedProduct.getRelatedByAnd("MainProductAssoc",
UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF")));
return productAssocs;
}
return null;
}
-
+
public static String getVariantVirtualId(GenericValue variantProduct) throws GenericEntityException {
List<GenericValue> productAssocs = getVariantVirtualAssocs(variantProduct);
if (productAssocs == null) {
@@ -224,14 +224,14 @@
public static List<GenericValue> getVariantVirtualAssocs(GenericValue variantProduct) throws GenericEntityException {
if (variantProduct != null && "Y".equals(variantProduct.getString("isVariant"))) {
- List<GenericValue> productAssocs = EntityUtil.filterByDate(variantProduct.getRelatedByAndCache("AssocProductAssoc",
+ List<GenericValue> productAssocs = EntityUtil.filterByDate(variantProduct.getRelatedByAndCache("AssocProductAssoc",
UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT")));
return productAssocs;
}
return null;
}
- /**
+ /**
* 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...
*/
@@ -263,7 +263,7 @@
}
}
- /**
+ /**
* Invokes the getInventoryAvailableByFacility service, returns true if specified quantity is available for all the selected parts, else false.
* Also, set the available flag for all the product configuration's options.
**/
@@ -328,10 +328,10 @@
Debug.logWarning(e, module);
}
}
-
+
/**
- * Gets ProductFeature GenericValue for all distinguishing features of a variant product.
- * Distinguishing means all features that are selectable on the corresponding virtual product and standard on the variant plus all DISTINGUISHING_FEAT assoc type features on the variant.
+ * Gets ProductFeature GenericValue for all distinguishing features of a variant product.
+ * Distinguishing means all features that are selectable on the corresponding virtual product and standard on the variant plus all DISTINGUISHING_FEAT assoc type features on the variant.
*/
public static Set<GenericValue> getVariantDistinguishingFeatures(GenericValue variantProduct) throws GenericEntityException {
if (variantProduct == null) {
@@ -342,10 +342,10 @@
}
GenericDelegator delegator = variantProduct.getDelegator();
String virtualProductId = getVariantVirtualId(variantProduct);
-
+
// find all selectable features on the virtual product that are also standard features on the variant
Set<GenericValue> distFeatures = FastSet.newInstance();
-
+
List<GenericValue> variantDistinguishingFeatures = delegator.findByAndCache("ProductFeatureAndAppl", UtilMisc.toMap("productId", variantProduct.get("productId"), "productFeatureApplTypeId", "DISTINGUISHING_FEAT"));
// Debug.logInfo("Found variantDistinguishingFeatures: " + variantDistinguishingFeatures, module);
@@ -362,7 +362,7 @@
for (GenericValue virtualSelectableFeature: EntityUtil.filterByDate(virtualSelectableFeatures)) {
virtualSelectableFeatureIds.add(virtualSelectableFeature.getString("productFeatureId"));
}
-
+
List<GenericValue> variantStandardFeatures = delegator.findByAndCache("ProductFeatureAndAppl", UtilMisc.toMap("productId", variantProduct.get("productId"), "productFeatureApplTypeId", "STANDARD_FEATURE"));
// Debug.logInfo("Found variantStandardFeatures: " + variantStandardFeatures, module);
@@ -373,11 +373,11 @@
distFeatures.add(dummyFeature);
}
}
-
+
return distFeatures;
}
- /**
+ /**
* Get the name to show to the customer for GWP alternative options.
* If the alternative is a variant, find the distinguishing features and show those instead of the name; if it is not a variant then show the PRODUCT_NAME content.
*/
@@ -389,7 +389,7 @@
Set<GenericValue> distFeatures = getVariantDistinguishingFeatures(alternativeOptionProduct);
if (UtilValidate.isNotEmpty(distFeatures)) {
// Debug.logInfo("Found distinguishing features: " + distFeatures, module);
-
+
StringBuilder nameBuf = new StringBuilder();
for (GenericValue productFeature: distFeatures) {
if (nameBuf.length() > 0) {
@@ -432,7 +432,7 @@
return null;
}
try {
- return getProductFeaturesByApplTypeId(delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)),
+ return getProductFeaturesByApplTypeId(delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)),
productFeatureApplTypeId);
} catch (GenericEntityException e) {
Debug.logError(e, module);
@@ -479,9 +479,9 @@
return null;
}
}
-
+
/**
- *
+ *
* @param product
* @return list featureType and related featuresIds, description and feature price for this product ordered by type and sequence
*/
@@ -505,11 +505,11 @@
if (oldType != null) {
featureTypeFeatures.add(featureList);
featureList = FastList.newInstance();
- }
- GenericValue productFeatureType = delegator.findByPrimaryKey("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId",
+ }
+ GenericValue productFeatureType = delegator.findByPrimaryKey("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId",
productFeatureAppl.getString("productFeatureTypeId")));
- featureList.add(UtilMisc.<String, String>toMap("productFeatureTypeId", productFeatureAppl.getString("productFeatureTypeId"),
- "description", productFeatureType.getString("description")));
+ featureList.add(UtilMisc.<String, String>toMap("productFeatureTypeId", productFeatureAppl.getString("productFeatureTypeId"),
+ "description", productFeatureType.getString("description")));
oldType = productFeatureAppl.getString("productFeatureTypeId");
}
// fill other entries with featureId, description and default price and currency
@@ -519,13 +519,13 @@
} else {
featureData.put("description", productFeatureAppl.getString("productFeatureId"));
}
- List<GenericValue> productFeaturePrices = EntityUtil.filterByDate(delegator.findByAnd("ProductFeaturePrice",
+ List<GenericValue> productFeaturePrices = EntityUtil.filterByDate(delegator.findByAnd("ProductFeaturePrice",
UtilMisc.toMap("productFeatureId", productFeatureAppl.getString("productFeatureId"), "productPriceTypeId", "DEFAULT_PRICE")));
if (UtilValidate.isNotEmpty(productFeaturePrices)) {
GenericValue productFeaturePrice = productFeaturePrices.get(0);
if (UtilValidate.isNotEmpty(productFeaturePrice.get("price"))) {
- featureData.put("price", productFeaturePrice.getBigDecimal("price").toString());
- featureData.put("currencyUomId", productFeaturePrice.getString("currencyUomId"));
+ featureData.put("price", productFeaturePrice.getBigDecimal("price").toString());
+ featureData.put("currencyUomId", productFeaturePrice.getString("currencyUomId"));
}
}
featureList.add(featureData);
@@ -533,7 +533,7 @@
if (oldType != null) {
// last map
featureTypeFeatures.add(featureList);
- }
+ }
}
} catch (GenericEntityException e) {
Debug.logError(e, module);
@@ -567,7 +567,7 @@
}
// product calc methods
-
+
public static BigDecimal calcOrderAdjustments(List<GenericValue> orderHeaderAdjustments, BigDecimal subTotal, boolean includeOther, boolean includeTax, boolean includeShipping) {
BigDecimal adjTotal = BigDecimal.ZERO;
@@ -579,7 +579,7 @@
}
return adjTotal;
}
-
+
public static BigDecimal calcOrderAdjustment(GenericValue orderAdjustment, BigDecimal orderSubTotal) {
BigDecimal adjustment = BigDecimal.ZERO;
@@ -590,8 +590,8 @@
adjustment = adjustment.add(orderAdjustment.getBigDecimal("sourcePercentage").multiply(orderSubTotal));
}
return adjustment;
- }
-
+ }
+
public static List<GenericValue> filterOrderAdjustments(List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
List<GenericValue> newOrderAdjustmentsList = FastList.newInstance();
@@ -628,7 +628,7 @@
public static BigDecimal getAverageProductRating(GenericDelegator delegator, String productId) {
return getAverageProductRating(delegator, productId, null);
}
-
+
public static BigDecimal getAverageProductRating(GenericDelegator delegator, String productId, String productStoreId) {
GenericValue product = null;
try {
@@ -735,7 +735,7 @@
}
return categories;
}
-
+
//get parent product
public static GenericValue getParentProduct(String productId, GenericDelegator delegator) {
GenericValue _parentProduct = null;
@@ -804,7 +804,7 @@
return false;
}
-
+
public static boolean isAmountRequired(GenericDelegator delegator, String productI) {
try {
GenericValue product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productI));
@@ -816,7 +816,7 @@
}
return false;
- }
+ }
public static String getProductTypeId(GenericDelegator delegator, String productI) {
try {
@@ -830,13 +830,13 @@
return null;
}
-
-
+
+
/**
* Generic service to find product by id.
- * By default return the product find by productId
- * but you can pass searchProductFirst at false if you want search in goodIdentification before
- * or pass searchAllId at true to find all product with this id (product.productId and goodIdentification.idValue)
+ * By default return the product find by productId
+ * but you can pass searchProductFirst at false if you want search in goodIdentification before
+ * or pass searchAllId at true to find all product with this id (product.productId and goodIdentification.idValue)
* @param delegator
* @param idToFind
* @param goodIdentificationTypeId
@@ -845,15 +845,15 @@
* @return
* @throws GenericEntityException
*/
- public static List<GenericValue> findProductsById( GenericDelegator delegator,
+ public static List<GenericValue> findProductsById( GenericDelegator delegator,
String idToFind, String goodIdentificationTypeId,
boolean searchProductFirst, boolean searchAllId) throws GenericEntityException {
-
+
if (Debug.verboseOn()) Debug.logVerbose("Analyze goodIdentification: entered id = " + idToFind + ", goodIdentificationTypeId = " + goodIdentificationTypeId, module);
-
+
GenericValue product = null;
List<GenericValue> productsFound = null;
-
+
// 1) look if the idToFind given is a real productId
if (searchProductFirst) {
product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", idToFind));
@@ -867,16 +867,16 @@
}
productsFound = delegator.findByAndCache("GoodIdentificationAndProduct", conditions, UtilMisc.toList("productId"));
}
-
+
if (! searchProductFirst) {
product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", idToFind));
}
-
+
if (UtilValidate.isNotEmpty(product)) {
if (UtilValidate.isNotEmpty(productsFound)) productsFound.add(product);
else productsFound = UtilMisc.toList(product);
}
- if (Debug.verboseOn()) Debug.logVerbose("Analyze goodIdentification: found product.productId = " + product + ", and list : " + productsFound, module);
+ if (Debug.verboseOn()) Debug.logVerbose("Analyze goodIdentification: found product.productId = " + product + ", and list : " + productsFound, module);
return productsFound;
}
@@ -884,7 +884,7 @@
throws GenericEntityException {
return findProductsById(delegator, idToFind, goodIdentificationTypeId, true, false);
}
-
+
public static String findProductId(GenericDelegator delegator, String idToFind, String goodIdentificationTypeId) throws GenericEntityException {
GenericValue product = findProduct(delegator, idToFind, goodIdentificationTypeId);
if (UtilValidate.isNotEmpty(product)) {
@@ -914,14 +914,14 @@
if (! "Product".equals(product.getEntityName())) {
productToAdd = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", product.get("productId")));
}
-
+
if (UtilValidate.isEmpty(products)) {
products = UtilMisc.toList(productToAdd);
}
else {
products.add(productToAdd);
}
- }
+ }
}
return products;
}
@@ -958,29 +958,29 @@
}
return false;
}
-
+
public static Set<String> getRefurbishedProductIdSet(String productId, GenericDelegator delegator) throws GenericEntityException {
Set<String> productIdSet = FastSet.newInstance();
// find associated refurb items, we want serial number for main item or any refurb items too
- List<GenericValue> refubProductAssocs = EntityUtil.filterByDate(delegator.findByAnd("ProductAssoc",
+ List<GenericValue> refubProductAssocs = EntityUtil.filterByDate(delegator.findByAnd("ProductAssoc",
UtilMisc.toMap("productId", productId, "productAssocTypeId", "PRODUCT_REFURB")));
for (GenericValue refubProductAssoc: refubProductAssocs) {
productIdSet.add(refubProductAssoc.getString("productIdTo"));
}
-
+
// see if this is a refurb productId to, and find product(s) it is a refurb of
- List<GenericValue> refubProductToAssocs = EntityUtil.filterByDate(delegator.findByAnd("ProductAssoc",
+ List<GenericValue> refubProductToAssocs = EntityUtil.filterByDate(delegator.findByAnd("ProductAssoc",
UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", "PRODUCT_REFURB")));
for (GenericValue refubProductToAssoc: refubProductToAssocs) {
productIdSet.add(refubProductToAssoc.getString("productId"));
}
-
+
return productIdSet;
}
-
+
public static String getVariantFromFeatureTree(String productId, List<String> selectedFeatures, GenericDelegator delegator) {
-
+
// all method code moved here from ShoppingCartEvents.addToCart event
String variantProductId = null;
try {
@@ -1043,9 +1043,9 @@
// Debug.log("=====product found:" + productId + " and features: " + selectedFeatures);
/**
- * 1. variant not found so create new variant product and use the virtual product as basis, new one is a variant type and not a virtual type.
+ * 1. variant not found so create new variant product and use the virtual product as basis, new one is a variant type and not a virtual type.
* adjust the prices according the selected features
- */
+ */
if (!productFound) {
// copy product to be variant
GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId));
@@ -1055,9 +1055,9 @@
product.remove("virtualVariantMethodEnum"); // not relevant for a non virtual product.
product.create();
// add the selected/standard features as 'standard features' to the 'ProductFeatureAppl' table
- GenericValue productFeatureAppl = delegator.makeValue("ProductFeatureAppl",
+ GenericValue productFeatureAppl = delegator.makeValue("ProductFeatureAppl",
UtilMisc.toMap("productId", product.getString("productId"), "productFeatureApplTypeId", "STANDARD_FEATURE"));
- productFeatureAppl.put("fromDate", UtilDateTime.nowTimestamp());
+ productFeatureAppl.put("fromDate", UtilDateTime.nowTimestamp());
for (String productFeatureId: selectedFeatures) {
productFeatureAppl.put("productFeatureId", productFeatureId);
productFeatureAppl.create();
@@ -1075,7 +1075,7 @@
List<GenericValue> productPrices = EntityUtil.filterByDate(delegator.findByAnd("ProductPrice", UtilMisc.toMap("productId", productId)));
for (GenericValue productPrice: productPrices) {
for (String selectedFeaturedId: selectedFeatures) {
- List<GenericValue> productFeaturePrices = EntityUtil.filterByDate(delegator.findByAnd("ProductFeaturePrice",
+ List<GenericValue> productFeaturePrices = EntityUtil.filterByDate(delegator.findByAnd("ProductFeaturePrice",
UtilMisc.toMap("productFeatureId", selectedFeaturedId, "productPriceTypeId", productPrice.getString("productPriceTypeId"))));
if (UtilValidate.isNotEmpty(productFeaturePrices)) {
GenericValue productFeaturePrice = productFeaturePrices.get(0);
@@ -1095,21 +1095,21 @@
productAssoc.put("fromDate", UtilDateTime.nowTimestamp());
productAssoc.create();
Debug.log("set the productId to: " + product.getString("productId"));
-
+
// copy the supplier
List<GenericValue> supplierProducts = delegator.findByAndCache("SupplierProduct", UtilMisc.toMap("productId", productId));
for (GenericValue supplierProduct: supplierProducts) {
- supplierProduct.set("productId", product.getString("productId"));
+ supplierProduct.set("productId", product.getString("productId"));
supplierProduct.create();
}
-
+
// copy the content
List<GenericValue> productContents = delegator.findByAndCache("ProductContent", UtilMisc.toMap("productId", productId));
for (GenericValue productContent: productContents) {
- productContent.set("productId", product.getString("productId"));
+ productContent.set("productId", product.getString("productId"));
productContent.create();
- }
-
+ }
+
// finally use the new productId to be added to the cart
variantProductId = product.getString("productId"); // set to the new product
}
@@ -1117,7 +1117,7 @@
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
-
+
return variantProductId;
- }
+ }
}
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -80,7 +80,7 @@
GenericDelegator delegator = dctx.getDelegator();
String productStoreId = (String) context.get("productStoreId");
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-
+
List<EntityCondition> condList = FastList.newInstance();
if (UtilValidate.isEmpty(productStoreId)) {
condList.add(EntityCondition.makeCondition("productStoreId", EntityOperator.EQUALS, productStoreId));
@@ -89,7 +89,7 @@
condList.add(EntityCondition.makeCondition("thruDate", EntityOperator.NOT_EQUAL, null));
condList.add(EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN, nowTimestamp));
EntityCondition cond = EntityCondition.makeCondition(condList, EntityOperator.AND);
-
+
try {
EntityListIterator eli = delegator.find("ProductStorePromoAndAppl", cond, null, null, null, null);
GenericValue productStorePromoAndAppl = null;
@@ -104,7 +104,7 @@
Debug.logError(e, errMsg, module);
return ServiceUtil.returnError(errMsg);
}
-
+
return ServiceUtil.returnSuccess();
}
@@ -186,7 +186,7 @@
String productPromoCodeId = (String) context.get("productPromoCodeId");
byte[] wrapper = (byte[]) context.get("uploadedFile");
GenericValue userLogin = (GenericValue) context.get("userLogin");
-
+
if (wrapper == null) {
return ServiceUtil.returnError("Uploaded file not valid or corrupted");
}
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductHelper.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductHelper.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductHelper.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -50,10 +50,10 @@
* "InventoryItem" entities into database. The method uses the
* ImportProductHelper class to perform its opertaion. The method uses "Apache
* POI" api for importing spreadsheet(xls files) data.
- *
+ *
* Note : Create the spreadsheet directory in the ofbiz home folder and keep
* your xls files in this folder only.
- *
+ *
* @param dctx
* @param context
* @return
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreSurveyWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreSurveyWrapper.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreSurveyWrapper.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreSurveyWrapper.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -89,7 +89,7 @@
}
return null;
}
-
+
public static String getStoreCurrencyUomId(HttpServletRequest request) {
GenericValue productStore = getProductStore(request);
return UtilHttp.getCurrencyUom(request.getSession(), productStore.getString("defaultCurrencyUomId"));
@@ -131,7 +131,7 @@
public static String getProductStorePayToPartyId(String productStoreId, GenericDelegator delegator) {
return getProductStorePayToPartyId(getProductStore(productStoreId, delegator));
}
-
+
public static String getProductStorePayToPartyId(GenericValue productStore) {
String payToPartyId = "Company"; // default value
if (productStore != null && productStore.get("payToPartyId") != null) {
@@ -477,7 +477,7 @@
GenericValue product = null;
String virtualProductId = null;
- // if the item is a variant, get its virtual productId
+ // if the item is a variant, get its virtual productId
try {
product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
if ((product != null) && ("Y".equals(product.get("isVariant")))) {
@@ -569,9 +569,9 @@
}
/**
- * This method is used in the showcart pages to determine whether or not to show the inventory message and
+ * This method is used in the showcart pages to determine whether or not to show the inventory message and
* in the productdetail pages to determine whether or not to show the item as out of stock.
- *
+ *
* @param request ServletRequest (or HttpServletRequest of course)
* @param product GenericValue representing the product in question
* @param quantity Quantity desired.
@@ -718,13 +718,13 @@
defaultProductStoreEmailScreenLocation.put("PRDS_GC_PURCHASE", "component://ecommerce/widget/EmailGiftCardScreens.xml#GiftCardPurchase");
defaultProductStoreEmailScreenLocation.put("PRDS_GC_RELOAD", "component://ecommerce/widget/EmailGiftCardScreens.xml#GiftCardReload");
-
+
defaultProductStoreEmailScreenLocation.put("PRDS_QUO_CONFIRM", "component://order/widget/ordermgr/QuoteScreens.xml#ViewQuoteSimple");
-
+
defaultProductStoreEmailScreenLocation.put("PRDS_PWD_RETRIEVE", "component://securityext/widget/EmailSecurityScreens.xml#PasswordEmail");
-
+
defaultProductStoreEmailScreenLocation.put("PRDS_TELL_FRIEND", "component://ecommerce/widget/EmailProductScreens.xml#TellFriend");
-
+
defaultProductStoreEmailScreenLocation.put("PRDS_CUST_REGISTER", "component://securityext/widget/EmailSecurityScreens.xml#PasswordEmail");
}
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -52,7 +52,7 @@
GenericDelegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-
+
String partyId = (String) context.get("partyId");
String subscriptionResourceId = (String) context.get("subscriptionResourceId");
String inventoryItemId = (String) context.get("inventoryItemId");
@@ -62,7 +62,7 @@
String useTimeUomId = (String) context.get("useTimeUomId");
String alwaysCreateNewRecordStr = (String) context.get("alwaysCreateNewRecord");
boolean alwaysCreateNewRecord = !"N".equals(alwaysCreateNewRecordStr);
-
+
GenericValue lastSubscription = null;
try {
Map<String, String> subscriptionFindMap = UtilMisc.toMap("partyId", partyId, "subscriptionResourceId", subscriptionResourceId);
@@ -96,7 +96,7 @@
newSubscription.set("inventoryItemId", inventoryItemId);
Timestamp thruDate = lastSubscription != null ? (Timestamp) lastSubscription.get("thruDate") : null;
-
+
// set the fromDate, one way or another
if (thruDate == null) {
// no thruDate? start with NOW
@@ -111,7 +111,7 @@
}
newSubscription.set("fromDate", thruDate);
}
-
+
Calendar calendar = Calendar.getInstance();
calendar.setTime(thruDate);
int[] times = UomWorker.uomTimeToCalTime(useTimeUomId);
@@ -121,10 +121,10 @@
Debug.logWarning("Don't know anything about useTimeUomId [" + useTimeUomId + "], defaulting to month", module);
calendar.add(Calendar.MONTH, (useTime.intValue() * times[1]));
}
-
+
thruDate = new Timestamp(calendar.getTimeInMillis());
newSubscription.set("thruDate", thruDate);
-
+
Map<String, Object> result = ServiceUtil.returnSuccess();
try {
if (lastSubscription != null && !alwaysCreateNewRecord) {
@@ -163,7 +163,7 @@
}
return result;
}
-
+
public static Map<String, Object> processExtendSubscriptionByProduct(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{
GenericDelegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
@@ -172,10 +172,10 @@
if (qty == null) {
qty = Integer.valueOf(1);
}
-
+
Timestamp orderCreatedDate = (Timestamp) context.get("orderCreatedDate");
if (orderCreatedDate == null) {
- orderCreatedDate = UtilDateTime.nowTimestamp();
+ orderCreatedDate = UtilDateTime.nowTimestamp();
}
try {
List<GenericValue> productSubscriptionResourceList = delegator.findByAndCache("ProductSubscriptionResource", UtilMisc.toMap("productId", productId));
@@ -185,7 +185,7 @@
if (productSubscriptionResourceList.size() == 0) {
String msg = "No ProductSubscriptionResource found for productId: " + productId;
Debug.logError(msg, module);
- return ServiceUtil.returnError(msg);
+ return ServiceUtil.returnError(msg);
}
for (GenericValue productSubscriptionResource: productSubscriptionResourceList) {
@@ -202,7 +202,7 @@
subContext.put("automaticExtend", productSubscriptionResource.get("automaticExtend"));
subContext.put("canclAutmExtTime", productSubscriptionResource.get("canclAutmExtTime"));
subContext.put("canclAutmExtTimeUomId", productSubscriptionResource.get("canclAutmExtTimeUomId"));
-
+
Map<String, Object> ctx = dctx.getModelService("processExtendSubscription").makeValid(subContext, ModelService.IN_PARAM);
Map<String, Object> processExtendSubscriptionResult = dispatcher.runSync("processExtendSubscription", ctx);
if (ServiceUtil.isError(processExtendSubscriptionResult)) {
@@ -213,18 +213,18 @@
Debug.logError(e, e.toString(), module);
return ServiceUtil.returnError(e.toString());
}
-
+
return ServiceUtil.returnSuccess();
}
-
+
public static Map<String, Object> processExtendSubscriptionByOrder(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{
GenericDelegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
Map<String, Object> subContext = UtilMisc.makeMapWritable(context);
String orderId = (String) context.get("orderId");
-
+
Debug.logInfo("In processExtendSubscriptionByOrder service with orderId: " + orderId, module);
-
+
GenericValue orderHeader = null;
try {
List<GenericValue> orderRoleList = delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", orderId, "roleTypeId", "END_USER_CUSTOMER"));
@@ -234,12 +234,12 @@
subContext.put("partyId", partyId);
} else {
String msg = "No OrderRole found for orderId:" + orderId;
- return ServiceUtil.returnFailure(msg);
+ return ServiceUtil.returnFailure(msg);
}
orderHeader = delegator.findByPrimaryKeyCache("OrderHeader", UtilMisc.toMap("orderId", orderId));
if (orderHeader == null) {
String msg = "No OrderHeader found for orderId:" + orderId;
- return ServiceUtil.returnError(msg);
+ return ServiceUtil.returnError(msg);
}
Timestamp orderCreatedDate = (Timestamp) orderHeader.get("orderDate");
subContext.put("orderCreatedDate", orderCreatedDate);
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -49,7 +49,7 @@
public static final String module = SupplierProductServices.class.getName();
public static final String resource = "ProductUiLabels";
-
+
/*
* Parameters: productId, partyId, currencyUomId, quantity
* Result: a List of SupplierProduct entities for productId,
@@ -58,7 +58,7 @@
public static Map<String, Object> getSuppliersForProduct(DispatchContext dctx, Map<String, ? extends Object> context) {
Map<String, Object> results = FastMap.newInstance();
GenericDelegator delegator = dctx.getDelegator();
-
+
GenericValue product = null;
String productId = (String) context.get("productId");
String partyId = (String) context.get("partyId");
@@ -73,7 +73,7 @@
return results;
}
List<GenericValue> supplierProducts = product.getRelatedCache("SupplierProduct");
-
+
// if there were no related SupplierProduct entities and the item is a variant, then get the SupplierProducts of the virtual parent product
if (supplierProducts.size() == 0 && product.getString("isVariant") != null && product.getString("isVariant").equals("Y")) {
String virtualProductId = ProductWorker.getVariantVirtualId(product);
@@ -82,17 +82,17 @@
supplierProducts = virtualProduct.getRelatedCache("SupplierProduct");
}
}
-
+
// filter the list down by the partyId if one is provided
if (partyId != null) {
supplierProducts = EntityUtil.filterByAnd(supplierProducts, UtilMisc.toMap("partyId", partyId));
}
-
+
// filter the list down by the currencyUomId if one is provided
if (currencyUomId != null) {
supplierProducts = EntityUtil.filterByAnd(supplierProducts, UtilMisc.toMap("currencyUomId", currencyUomId));
}
-
+
// filter the list down by the minimumOrderQuantity if one is provided
if (quantity != null) {
//minimumOrderQuantity
@@ -106,10 +106,10 @@
// filter the list down again by date before returning it
supplierProducts = EntityUtil.filterByDate(supplierProducts, UtilDateTime.nowTimestamp(), "availableFromDate", "availableThruDate", true);
-
+
//sort resulting list of SupplierProduct entities by price in ASCENDING order
supplierProducts = EntityUtil.orderBy(supplierProducts, UtilMisc.toList("lastPrice ASC"));
-
+
results = ServiceUtil.returnSuccess();
results.put("supplierProducts", supplierProducts);
} catch (GenericEntityException ex) {
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java Sat Mar 21 23:44:24 2009
@@ -52,7 +52,7 @@
protected void tearDown() throws Exception {
}
-
+
public void testCreateInventoryItemsTransfer() throws Exception {
Map<String, Object> ctx = FastMap.newInstance();
String statusId = "IXF_REQUESTED";
@@ -68,7 +68,7 @@
inventoryTransferId = (String) resp.get("inventoryTransferId");
assertNotNull(inventoryTransferId);
}
-
+
public void testUpdateInventoryItemTransfer() throws Exception {
Map<String, Object> ctx = FastMap.newInstance();
String statusId = "IXF_COMPLETE";
@@ -81,4 +81,4 @@
String respMsg = (String) resp.get("responseMessage");
assertNotSame("error", respMsg);
}
-}
+}
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java Sat Mar 21 23:44:24 2009
@@ -54,26 +54,26 @@
protected void tearDown() throws Exception {
}
-
+
public void testStockMoves() throws Exception {
Map<String, Object> fsmnCtx = FastMap.newInstance();
Map stockMoveHandled = null;
List warningList = FastList.newInstance();
-
+
fsmnCtx.put("facilityId", "WebStoreWarehouse");
fsmnCtx.put("userLogin", userLogin);
Map<String, Object> respMap1 = dispatcher.runSync("findStockMovesNeeded", fsmnCtx);
stockMoveHandled = (Map) respMap1.get("stockMoveHandled");
warningList = (List) respMap1.get("warningMessageList");
assertNull(warningList);
-
+
if (stockMoveHandled != null) {
fsmnCtx.put("stockMoveHandled", stockMoveHandled);
}
Map<String, Object> respMap2 = dispatcher.runSync("findStockMovesRecommended", fsmnCtx);
warningList = (List) respMap2.get("warningMessageList");
assertNull(warningList);
-
+
Map<String, Object> ppsmCtx = FastMap.newInstance();
ppsmCtx.put("productId", "GZ-2644");
ppsmCtx.put("facilityId", "WebStoreWarehouse");
@@ -83,4 +83,4 @@
ppsmCtx.put("userLogin", userLogin);
Map<String, Object> respMap3 = dispatcher.runSync("processPhysicalStockMove", ppsmCtx);
}
-}
+}
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingEvent.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingEvent.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingEvent.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingEvent.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -54,9 +54,9 @@
}
Debug.log("OrderId [" + orderId + "] ship group [" + shipGroupSeqId + "] Pack input [" + productId + "] @ [" + quantity + "] packageSeq [" + packageSeq + "] weight [" + weight +"]", module);
-
+
if (weight == null) {
- Debug.logWarning("OrderId [" + orderId + "] ship group [" + shipGroupSeqId + "] product [" + productId + "] being packed without a weight, assuming 0", module);
+ Debug.logWarning("OrderId [" + orderId + "] ship group [" + shipGroupSeqId + "] product [" + productId + "] being packed without a weight, assuming 0", module);
weight = BigDecimal.ZERO;
}
@@ -158,7 +158,7 @@
} else {
quantities = new String[] { qtyStr };
}
-
+
// process the weight array
if (UtilValidate.isEmpty(wgtStr)) wgtStr = "0";
weights = new String[] { wgtStr };
@@ -255,7 +255,7 @@
String carrierPartyId = (String) context.get("carrierPartyId");
String carrierRoleTypeId = (String) context.get("carrierRoleTypeId");
String productStoreId = (String) context.get("productStoreId");
-
+
BigDecimal shippableWeight = setSessionPackageWeights(session, packageWeights);
BigDecimal estimatedShipCost = session.getShipmentCostEstimate(shippingContactMechId, shipmentMethodTypeId, carrierPartyId, carrierRoleTypeId, productStoreId, null, null, shippableWeight, null);
session.setAdditionalShippingCharge(estimatedShipCost);
@@ -301,7 +301,7 @@
} else {
resp = ServiceUtil.returnSuccess("Shipment #" + shipmentId + " created and marked as PACKED.");
}
-
+
resp.put("shipmentId", shipmentId);
return resp;
}