This is an automated email from the ASF dual-hosted git repository.
surajk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git The following commit(s) were added to refs/heads/trunk by this push: new e7ead36 Improved: Corrected all checkstyle formatting issues: Line has trailing spaces in plugins component. (OFBIZ-11880) Thanks Jacques for review. e7ead36 is described below commit e7ead3697fd219c591367c2de186a335fb5d9fc2 Author: Suraj Khurana <[hidden email]> AuthorDate: Mon Jul 13 14:14:42 2020 +0530 Improved: Corrected all checkstyle formatting issues: Line has trailing spaces in plugins component. (OFBIZ-11880) Thanks Jacques for review. --- .../apache/ofbiz/birt/email/BirtEmailServices.java | 4 +- .../ofbiz/birt/flexible/ReportDesignGenerator.java | 4 +- .../birt/report/servlet/BirtEngineServlet.java | 2 +- .../birt/report/servlet/BirtViewerServlet.java | 6 +- .../birt/report/servlet/ViewerServletRequest.java | 2 - .../ofbiz/birt/webapp/view/BirtViewHandler.java | 8 +- .../cmssite/multisite/MultiSiteRequestWrapper.java | 2 +- .../ofbiz/cmssite/multisite/WebSiteFilter.java | 1 - .../org/apache/ofbiz/ebay/EbayOrderServices.java | 20 ++-- .../apache/ofbiz/ebay/ImportOrdersFromEbay.java | 2 +- .../apache/ofbiz/ebay/ProductsExportToEbay.java | 8 +- .../org/apache/ofbiz/ebaystore/EbayAccount.java | 17 ++- .../ofbiz/ebaystore/EbayBestOfferAutoPref.java | 4 +- .../org/apache/ofbiz/ebaystore/EbayEvents.java | 67 +++++------ .../java/org/apache/ofbiz/ebaystore/EbayStore.java | 21 ++-- .../ofbiz/ebaystore/EbayStoreAutoPreferences.java | 1 - .../ofbiz/ebaystore/EbayStoreCategoryFacade.java | 4 +- .../ofbiz/ebaystore/EbayStoreCustomerService.java | 1 - .../apache/ofbiz/ebaystore/EbayStoreHelper.java | 8 +- .../ebaystore/EbayStoreInventoryServices.java | 2 +- .../apache/ofbiz/ebaystore/EbayStoreOptions.java | 1 - .../org/apache/ofbiz/ebaystore/EbayStoreOrder.java | 10 +- .../ofbiz/ebaystore/EbayStoreSiteFacade.java | 3 +- .../ofbiz/ecommerce/janrain/JanrainHelper.java | 11 +- .../apache/ofbiz/example/ExamplePrintServices.java | 4 +- .../OFBizActiveDirectoryAuthenticationHandler.java | 2 +- .../openldap/OFBizLdapAuthenticationHandler.java | 2 +- .../org/apache/ofbiz/content/test/LuceneTests.java | 6 +- .../apache/ofbiz/passport/event/GitHubEvents.java | 35 ++---- .../ofbiz/passport/event/LinkedInEvents.java | 36 ++---- .../ofbiz/passport/user/GitHubAuthenticator.java | 5 +- .../ofbiz/passport/user/LinkedInAuthenticator.java | 7 +- .../apache/ofbiz/passport/util/PassportUtil.java | 10 +- .../ofbiz/htmlreport/AbstractHtmlReport.java | 18 +-- .../apache/ofbiz/htmlreport/AbstractReport.java | 10 +- .../ofbiz/htmlreport/AbstractReportThread.java | 34 +----- .../org/apache/ofbiz/htmlreport/HtmlReport.java | 133 ++++----------------- .../apache/ofbiz/htmlreport/InterfaceReport.java | 29 +---- .../ofbiz/htmlreport/InterfaceReportThread.java | 1 - .../ofbiz/htmlreport/sample/SampleHtmlReport.java | 11 +- .../ofbiz/htmlreport/sample/SampleHtmlThread.java | 8 -- .../ofbiz/htmlreport/util/ReportEncoder.java | 104 ++++------------ .../ofbiz/htmlreport/util/ReportStringUtil.java | 89 ++++---------- .../apache/ofbiz/pricat/AbstractPricatParser.java | 38 +----- .../apache/ofbiz/pricat/InterfacePricatParser.java | 29 +---- .../java/org/apache/ofbiz/pricat/PricatEvents.java | 8 -- .../ofbiz/pricat/PricatParseExcelHtmlReport.java | 17 +-- .../ofbiz/pricat/PricatParseExcelHtmlThread.java | 35 +----- .../ofbiz/pricat/sample/SamplePricatEvents.java | 6 - .../ofbiz/pricat/sample/SamplePricatParser.java | 43 +++---- .../apache/ofbiz/pricat/util/OFBizPricatUtil.java | 7 -- .../java/org/apache/ofbiz/scrum/ScrumServices.java | 6 +- .../java/org/apache/ofbiz/solr/CategoryUtil.java | 23 ++-- .../java/org/apache/ofbiz/solr/ProductUtil.java | 6 +- .../main/java/org/apache/ofbiz/solr/SolrUtil.java | 39 +++--- .../ofbiz/solr/webapp/OFBizSolrContextFilter.java | 4 +- .../solr/webapp/OFBizSolrLoadAdminUiServlet.java | 1 - .../solr/webapp/OFBizSolrRedirectServlet.java | 4 - .../java/org/apache/ofbiz/webpos/WebPosEvents.java | 17 ++- .../apache/ofbiz/webpos/session/WebPosSession.java | 2 +- .../webpos/transaction/WebPosTransaction.java | 2 +- 61 files changed, 285 insertions(+), 755 deletions(-) diff --git a/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java b/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java index 24369ce..b835de9 100644 --- a/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java +++ b/birt/src/main/java/org/apache/ofbiz/birt/email/BirtEmailServices.java @@ -77,7 +77,6 @@ public class BirtEmailServices { Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Security security = ctx.getSecurity(); - String webSiteId = (String) serviceContext.remove("webSiteId"); String bodyText = (String) serviceContext.remove("bodyText"); String bodyScreenUri = (String) serviceContext.remove("bodyScreenUri"); @@ -92,7 +91,7 @@ public class BirtEmailServices { VisualTheme visualTheme = (VisualTheme) context.get("visualTheme"); if (visualTheme == null) { visualTheme = ThemeFactory.resolveVisualTheme(null); - } + } if (visualTheme == null) visualTheme = ThemeFactory.resolveVisualTheme(null); if (bodyParameters == null) { bodyParameters = MapStack.create(); @@ -182,7 +181,6 @@ public class BirtEmailServices { appContext.put("delegator", delegator); appContext.put("dispatcher", dispatcher); appContext.put("security", security); - InputStream reportInputStream = BirtFactory.getReportInputStreamFromLocation(birtReportLocation); IReportRunnable design = engine.openReportDesign(reportInputStream); Debug.logInfo("Export report as content type:" + birtContentType, MODULE); diff --git a/birt/src/main/java/org/apache/ofbiz/birt/flexible/ReportDesignGenerator.java b/birt/src/main/java/org/apache/ofbiz/birt/flexible/ReportDesignGenerator.java index b854e28..7822893 100644 --- a/birt/src/main/java/org/apache/ofbiz/birt/flexible/ReportDesignGenerator.java +++ b/birt/src/main/java/org/apache/ofbiz/birt/flexible/ReportDesignGenerator.java @@ -110,7 +110,7 @@ public class ReportDesignGenerator { DesignConfig config = new DesignConfig(); Platform.startup(); IDesignEngine engine = ((IDesignEngineFactory) Platform.createFactoryObject(IDesignEngineFactory.EXTENSION_DESIGN_ENGINE_FACTORY)).createDesignEngine(config); - + // creating main design elements SessionHandle session = engine.newSessionHandle(ULocale.forLocale(locale)); design = session.createDesign(); @@ -219,7 +219,7 @@ public class ReportDesignGenerator { cell.getContent().add(label); label.setText("Dat is dat test !"); // ################ CODE HERE IF YOU WANT TO ADD GENERATED DESIGN / MAY BE WORTH USING RPTTEMPLATE AND-OR RPTLIBRARY ################### */ - + design.saveAs(rptDesignName); design.close(); if (Debug.infoOn())Debug.logInfo("####### Design generated: " + rptDesignName, MODULE); diff --git a/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/BirtEngineServlet.java b/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/BirtEngineServlet.java index 37197b6..45ee419 100644 --- a/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/BirtEngineServlet.java +++ b/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/BirtEngineServlet.java @@ -41,7 +41,7 @@ public class BirtEngineServlet extends org.eclipse.birt.report.servlet.BirtEngin @Override protected IContext __getContext(HttpServletRequest request, HttpServletResponse response) throws BirtException { BirtReportServiceFactory.getReportService().setContext(getServletContext(), null); - + // set app context Map<String, Object> appContext = UtilGenerics.cast(ReportEngineService.getInstance().getEngineConfig().getAppContext()); try { diff --git a/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/BirtViewerServlet.java b/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/BirtViewerServlet.java index 108d3d8..d744ea2 100644 --- a/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/BirtViewerServlet.java +++ b/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/BirtViewerServlet.java @@ -42,7 +42,7 @@ public class BirtViewerServlet extends ViewerServlet { @Override protected IContext __getContext(HttpServletRequest request, HttpServletResponse response) throws BirtException { BirtReportServiceFactory.getReportService().setContext(getServletContext(), null); - + // set app context Map<String, Object> appContext = UtilGenerics.cast(ReportEngineService.getInstance().getEngineConfig().getAppContext()); try { @@ -50,8 +50,6 @@ public class BirtViewerServlet extends ViewerServlet { } catch (GeneralException e) { throw new BirtException(e.getMessage()); } - - return new BirtContext(new ViewerServletRequest(ParameterAccessor.getParameter(request, ParameterAccessor.PARAM_REPORT) - , request), response); + return new BirtContext(new ViewerServletRequest(ParameterAccessor.getParameter(request, ParameterAccessor.PARAM_REPORT), request), response); } } diff --git a/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/ViewerServletRequest.java b/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/ViewerServletRequest.java index 77deb5e..a1c371c 100644 --- a/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/ViewerServletRequest.java +++ b/birt/src/main/java/org/apache/ofbiz/birt/report/servlet/ViewerServletRequest.java @@ -30,7 +30,6 @@ import org.apache.ofbiz.base.location.FlexibleLocation; import org.apache.ofbiz.base.util.Debug; public class ViewerServletRequest extends HttpServletRequestWrapper { - public final static String MODULE = ViewerServletRequest.class.getName(); protected String originalReportParam = null; @@ -39,7 +38,6 @@ public class ViewerServletRequest extends HttpServletRequestWrapper { super(request); this.originalReportParam = originalReportParam; } - @Override public String getParameter(String name) { if (ParameterAccessor.PARAM_REPORT.equals(name)) { diff --git a/birt/src/main/java/org/apache/ofbiz/birt/webapp/view/BirtViewHandler.java b/birt/src/main/java/org/apache/ofbiz/birt/webapp/view/BirtViewHandler.java index 3b2d737..7878aef 100644 --- a/birt/src/main/java/org/apache/ofbiz/birt/webapp/view/BirtViewHandler.java +++ b/birt/src/main/java/org/apache/ofbiz/birt/webapp/view/BirtViewHandler.java @@ -77,7 +77,7 @@ public class BirtViewHandler implements ViewHandler { public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException { - + try { IReportEngine engine = org.apache.ofbiz.birt.BirtFactory.getReportEngine(); // open report design @@ -97,7 +97,7 @@ public class BirtViewHandler implements ViewHandler { } else { design = engine.openReportDesign(page); } - + Map<String, Object> appContext = UtilGenerics.cast(engine.getConfig().getAppContext()); BirtWorker.setWebContextObjects(appContext, request, response); @@ -114,13 +114,13 @@ public class BirtViewHandler implements ViewHandler { if (locale == null) { locale = UtilHttp.getLocale(request); } - + // set override content type String overrideContentType = request.getParameter(BirtWorker.getBirtContentType()); if (UtilValidate.isNotEmpty(overrideContentType)) { contentType = overrideContentType; } - + // set output file name to get also file extension String outputFileName = request.getParameter(BirtWorker.getBirtOutputFileName()); if (UtilValidate.isNotEmpty(outputFileName)) { diff --git a/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java b/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java index aa79573..65305b3 100644 --- a/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java +++ b/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java @@ -213,7 +213,7 @@ public class MultiSiteRequestWrapper implements HttpServletRequest { public int getContentLength() { return request.getContentLength(); } - + @Override public long getContentLengthLong() { return request.getContentLengthLong(); diff --git a/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java b/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java index 8be0dfc..001bdc3 100644 --- a/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java +++ b/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java @@ -160,7 +160,6 @@ public class WebSiteFilter implements Filter { session.setAttribute("dispatcher", dispatcher); session.setAttribute("security", security); session.setAttribute("_WEBAPP_NAME_", UtilHttp.getApplicationName(request)); - // get rid of the visit info since it was pointing to the previous database, and get a new one session.removeAttribute("visitor"); session.removeAttribute("visit"); diff --git a/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java b/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java index 1bd98d3..b970cd7 100644 --- a/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java +++ b/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java @@ -208,7 +208,7 @@ public class EbayOrderServices { } private static Map<String, Object> buildGetSellerTransactionsRequest(Map<String, Object> context, StringBuffer sellerTransactionsItemsXml, String token) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); String fromDate = (String) context.get("fromDate"); String thruDate = (String) context.get("thruDate"); try { @@ -1115,26 +1115,22 @@ public class EbayOrderServices { if (UtilValidate.isNotEmpty(shippingAddressCtx)) { String buyerName = (String) shippingAddressCtx.get("buyerName"); String firstName = buyerName.substring(0, buyerName.indexOf(" ")); - String lastName = buyerName.substring(buyerName.indexOf(" ")+1); + String lastName = buyerName.substring(buyerName.indexOf(" ") + 1); String country = (String) shippingAddressCtx.get("shippingAddressCountry"); String state = (String) shippingAddressCtx.get("shippingAddressStateOrProvince"); String city = (String) shippingAddressCtx.get("shippingAddressCityName"); EbayHelper.correctCityStateCountry(dispatcher, shippingAddressCtx, city, state, country); - List<GenericValue> shipInfo = + List<GenericValue> shipInfo = PartyWorker.findMatchingPersonPostalAddresses - (delegator, + (delegator, shippingAddressCtx.get("shippingAddressStreet1").toString(), - (UtilValidate.isEmpty(shippingAddressCtx.get("shippingAddressStreet2")) ? null : shippingAddressCtx.get("shippingAddressStreet2").toString()), - shippingAddressCtx.get("city").toString(), + (UtilValidate.isEmpty(shippingAddressCtx.get("shippingAddressStreet2")) ? null : shippingAddressCtx.get("shippingAddressStreet2").toString()), + shippingAddressCtx.get("city").toString(), (UtilValidate.isEmpty(shippingAddressCtx.get("stateProvinceGeoId")) ? null : shippingAddressCtx.get("stateProvinceGeoId").toString()), - shippingAddressCtx.get("shippingAddressPostalCode").toString(), - null, - shippingAddressCtx.get("countryGeoId").toString(), - firstName, - null, - lastName); + shippingAddressCtx.get("shippingAddressPostalCode").toString(), + null, shippingAddressCtx.get("countryGeoId").toString(), firstName, null, lastName); if (UtilValidate.isNotEmpty(shipInfo)) { GenericValue first = EntityUtil.getFirst(shipInfo); partyId = first.getString("partyId"); diff --git a/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java b/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java index f9337bd..f3898b9 100755 --- a/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java +++ b/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java @@ -212,7 +212,7 @@ public class ImportOrdersFromEbay { } private static Map<String, Object> buildGetSellerTransactionsRequest(Map<String, Object> context, StringBuffer dataItemsXml, String token) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); String fromDate = (String) context.get("fromDate"); String thruDate = (String) context.get("thruDate"); try { diff --git a/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java b/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java index 3658e1d..0bd66d5 100755 --- a/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java +++ b/ebay/src/main/java/org/apache/ofbiz/ebay/ProductsExportToEbay.java @@ -174,7 +174,7 @@ public class ProductsExportToEbay { } public static Map<String, Object> buildDataItemsXml(DispatchContext dctx, Map<String, Object> context, StringBuffer dataItemsXml, String token, GenericValue prod) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); try { Delegator delegator = dctx.getDelegator(); String webSiteUrl = (String) context.get("webSiteUrl"); @@ -334,7 +334,7 @@ public class ProductsExportToEbay { } private static Map<String, Object> buildCategoriesXml(Map<String, Object> context, StringBuffer dataItemsXml, String token, String siteID, String categoryParent, String levelLimit) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); try { Document itemRequest = UtilXml.makeEmptyXmlDocument("GetCategoriesRequest"); Element itemRequestElem = itemRequest.getDocumentElement(); @@ -366,7 +366,7 @@ public class ProductsExportToEbay { /* private static Map<String, Object> buildSetTaxTableRequestXml(DispatchContext dctx, Map<String, Object> context, StringBuffer setTaxTableRequestXml, String token) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); try { Document taxRequestDocument = UtilXml.makeEmptyXmlDocument("SetTaxTableRequest"); Element taxRequestElem = taxRequestDocument.getDocumentElement(); @@ -392,7 +392,7 @@ public class ProductsExportToEbay { /* private static Map<String, Object> buildAddTransactionConfirmationItemRequest(Map<String, Object> context, StringBuffer dataItemsXml, String token, String itemId) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); try { Document transDoc = UtilXml.makeEmptyXmlDocument("AddTransactionConfirmationItemRequest"); Element transElem = transDoc.getDocumentElement(); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java index 72e8287..b5debbd 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java @@ -33,7 +33,6 @@ import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType; import com.ebay.soap.eBLBaseComponents.UserType; public class EbayAccount { - public static Map<String, Object> getEbayUser(DispatchContext dctx, Map<String, ? extends Object> context) { Map<String, Object>result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); @@ -42,17 +41,17 @@ public class EbayAccount { // Output Variable String email = null, - cityName = null, - companyName = null, - country = null, - firstName = null, + cityName = null, + companyName = null, + country = null, + firstName = null, lastName = null, name = null, - phone = null, + phone = null, postalCode = null, - stateOrProvince = null, - street = null, - street1 = null, + stateOrProvince = null, + street = null, + street1 = null, street2 = null, status = null; Map<String, Object>registrationAddress = new HashMap<>(); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java index a2e0cfe..2ded91a 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayBestOfferAutoPref.java @@ -43,7 +43,7 @@ public class EbayBestOfferAutoPref { Map<String, Object> result = new HashMap<>(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); Delegator delegator = dctx.getDelegator(); String productStoreId = (String) context.get("productStoreId"); @@ -229,9 +229,7 @@ public class EbayBestOfferAutoPref { } } } - } - } catch (GenericServiceException | GenericEntityException e) { String errorMessage = UtilProperties.getMessage(RESOURCE, "EbayStoreBestOfferToEntityFailed", locale); result = ServiceUtil.returnError(errorMessage); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java index d6cc4d5..4f43f24 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java @@ -142,7 +142,7 @@ public class EbayEvents { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(e.getMessage())); return "error"; } } @@ -156,7 +156,7 @@ public class EbayEvents { Locale locale = UtilHttp.getLocale(request); if (UtilValidate.isEmpty(requestParams.get("productStoreId"))) { - request.setAttribute("_ERROR_MESSAGE_","Required productStoreId and selected products."); + request.setAttribute("_ERROR_MESSAGE_", "Required productStoreId and selected products."); return "error"; } List<String> productIds = UtilGenerics.checkList(requestParams.get("productIds")); @@ -170,7 +170,7 @@ public class EbayEvents { productIds.add((String) requestParams.get("selectResult")); } } else { - request.setAttribute("_ERROR_MESSAGE_","Required productStoreId and selected products."); + request.setAttribute("_ERROR_MESSAGE_", "Required productStoreId and selected products."); return "error"; } String productStoreId = (String) requestParams.get("productStoreId"); @@ -264,7 +264,7 @@ public class EbayEvents { addItemObject.put("itemListing", itemObjs); } catch (Exception e) { Debug.logError(e.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(e.getMessage())); return "error"; } } @@ -286,17 +286,17 @@ public class EbayEvents { } getSiteFacade(apiContext, request); } else { - request.setAttribute("_ERROR_MESSAGE_","No apiContext for this account or this site please register on ebay or check you user account."); + request.setAttribute("_ERROR_MESSAGE_", "No apiContext for this account or this site please register on ebay or check you user account."); return "error"; } } catch (ApiException e) { - request.setAttribute("_ERROR_MESSAGE_","ApiException ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "ApiException ".concat(e.getMessage())); return "error"; } catch (SdkException e) { - request.setAttribute("_ERROR_MESSAGE_","SdkException ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "SdkException ".concat(e.getMessage())); return "error"; } catch (Exception e) { - request.setAttribute("_ERROR_MESSAGE_","Exception ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception ".concat(e.getMessage())); return "error"; } return "success"; @@ -510,7 +510,7 @@ public class EbayEvents { break; } } - } + } } } return cate; @@ -520,21 +520,21 @@ public class EbayEvents { Map<String, Object> requestParams = UtilHttp.getParameterMap(request); Delegator delegator = (Delegator) request.getAttribute("delegator"); if (UtilValidate.isEmpty(requestParams.get("productStoreId"))) { - request.setAttribute("_ERROR_MESSAGE_","Required productStoreId."); + request.setAttribute("_ERROR_MESSAGE_", "Required productStoreId."); return "error"; } if (UtilValidate.isEmpty(requestParams.get("isProductId"))) { - request.setAttribute("_ERROR_MESSAGE_","Required can not find form Id."); + request.setAttribute("_ERROR_MESSAGE_", "Required can not find form Id."); return "error"; } String isProductId = (String) requestParams.get("isProductId"); if (UtilValidate.isEmpty(requestParams.get("productId")) || UtilValidate.isEmpty(requestParams.get("ebayCategory"))) { - request.setAttribute("_ERROR_MESSAGE_","No ebay category or productId selected with form id ".concat(isProductId)); + request.setAttribute("_ERROR_MESSAGE_", "No ebay category or productId selected with form id ".concat(isProductId)); return "error"; } String categoryId = (String)requestParams.get("ebayCategory"); if (categoryId.contains("false")) { - request.setAttribute("_ERROR_MESSAGE_","Please select ebay category with low level of categories."); + request.setAttribute("_ERROR_MESSAGE_", "Please select ebay category with low level of categories."); return "error"; } else { if (categoryId.contains("true")) categoryId = categoryId.substring(0, categoryId.indexOf(":")); @@ -566,7 +566,7 @@ public class EbayEvents { cf = new EbayStoreCategoryFacade(csCate.getCategoryID(), apiContext, sf.getAttrMaster(), sf); addItemObject.put(refName, cf); } - request.setAttribute("_EVENT_MESSAGE_","Set selected ebay category ".concat(csCate.getCategoryID().toString()).concat(" with product ".concat(productId).concat(" successed."))); + request.setAttribute("_EVENT_MESSAGE_", "Set selected ebay category ".concat(csCate.getCategoryID().toString()).concat(" with product ".concat(productId).concat(" successed."))); } else { Debug.logWarning(categoryId.concat(" This category is not leaf category or ?"), MODULE); } @@ -579,13 +579,13 @@ public class EbayEvents { Debug.logError(e.getMessage(), MODULE); return "error"; } catch (ApiException e) { - request.setAttribute("_ERROR_MESSAGE_","ApiException ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "ApiException ".concat(e.getMessage())); return "error"; } catch (SdkException e) { - request.setAttribute("_ERROR_MESSAGE_","SdkException ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "SdkException ".concat(e.getMessage())); return "error"; } catch (Exception e) { - request.setAttribute("_ERROR_MESSAGE_","Exception ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception ".concat(e.getMessage())); return "error"; } request.setAttribute("productStoreId", requestParams.get("productStoreId")); @@ -647,7 +647,7 @@ public class EbayEvents { String itemPkCateId = (String) requestParams.get("primaryCateId"); String shippingService = (String) requestParams.get("ShippingService"); String productStoreId = (String) requestParams.get("productStoreId"); - + // initialize request parameter. Map<String, Object> paramMap = UtilHttp.getParameterMap(request); List<String> nameSpecificList = new LinkedList<>(); @@ -666,14 +666,12 @@ public class EbayEvents { if (paramMap.containsKey("categorySpecifics" + thisSuffix)) { valueListType = (String) paramMap.remove("categorySpecifics" + thisSuffix); } - if ((UtilValidate.isNotEmpty(nameValueListType)) && (UtilValidate.isNotEmpty(valueListType))) { nameSpecificList.add(nameValueListType); valueSpecificList.add(valueListType); } } } - try { ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); Map<String, Object> addItemObject = getAddItemListingObject(request, apiContext); @@ -683,14 +681,12 @@ public class EbayEvents { } else { listAddItem = new LinkedList<>(); } - for (Map<String, Object> itemObj : listAddItem) { AddItemCall addItemCall = (AddItemCall) itemObj.get("addItemCall"); ItemType item = addItemCall.getItem(); String SKU = item.getSKU(); if (UtilValidate.isNotEmpty(productId)) { if (productId.equals(SKU)) { - attributeMapList.put("Title", item.getTitle()); attributeMapList.put("SKU", SKU); attributeMapList.put("Currency", item.getCurrency().value()); @@ -719,7 +715,6 @@ public class EbayEvents { String name = nameSpecificList.get(i); String value = valueSpecificList.get(i); String[] valueArray = new String[] { value }; - // set Name value list type. NameValueListType listType = new NameValueListType(); listType.setName(name); @@ -839,7 +834,7 @@ public class EbayEvents { if (UtilValidate.isNotEmpty(requestParams.get("ebayStore1Category"))) { String ebayStore1Category = (String)requestParams.get("ebayStore1Category"); if (ebayStore1Category.contains("false")) { - request.setAttribute("_ERROR_MESSAGE_","Please select ebay store category with low level of categories."); + request.setAttribute("_ERROR_MESSAGE_", "Please select ebay store category with low level of categories."); return "error"; } else { if (ebayStore1Category.contains("true")) ebayStore1Category = ebayStore1Category.substring(0, ebayStore1Category.indexOf(":")); @@ -851,7 +846,7 @@ public class EbayEvents { if (UtilValidate.isNotEmpty(requestParams.get("ebayStore2Category"))) { String ebayStore2Category = (String)requestParams.get("ebayStore2Category"); if (ebayStore2Category.contains("false")) { - request.setAttribute("_ERROR_MESSAGE_","Please select ebay store category with low level of categories."); + request.setAttribute("_ERROR_MESSAGE_", "Please select ebay store category with low level of categories."); return "error"; } else { if (ebayStore2Category.contains("true")) ebayStore2Category = ebayStore2Category.substring(0, ebayStore2Category.indexOf(":")); @@ -892,7 +887,7 @@ public class EbayEvents { } } catch (GenericServiceException ex) { Debug.logError(ex.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(ex.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(ex.getMessage())); return "error"; } itemObj.put("requireEbayInventory", "Y"); @@ -922,7 +917,7 @@ public class EbayEvents { } } catch (GenericEntityException ex) { Debug.logError(ex.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(ex.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(ex.getMessage())); return "error"; } String productListingId = null; @@ -941,7 +936,7 @@ public class EbayEvents { itemObj.put("isSaved", "Y"); } catch (GenericServiceException ex) { Debug.logError(ex.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(ex.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(ex.getMessage())); return "error"; } } else { @@ -957,7 +952,7 @@ public class EbayEvents { } } catch (GenericServiceException ex) { Debug.logError(ex.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(ex.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(ex.getMessage())); return "error"; } } @@ -979,7 +974,7 @@ public class EbayEvents { } } catch (GenericServiceException ex) { Debug.logError(ex.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(ex.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(ex.getMessage())); return "error"; } } @@ -989,7 +984,7 @@ public class EbayEvents { request.setAttribute("productStoreId", requestParams.get("productStoreId")); } catch (Exception e) { Debug.logError(e.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(e.getMessage())); return "error"; } return "success"; @@ -1054,7 +1049,7 @@ public class EbayEvents { request.setAttribute("productStoreId", requestParams.get("productStoreId")); } catch (Exception e) { Debug.logError(e.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(e.getMessage())); return "error"; } return "success"; @@ -1093,7 +1088,7 @@ public class EbayEvents { request.setAttribute("productStoreId", requestParams.get("productStoreId")); } catch (Exception e) { Debug.logError(e.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(e.getMessage())); return "error"; } return "success"; @@ -1128,11 +1123,11 @@ public class EbayEvents { } } catch (GenericServiceException gse) { Debug.logError(e.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(gse.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(gse.getMessage())); return "error"; } catch (Exception e) { Debug.logError(e.getMessage(), MODULE); - request.setAttribute("_ERROR_MESSAGE_","Exception: ".concat(e.getMessage())); + request.setAttribute("_ERROR_MESSAGE_", "Exception: ".concat(e.getMessage())); return "error"; } return "success"; @@ -1181,14 +1176,12 @@ public class EbayEvents { Debug.logError(e.getMessage(), MODULE); } } - public static Map<String, Map<String, List<String>>> categorySpecifics(String categoryId, HttpServletRequest request) { Map<String, Map<String, List<String>>> recommendationMap = new HashMap<>(); Delegator delegator = (Delegator) request.getAttribute("delegator"); Map<String, Object> requestParams = UtilHttp.getParameterMap(request); Locale locale = UtilHttp.getLocale(request); String productStoreId = (String) requestParams.get("productStoreId"); - try { ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); GetCategorySpecificsCall categorySpecifics = new GetCategorySpecificsCall(apiContext); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java index de13fd5..dd21922 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java @@ -235,7 +235,7 @@ public class EbayStore { try { SetStoreCategoriesCall call = new SetStoreCategoriesCall(EbayStoreHelper.getApiContext((String) context.get("productStoreId"), locale, delegator)); - catalogCategories = EntityQuery.use(delegator).from("ProdCatalogCategory").where("prodCatalogId", context.get("prodCatalogId").toString(),"prodCatalogCategoryTypeId","PCCT_EBAY_ROOT").orderBy("sequenceNum ASC").queryList(); + catalogCategories = EntityQuery.use(delegator).from("ProdCatalogCategory").where("prodCatalogId", context.get("prodCatalogId").toString(), "prodCatalogCategoryTypeId", "PCCT_EBAY_ROOT").orderBy("sequenceNum ASC").queryList(); if (catalogCategories != null && catalogCategories.size() > 0) { List<StoreCustomCategoryType> listAdd = new LinkedList<StoreCustomCategoryType>(); List<StoreCustomCategoryType> listEdit = new LinkedList<StoreCustomCategoryType>(); @@ -397,7 +397,7 @@ public class EbayStore { if (actionCode.equals(StoreCategoryUpdateActionCodeType.ADD) && returnedCustomCategory != null) { StoreCustomCategoryType[] returnCategoryTypeList = returnedCustomCategory.getCustomCategory(); for (StoreCustomCategoryType returnCategoryType : returnCategoryTypeList) { - List<GenericValue> productCategoryList = EntityQuery.use(delegator).from("ProductCategory").where("categoryName", returnCategoryType.getName(),"productCategoryTypeId","EBAY_CATEGORY").queryList(); + List<GenericValue> productCategoryList = EntityQuery.use(delegator).from("ProductCategory").where("categoryName", returnCategoryType.getName(), "productCategoryTypeId", "EBAY_CATEGORY").queryList(); for (GenericValue productCategory : productCategoryList) { if (EbayStoreHelper.veriflyCategoryInCatalog(delegator, catalogCategories, productCategory.getString("productCategoryId"))) { if (EbayStoreHelper.createEbayCategoryIdByPartyId(delegator, productCategory.getString("productCategoryId"), partyId, String.valueOf(returnCategoryType.getCategoryID()))) { @@ -426,10 +426,9 @@ public class EbayStore { } public static Map<String, Object> buildSetStoreXml(DispatchContext dctx, Map<String, ? extends Object> context, StringBuffer dataStoreXml, String token, String siteID) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); try { Delegator delegator = dctx.getDelegator(); - // Get the list of products to be exported to eBay try { Document storeDocument = UtilXml.makeEmptyXmlDocument("SetStoreRequest"); @@ -485,7 +484,7 @@ public class EbayStore { } public static Map<String, Object> buildGetStoreXml(Map<String, ? extends Object> context, StringBuffer dataStoreXml, String token, String siteID) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); // Get the list of products to be exported to eBay try { Document storeDocument = UtilXml.makeEmptyXmlDocument("GetStoreRequest"); @@ -505,7 +504,7 @@ public class EbayStore { public static Map<String, Object> buildSetStoreCategoriesXml(DispatchContext dctx, Map<String, ? extends Object> context, StringBuffer dataStoreXml, String token, String siteID, String productCategoryId) { Delegator delegator = dctx.getDelegator(); - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); // Get the list of products to be exported to eBay try { Document storeDocument = UtilXml.makeEmptyXmlDocument("SetStoreCategoriesRequest"); @@ -625,7 +624,7 @@ public class EbayStore { if (context.get("productStoreId") != null) { String partyId = null; try { - List<GenericValue> productStoreRoles = EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId", context.get("productStoreId").toString(),"roleTypeId","EBAY_ACCOUNT").queryList(); + List<GenericValue> productStoreRoles = EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId", context.get("productStoreId").toString(), "roleTypeId", "EBAY_ACCOUNT").queryList(); if (productStoreRoles.size() != 0) { partyId= (String)productStoreRoles.get(0).get("partyId"); List<GenericValue> userLogins = EntityQuery.use(delegator).from("UserLogin").where("partyId", partyId).queryList(); @@ -681,7 +680,7 @@ public class EbayStore { ebayResp.put("storeNameColor", fontType.getNameColor()); ebayResp.put("storeTitleColor", fontType.getTitleColor()); - if (fontType != null) {// basic & advance theme + if (fontType != null) { // basic & advance theme String themeId = themeType.getThemeID().toString().concat("-").concat(colorSchemeType.getColorSchemeID().toString()); context.put("themeId", themeId); Map<String, Object> results = retrieveThemeColorSchemeByThemeId(dctx, context); @@ -1317,7 +1316,7 @@ public class EbayStore { result = ServiceUtil.returnError(resp.getMessage()); } LocalDispatcher dispatcher = dctx.getDispatcher(); - Map<String, Object> results = dispatcher.runSync("getEbayStoreOutput", UtilMisc.toMap("productStoreId", (String) context.get("productStoreId"),"userLogin", context.get("userLogin"))); + Map<String, Object> results = dispatcher.runSync("getEbayStoreOutput", UtilMisc.toMap("productStoreId", (String) context.get("productStoreId"), "userLogin", context.get("userLogin"))); if (ServiceUtil.isError(results)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(results)); } @@ -1556,10 +1555,10 @@ public class EbayStore { } GenericValue userLogin = (GenericValue) context.get("userLogin"); if (UtilValidate.isNotEmpty(context.get("productCategoryId"))) { - GenericValue prodCategoryMember = EntityQuery.use(delegator).from("ProductCategoryMember").where("productCategoryId", context.get("productCategoryId"),"productId", context.get("productId")).filterByDate().queryFirst(); + GenericValue prodCategoryMember = EntityQuery.use(delegator).from("ProductCategoryMember").where("productCategoryId", context.get("productCategoryId"), "productId", context.get("productId")).filterByDate().queryFirst(); if (prodCategoryMember != null) { GenericValue prodCategoryRole = EntityQuery.use(delegator).from("ProductCategoryRole").where("productCategoryId", - prodCategoryMember.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"),"roleTypeId", "EBAY_ACCOUNT") + prodCategoryMember.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"), "roleTypeId", "EBAY_ACCOUNT") .filterByDate().queryFirst(); if (prodCategoryRole != null) { context.put("ebayCategory", prodCategoryRole.get("comments")); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java index e77fa60..d9533f3 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java @@ -333,7 +333,6 @@ public class EbayStoreAutoPreferences { // if isAutoPositiveFeedback is N that means not start this job run service if ("Y".equals(isAutoFeedbackReminder) && jobId.equals(ebayProductStorePref.getString("autoPrefJobId"))) { afterDays = Integer.parseInt(ebayProductStorePref.getString("condition1")); - // start getting sold item list from ebay follow your site GetSellingManagerSoldListingsCall sellingManagerSoldListings = new GetSellingManagerSoldListingsCall(apiContext); List<SellingManagerSoldOrderType> items = new LinkedList<SellingManagerSoldOrderType>(); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCategoryFacade.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCategoryFacade.java index 8a2cbff..511727b 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCategoryFacade.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCategoryFacade.java @@ -211,7 +211,7 @@ public class EbayStoreCategoryFacade { m = cf.getClass().getMethod(methodName); if (m != null) { return m.invoke(cf); - } + } } catch (Exception e) { e.printStackTrace(); } @@ -277,7 +277,7 @@ public class EbayStoreCategoryFacade { } } } - return adItemTemplates = temGroupList; + return adItemTemplates = temGroupList; } public List<Map<String, Object>> getAdItemTemplates(String temGroupId) { diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCustomerService.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCustomerService.java index 5670a6d..e8a5b73 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCustomerService.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCustomerService.java @@ -132,7 +132,6 @@ public class EbayStoreCustomerService { GenericValue ebayUserBestOffer = EntityQuery.use(delegator).from("EbayUserBestOffer").where("userId", userId, "itemId", itemId).queryOne(); ebayUserBestOffer.set("contactStatus", contactStatus); ebayUserBestOffer.store(); - result.put("userId", userId); result.put("itemId", itemId); result.put("productStoreId", productStoreId); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java index 2d7541c..17e164c 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java @@ -123,7 +123,7 @@ public class EbayStoreHelper { ApiContext apiContext = new ApiContext(); apiContext.setApiCredential(apiCredential); apiContext.setApiServerUrl(apiServerUrl); - apiContext.setApiLogging(apiLogging); + apiContext.setApiLogging(apiLogging); apiContext.setErrorLanguage("en_US"); return apiContext; } @@ -215,7 +215,7 @@ public class EbayStoreHelper { GenericValue productCategoryRole = delegator.makeValue("ProductCategoryRole"); productCategoryRole.put("productCategoryId", productCategoryId); productCategoryRole.put("partyId", partyId); - productCategoryRole.put("roleTypeId","EBAY_ACCOUNT"); + productCategoryRole.put("roleTypeId", "EBAY_ACCOUNT"); productCategoryRole.put("fromDate", UtilDateTime.nowTimestamp()); productCategoryRole.put("comments", ebayCategoryId); productCategoryRole.create(); @@ -322,10 +322,8 @@ public class EbayStoreHelper { GenericValue jobV; jobV = delegator.makeValue("JobSandbox", jFields); GenericValue jobSandbox = delegator.createSetNextSeqId(jobV); - ebayProductPref.set("autoPrefJobId", jobSandbox.getString("jobId")); ebayProductPref.store(); - Map<String, Object>infoData = new HashMap<>(); infoData.put("jobId", jobSandbox.getString("jobId")); infoData.put("productStoreId", ebayProductPref.getString("productStoreId")); @@ -349,7 +347,7 @@ public class EbayStoreHelper { try { GenericValue ebayProductPref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", autoPrefEnumId).queryOne(); String jobId = ebayProductPref.getString("autoPrefJobId"); - List<GenericValue> jobs = EntityQuery.use(delegator).from("JobSandbox").where("parentJobId", jobId ,"statusId", "SERVICE_PENDING").queryList(); + List<GenericValue> jobs = EntityQuery.use(delegator).from("JobSandbox").where("parentJobId", jobId , "statusId", "SERVICE_PENDING").queryList(); Map<String, Object>inMap = new HashMap<>(); inMap.put("userLogin", userLogin); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java index 9402213..1cd3fc2 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java @@ -364,7 +364,7 @@ public class EbayStoreInventoryServices { try { if (context.get("productStoreId") != null && context.get("facilityId") != null) { - ebayProductStoreInventoryList = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("facilityId", (String) context.get("facilityId"),"productStoreId", (String) context.get("productStoreId")).queryList(); + ebayProductStoreInventoryList = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("facilityId", (String) context.get("facilityId"), "productStoreId", (String) context.get("productStoreId")).queryList(); for (GenericValue ebayProductStoreInventory : ebayProductStoreInventoryList) { if (ebayProductStoreInventory.get("ebayProductId") != null) { Map<String, Object> result = dispatcher.runSync("updateEbayInventoryStatusByProductId", UtilMisc.toMap("productStoreId", (String) context.get("productStoreId"), "facilityId", (String) context.get("facilityId"), "folderId", ebayProductStoreInventory.get("folderId"), "productId", ebayProductStoreInventory.get("productId"), "ebayProductId", ebayProductStoreInventory.get("ebayProductId"), "userLogin", context.get("userLogin"))); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOptions.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOptions.java index 64bb800..dc49b21 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOptions.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOptions.java @@ -55,7 +55,6 @@ import com.ebay.soap.eBLBaseComponents.StoreCustomCategoryType; public class EbayStoreOptions { private static final String MODULE = EbayStoreOptions.class.getName(); - public static String retrieveThemeColorSchemeByThemeId(HttpServletRequest request, HttpServletResponse response) { Locale locale = UtilHttp.getLocale(request); HttpSession session = request.getSession(true); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java index aa1c008..350dd94 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java @@ -93,19 +93,19 @@ public class EbayStoreOrder { result.put("formSelect", "order"); return result; } - + public static Map<String, Object> EbayStoreCreateTransactionShoppingCart(DispatchContext dctx, Map<String, Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); Map<String, Object> result = new HashMap<>(); - + String productStoreId = context.get("productStoreId").toString(); String defaultCurrencyUomId = ""; String payToPartyId = ""; String facilityId = ""; - + try { if (UtilValidate.isEmpty(productStoreId)) { return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "ordersImportFromEbay.productStoreIdIsMandatory", locale)); @@ -119,7 +119,7 @@ public class EbayStoreOrder { return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "ordersImportFromEbay.productStoreIdIsMandatory", locale)); } } - + ShoppingCart cart = new ShoppingCart(delegator, productStoreId, locale, defaultCurrencyUomId); String externalId = context.get("externalId").toString(); if (UtilValidate.isNotEmpty(externalId)) { @@ -211,7 +211,7 @@ public class EbayStoreOrder { } } } - + Debug.logInfo("Importing new order from eBay", MODULE); // set partyId to String partyId = null; diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreSiteFacade.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreSiteFacade.java index f2f970f..09cc99e 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreSiteFacade.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreSiteFacade.java @@ -100,7 +100,7 @@ public class EbayStoreSiteFacade { //sync and cache all categories features in memory private void syncAllCategoriesFeatures() throws Exception { - if (!siteCategoriesFeaturesMap.containsKey(this.apiContext.getSite())) { + if (!siteCategoriesFeaturesMap.containsKey(this.apiContext.getSite())) { FeaturesDownloader fd = new FeaturesDownloader(this.apiContext); GetCategoryFeaturesResponseType cfrt = fd.getAllCategoryFeatures(); CategoryFeatureType[] categoryFeatures = cfrt.getCategory(); @@ -117,7 +117,6 @@ public class EbayStoreSiteFacade { /** * Get categories using GetCategory2CS and GetCategories calls, * and merge the categories - * */ public List<CategoryType> getAllMergedCategories() throws ApiException, SdkException, Exception { //Get all categories that are mapped to characteristics sets diff --git a/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/janrain/JanrainHelper.java b/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/janrain/JanrainHelper.java index 3bc7e11..379943b 100644 --- a/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/janrain/JanrainHelper.java +++ b/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/janrain/JanrainHelper.java @@ -163,7 +163,7 @@ public class JanrainHelper { conn.getOutputStream(), "UTF-8"); osw.write(data); osw.close(); - + BufferedReader post = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line = ""; StringBuilder buf = new StringBuilder(); @@ -194,7 +194,7 @@ public class JanrainHelper { Element authInfo = JanrainHelper.authInfo(token); Element profileElement = UtilXml.firstChildElement(authInfo, "profile"); Element nameElement = UtilXml.firstChildElement(profileElement, "name"); - + // profile element String displayName = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "displayName")); String email = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "email")); @@ -202,18 +202,18 @@ public class JanrainHelper { String preferredUsername = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "preferredUsername")); String providerName = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "providerName")); String url = UtilXml.elementValue(UtilXml.firstChildElement(profileElement, "url")); - + // name element String givenName = UtilXml.elementValue(UtilXml.firstChildElement(nameElement, "givenName")); String familyName = UtilXml.elementValue(UtilXml.firstChildElement(nameElement, "familyName")); String formatted = UtilXml.elementValue(UtilXml.firstChildElement(nameElement, "formatted")); - + if (UtilValidate.isEmpty("preferredUsername")) { errMsg = UtilProperties.getMessage("SecurityextUiLabels", "loginevents.username_not_found_reenter", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } - + Map<String, String> result = new HashMap<>(); result.put("displayName", displayName); result.put("email", email); @@ -225,7 +225,6 @@ public class JanrainHelper { result.put("familyName", familyName); result.put("formatted", formatted); request.setAttribute("userInfoMap", result); - try { GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", preferredUsername).cache().queryOne(); if (userLogin != null) { diff --git a/example/src/main/java/org/apache/ofbiz/example/ExamplePrintServices.java b/example/src/main/java/org/apache/ofbiz/example/ExamplePrintServices.java index 87d984a..bcf7540 100644 --- a/example/src/main/java/org/apache/ofbiz/example/ExamplePrintServices.java +++ b/example/src/main/java/org/apache/ofbiz/example/ExamplePrintServices.java @@ -65,13 +65,13 @@ public class ExamplePrintServices { private static final String RESOURCE = "ExampleUiLabels"; public static Map<String, Object> printReportPdf(DispatchContext dctx, Map<String, ? extends Object> context) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); String screenLocation = "component://example/widget/example/ExampleReportScreens.xml"; String reportScreenName = "ExampleReport"; VisualTheme visualTheme = (VisualTheme) context.get("visualTheme"); if (visualTheme == null) { visualTheme = ThemeFactory.resolveVisualTheme(null); - } + } if (visualTheme == null) visualTheme = ThemeFactory.resolveVisualTheme(null); Map<String, Object> workContext = new HashMap<>(); workContext.putAll(context); diff --git a/ldap/src/main/java/org/apache/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java b/ldap/src/main/java/org/apache/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java index dc9e20b..cfc013a 100644 --- a/ldap/src/main/java/org/apache/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java +++ b/ldap/src/main/java/org/apache/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java @@ -60,7 +60,7 @@ public final class OFBizActiveDirectoryAuthenticationHandler extends AbstractOFB String searchType = UtilXml.childElementValue(rootElement, "SearchType", ""); String baseDN = UtilXml.childElementValue(rootElement, "BaseDN"); Hashtable<String, String> env = new Hashtable<>(); - env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); + env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, ldapURL); if (searchType == null || searchType.trim().equals("")) { env.put(Context.SECURITY_AUTHENTICATION, "none"); diff --git a/ldap/src/main/java/org/apache/ofbiz/ldap/openldap/OFBizLdapAuthenticationHandler.java b/ldap/src/main/java/org/apache/ofbiz/ldap/openldap/OFBizLdapAuthenticationHandler.java index 5cceef2..ed4632a 100644 --- a/ldap/src/main/java/org/apache/ofbiz/ldap/openldap/OFBizLdapAuthenticationHandler.java +++ b/ldap/src/main/java/org/apache/ofbiz/ldap/openldap/OFBizLdapAuthenticationHandler.java @@ -55,7 +55,7 @@ public final class OFBizLdapAuthenticationHandler extends AbstractOFBizAuthentic String authenType = UtilXml.childElementValue(rootElement, "AuthenType", "simple"); String baseDN = UtilXml.childElementValue(rootElement, "BaseDN"); Hashtable<String, String> env = new Hashtable<>(); - env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); + env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, ldapURL); env.put(Context.SECURITY_AUTHENTICATION, "none"); try { diff --git a/lucene/src/main/java/org/apache/ofbiz/content/test/LuceneTests.java b/lucene/src/main/java/org/apache/ofbiz/content/test/LuceneTests.java index 40aa62b..63a61b0 100644 --- a/lucene/src/main/java/org/apache/ofbiz/content/test/LuceneTests.java +++ b/lucene/src/main/java/org/apache/ofbiz/content/test/LuceneTests.java @@ -63,15 +63,15 @@ public class LuceneTests extends OFBizTestCase { throw new Exception(errorMessage); } assertTrue("Could not init search index", ServiceUtil.isSuccess(resp)); - + try { Thread.sleep(3000); // sleep 3 seconds to give enough time to the indexer to process the entries } catch (InterruptedException e) { Debug.logError("Thread interrupted :" + e, MODULE); } - + Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath("content")).toPath()); - + DirectoryReader r = null; try { r = DirectoryReader.open(directory); diff --git a/passport/src/main/java/org/apache/ofbiz/passport/event/GitHubEvents.java b/passport/src/main/java/org/apache/ofbiz/passport/event/GitHubEvents.java index 24d758c..4c1a651 100644 --- a/passport/src/main/java/org/apache/ofbiz/passport/event/GitHubEvents.java +++ b/passport/src/main/java/org/apache/ofbiz/passport/event/GitHubEvents.java @@ -69,39 +69,29 @@ import org.apache.ofbiz.service.LocalDispatcher; public class GitHubEvents { private static final String MODULE = GitHubEvents.class.getName(); - private static final String RESOURCE = "PassportUiLabels"; - public static final String AuthorizeUri = "/login/oauth/authorize"; - public static final String TokenServiceUri = "/login/oauth/access_token"; - public static final String UserApiUri = "/user"; - public static final String DEFAULT_SCOPE = "user,gist"; - public static final String ApiEndpoint = "https://api.github.com"; - public static final String TokenEndpoint = "https://github.com"; - public static final String SESSION_GITHUB_STATE = "_GITHUB_STATE_"; public static final String envPrefix = UtilProperties.getPropertyValue(GitHubAuthenticator.props, "github.env.prefix", "test"); /** * Redirect to GitHub login page. - * - * @return + * @return */ public static String gitHubRedirect(HttpServletRequest request, HttpServletResponse response) { GenericValue oauth2GitHub = getOAuth2GitHubConfig(request); if (UtilValidate.isEmpty(oauth2GitHub)) { return "error"; } - String clientId = oauth2GitHub.getString(PassportUtil.COMMON_CLIENT_ID); String returnURI = oauth2GitHub.getString(PassportUtil.COMMON_RETURN_RUL); - + // Get user authorization code try { String state = System.currentTimeMillis() + String.valueOf((new Random(10)).nextLong()); @@ -123,14 +113,13 @@ public class GitHubEvents { request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } - + return "success"; } /** * Parse GitHub login response and login the user if possible. - * - * @return + * @return */ public static String parseGitHubResponse(HttpServletRequest request, HttpServletResponse response) { String authorizationCode = request.getParameter(PassportUtil.COMMON_CODE); @@ -153,7 +142,7 @@ public class GitHubEvents { return "error"; } Debug.logInfo("GitHub authorization code: " + authorizationCode, MODULE); - + GenericValue oauth2GitHub = getOAuth2GitHubConfig(request); if (UtilValidate.isEmpty(oauth2GitHub)) { String errMsg = UtilProperties.getMessage(RESOURCE, "GitHubGetOAuth2ConfigError", UtilHttp.getLocale(request)); @@ -163,12 +152,12 @@ public class GitHubEvents { String clientId = oauth2GitHub.getString(PassportUtil.COMMON_CLIENT_ID); String secret = oauth2GitHub.getString(PassportUtil.COMMON_CLIENT_SECRET); String returnURI = oauth2GitHub.getString(PassportUtil.COMMON_RETURN_RUL); - + // Grant token from authorization code and oauth2 token // Use the authorization code to obtain an access token String accessToken = null; String tokenType = null; - + try { URI uri = new URIBuilder() .setScheme(TokenEndpoint.substring(0, TokenEndpoint.indexOf(":"))) @@ -219,7 +208,7 @@ public class GitHubEvents { getMethod.releaseConnection(); } // Debug.logInfo("GitHub User Info:" + userInfo, MODULE); - + // Store the user info and check login the user return checkLoginGitHubUser(request, userInfo, accessToken); } @@ -258,9 +247,9 @@ public class GitHubEvents { } } } else { - gitHubUser = delegator.makeValue("GitHubUser", UtilMisc.toMap("accessToken", accessToken, - "productStoreId", productStoreId, - "envPrefix", envPrefix, + gitHubUser = delegator.makeValue("GitHubUser", UtilMisc.toMap("accessToken", accessToken, + "productStoreId", productStoreId, + "envPrefix", envPrefix, "gitHubUserId", gitHubUserId)); try { gitHubUser.create(); @@ -302,7 +291,7 @@ public class GitHubEvents { } return null; } - + public static GenericValue getOAuth2GitHubConfig(Delegator delegator, String productStoreId) throws GenericEntityException { return EntityQuery.use(delegator).from("OAuth2GitHub").where("productStoreId", productStoreId).filterByDate().queryFirst(); } diff --git a/passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java b/passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java index 8efaad7..4e1705a 100644 --- a/passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java +++ b/passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java @@ -72,37 +72,28 @@ import org.xml.sax.SAXException; public class LinkedInEvents { private static final String MODULE = LinkedInEvents.class.getName(); - private static final String RESOURCE = "PassportUiLabels"; - public static final String AuthorizeUri = "/uas/oauth2/authorization"; - public static final String TokenServiceUri = "/uas/oauth2/accessToken"; - public static final String UserApiUri = "/v1/people/~"; - public static final String DEFAULT_SCOPE = "r_basicprofile%20r_emailaddress"; - public static final String TokenEndpoint = "https://www.linkedin.com"; - public static final String SESSION_LINKEDIN_STATE = "_LINKEDIN_STATE_"; - public static final String envPrefix = UtilProperties.getPropertyValue(LinkedInAuthenticator.props, "linkedin.env.prefix", "test"); /** * Redirect to LinkedIn login page. - * - * @return + * @return */ public static String linkedInRedirect(HttpServletRequest request, HttpServletResponse response) { GenericValue oauth2LinkedIn = getOAuth2LinkedInConfig(request); if (UtilValidate.isEmpty(oauth2LinkedIn)) { return "error"; } - + String clientId = oauth2LinkedIn.getString(PassportUtil.ApiKeyLabel); String returnURI = oauth2LinkedIn.getString(envPrefix + PassportUtil.ReturnUrlLabel); - + // Get user authorization code try { String state = System.currentTimeMillis() + String.valueOf((new Random(10)).nextLong()); @@ -124,14 +115,13 @@ public class LinkedInEvents { request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } - + return "success"; } /** * Parse LinkedIn login response and login the user if possible. - * - * @return + * @return */ public static String parseLinkedInResponse(HttpServletRequest request, HttpServletResponse response) { String authorizationCode = request.getParameter(PassportUtil.COMMON_CODE); @@ -154,7 +144,7 @@ public class LinkedInEvents { return "error"; } // Debug.logInfo("LinkedIn authorization code: " + authorizationCode, MODULE); - + GenericValue oauth2LinkedIn = getOAuth2LinkedInConfig(request); if (UtilValidate.isEmpty(oauth2LinkedIn)) { String errMsg = UtilProperties.getMessage(RESOURCE, "LinkedInGetOAuth2ConfigError", UtilHttp.getLocale(request)); @@ -164,11 +154,11 @@ public class LinkedInEvents { String clientId = oauth2LinkedIn.getString(PassportUtil.ApiKeyLabel); String secret = oauth2LinkedIn.getString(PassportUtil.SecretKeyLabel); String returnURI = oauth2LinkedIn.getString(envPrefix + PassportUtil.ReturnUrlLabel); - + // Grant token from authorization code and oauth2 token // Use the authorization code to obtain an access token String accessToken = null; - + try { URI uri = new URIBuilder() .setScheme(TokenEndpoint.substring(0, TokenEndpoint.indexOf(":"))) @@ -217,7 +207,7 @@ public class LinkedInEvents { getMethod.releaseConnection(); } // Debug.logInfo("LinkedIn User Info:" + userInfo, MODULE); - + // Store the user info and check login the user return checkLoginLinkedInUser(request, userInfo, accessToken); } @@ -256,9 +246,9 @@ public class LinkedInEvents { } } } else { - linkedInUser = delegator.makeValue("LinkedInUser", UtilMisc.toMap("accessToken", accessToken, - "productStoreId", productStoreId, - "envPrefix", envPrefix, + linkedInUser = delegator.makeValue("LinkedInUser", UtilMisc.toMap("accessToken", accessToken, + "productStoreId", productStoreId, + "envPrefix", envPrefix, "linkedInUserId", linkedInUserId)); try { linkedInUser.create(); @@ -300,7 +290,7 @@ public class LinkedInEvents { } return null; } - + public static GenericValue getOAuth2LinkedInConfig(Delegator delegator, String productStoreId) throws GenericEntityException { return EntityQuery.use(delegator).from("OAuth2LinkedIn").where("productStoreId", productStoreId).filterByDate().queryFirst(); } diff --git a/passport/src/main/java/org/apache/ofbiz/passport/user/GitHubAuthenticator.java b/passport/src/main/java/org/apache/ofbiz/passport/user/GitHubAuthenticator.java index f808c5f..11bb535 100644 --- a/passport/src/main/java/org/apache/ofbiz/passport/user/GitHubAuthenticator.java +++ b/passport/src/main/java/org/apache/ofbiz/passport/user/GitHubAuthenticator.java @@ -86,8 +86,7 @@ public class GitHubAuthenticator implements Authenticator { /** * Method to authenticate a user. - * - * For GitHub users, we only check if the username(userLoginId) exists an + * For GitHub users, we only check if the username(userLoginId) exists an * externalAuthId, and the externalAuthId has a valid accessToken in * GitHubUser entity. * @@ -235,7 +234,7 @@ public class GitHubAuthenticator implements Authenticator { } return createUser(userMap, system); } - + private String createUser(Map<String, Object> userMap, GenericValue system) throws AuthenticatorException { // create person + userLogin Map<String, Serializable> createPersonUlMap = new HashMap<>(); diff --git a/passport/src/main/java/org/apache/ofbiz/passport/user/LinkedInAuthenticator.java b/passport/src/main/java/org/apache/ofbiz/passport/user/LinkedInAuthenticator.java index f79b37c..aaf71bc 100644 --- a/passport/src/main/java/org/apache/ofbiz/passport/user/LinkedInAuthenticator.java +++ b/passport/src/main/java/org/apache/ofbiz/passport/user/LinkedInAuthenticator.java @@ -87,9 +87,8 @@ public class LinkedInAuthenticator implements Authenticator { /** * Method to authenticate a user. - * - * For LinkedIn users, we only check if the username(userLoginId) exists an - * externalAuthId, and the externalAuthId has a valid accessToken in + * For LinkedIn users, we only check if the username(userLoginId) exists an + * externalAuthId, and the externalAuthId has a valid accessToken in * LinkedInUser entity. * * @param userLoginId User's login id @@ -243,7 +242,7 @@ public class LinkedInAuthenticator implements Authenticator { } return createUser(user, system); } - + private String createUser(Document user, GenericValue system) throws AuthenticatorException { Map<String, String> userInfo = parseLinkedInUserInfo(user); diff --git a/passport/src/main/java/org/apache/ofbiz/passport/util/PassportUtil.java b/passport/src/main/java/org/apache/ofbiz/passport/util/PassportUtil.java index 9cea0e0..6cd56a2 100644 --- a/passport/src/main/java/org/apache/ofbiz/passport/util/PassportUtil.java +++ b/passport/src/main/java/org/apache/ofbiz/passport/util/PassportUtil.java @@ -29,9 +29,9 @@ import org.apache.ofbiz.base.util.Debug; public class PassportUtil { private static final String MODULE = PassportUtil.class.getName(); - + public static final String ClientIdLabel = "ClientId"; - + public static final String SecretLabel = "Secret"; public static final String ReturnUrlLabel = "ReturnUrl"; @@ -89,15 +89,15 @@ public class PassportUtil { public static final String COMMON_APP_KEY = "AppKey"; public static final String COMMON_APP_SECRET = "AppSecret"; - + public static final RequestConfig StandardRequestConfig = RequestConfig.custom() .setCookieSpec(CookieSpecs.STANDARD) .build(); - + protected PassportUtil() { // empty constructor } - + public static PassportUtil getInstance() { return new PassportUtil(); } diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java index 8a01fad..695f114 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractHtmlReport.java @@ -29,16 +29,13 @@ import org.apache.ofbiz.htmlreport.util.ReportStringUtil; * */ public abstract class AbstractHtmlReport extends HtmlReport { - - private static final String MODULE = AbstractHtmlReport.class.getName(); + private static final String MODULE = AbstractHtmlReport.class.getName(); public final static String THREAD_TYPE = "thread_type"; - public final static String FILE_REPORT_OUTPUT = "plugins/pricat/template/pricat/report.ftl"; - + /** * Constructs a new report using the provided locale for the output language. - * * @param request HttpServletRequest * @param response HttpServletResponse */ @@ -48,7 +45,6 @@ public abstract class AbstractHtmlReport extends HtmlReport { /** * Constructs a new report using the provided locale for the output language. - * * @param request HttpServletRequest * @param response HttpServletResponse * @param writeHtml if <code>true</code>, this report should generate HTML instead of JavaScript output @@ -57,18 +53,15 @@ public abstract class AbstractHtmlReport extends HtmlReport { public AbstractHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) { super(request, response, writeHtml, isTransient); } - + /** * Prepare display an html report. - * - * @throws IOException + * @throws IOException */ public void prepareDisplayReport(HttpServletRequest request, HttpServletResponse response, String name, String dialogUri) throws IOException { - if (ReportStringUtil.isNotEmpty(dialogUri)) { setDialogRealUri(request, dialogUri); } - String action = getParamAction(request); if (action == null) action = ""; if ("reportend".equals(action) || "cancel".equals(action)) { @@ -85,14 +78,12 @@ public abstract class AbstractHtmlReport extends HtmlReport { /** * Initializes the report thread to use for this report.<p> - * * @return the reported thread to use for this report. */ public abstract InterfaceReportThread initializeThread(HttpServletRequest request, HttpServletResponse response, String name); /** * Set the report dialog uri. - * * @param dialogUri */ public void setDialogRealUri(HttpServletRequest request, String dialogUri) { @@ -128,7 +119,6 @@ public abstract class AbstractHtmlReport extends HtmlReport { return "cancel"; } } - return "success"; } } \ No newline at end of file diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java index 97c58cf..5926628 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReport.java @@ -51,24 +51,20 @@ public abstract class AbstractReport implements InterfaceReport { /** Second constant. */ private static final long SECONDS = 1000; - public static final String SESSION_REPORT_CLASS = "OFBIZ_HTML_REPORT"; @Override public void addError(Object obj) { - errors.add(obj); } @Override public void addWarning(Object obj) { - warnings.add(obj); } @Override public String formatRuntime() { - long runtime = getRuntime(); long seconds = (runtime / SECONDS) % 60; long minutes = (runtime / MINUTES) % 60; @@ -128,7 +124,7 @@ public abstract class AbstractReport implements InterfaceReport { public boolean hasError() { return (errors.size() > 0); } - + @Override public boolean hasWarning() { return (warnings.size() > 0); @@ -141,7 +137,6 @@ public abstract class AbstractReport implements InterfaceReport { /** * Initializes some member variables for this report.<p> - * * @param locale the locale for this report */ protected void init(Locale locale) { @@ -162,7 +157,6 @@ public abstract class AbstractReport implements InterfaceReport { /** * Prints a String to the report, using the indicated formatting.<p> - * * Use the contants starting with <code>FORMAT</code> from this interface * to indicate which formatting to use.<p> * @@ -174,7 +168,6 @@ public abstract class AbstractReport implements InterfaceReport { /** * Prints a String with line break to the report.<p> - * * @param value the message container to add */ @Override @@ -185,7 +178,6 @@ public abstract class AbstractReport implements InterfaceReport { /** * Prints a String with line break to the report, using the indicated formatting.<p> - * * Use the contants starting with <code>FORMAT</code> from this interface * to indicate which formatting to use.<p> * diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java index 076f877..379a20c 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/AbstractReportThread.java @@ -37,15 +37,13 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe /** Indicates if the thread was already checked by the grim reaper. */ private boolean doomed; - + /** The report that belongs to the thread. */ private InterfaceReport report; /** The time this report is running. */ private long startTime; - private UUID uuid; - private Locale locale; /** @@ -59,7 +57,6 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe // the session must not be updated when it is used in a report EthernetAddress ethernetAddress = UUIDGenerator.getInstance().getDummyAddress(); uuid = UUIDGenerator.getInstance().generateTimeBasedUUID(ethernetAddress); - setName(name + " [" + uuid.toString() + "]"); // new Threads are not doomed doomed = false; @@ -67,8 +64,6 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe startTime = System.currentTimeMillis(); locale = UtilHttp.getLocale(request); } - - @Override public UUID getUUID() { return uuid; @@ -76,7 +71,6 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe /** * Adds an error object to the list of errors that occured during the report. - * * @param obj the error object */ public void addError(Object obj) { @@ -89,21 +83,17 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe /** * Returns the error exception in case there was an error during the execution of * this Thread, null otherwise. - * * @return the error exception in case there was an error, null otherwise */ public Throwable getError() { - return null; } /** * Returns a list of all errors that occured during the report. - * * @return an error list that occured during the report */ public List<?> getErrors() { - if (getReport() != null) { return getReport().getErrors(); } else { @@ -113,18 +103,15 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe /** * Returns the part of the report that is ready for output. - * * @return the part of the report that is ready for output */ public abstract String getReportUpdate(); /** * Returns the time this report has been running. - * * @return the time this report has been running */ public synchronized long getRuntime() { - if (doomed) { return startTime; } else { @@ -134,11 +121,9 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe /** * Returns if the report generated an error output. - * * @return true if the report generated an error, otherwise false */ public boolean hasError() { - if (getReport() != null) { return (getReport().getErrors().size() > 0); } else { @@ -148,15 +133,12 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe /** * Returns true if this thread is already "doomed" to be deleted. - * - * A OFBiz deamon Thread (the "Grim Reaper") will collect all + * A OFBiz deamon Thread (the "Grim Reaper") will collect all * doomed Threads, i.e. threads that are not longer active for some * time. - * * @return true if this thread is already "doomed" to be deleted */ public synchronized boolean isDoomed() { - if (isAlive()) { // as long as the Thread is still active it is never doomed return false; @@ -165,7 +147,7 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe // not longer active, and already doomed, so rest in peace... return true; } - // condemn the Thread to be collected by the grim reaper next time + // condemn the Thread to be collected by the grim reaper next time startTime = getRuntime(); doomed = true; return false; @@ -173,7 +155,6 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe /** * Returns the report where the output of this Thread is written to. - * * @return the report where the output of this Thread is written to */ protected InterfaceReport getReport() { @@ -183,32 +164,27 @@ public abstract class AbstractReportThread extends Thread implements InterfaceRe /** * Initialize a HTML report for this Thread. - * */ protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response) { report = HtmlReport.getInstance(request, response); ((HtmlReport) report).setParamThread(getUUID().toString()); } - + /** * Initialize a HTML report for this Thread. - * */ protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) { report = HtmlReport.getInstance(request, response, writeHtml, isTransient); ((HtmlReport) report).setParamThread(getUUID().toString()); } - - protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, String logFileName) { + protected void initHtmlReport(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, String logFileName) { report = HtmlReport.getInstance(request, response, writeHtml, isTransient, logFileName); ((HtmlReport) report).setParamThread(getUUID().toString()); } - protected Locale getLocale() { return locale; } - } diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java index 9b0885d..ac942fd 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java @@ -87,7 +87,7 @@ public class HtmlReport extends AbstractReport { /** Boolean flag indicating whether this report should generate HTML or JavaScript output. */ protected boolean writeHtml; - + /** Helper variable to deliver the html end part. */ public static final int HTML_END = 1; @@ -99,11 +99,11 @@ public class HtmlReport extends AbstractReport { /** The next thread to display after this report. */ protected String paramThreadHasNext; - + protected String paramAction; - + protected String paramTitle; - + protected String paramResource; /** Flag for refreching workplace .*/ @@ -147,45 +147,31 @@ public class HtmlReport extends AbstractReport { /** Request parameter value for the action: back. */ public static final String DIALOG_BACK = "back"; - /** Request parameter value for the action: cancel. */ public static final String DIALOG_CANCEL = "cancel"; - /** Request parameter value for the action: continue. */ public static final String DIALOG_CONTINUE = "continue"; - /** Request parameter value for the action: set. */ public static final String DIALOG_SET = "set"; - /** The RESOURCE list parameter value. */ protected String paramResourcelist; - /** The list of RESOURCE names for the multi operation. */ protected List<String> resourceList; - /** The key name which contains the localized message for the continue checkbox. */ protected String paramReportContinueKey; - public static final String DIALOG_URI = "dialoguri"; - public static final String FORM_URI = "formuri"; - private static final String RESOURCE = "PricatUiLabels"; - /** Log file. */ protected File logFile; - /** Log file name. */ protected String logFileName; - /** Log file output stream. */ protected FileOutputStream logFileOutputStream; - protected long sequenceNum = -1; /** * Constructs a new report using the provided locale for the output language.<p> - * * @param request HttpServletRequest * @param response HttpServletResponse */ @@ -196,7 +182,6 @@ public class HtmlReport extends AbstractReport { /** * Constructs a new report using the provided locale for the output language.<p> - * * @param request HttpServletRequest * @param response HttpServletResponse * @param writeHtml if <code>true</code>, this report should generate HTML instead of JavaScript output @@ -211,7 +196,6 @@ public class HtmlReport extends AbstractReport { this.writeHtml = writeHtml; this.isTransient = isTransient; } - public static HtmlReport getInstance(HttpServletRequest request, HttpServletResponse response) { HtmlReport wp = (HtmlReport) request.getSession().getAttribute(SESSION_REPORT_CLASS); if (wp == null) { @@ -220,7 +204,6 @@ public class HtmlReport extends AbstractReport { } return wp; } - public static HtmlReport getInstance(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient) { HtmlReport wp = (HtmlReport) request.getSession().getAttribute(SESSION_REPORT_CLASS); if (wp == null) { @@ -229,7 +212,6 @@ public class HtmlReport extends AbstractReport { } return wp; } - public static HtmlReport getInstance(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, String logFileName) { HtmlReport wp = (HtmlReport) request.getSession().getAttribute(SESSION_REPORT_CLASS); if (wp == null || UtilValidate.isEmpty(wp.getLogFileName()) || !wp.getLogFileName().equals(logFileName)) { @@ -238,12 +220,10 @@ public class HtmlReport extends AbstractReport { } return wp; } - public String getParamAction(HttpServletRequest request) { paramAction = request.getParameter("action"); return paramAction != null ? paramAction : "reportbegin"; } - public void setParamAction(String action) { paramAction = action; } @@ -280,9 +260,7 @@ public class HtmlReport extends AbstractReport { } } } - indexNext = isTransient ? 0 : indexEnd; - if (isTransient && logFileOutputStream != null && logResult.toString().length() > 0) { try { logFileOutputStream.write((logResult.toString() + "\n").getBytes()); @@ -295,8 +273,7 @@ public class HtmlReport extends AbstractReport { } /** - * Returns if the report writes html or javascript code.<p> - * + * Returns if the report writes html or javascript code.<p> * @return <code>true</code> if the report writes html, and <code>false</code> if the report writes javascript code */ public boolean isWriteHtml() { @@ -406,10 +383,9 @@ public class HtmlReport extends AbstractReport { content.add(getExceptionElementJS(t)); logContent.add(getExceptionElementHtml(t)); } - + /** * Returns the correct line break notation depending on the output style of this report. - * * @return the correct line break notation */ protected String getLineBreak() { @@ -418,14 +394,11 @@ public class HtmlReport extends AbstractReport { /** * Output helper method to format a reported <code>Throwable</code> element.<p> - * * This method ensures that exception stack traces are properly escaped * when they are added to the report.<p> - * * There is a member variable {@link #showExceptionStackTrace} in this * class that controls if the stack track is shown or not. * In a later version this might be configurable on a per-user basis.<p> - * * @param throwable the exception to format * @return the formatted StringBuffer */ @@ -491,11 +464,9 @@ public class HtmlReport extends AbstractReport { } /** - * Builds the start html of the page, including setting of DOCTYPE and + * Builds the start html of the page, including setting of DOCTYPE and * inserting a header with the content-type.<p> - * * This overloads the default method of the parent class.<p> - * * @return the start html of the page */ public String htmlStart() { @@ -504,11 +475,9 @@ public class HtmlReport extends AbstractReport { } /** - * Builds the start html of the page, including setting of DOCTYPE and + * Builds the start html of the page, including setting of DOCTYPE and * inserting a header with the content-type.<p> - * * This overloads the default method of the parent class.<p> - * * @param loadStyles if true, the defaul style sheet will be loaded * @return the start html of the page */ @@ -518,11 +487,9 @@ public class HtmlReport extends AbstractReport { } /** - * Builds the start html of the page, including setting of DOCTYPE and + * Builds the start html of the page, including setting of DOCTYPE and * inserting a header with the content-type.<p> - * * This overloads the default method of the parent class.<p> - * * @param segment the HTML segment (START / END) * @param loadStyles if true, the defaul style sheet will be loaded * @return the start html of the page @@ -549,7 +516,6 @@ public class HtmlReport extends AbstractReport { /** * Builds the standard javascript for submitting the dialog.<p> - * * @return the standard javascript for submitting the dialog */ public String dialogScriptSubmit() { @@ -567,7 +533,6 @@ public class HtmlReport extends AbstractReport { /** * Returns true if the report Thread is still alive (i.e. running), false otherwise.<p> - * * @return true if the report Thread is still alive */ public boolean isAlive(HttpServletRequest request) { @@ -599,7 +564,7 @@ public class HtmlReport extends AbstractReport { */ public String getParamThread(HttpServletRequest request) { String thread = request.getParameter("thread"); - return ReportStringUtil.isNotEmptyOrWhitespaceOnly(thread) ? thread : (paramThread == null? "" : paramThread); + return ReportStringUtil.isNotEmptyOrWhitespaceOnly(thread) ? thread : (paramThread == null ? "" : paramThread); } /** @@ -614,7 +579,6 @@ public class HtmlReport extends AbstractReport { /** * Builds the start html of the body.<p> - * * @param className optional class attribute to add to the body tag * @param parameters optional parameters to add to the body tag * @return the start html of the body @@ -625,7 +589,6 @@ public class HtmlReport extends AbstractReport { /** * Builds the html of the body.<p> - * * @param segment the HTML segment (START / END) * @param className optional class attribute to add to the body tag * @param parameters optional parameters to add to the body tag @@ -653,7 +616,6 @@ public class HtmlReport extends AbstractReport { /** * Builds the end html of the body.<p> - * * @return the end html of the body */ public String bodyEnd() { @@ -662,7 +624,6 @@ public class HtmlReport extends AbstractReport { /** * Builds the end html of the page.<p> - * * @return the end html of the page */ public String htmlEnd() { @@ -670,9 +631,8 @@ public class HtmlReport extends AbstractReport { } /** - * Returns the default html for a workplace page, including setting of DOCTYPE and + * Returns the default html for a workplace page, including setting of DOCTYPE and * inserting a header with the content-type.<p> - * * @param segment the HTML segment (START / END) * @param title the title of the page, if null no title tag is inserted * @return the default html for a workplace page @@ -682,9 +642,8 @@ public class HtmlReport extends AbstractReport { } /** - * Returns the default html for a workplace page, including setting of DOCTYPE and + * Returns the default html for a workplace page, including setting of DOCTYPE and * inserting a header with the content-type, allowing the selection of an individual style sheet.<p> - * * @param segment the HTML segment (START / END) * @param title the title of the page, if null no title tag is inserted * @param stylesheet the used style sheet, if null the default stylesheet 'workplace.css' is inserted @@ -713,7 +672,6 @@ public class HtmlReport extends AbstractReport { /** * Returns the start html for the outer dialog window border. - * * @return the start html for the outer dialog window border */ public String dialogStart() { @@ -722,10 +680,8 @@ public class HtmlReport extends AbstractReport { /** * Builds the outer dialog window border. - * * @param segment the HTML segment (START / END) * @param attributes optional additional attributes for the opening dialog table - * * @return a dialog window start / end segment */ public String dialog(int segment, String attributes) { @@ -746,9 +702,7 @@ public class HtmlReport extends AbstractReport { /** * Returns the start html for the content area of the dialog window.<p> - * * @param title the title for the dialog - * * @return the start html for the content area of the dialog window */ public String dialogContentStart(String title) { @@ -757,10 +711,8 @@ public class HtmlReport extends AbstractReport { /** * Builds the content area of the dialog window.<p> - * * @param segment the HTML segment (START / END) * @param title the title String for the dialog window - * * @return a content area start / end segment */ public String dialogContent(int segment, String title) { @@ -778,9 +730,7 @@ public class HtmlReport extends AbstractReport { /** * Builds the title of the dialog window.<p> - * * @param title the title String for the dialog window - * * @return the HTML title String for the dialog window */ public String dialogHead(String title) { @@ -788,13 +738,11 @@ public class HtmlReport extends AbstractReport { } /** - * Returns the value of the title parameter, + * Returns the value of the title parameter, * or null if this parameter was not provided.<p> - * - * This parameter is used to build the title - * of the dialog. It is a parameter so that the title + * This parameter is used to build the title + * of the dialog. It is a parameter so that the title * can be passed to included elements.<p> - * * @return the value of the title parameter */ public String getParamTitle(HttpServletRequest request) { @@ -805,9 +753,8 @@ public class HtmlReport extends AbstractReport { } /** - * Returns all initialized parameters of the current workplace class + * Returns all initialized parameters of the current workplace class * as hidden field tags that can be inserted in a form.<p> - * * @return all initialized parameters of the current workplace class * as hidden field tags that can be inserted in a html form */ @@ -816,11 +763,9 @@ public class HtmlReport extends AbstractReport { } /** - * Returns all initialized parameters of the current workplace class + * Returns all initialized parameters of the current workplace class * that are not in the given exclusion list as hidden field tags that can be inserted in a form.<p> - * - * @param excludes the parameters to exclude - * + * @param excludes the parameters to exclude * @return all initialized parameters of the current workplace class * that are not in the given exclusion list as hidden field tags that can be inserted in a form */ @@ -842,13 +787,12 @@ public class HtmlReport extends AbstractReport { result.append("\">\n"); } } - + return result.toString(); } /** * Returns the values of all parameter methods of this workplace class instance.<p> - * * @return the values of all parameter methods of this workplace class instance */ protected Map<String, Object> paramValues(HttpServletRequest request) { @@ -871,10 +815,9 @@ public class HtmlReport extends AbstractReport { } /** - * Returns a list of all methods of the current class instance that - * start with "getParam" and have no parameters.<p> - * - * @return a list of all methods of the current class instance that + * Returns a list of all methods of the current class instance that + * start with "getParam" and have no parameters.<p> + * @return a list of all methods of the current class instance that * start with "getParam" and have no parameters */ private List<Method> paramGetMethods() { @@ -893,7 +836,6 @@ public class HtmlReport extends AbstractReport { /** * Returns an optional introduction text to be displayed above the report output.<p> - * * @return an optional introduction text */ public String reportIntroductionText() { @@ -902,7 +844,6 @@ public class HtmlReport extends AbstractReport { /** * Returns an optional conclusion text to be displayed below the report output.<p> - * * @return an optional conclusion text */ public String reportConclusionText() { @@ -911,7 +852,6 @@ public class HtmlReport extends AbstractReport { /** * Returns the end html for the content area of the dialog window.<p> - * * @return the end html for the content area of the dialog window */ public String dialogContentEnd() { @@ -920,9 +860,7 @@ public class HtmlReport extends AbstractReport { /** * Builds a button row with an "Ok" and a "Cancel" button.<p> - * * This row is displayed when the first report is running.<p> - * * @param okAttrs optional attributes for the ok button * @param cancelAttrs optional attributes for the cancel button * @return the button row @@ -935,9 +873,7 @@ public class HtmlReport extends AbstractReport { /** * Builds a button row with an "OK" and a "Cancel" button.<p> - * * This row is used when a single report is running or after the first report has finished.<p> - * * @param okAttrs optional attributes for the ok button * @param cancelAttrs optional attributes for the cancel button * @return the button row @@ -954,9 +890,7 @@ public class HtmlReport extends AbstractReport { /** * Builds a button row with an "OK", a "Cancel" and a "Download" button.<p> - * * This row is used when a single report is running or after the first report has finished.<p> - * * @param okAttrs optional attributes for the ok button * @param cancelAttrs optional attributes for the cancel button * @param downloadAttrs optional attributes for the download button @@ -982,10 +916,8 @@ public class HtmlReport extends AbstractReport { /** * Builds the html for the button row under the dialog content area, including buttons.<p> - * * @param buttons array of constants of which buttons to include in the row * @param attributes array of Strings for additional button attributes - * * @return the html for the button row under the dialog content area, including buttons */ public String dialogButtons(int[] buttons, String[] attributes) { @@ -1000,9 +932,7 @@ public class HtmlReport extends AbstractReport { /** * Builds the button row under the dialog content area without the buttons.<p> - * * @param segment the HTML segment (START / END) - * * @return the button row start / end segment */ public String dialogButtonRow(int segment) { @@ -1015,7 +945,6 @@ public class HtmlReport extends AbstractReport { /** * Renders the HTML for a single input button of a specified type.<p> - * * @param result a string buffer where the rendered HTML gets appended to * @param button a integer key to identify the button * @param attribute an optional string with possible tag attributes, or null @@ -1138,9 +1067,7 @@ public class HtmlReport extends AbstractReport { /** * Appends a space char. between tag attributes.<p> - * * @param attribute a tag attribute - * * @return the tag attribute with a leading space char */ protected String appendDelimiter(String attribute) { @@ -1157,7 +1084,6 @@ public class HtmlReport extends AbstractReport { /** * Returns true if the dialog operation has to be performed on multiple resources.<p> - * * @return true if the dialog operation has to be performed on multiple resources, otherwise false */ public boolean isMultiOperation(HttpServletRequest request) { @@ -1166,10 +1092,8 @@ public class HtmlReport extends AbstractReport { /** * Returns the resources that are defined for the dialog operation. - * * For single RESOURCE operations, the list contains one item: the RESOURCE name found * in the request parameter value of the "RESOURCE" parameter. - * * @return the resources that are defined for the dialog operation */ public List<String> getResourceList(HttpServletRequest request) { @@ -1195,9 +1119,7 @@ public class HtmlReport extends AbstractReport { /** * Returns the value of the RESOURCE list parameter, or null if the parameter is not provided.<p> - * * This parameter selects the resources to perform operations on.<p> - * * @return the value of the RESOURCE list parameter or null, if the parameter is not provided */ public String getParamResourcelist(HttpServletRequest request) { @@ -1211,10 +1133,8 @@ public class HtmlReport extends AbstractReport { /** * Returns the value of the file parameter, * or null if this parameter was not provided.<p> - * * The file parameter selects the file on which the dialog action * is to be performed.<p> - * * @return the value of the file parameter */ public String getParamResource(HttpServletRequest request) { @@ -1228,7 +1148,6 @@ public class HtmlReport extends AbstractReport { /** * Returns if the workplace must be refreshed.<p> - * * @return <code>"true"</code> if the workplace must be refreshed. */ public String getParamRefreshWorkplace() { @@ -1237,7 +1156,6 @@ public class HtmlReport extends AbstractReport { /** * Returns the key name which contains the localized message for the continue checkbox.<p> - * * @return the key name which contains the localized message for the continue checkbox */ public String getParamReportContinueKey() { @@ -1248,12 +1166,10 @@ public class HtmlReport extends AbstractReport { } /** - * Returns the value of the resourcelist parameter in form of a String separated + * Returns the value of the resourcelist parameter in form of a String separated * with {@link #DELIMITER_RESOURCES}, or the value of the RESOURCE parameter if the * first parameter is not provided (no multiple choice has been done.<p> - * * This may be used for jsps as value for the parameter for resources {@link #PARAM_RESOURCELIST}.<p> - * * @return the value of the resourcelist parameter or null, if the parameter is not provided */ public String getResourceListAsParam(HttpServletRequest request) { @@ -1266,7 +1182,6 @@ public class HtmlReport extends AbstractReport { /** * Returns the end html for the outer dialog window border.<p> - * * @return the end html for the outer dialog window border */ public String dialogEnd() { @@ -1285,7 +1200,6 @@ public class HtmlReport extends AbstractReport { } /** * Set the report form uri. - * * @param request * @param formUri */ @@ -1294,7 +1208,6 @@ public class HtmlReport extends AbstractReport { } /** * Get the report form uri. - * * @param request * @return */ diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReport.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReport.java index 4146278..356662b 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReport.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReport.java @@ -55,88 +55,75 @@ public interface InterfaceReport { /** * Adds an error object to the list of errors that occured during the report.<p> - * * @param obj the error object */ void addError(Object obj); /** * Adds a warning object to the list of warnings that occured during the report.<p> - * * @param obj the error object */ void addWarning(Object obj); /** * Formats the runtime formatted as "hh:mm:ss".<p> - * * @return the runtime formatted as "hh:mm:ss" */ String formatRuntime(); /** * Returns a list of all errors that occured during the report.<p> - * * @return an error list that occured during the report */ List<Object> getErrors(); /** * Returns the locale this report was initialized with.<p> - * * @return the locale this report was initialized with */ Locale getLocale(); /** - * Updates this report, this processes all new output added since + * Updates this report, this processes all new output added since * the last call to this method.<p> - * * This is only required in case the output is written to a HTML page, * if the shell output is used, this will just return an empty String.<p> - * * @return new elements that have been added to the report and not yet processed. */ String getReportUpdate(); /** * Returns the time this report has been running.<p> - * * @return the time this report has been running */ long getRuntime(); /** * Returns a list of all warnings that occured during the report.<p> - * * @return a warning list that occured during the report */ List<Object> getWarnings(); /** * Returns if the report generated an error output.<p> - * * @return true if the report generated an error, otherwise false */ boolean hasError(); /** * Returns if the report generated a warning output.<p> - * * @return true if the report generated a warning, otherwise false */ boolean hasWarning(); /** * Prints a localized message to the report.<p> - * * @param uiLabel the String to add */ void print(String uiLabel); /** * Prints a localized message to the report, using the indicated formatting.<p> - * * Use the contants starting with <code>FORMAT</code> from this interface * to indicate which formatting to use.<p> * @@ -152,7 +139,6 @@ public interface InterfaceReport { /** * Prints a localized message to the report.<p> - * * @param uiLabel the message to add */ void println(String uiLabel); @@ -171,18 +157,14 @@ public interface InterfaceReport { /** * Adds an Exception to the report, ensuring that the Exception content is * processed to generate a valid output esp. for HTML pages.<p> - * * The exception will be stored and the output will later be processed - * in a special way.<p> - * + * in a special way.<p> * @param t the exception to add - * */ void println(Throwable t); /** * Prints a localized message followed by a parameter and dots to the report.<p> - * * @param uiLabel the Message to add * @param param the Parameter to add */ @@ -190,14 +172,11 @@ public interface InterfaceReport { /** * Convenience method to print a localized message, followed by a parameter and dots to the report.<p> - * * The output follows the pattern: ( 3 / 8 ) Deleting filename.txt ... - * * @param m the number of the report output * @param n the total number of report outputs * @param uiLabel the Message to add * @param param the Parameter to add - * */ void printMessageWithParam(int m, int n, String uiLabel, Object param); @@ -208,23 +187,19 @@ public interface InterfaceReport { /** * Add a log file to the report. - * * @param logFileName */ void addLogFile(String logFileName); /** * Close log file if necessary. - * */ String closeLogFile(); - /** * Set log's sequence number. * @param sequenceNum */ void setSequenceNum(long sequenceNum); - long getSequenceNum(); } \ No newline at end of file diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReportThread.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReportThread.java index 344ef11..f9f1e1f 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReportThread.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/InterfaceReportThread.java @@ -33,7 +33,6 @@ public interface InterfaceReportThread { /** * Returns the UUID of this report thread.<p> - * * @return the UUID of this report thread */ UUID getUUID(); diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlReport.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlReport.java index 23d4ec3..a1e7aa3 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlReport.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlReport.java @@ -29,20 +29,17 @@ import org.apache.ofbiz.htmlreport.InterfaceReportThread; * */ public class SampleHtmlReport extends AbstractHtmlReport { - + /** * Public constructor with report variables.<p> - * * @param request the HttpServletRequest request * @param response the HttpServletResponse response */ public SampleHtmlReport(HttpServletRequest request, HttpServletResponse response) { - super(request, response); } - + public static SampleHtmlReport getReport(HttpServletRequest request, HttpServletResponse response) { - SampleHtmlReport wp = (SampleHtmlReport) request.getAttribute(SESSION_REPORT_CLASS); if (wp == null) { wp = new SampleHtmlReport(request, response); @@ -50,10 +47,9 @@ public class SampleHtmlReport extends AbstractHtmlReport { } return wp; } - + @Override public InterfaceReportThread initializeThread(HttpServletRequest request, HttpServletResponse response, String name) { - if (name == null) { name = ""; } @@ -69,7 +65,6 @@ public class SampleHtmlReport extends AbstractHtmlReport { break; } } - if (thread == null) { thread = new SampleHtmlThread(request, response, name.toLowerCase()); } diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlThread.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlThread.java index 605d823..7671d0d 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlThread.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/sample/SampleHtmlThread.java @@ -34,25 +34,17 @@ import org.apache.ofbiz.htmlreport.InterfaceReport; /** * Thread for running sample html report. - * */ public class SampleHtmlThread extends AbstractReportThread { public static final String COUNT_DOWN = "countdown"; - public static final String COUNT_UP = "countup"; - public static final String CONFIRM = "confirm_action"; - public static final String[] messageLables = new String[] {"FORMAT_DEFAULT", "FORMAT_WARNING", "FORMAT_HEADLINE", "FORMAT_NOTE", "FORMAT_OK", "FORMAT_ERROR", "FORMAT_THROWABLE"}; - public static final List<String> messages = Collections.unmodifiableList(Arrays.asList(messageLables)); - private static final String RESOURCE = "PricatUiLabels"; - /** * Constructor, creates a new HtmlImportThreat. - * */ public SampleHtmlThread(HttpServletRequest request, HttpServletResponse response, String name) { super(request, response, name); diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportEncoder.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportEncoder.java index 60f71f0..7e1b6db 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportEncoder.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportEncoder.java @@ -52,10 +52,9 @@ public final class ReportEncoder { /** Constant for the standard <code>US-ASCII</code> encoding. */ public static final String ENCODING_US_ASCII = "US-ASCII"; - /** + /** * Constant for the standard <code>UTF-8</code> encoding.<p> - * - * Default encoding for JavaScript decodeUriComponent methods is <code>UTF-8</code> by w3c standard. + * Default encoding for JavaScript decodeUriComponent methods is <code>UTF-8</code> by w3c standard. */ public static final String ENCODING_UTF_8 = "UTF-8"; @@ -84,14 +83,11 @@ public final class ReportEncoder { /** * Adjusts the given String by making sure all characters that can be displayed * in the given charset are contained as chars, whereas all other non-displayable - * characters are converted to HTML entities.<p> - * + * characters are converted to HTML entities.<p> * Just calls {@link #decodeHtmlEntities(String, String)} first and feeds the result * to {@link #encodeHtmlEntities(String, String)}. <p> - * * @param input the input to adjust the HTML encoding for * @param encoding the charset to encode the result with\ - * * @return the input with the decoded/encoded HTML entities */ public static String adjustHtmlEncoding(String input, String encoding) { @@ -101,11 +97,9 @@ public final class ReportEncoder { /** * Changes the encoding of a byte array that represents a String.<p> - * * @param input the byte array to convert * @param oldEncoding the current encoding of the byte array * @param newEncoding the new encoding of the byte array - * * @return the byte array encoded in the new encoding */ public static byte[] changeEncoding(byte[] input, String oldEncoding, String newEncoding) { @@ -128,13 +122,10 @@ public final class ReportEncoder { /** * Creates a String out of a byte array with the specified encoding, falling back * to the system default in case the encoding name is not valid.<p> - * * Use this method as a replacement for <code>new String(byte[], encoding)</code> * to avoid possible encoding problems.<p> - * - * @param bytes the bytes to decode + * @param bytes the bytes to decode * @param encoding the encoding scheme to use for decoding the bytes - * * @return the bytes decoded to a String */ public static String createString(byte[] bytes, String encoding) { @@ -164,9 +155,7 @@ public final class ReportEncoder { /** * Decodes a String using UTF-8 encoding, which is the standard for http data transmission * with GET ant POST requests.<p> - * * @param source the String to decode - * * @return String the decoded source String */ public static String decode(String source) { @@ -176,14 +165,11 @@ public final class ReportEncoder { /** * This method is a substitute for <code>URLDecoder.decode()</code>.<p> - * - * In case you don't know what encoding to use, set the value of + * In case you don't know what encoding to use, set the value of * the <code>encoding</code> parameter to <code>null</code>. * This method will then default to UTF-8 encoding, which is probably the right one.<p> - * * @param source The string to decode * @param encoding The encoding to use (if null, the system default is used) - * * @return The decoded source String */ public static String decode(String source, String encoding) { @@ -208,14 +194,12 @@ public final class ReportEncoder { } /** - * Decodes HTML entity references like <code>&#8364;</code> that are contained in the - * String to a regular character, but only if that character is contained in the given - * encodings charset.<p> - * + * Decodes HTML entity references like <code>&#8364;</code> that are contained in the + * String to a regular character, but only if that character is contained in the given + * encodings charset.<p> * @param input the input to decode the HTML entities in * @param encoding the charset to decode the input for * @return the input with the decoded HTML entities - * * @see #encodeHtmlEntities(String, String) */ public static String decodeHtmlEntities(String input, String encoding) { @@ -246,11 +230,8 @@ public final class ReportEncoder { /** * Decodes a string used as parameter in an uri in a way independent of other encodings/decodings applied before.<p> - * * @param input the encoded parameter string - * * @return the decoded parameter string - * * @see #encodeParameter(String) */ public static String decodeParameter(String input) { @@ -262,9 +243,7 @@ public final class ReportEncoder { /** * Encodes a String using UTF-8 encoding, which is the standard for http data transmission * with GET ant POST requests.<p> - * * @param source the String to encode - * * @return String the encoded source String */ public static String encode(String source) { @@ -274,14 +253,11 @@ public final class ReportEncoder { /** * This method is a substitute for <code>URLEncoder.encode()</code>.<p> - * - * In case you don't know what encoding to use, set the value of - * the <code>encoding</code> parameter to <code>null</code>. + * In case you don't know what encoding to use, set the value of + * the <code>encoding</code> parameter to <code>null</code>. * This method will then default to UTF-8 encoding, which is probably the right one.<p> - * * @param source the String to encode * @param encoding the encoding to use (if null, the system default is used) - * * @return the encoded source String */ public static String encode(String source, String encoding) { @@ -306,19 +282,15 @@ public final class ReportEncoder { } /** - * Encodes all characters that are contained in the String which can not displayed + * Encodes all characters that are contained in the String which can not displayed * in the given encodings charset with HTML entity references * like <code>&#8364;</code>.<p> - * - * This is required since a Java String is - * internally always stored as Unicode, meaning it can contain almost every character, but + * This is required since a Java String is + * internally always stored as Unicode, meaning it can contain almost every character, but * the HTML charset used might not support all such characters.<p> - * * @param input the input to encode for HTML * @param encoding the charset to encode the result with - * * @return the input with the encoded HTML entities - * * @see #decodeHtmlEntities(String, String) */ public static String encodeHtmlEntities(String input, String encoding) { @@ -348,14 +320,11 @@ public final class ReportEncoder { } /** - * Encodes all characters that are contained in the String which can not displayed + * Encodes all characters that are contained in the String which can not displayed * in the given encodings charset with Java escaping like <code>\u20ac</code>.<p> - * * This can be used to escape values used in Java property files.<p> - * * @param input the input to encode for Java * @param encoding the charset to encode the result with - * * @return the input with the encoded Java entities */ public static String encodeJavaEntities(String input, String encoding) { @@ -390,14 +359,11 @@ public final class ReportEncoder { /** * Encodes a string used as parameter in an uri in a way independent of other encodings/decodings applied later.<p> - * * Used to ensure that GET parameters are not wrecked by wrong or incompatible configuration settings. * In order to ensure this, the String is first encoded with html entities for any character that cannot encoded * in US-ASCII; additionally, the plus sign is also encoded to avoid problems with the white-space replacer. * Finally, the entity prefix is replaced with characters not used as delimiters in urls.<p> - * * @param input the parameter string - * * @return the encoded parameter string */ public static String encodeParameter(String input) { @@ -409,10 +375,8 @@ public final class ReportEncoder { /** * Encodes a String in a way that is compatible with the JavaScript escape function. - * * @param source The text to be encoded * @param encoding the encoding type - * * @return The JavaScript escaped string */ public static String escape(String source, String encoding) { @@ -422,16 +386,12 @@ public final class ReportEncoder { } /** - * Escapes special characters in a HTML-String with their number-based + * Escapes special characters in a HTML-String with their number-based * entity representation, for example & becomes &#38;.<p> - * * A character <code>num</code> is replaced if<br> * <code>((ch != 32) && ((ch > 122) || (ch < 48) || (ch == 60) || (ch == 62)))</code><p> - * * @param source the String to escape - * * @return String the escaped String - * * @see #escapeXml(String) */ public static String escapeHtml(String source) { @@ -443,7 +403,7 @@ public final class ReportEncoder { StringBuffer result = new StringBuffer(source.length() * 2); for (int i = 0; i < source.length(); i++) { int ch = source.charAt(i); - // avoid escaping already escaped characters + // avoid escaping already escaped characters if (ch == 38) { terminatorIndex = source.indexOf(";", i); if (terminatorIndex > 0) { @@ -467,16 +427,12 @@ public final class ReportEncoder { } /** - * Escapes non ASCII characters in a HTML-String with their number-based + * Escapes non ASCII characters in a HTML-String with their number-based * entity representation, for example & becomes &#38;.<p> - * * A character <code>num</code> is replaced if<br> * <code>(ch > 255)</code><p> - * * @param source the String to escape - * * @return String the escaped String - * * @see #escapeXml(String) */ public static String escapeNonAscii(String source) { @@ -501,10 +457,8 @@ public final class ReportEncoder { /** * Encodes a String in a way that is compatible with the JavaScript escape function. * Multiple blanks are encoded _multiply _with <code>%20</code>.<p> - * * @param source The text to be encoded * @param encoding the encoding type - * * @return The JavaScript escaped string */ public static String escapeWBlanks(String source, String encoding) { @@ -533,7 +487,6 @@ public final class ReportEncoder { /** * Escapes a String so it may be printed as text content or attribute * value in a HTML page or an XML file.<p> - * * This method replaces the following characters in a String: * <ul> * <li><b><</b> with &lt; @@ -541,11 +494,8 @@ public final class ReportEncoder { * <li><b>&</b> with &amp; * <li><b>"</b> with &quot; * </ul><p> - * * @param source the string to escape - * * @return the escaped string - * * @see #escapeHtml(String) */ public static String escapeXml(String source) { @@ -556,7 +506,6 @@ public final class ReportEncoder { /** * Escapes a String so it may be printed as text content or attribute * value in a HTML page or an XML file.<p> - * * This method replaces the following characters in a String: * <ul> * <li><b><</b> with &lt; @@ -564,12 +513,9 @@ public final class ReportEncoder { * <li><b>&</b> with &amp; * <li><b>"</b> with &quot; * </ul><p> - * * @param source the string to escape * @param doubleEscape if <code>false</code>, all entities that already are escaped are left untouched - * * @return the escaped string - * * @see #escapeHtml(String) */ public static String escapeXml(String source, boolean doubleEscape) { @@ -614,20 +560,16 @@ public final class ReportEncoder { /** * Checks if a given encoding name is actually supported, and if so - * resolves it to it's canonical name, if not it returns the given fallback - * value.<p> - * + * resolves it to it's canonical name, if not it returns the given fallback + * value.<p> * Charsets have a set of aliases. For example, valid aliases for "UTF-8" - * are "UTF8", "utf-8" or "utf8". This method resolves any given valid charset name + * are "UTF8", "utf-8" or "utf8". This method resolves any given valid charset name * to it's "canonical" form, so that simple String comparison can be used * when checking charset names internally later.<p> - * - * Please see <a href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a> + * Please see <a href="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</a> * for a list of valid charset alias names.<p> - * * @param encoding the encoding to check and resolve * @param fallback the fallback encoding scheme - * * @return the resolved encoding name, or the fallback value */ public static String lookupEncoding(String encoding, String fallback) { @@ -649,12 +591,10 @@ public final class ReportEncoder { } /** - * Decodes a String in a way that is compatible with the JavaScript + * Decodes a String in a way that is compatible with the JavaScript * unescape function.<p> - * * @param source The String to be decoded * @param encoding the encoding type - * * @return The JavaScript unescaped String */ public static String unescape(String source, String encoding) { diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java index fb2c1af..2695204 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/util/ReportStringUtil.java @@ -63,11 +63,9 @@ public final class ReportStringUtil { } /** - * Changes the filename suffix. - * + * Changes the filename suffix. * @param filename the filename to be changed * @param suffix the new suffix of the file - * * @return the filename with the replaced suffix */ public static String changeFileNameSuffixTo(String filename, String suffix) { @@ -83,10 +81,8 @@ public final class ReportStringUtil { /** * Returns a string representation for the given collection using the given separator.<p> - * * @param collection the collection to print * @param separator the item separator - * * @return the string representation for the given collection */ public static String collectionAsString(Collection<String> collection, String separator) { @@ -103,14 +99,11 @@ public final class ReportStringUtil { } /** - * Replaces occurrences of special control characters in the given input with + * Replaces occurrences of special control characters in the given input with * a HTML representation.<p> - * - * This method currently replaces line breaks to <code><br/></code> and special HTML chars + * This method currently replaces line breaks to <code><br/></code> and special HTML chars * like <code>< > & "</code> with their HTML entity representation.<p> - * * @param source the String to escape - * * @return the escaped String */ public static String escapeHtml(String source) { @@ -126,11 +119,8 @@ public final class ReportStringUtil { /** * Escapes a String so it may be used in JavaScript String definitions.<p> - * * This method replaces line breaks, quotation marks and \ characters.<p> - * * @param source the String to escape - * * @return the escaped String */ public static String escapeJavaScript(String source) { @@ -145,12 +135,9 @@ public final class ReportStringUtil { /** * Escapes a String so it may be used as a Perl5 regular expression.<p> - * * This method replaces the following characters in a String:<br> * <code>{}[]()\$^.*+/</code><p> - * * @param source the string to escape - * * @return the escaped string */ public static String escapePattern(String source) { @@ -216,11 +203,8 @@ public final class ReportStringUtil { /** * Formats a runtime in the format hh:mm:ss, to be used e.g. in reports.<p> - * - * If the runtime is greater then 24 hours, the format dd:hh:mm:ss is used.<p> - * + * If the runtime is greater then 24 hours, the format dd:hh:mm:ss is used.<p> * @param runtime the time to format - * * @return the formatted runtime */ public static String formatRuntime(long runtime) { @@ -261,10 +245,8 @@ public final class ReportStringUtil { /** * Returns <code>true</code> if the provided String is either <code>null</code> - * or the empty String <code>""</code>.<p> - * + * or the empty String <code>""</code>.<p> * @param value the value to check - * * @return true, if the provided value is null or the empty String, false otherwise */ public static boolean isEmpty(String value) { @@ -274,10 +256,8 @@ public final class ReportStringUtil { /** * Returns <code>true</code> if the provided String is either <code>null</code> - * or contains only white spaces.<p> - * + * or contains only white spaces.<p> * @param value the value to check - * * @return true, if the provided value is null or contains only white spaces, false otherwise */ public static boolean isEmptyOrWhitespaceOnly(String value) { @@ -286,14 +266,12 @@ public final class ReportStringUtil { } /** - * Returns <code>true</code> if the provided Objects are either both <code>null</code> + * Returns <code>true</code> if the provided Objects are either both <code>null</code> * or equal according to {@link Object#equals(Object)}.<p> - * * @param value1 the first object to compare * @param value2 the second object to compare - * - * @return <code>true</code> if the provided Objects are either both <code>null</code> - * or equal according to {@link Object#equals(Object)} + * @return <code>true</code> if the provided Objects are either both <code>null</code> + * or equal according to {@link Object#equals(Object)} */ public static boolean isEqual(Object value1, Object value2) { @@ -305,10 +283,8 @@ public final class ReportStringUtil { /** * Returns <code>true</code> if the provided String is neither <code>null</code> - * nor the empty String <code>""</code>.<p> - * + * nor the empty String <code>""</code>.<p> * @param value the value to check - * * @return true, if the provided value is not null and not the empty String, false otherwise */ public static boolean isNotEmpty(String value) { @@ -318,11 +294,9 @@ public final class ReportStringUtil { /** * Returns <code>true</code> if the provided String is neither <code>null</code> - * nor contains only white spaces.<p> - * + * nor contains only white spaces.<p> * @param value the value to check - * - * @return <code>true</code>, if the provided value is <code>null</code> + * @return <code>true</code>, if the provided value is <code>null</code> * or contains only white spaces, <code>false</code> otherwise */ public static boolean isNotEmptyOrWhitespaceOnly(String value) { @@ -331,13 +305,10 @@ public final class ReportStringUtil { } /** - * Returns the last index of any of the given chars in the given source.<p> - * + * Returns the last index of any of the given chars in the given source.<p> * If no char is found, -1 is returned.<p> - * * @param source the source to check * @param chars the chars to find - * * @return the last index of any of the given chars in the given source, or -1 */ public static int lastIndexOf(String source, char[] chars) { @@ -355,12 +326,9 @@ public final class ReportStringUtil { } /** - * Returns the last index a whitespace char the given source.<p> - * + * Returns the last index a whitespace char the given source.<p> * If no whitespace char is found, -1 is returned.<p> - * * @param source the source to check - * * @return the last index a whitespace char the given source, or -1 */ public static int lastWhitespaceIn(String source) { @@ -380,15 +348,12 @@ public final class ReportStringUtil { /** * Substitutes <code>searchString</code> in the given source String with <code>replaceString</code>.<p> - * - * This is a high-performance implementation which should be used as a replacement for + * This is a high-performance implementation which should be used as a replacement for * <code>{@link String#replaceAll(java.lang.String, java.lang.String)}</code> in case no * regular expression evaluation is required.<p> - * * @param source the content which is scanned * @param searchString the String which is searched in content * @param replaceString the String which replaces <code>searchString</code> - * * @return the substituted String */ public static String substitute(String source, String searchString, String replaceString) { @@ -443,14 +408,10 @@ public final class ReportStringUtil { /** * Returns the java String literal for the given String. <p> - * * This is the form of the String that had to be written into source code - * using the unicode escape sequence for special characters. <p> - * + * using the unicode escape sequence for special characters. <p> * Example: "�" would be transformed to "\\u00C4".<p> - * - * @param s a string that may contain non-ascii characters - * + * @param s a string that may contain non-ascii characters * @return the java unicode escaped string Literal of the given input string */ public static String toUnicodeLiteral(String s) { @@ -473,13 +434,10 @@ public final class ReportStringUtil { /** * Returns a substring of the source, which is at most length characters long.<p> - * - * This is the same as calling {@link #trimToSize(String, int, String)} with the + * This is the same as calling {@link #trimToSize(String, int, String)} with the * parameters <code>(source, length, " ...")</code>.<p> - * * @param source the string to trim * @param length the maximum length of the string to be returned - * * @return a substring of the source, which is at most length characters long */ public static String trimToSize(String source, int length) { @@ -489,18 +447,14 @@ public final class ReportStringUtil { /** * Returns a substring of the source, which is at most length characters long.<p> - * * If a char is cut, the given <code>suffix</code> is appended to the result.<p> - * - * This is almost the same as calling {@link #trimToSize(String, int, int, String)} with the + * This is almost the same as calling {@link #trimToSize(String, int, int, String)} with the * parameters <code>(source, length, length*, suffix)</code>. If <code>length</code> * if larger then 100, then <code>length* = length / 2</code>, * otherwise <code>length* = length</code>.<p> - * * @param source the string to trim * @param length the maximum length of the string to be returned * @param suffix the suffix to append in case the String was trimmed - * * @return a substring of the source, which is at most length characters long */ public static String trimToSize(String source, int length, String suffix) { @@ -510,16 +464,13 @@ public final class ReportStringUtil { } /** - * Returns a substring of the source, which is at most length characters long, cut + * Returns a substring of the source, which is at most length characters long, cut * in the last <code>area</code> chars in the source at a sentence ending char or whitespace.<p> - * * If a char is cut, the given <code>suffix</code> is appended to the result.<p> - * * @param source the string to trim * @param length the maximum length of the string to be returned * @param area the area at the end of the string in which to find a sentence ender or whitespace * @param suffix the suffix to append in case the String was trimmed - * * @return a substring of the source, which is at most length characters long */ public static String trimToSize(String source, int length, int area, String suffix) { diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java b/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java index 647c0d9..e8aa68b 100644 --- a/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java +++ b/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java @@ -78,45 +78,26 @@ import org.apache.ofbiz.service.ServiceUtil; * */ public abstract class AbstractPricatParser implements InterfacePricatParser { - + private static final String MODULE = AbstractPricatParser.class.getName(); - protected LocalDispatcher dispatcher; - protected Delegator delegator; - protected List<FileItem> fileItems; - protected File pricatFile; - protected String userLoginId; - protected GenericValue userLogin; - protected String pricatFileVersion; - protected String currencyId; - protected Map<CellReference, String> errorMessages = new HashMap<>(); - protected HSSFDataFormatter formatter = new HSSFDataFormatter(); - protected Map<String, String[]> facilities = new HashMap<>(); - protected HttpSession session; - protected List<EntityCondition> basicCategoryConds; - protected List<EntityCondition> basicBrandConds; - protected String selectedPricatType = DEFAULT_PRICAT_TYPE; - protected String selectedFacilityId; - protected InterfaceReport report; - protected Locale locale; - protected long sequenceNum = -1L; public AbstractPricatParser(LocalDispatcher dispatcher, Delegator delegator, Locale locale, InterfaceReport report, Map<String, String[]> facilities, File pricatFile, GenericValue userLogin) { @@ -132,7 +113,6 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { this.pricatFile = pricatFile; initBasicConds(UtilMisc.toList(userLogin.getString("partyId"))); } - @Override public void writeCommentsToFile(XSSFWorkbook workbook, XSSFSheet sheet) { report.println(); @@ -148,7 +128,7 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { plainFont.setFontName("Arial"); plainFont.setCharSet(134); plainFont.setFontHeightInPoints((short) 9); - + XSSFSheet errorSheet = null; if (errorMessages.keySet().size() > 0) { String errorSheetName = UtilDateTime.nowDateString("yyyy-MM-dd HHmm") + " Errors"; @@ -166,7 +146,6 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { newRow.setHeight(row.getHeight()); copyRow(row, newRow, factory, drawingPatriarch); } - // copy merged regions for (int i = 0; i < sheet.getNumMergedRegions(); i++) { CellRangeAddress mergedRegion = sheet.getMergedRegion(i); @@ -174,7 +153,6 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { errorSheet.addMergedRegion(mergedRegion); } } - // copy images List<XSSFPictureData> pics = workbook.getAllPictures(); List<XSSFShape> shapes = sheet.getDrawingPatriarch().getShapes(); @@ -195,7 +173,6 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { } } } - try { // set comments in the original sheet XSSFDrawing patriarch = sheet.getDrawingPatriarch(); @@ -229,7 +206,6 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { } } } - // set comments in the new error sheet XSSFDrawing errorPatriarch = errorSheet.getDrawingPatriarch(); int newRowNum = getHeaderRowNo() + 1; @@ -342,11 +318,9 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { basicCategoryConds = new ArrayList<>(); basicCategoryConds.add(EntityCondition.makeCondition("isPublic", "N")); //basicCategoryConds.add(EntityCondition.makeCondition("isDefault", "Y")); - basicBrandConds = new ArrayList<>(); basicBrandConds.add(EntityCondition.makeCondition("isPublic", "N")); basicBrandConds.add(EntityCondition.makeCondition("productFeatureTypeId", "BRAND")); - List<EntityCondition> partyIdConds = new ArrayList<>(); for (String orgPartyId : orgPartyIds) { partyIdConds.add(EntityCondition.makeCondition("ownerPartyId", orgPartyId)); @@ -406,7 +380,6 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { /** * Get data by version definition. - * * @param row * @param colNames * @param size @@ -551,9 +524,8 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { } return isEmptyRow; } - + protected abstract int getHeaderRowNo(); - @Override public synchronized void endExcelImportHistory(String logFileName, String thruReasonId) { @@ -575,7 +547,7 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { Timestamp now = UtilDateTime.nowTimestamp(); if (UtilValidate.isEmpty(historyValue)) { historyValue = delegator.makeValue("ExcelImportHistory", UtilMisc.toMap("sequenceNum", sequenceNum, "userLoginId", userLoginId, - "fileName", pricatFile.getName(), "statusId", "EXCEL_IMPORTED", "fromDate", now, + "fileName", pricatFile.getName(), "statusId", "EXCEL_IMPORTED", "fromDate", now, "thruDate", now, "threadName", threadName, "logFileName", logFileName)); } else { historyValue.set("statusId", "EXCEL_IMPORTED"); @@ -590,7 +562,6 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { // do nothing } } - @Override public boolean hasErrorMessages() { return !errorMessages.keySet().isEmpty(); @@ -598,7 +569,6 @@ public abstract class AbstractPricatParser implements InterfacePricatParser { /** * Check whether a commented file exists. - * * @param request * @param sequenceNum * @return diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/InterfacePricatParser.java b/pricat/src/main/java/org/apache/ofbiz/pricat/InterfacePricatParser.java index 97e382b..5216b24 100644 --- a/pricat/src/main/java/org/apache/ofbiz/pricat/InterfacePricatParser.java +++ b/pricat/src/main/java/org/apache/ofbiz/pricat/InterfacePricatParser.java @@ -36,60 +36,37 @@ import org.apache.ofbiz.entity.transaction.GenericTransactionException; * */ public interface InterfacePricatParser { - public static final String PARSE_EXCEL = "parse_excel"; - public static final String CONFIRM = "confirm_action"; - public static final String[] messageLabels = new String[] {"FORMAT_DEFAULT", "FORMAT_WARNING", "FORMAT_HEADLINE", "FORMAT_NOTE", "FORMAT_OK", "FORMAT_ERROR", "FORMAT_THROWABLE"}; - public static final List<String> messages = Collections.unmodifiableList(Arrays.asList(messageLabels)); - public static final String tempFilesFolder = "runtime/pricat/"; - public static final String FileDateTimePattern = "yyyyMMddHHmmss"; - public static final String defaultColorName = "DefaultColor"; - public static final String defaultDimensionName = "DefaultDimension"; - public static final String defaultCategoryName = "DefaultCategory"; - public static final String EXCEL_TEMPLATE_TYPE = "excelTemplateType"; - public static final String FACILITY_ID = "facilityId"; - public static final String RESOURCE = "PricatUiLabels"; - public static final String PRICAT_FILE = "__PRICAT_FILE__"; - public static final String DEFAULT_PRICAT_TYPE = "ApacheOFBiz"; - public static final Map<String, String> PricatTypeLabels = UtilMisc.toMap(DEFAULT_PRICAT_TYPE, "ApacheOFBizPricatTemplate", "SamplePricat", "SamplePricatTemplate"); - public static final int HISTORY_MAX_FILENUMBER = UtilProperties.getPropertyAsInteger("pricat.properties", "pricat.history.max.filenumber", 20); - abstract void parsePricatExcel(); - public void writeCommentsToFile(XSSFWorkbook workbook, XSSFSheet sheet); - public void initBasicConds(List<String> orgPartyIds); - public boolean existsCurrencyId(XSSFSheet sheet); - abstract void parseRowByRow(XSSFSheet sheet); - abstract boolean parseCellContentsAndStore(XSSFRow row, List<Object> cellContents) throws GenericTransactionException; - public Map<String, Object> updateSkuPrice(String skuId, String ownerPartyId, BigDecimal memberPrice); abstract String updateSku(XSSFRow row, String productId, String ownerPartyId, String facilityId, String barcode, BigDecimal inventory, String colorId, String color, String dimensionId, String dimension, BigDecimal listPrice, BigDecimal averageCost); public Map<String, Object> updateColorAndDimension(String productId, String ownerPartyId, String color, String dimension); - + public Map<String, Object> getDimensionIds(String productId, String ownerPartyId, String dimension); - + public Map<String, Object> getColorIds(String productId, String ownerPartyId, String color); abstract String getProductId(XSSFRow row, String brandId, String modelName, String productName, String productCategoryId, String ownerPartyId, BigDecimal listPrice); @@ -115,6 +92,6 @@ public interface InterfacePricatParser { abstract void setFacilityId(String selectedFacilityId); public void endExcelImportHistory(String logFileName, String thruReasonId); - + public boolean hasErrorMessages(); } diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java b/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java index e8c4ba2..98b1f2a 100644 --- a/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java +++ b/pricat/src/main/java/org/apache/ofbiz/pricat/PricatEvents.java @@ -42,18 +42,12 @@ import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.util.EntityQuery; public class PricatEvents { - private static final String MODULE = PricatEvents.class.getName(); - public static final String PricatLatestVersion = UtilProperties.getPropertyValue("pricat", "pricat.latest.version", "V1.1"); - public static final String PricatFileName = "PricatTemplate_" + PricatLatestVersion + ".xlsx"; - public static final String PricatPath = "component://pricat/webapp/pricat/downloads/"; - /** * Download excel template. - * * @param request * @param response */ @@ -80,7 +74,6 @@ public class PricatEvents { } return "success"; } - /** * Upload a pricat. */ @@ -127,7 +120,6 @@ public class PricatEvents { /** * Download commented excel file after it's parsed. - * * @param request * @param response * @return diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlReport.java b/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlReport.java index 5d134a4..5d78883 100644 --- a/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlReport.java +++ b/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlReport.java @@ -31,22 +31,19 @@ import org.apache.ofbiz.htmlreport.util.ReportStringUtil; * */ public class PricatParseExcelHtmlReport extends AbstractHtmlReport { - + public static final String PRICAT_REPORT_CLASS = "PRICAT_HTML_REPORT"; - + /** * Public constructor with report variables.<p> - * * @param request the HttpServletRequest request * @param response the HttpServletResponse response */ public PricatParseExcelHtmlReport(HttpServletRequest request, HttpServletResponse response) { - super(request, response, true, true); } - + public static PricatParseExcelHtmlReport getReport(HttpServletRequest request, HttpServletResponse response) { - PricatParseExcelHtmlReport wp = (PricatParseExcelHtmlReport) request.getAttribute(PRICAT_REPORT_CLASS); if (wp == null) { wp = new PricatParseExcelHtmlReport(request, response); @@ -54,10 +51,8 @@ public class PricatParseExcelHtmlReport extends AbstractHtmlReport { } return wp; } - @Override public InterfaceReportThread initializeThread(HttpServletRequest request, HttpServletResponse response, String name) { - if (name == null) { name = ""; } @@ -76,7 +71,6 @@ public class PricatParseExcelHtmlReport extends AbstractHtmlReport { if (thread == null) { thread = new PricatParseExcelHtmlThread(request, response, name); } - return thread; } @@ -109,14 +103,12 @@ public class PricatParseExcelHtmlReport extends AbstractHtmlReport { return "cancel"; } } - return "success"; } /** * Performs the dialog actions depending on the initialized action.<p> - * - * @throws IOException + * @throws IOException */ @Override public void prepareDisplayReport(HttpServletRequest request, HttpServletResponse response, String name, String dialogUri) throws IOException { @@ -124,7 +116,6 @@ public class PricatParseExcelHtmlReport extends AbstractHtmlReport { if (ReportStringUtil.isNotEmpty(dialogUri)) { setDialogRealUri(request, dialogUri); } - String action = getParamAction(request); if (action == null) action = ""; if ("reportend".equals(action) || "cancel".equals(action)) { diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlThread.java b/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlThread.java index 88feda6..07afc0e 100644 --- a/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlThread.java +++ b/pricat/src/main/java/org/apache/ofbiz/pricat/PricatParseExcelHtmlThread.java @@ -65,63 +65,38 @@ import org.apache.ofbiz.service.LocalDispatcher; * */ public class PricatParseExcelHtmlThread extends AbstractReportThread { - - private static final String MODULE = PricatParseExcelHtmlThread.class.getName(); + private static final String MODULE = PricatParseExcelHtmlThread.class.getName(); public static final String PARSE_EXCEL = "parse_excel"; - public static final String CONFIRM = "confirm_action"; - public static final String[] messageLabels = new String[] {"FORMAT_DEFAULT", "FORMAT_WARNING", "FORMAT_HEADLINE", "FORMAT_NOTE", "FORMAT_OK", "FORMAT_ERROR", "FORMAT_THROWABLE"}; - public static final List<String> messages = Collections.unmodifiableList(Arrays.asList(messageLabels)); - public static final String FileDateTimePattern = "yyyyMMddHHmmss"; - public static final String defaultColorName = "DefaultColor"; - public static final String defaultDimensionName = "DefaultDimension"; - public static final String defaultCategoryName = "DefaultCategory"; - public static final String EXCEL_TEMPLATE_TYPE = "excelTemplateType"; - public static final String FACILITY_ID = "facilityId"; - private LocalDispatcher dispatcher; - private Delegator delegator; - private List<FileItem> fileItems; - private File pricatFile; - private String userLoginId; - private GenericValue userLogin; - private Map<String, String[]> facilities = new HashMap<>(); - private static final String RESOURCE = "PricatUiLabels"; - private HttpSession session; - public static final String PRICAT_FILE = "__PRICAT_FILE__"; public static final String DEFAULT_PRICAT_TYPE = "sample_pricat"; - private String selectedPricatType = DEFAULT_PRICAT_TYPE; - public static final Map<String, String> PricatTypeLabels = UtilMisc.toMap("sample_pricat", "SamplePricatTemplate", "ofbiz_pricat", "OFBizPricatTemplate"); - + private InterfacePricatParser pricatParser; - private String thruReasonId = "EXCEL_IMPORT_SUCCESS"; - /** * Constructor, creates a new html thread. - * * @param request * @param response * @param name @@ -140,7 +115,6 @@ public class PricatParseExcelHtmlThread extends AbstractReportThread { userLoginId = userLogin.getString("userLoginId"); session = request.getSession(); } - long sequenceNum = addExcelImportHistory(); File userFolder = FileUtil.getFile(InterfacePricatParser.tempFilesFolder + userLoginId + "/"); if (!userFolder.exists()) { @@ -168,13 +142,11 @@ public class PricatParseExcelHtmlThread extends AbstractReportThread { @Override public String getReportUpdate() { - return getReport().getReportUpdate(); } @Override public void run() { - try { if (getName().startsWith(PARSE_EXCEL) && UtilValidate.isNotEmpty(fileItems)) { getReport().println(); @@ -227,7 +199,6 @@ public class PricatParseExcelHtmlThread extends AbstractReportThread { getReport().println(" ... " + UtilProperties.getMessage(RESOURCE, "ok", getLocale()), InterfaceReport.FORMAT_OK); getReport().println(); } - // 2. store the pricat excel file if (!storePricatFile()) { return false; @@ -293,7 +264,6 @@ public class PricatParseExcelHtmlThread extends AbstractReportThread { Timestamp now = UtilDateTime.nowTimestamp(); organizations = EntityUtil.filterByDate(organizations, now, "twoFromDate", "twoThruDate", true); organizations = EntityUtil.filterByDate(organizations, now, "oneFromDate", "oneThruDate", true); - List<EntityCondition> ownerPartyConditions = new LinkedList<>(); Set<String> orgPartyIds = new HashSet<>(); for (GenericValue organization : organizations) { @@ -306,7 +276,6 @@ public class PricatParseExcelHtmlThread extends AbstractReportThread { if (UtilValidate.isEmpty(ownerPartyConditions)) { return facilities; } - List<GenericValue> facilityValues = delegator.findList("Facility", EntityCondition.makeCondition(ownerPartyConditions, EntityOperator.OR), null, null, null, false); if (UtilValidate.isNotEmpty(facilityValues)) { int i = 1; diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatEvents.java b/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatEvents.java index aecb68f..fb4e8f0 100644 --- a/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatEvents.java +++ b/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatEvents.java @@ -36,18 +36,12 @@ import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.pricat.PricatEvents; public class SamplePricatEvents extends PricatEvents { - private static final String MODULE = SamplePricatEvents.class.getName(); - public static final String PricatLatestVersion = UtilProperties.getPropertyValue("pricat", "pricat.latest.version", "V1.1"); - public static final String DemoPricatFileName = "SamplePricatTemplate_" + PricatLatestVersion + ".xlsx"; - public static final String DemoPricatPath = "component://pricat/webapp/pricatdemo/downloads/"; - /** * Download excel template. - * * @param request * @param response * @return diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java b/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java index dedd6a9..2986eb0 100644 --- a/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java +++ b/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java @@ -55,29 +55,28 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; * */ public class SamplePricatParser extends AbstractPricatParser { - + private static final String MODULE = SamplePricatParser.class.getName(); public static final Map<String, List<Object[]>> ColNamesList = UtilMisc.toMap("V1.1", genExcelHeaderNames("V1.1")); public static final int headerRowNo = 4; - + private List<String> headerColNames = new ArrayList<>(); - + public SamplePricatParser(LocalDispatcher dispatcher, Delegator delegator, Locale locale, InterfaceReport report, Map<String, String[]> facilities, File pricatFile, GenericValue userLogin) { super(dispatcher, delegator, locale, report, facilities, pricatFile, userLogin); } /** * Parse pricat excel file in xlsx format. - * */ public void parsePricatExcel(boolean writeFile) { XSSFWorkbook workbook = null; try { // 1. read the pricat excel file FileInputStream is = new FileInputStream(pricatFile); - + // 2. use POI to load this bytes report.print(UtilProperties.getMessage(RESOURCE, "ParsePricatFileStatement", new Object[] { pricatFile.getName() }, locale), InterfaceReport.FORMAT_DEFAULT); try { @@ -88,18 +87,18 @@ public class SamplePricatParser extends AbstractPricatParser { report.println(UtilProperties.getMessage(RESOURCE, "PricatSuggestion", locale), InterfaceReport.FORMAT_ERROR); return; } - + // 3. only first sheet will be parsed // 3.1 verify the file has a sheet at least formatter = new HSSFDataFormatter(locale); isNumOfSheetsOK(workbook); - + // 3.2 verify the version is supported XSSFSheet sheet = workbook.getSheetAt(0); if (!isVersionSupported(sheet)) { return; } - + // 3.3 get currencyId existsCurrencyId(sheet); @@ -107,15 +106,15 @@ public class SamplePricatParser extends AbstractPricatParser { if (!isTableHeaderMatched(sheet)) { return; } - + // 3.5 verify the first table has 6 rows at least containsDataRows(sheet); - + if (UtilValidate.isNotEmpty(errorMessages)) { report.println(UtilProperties.getMessage(RESOURCE, "HeaderContainsError", locale), InterfaceReport.FORMAT_ERROR); return; } - + // 4. parse data // 4.1 parse row by row and store the contents into database parseRowByRow(sheet); @@ -126,7 +125,7 @@ public class SamplePricatParser extends AbstractPricatParser { writeCommentsToFile(workbook, sheet); } } - + // 5. clean up the log files and commented Excel files cleanupLogAndCommentedExcel(); } catch (IOException e) { @@ -232,7 +231,6 @@ public class SamplePricatParser extends AbstractPricatParser { /** * Check data according to business logic. If data is ok, store it. - * * @param row * @param cellContents * @return @@ -249,7 +247,7 @@ public class SamplePricatParser extends AbstractPricatParser { return parseCellContentsAndStoreV1_X(row, cellContents); } } - + private boolean parseCellContentsAndStoreV1_X(XSSFRow row, List<Object> cellContents) throws GenericTransactionException { if (UtilValidate.isEmpty(cellContents)) { return false; @@ -259,11 +257,11 @@ public class SamplePricatParser extends AbstractPricatParser { String facilityId = (String) getCellContent(cellContents, "FacilityId"); if (!isFacilityOk(row, facilityName, facilityId)) return false; - + // 2. get productCategoryId String ownerPartyId = facilities.get(facilityId)[1]; String productCategoryId = getProductCategoryId(cellContents, ownerPartyId); - + // 3. get productFeatureId of brand String brandName = (String) getCellContent(cellContents, "Brand"); String brandId = getBrandId(brandName, ownerPartyId); @@ -305,7 +303,7 @@ public class SamplePricatParser extends AbstractPricatParser { } String colorId = (String) features.get("colorId"); String dimensionId = (String) features.get("dimensionId"); - + // 6. update skuIds by productId String barcode = (String) getCellContent(cellContents, "Barcode"); BigDecimal inventory = (BigDecimal) getCellContent(cellContents, "Stock Qty"); @@ -314,14 +312,14 @@ public class SamplePricatParser extends AbstractPricatParser { if (UtilValidate.isEmpty(skuId)) { return false; } - + // 7. store prices BigDecimal memberPrice = (BigDecimal) getCellContent(cellContents, "Member Price"); Map<String, Object> results = updateSkuPrice(skuId, ownerPartyId, memberPrice); if (ServiceUtil.isError(results)) { return false; } - + return true; } @@ -407,7 +405,7 @@ public class SamplePricatParser extends AbstractPricatParser { } else { report.println(UtilProperties.getMessage(RESOURCE, "ok", locale), InterfaceReport.FORMAT_OK); } - + report.print(UtilProperties.getMessage(RESOURCE, "StartCheckHeaderColLabel", new Object[] {pricatFileVersion}, locale), InterfaceReport.FORMAT_NOTE); boolean foundLabelNotMatch = false; for (int i = 0; i < cols; i++) { @@ -465,7 +463,6 @@ public class SamplePricatParser extends AbstractPricatParser { * 2. Cell data type to return. * 3. Boolean value to indicate whether the column is required. * 4. Boolean value to indicate whether the column is a price when cell data type is BigDecimal, this element is optional. - * * @param version * @return List of Object[] */ @@ -479,7 +476,6 @@ public class SamplePricatParser extends AbstractPricatParser { /** * Get V1.1 pricat excel header names and attributes. - * * @return list of Object[] */ private static List<Object[]> genExcelHeaderNamesV1_1() { @@ -545,7 +541,6 @@ public class SamplePricatParser extends AbstractPricatParser { /** * Get data by version definition. - * * @param row * @param colNames * @param size @@ -558,7 +553,7 @@ public class SamplePricatParser extends AbstractPricatParser { if (isEmptyRow(row, size, true)) { return null; } - + // check and get data for (int i = 0; i < size; i++) { XSSFCell cell = null; diff --git a/pricat/src/main/java/org/apache/ofbiz/pricat/util/OFBizPricatUtil.java b/pricat/src/main/java/org/apache/ofbiz/pricat/util/OFBizPricatUtil.java index 9fa6446..9c03596 100644 --- a/pricat/src/main/java/org/apache/ofbiz/pricat/util/OFBizPricatUtil.java +++ b/pricat/src/main/java/org/apache/ofbiz/pricat/util/OFBizPricatUtil.java @@ -29,14 +29,10 @@ import org.apache.poi.xssf.usermodel.XSSFVMLDrawing; import com.microsoft.schemas.vml.CTShape; public final class OFBizPricatUtil { - private static final String MODULE = OFBizPricatUtil.class.getName(); - protected static Method VMLDrawingMethod; - // for POI 4.0.0 and later, this field can be removed protected static Method FindCommentShapeMethod; - static { Method[] methods = XSSFSheet.class.getDeclaredMethods(); for (Method method : methods) { @@ -45,7 +41,6 @@ public final class OFBizPricatUtil { break; } } - // for POI 4.0.0 and later, this part can be removed methods = XSSFVMLDrawing.class.getDeclaredMethods(); for (Method method : methods) { @@ -55,7 +50,6 @@ public final class OFBizPricatUtil { } } } - public static void formatCommentShape(XSSFSheet sheet, CellReference cell) { if (VMLDrawingMethod != null && FindCommentShapeMethod != null) { try { @@ -70,7 +64,6 @@ public final class OFBizPricatUtil { } } } - public static void formatCommentShape(XSSFSheet sheet, int rowNum, short colNum) { if (VMLDrawingMethod != null && FindCommentShapeMethod != null) { try { diff --git a/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java b/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java index 5306471..264ea6e 100644 --- a/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java +++ b/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java @@ -52,7 +52,7 @@ public class ScrumServices { private static final String RESOURCE = "scrumUiLabels"; public static Map<String, Object> linkToProduct(DispatchContext ctx, Map<String, ? extends Object> context) { Delegator delegator = ctx.getDelegator(); - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); LocalDispatcher dispatcher = ctx.getDispatcher(); String communicationEventId = (String) context.get("communicationEventId"); // Debug.logInfo("==== Processing Commevent: " + communicationEventId, MODULE); @@ -80,7 +80,7 @@ public class ScrumServices { communicationEventProduct.create(); } try { - GenericValue productRoleMap = EntityQuery.use(delegator).from("ProductRole").where("productId", productId, "partyId", communicationEvent.getString("partyIdFrom"), "roleTypeId","PRODUCT_OWNER").queryFirst(); + GenericValue productRoleMap = EntityQuery.use(delegator).from("ProductRole").where("productId", productId, "partyId", communicationEvent.getString("partyIdFrom"), "roleTypeId", "PRODUCT_OWNER").queryFirst(); GenericValue userLogin = (GenericValue) context.get("userLogin"); // also close the incoming communication event if (UtilValidate.isNotEmpty(productRoleMap)) { @@ -209,7 +209,7 @@ public class ScrumServices { Debug.logInfo("Revision Link ============== >>>>>>>>>>> "+ revisionLink, MODULE); if (UtilValidate.isNotEmpty(taskId)) { String version = "R" + i; - List <GenericValue> workeffContentList = EntityQuery.use(delegator).from("WorkEffortAndContentDataResource").where("contentName", version.trim() ,"drObjectInfo", revisionLink.trim()).queryList(); + List <GenericValue> workeffContentList = EntityQuery.use(delegator).from("WorkEffortAndContentDataResource").where("contentName", version.trim() , "drObjectInfo", revisionLink.trim()).queryList(); List<EntityCondition> exprsAnd = new LinkedList<>(); exprsAnd.add(EntityCondition.makeCondition("workEffortId", EntityOperator.EQUALS, taskId)); diff --git a/solr/src/main/java/org/apache/ofbiz/solr/CategoryUtil.java b/solr/src/main/java/org/apache/ofbiz/solr/CategoryUtil.java index c5e2762..1866651 100644 --- a/solr/src/main/java/org/apache/ofbiz/solr/CategoryUtil.java +++ b/solr/src/main/java/org/apache/ofbiz/solr/CategoryUtil.java @@ -38,7 +38,7 @@ import org.apache.ofbiz.service.DispatchContext; * Product category util class for solr. */ public final class CategoryUtil { - + private static final String MODULE = CategoryUtil.class.getName(); private CategoryUtil() { } @@ -64,8 +64,7 @@ public final class CategoryUtil { } } return catalogIds; - } - + } public static List<List<String>> getCategoryTrail(String productCategoryId, DispatchContext dctx) { GenericDelegator delegator = (GenericDelegator) dctx.getDelegator(); List<List<String>> trailElements = new ArrayList<>(); @@ -113,7 +112,7 @@ public final class CategoryUtil { } return trailElements; } - + /** * Returns categoryName with trail */ @@ -125,7 +124,7 @@ public final class CategoryUtil { List<List<String>> trailElements = CategoryUtil.getCategoryTrail(productCategoryId, dctx); //Debug.log("trailElements ======> " + trailElements.toString()); StringBuilder catMember = new StringBuilder(); - String cm =""; + String cm = ""; int i = 0; for (List<String> trailElement : trailElements) { for (Iterator<String> trailIter = trailElement.iterator(); trailIter.hasNext();) { @@ -134,11 +133,11 @@ public final class CategoryUtil { catMember.append("/"); i++; } - + catMember.append(trailString); } } - + if (catMember.length() == 0) { catMember.append(productCategoryId); } @@ -149,9 +148,7 @@ public final class CategoryUtil { } return cm; } - - /** - * Returns nextLevel from trailed category. + /**Returns nextLevel from trailed category. * <p> * Ie for "1/SYRACUS2_CATEGORY/FICTION_C/" the returned value would be 2. */ @@ -168,9 +165,8 @@ public final class CategoryUtil { return 0; } } - - /** - * Returns proper FacetFilter from trailed category. + + /** Returns proper FacetFilter from trailed category. * <p> * Ie for "1/SYRACUS2_CATEGORY/FICTION_C/" the returned value would be * "2/SYRACUS2_CATEGORY/FICTION_C/". @@ -186,5 +182,4 @@ public final class CategoryUtil { return productCategoryId; } } - } \ No newline at end of file diff --git a/solr/src/main/java/org/apache/ofbiz/solr/ProductUtil.java b/solr/src/main/java/org/apache/ofbiz/solr/ProductUtil.java index b800f15..6cc6550 100644 --- a/solr/src/main/java/org/apache/ofbiz/solr/ProductUtil.java +++ b/solr/src/main/java/org/apache/ofbiz/solr/ProductUtil.java @@ -60,7 +60,6 @@ public final class ProductUtil { if (Debug.verboseOn()) { Debug.logVerbose("Solr: Getting product content for productId '" + productId + "'", MODULE); } - try { // Generate special ProductContentWrapper for the supported languages (de/en/fr) ProductContentWrapper productContentEn = new ProductContentWrapper(dispatcher, product, new Locale("en"), null); @@ -79,8 +78,7 @@ public final class ProductUtil { dispatchContext.put("mediumImage", mediumImage); String largeImage = (String) product.get("largeImageUrl"); if (largeImage != null) - dispatchContext.put("largeImage", largeImage); - + dispatchContext.put("largeImage", largeImage); // if (product.get("productWeight") != null) dispatchContext.put("weight", ""); // Trying to set a correctand trail @@ -95,7 +93,6 @@ public final class ProductUtil { StringBuilder catMember = new StringBuilder(); int i = 0; Iterator<String> trailIter = trailElement.iterator(); - while (trailIter.hasNext()) { String trailString = trailIter.next(); if (catMember.length() > 0) { @@ -110,7 +107,6 @@ public final class ProductUtil { // Debug.log("trail for product " + productId + " ====> " + catMember.toString()); } } - } } dispatchContext.put("category", trails); diff --git a/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java b/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java index 017a31b..c274549 100644 --- a/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java +++ b/solr/src/main/java/org/apache/ofbiz/solr/SolrUtil.java @@ -51,46 +51,46 @@ import org.apache.ofbiz.entity.GenericEntityException; * Solr utility class. */ public final class SolrUtil { - + private SolrUtil() { } private static final String MODULE = SolrUtil.class.getName(); private static final String[] solrProdAttribute = { "productId", "internalName", "manu", "size", "smallImage", "mediumImage", "largeImage", "listPrice", "defaultPrice", "inStock", "isVirtual" }; private static final String solrConfigName = "solrconfig.properties"; private static final String solrUrl = makeSolrWebappUrl(); - + private static final String socketTimeoutString = UtilProperties.getPropertyValue(solrConfigName, "solr.client.socket.timeout"); - + private static final String connectionTimeoutString = UtilProperties.getPropertyValue(solrConfigName, "solr.client.connection.timeout"); - + private static final String clientUsername = UtilProperties.getPropertyValue(solrConfigName, "solr.client.username"); - + private static final String clientPassword = UtilProperties.getPropertyValue(solrConfigName, "solr.client.password"); private static final Integer socketTimeout = getSocketTimeout(); - + private static final Integer connectionTimeout = getConnectionTimeout(); - + private static final String trustSelfSignedCertString = UtilProperties.getPropertyValue(solrConfigName, "solr.client.trust.selfsigned.cert", "false"); - + private static final boolean trustSelfSignedCert = getTrustSelfSignedCert(); - + public static String makeSolrWebappUrl() { final String solrWebappProtocol = UtilProperties.getPropertyValue(solrConfigName, "solr.webapp.protocol"); final String solrWebappDomainName = UtilProperties.getPropertyValue(solrConfigName, "solr.webapp.domainName"); final String solrWebappPath = UtilProperties.getPropertyValue(solrConfigName, "solr.webapp.path"); final String solrWebappPortOverride = UtilProperties.getPropertyValue(solrConfigName, "solr.webapp.portOverride"); - + String solrPort; if (UtilValidate.isNotEmpty(solrWebappPortOverride)) { solrPort = solrWebappPortOverride; } else { solrPort = UtilProperties.getPropertyValue("url", ("https".equals(solrWebappProtocol) ? "port.https" : "port.http"), ("https".equals(solrWebappProtocol) ? "8443" : "8080")); } - + return solrWebappProtocol + "://" + solrWebappDomainName + ":" + solrPort + solrWebappPath; } - + private static Integer getSocketTimeout() { if (UtilValidate.isNotEmpty(socketTimeoutString)) { try { @@ -133,7 +133,7 @@ public final class SolrUtil { } return Boolean.TRUE.equals(ecaEnabled); } - + public static WebappInfo getSolrWebappInfo() { WebappInfo solrApp = null; try { @@ -149,13 +149,10 @@ public final class SolrUtil { } return solrApp; } - public static boolean isEcaTreatConnectErrorNonFatal() { Boolean treatConnectErrorNonFatal = UtilProperties.getPropertyAsBoolean(solrConfigName, "solr.eca.treatConnectErrorNonFatal", true); return Boolean.TRUE.equals(treatConnectErrorNonFatal); } - - public static SolrInputDocument generateSolrDocument(Map<String, Object> context) throws GenericEntityException { SolrInputDocument doc1 = new SolrInputDocument(); @@ -230,7 +227,6 @@ public final class SolrUtil { return doc1; } - public static Map<String, Object> categoriesAvailable(String catalogId, String categoryId, String productId, boolean displayproducts, int viewIndex, int viewSize, String solrIndexName) { return categoriesAvailable(catalogId, categoryId, productId, null, displayproducts, viewIndex, viewSize, solrIndexName); } @@ -266,11 +262,11 @@ public final class SolrUtil { solrQuery.setFields("cat"); solrQuery.setRows(0); } - + if (UtilValidate.isNotEmpty(facetPrefix)) { solrQuery.setFacetPrefix(facetPrefix); } - + solrQuery.setFacetMinCount(0); solrQuery.setFacet(true); solrQuery.addFacetField("cat"); @@ -291,14 +287,14 @@ public final class SolrUtil { public static HttpSolrClient getHttpSolrClient(String solrIndexName) throws ClientProtocolException, IOException { HttpClientContext httpContext = HttpClientContext.create(); - + CloseableHttpClient httpClient = null; if (trustSelfSignedCert) { httpClient = UtilHttp.getAllowAllHttpClient(); } else { httpClient = HttpClients.createDefault(); } - + RequestConfig requestConfig = null; if (UtilValidate.isNotEmpty(socketTimeout) && UtilValidate.isNotEmpty(connectionTimeout)) { requestConfig = RequestConfig.custom() @@ -328,5 +324,4 @@ public final class SolrUtil { loginResponse.close(); return new HttpSolrClient.Builder(solrUrl + "/" + solrIndexName).withHttpClient(httpClient).build(); } - } diff --git a/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java b/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java index ee3ff8b..3484d30 100644 --- a/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java +++ b/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java @@ -58,7 +58,6 @@ import org.apache.solr.servlet.SolrDispatchFilter; public class OFBizSolrContextFilter extends SolrDispatchFilter { private static final String MODULE = OFBizSolrContextFilter.class.getName(); - private static final String RESOURCE = "SolrUiLabels"; @Override @@ -129,7 +128,7 @@ public class OFBizSolrContextFilter extends SolrDispatchFilter { } } } - + String charset = request.getCharacterEncoding(); String rname = null; if (httpRequest.getRequestURI() != null) { @@ -172,7 +171,6 @@ public class OFBizSolrContextFilter extends SolrDispatchFilter { cores.load(); return cores; } - private static void sendJsonHeaderMessage(HttpServletRequest httpRequest, HttpServletResponse httpResponse, GenericValue userLogin, String notLoginMessage, String noPermissionMessage, Locale locale) throws IOException { diff --git a/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java b/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java index eee3706..21bb064 100644 --- a/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java +++ b/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrLoadAdminUiServlet.java @@ -49,7 +49,6 @@ public class OFBizSolrLoadAdminUiServlet extends OFBizSolrRedirectServlet { if (isForwarded) { return; } - // This attribute is set by the SolrDispatchFilter CoreContainer cores = (CoreContainer) request.getAttribute("org.apache.solr.CoreContainer"); diff --git a/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java b/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java index eacb860..f26d771 100644 --- a/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java +++ b/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrRedirectServlet.java @@ -38,7 +38,6 @@ import org.apache.solr.servlet.RedirectServlet; public class OFBizSolrRedirectServlet extends RedirectServlet { private static final String MODULE = OFBizSolrRedirectServlet.class.getName(); - /** * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ @@ -48,7 +47,6 @@ public class OFBizSolrRedirectServlet extends RedirectServlet { if (isForwarded) { return; } - super.doGet(request, response); } @@ -63,7 +61,6 @@ public class OFBizSolrRedirectServlet extends RedirectServlet { forwardToLogin = true; } } - if (forwardToLogin) { String contextPath = request.getContextPath(); String uri = request.getRequestURI(); @@ -77,7 +74,6 @@ public class OFBizSolrRedirectServlet extends RedirectServlet { response.sendRedirect(contextPath + "/control/checkLogin" + uri); return true; } - return false; } } diff --git a/webpos/src/main/java/org/apache/ofbiz/webpos/WebPosEvents.java b/webpos/src/main/java/org/apache/ofbiz/webpos/WebPosEvents.java index 6858051..bd2ee00 100755 --- a/webpos/src/main/java/org/apache/ofbiz/webpos/WebPosEvents.java +++ b/webpos/src/main/java/org/apache/ofbiz/webpos/WebPosEvents.java @@ -55,7 +55,7 @@ public class WebPosEvents { public static String posLogin(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException { HttpSession session = request.getSession(true); - + // get the posTerminalId String posTerminalId = request.getParameter("posTerminalId"); session.removeAttribute("shoppingCart"); @@ -63,7 +63,7 @@ public class WebPosEvents { WebPosSession webPosSession = WebPosEvents.getWebPosSession(request, posTerminalId); String responseString = LoginEvents.storeLogin(request, response); GenericValue userLoginNew = (GenericValue)session.getAttribute("userLogin"); - + if (userLoginNew != null && UtilValidate.isNotEmpty(posTerminalId)) { webPosSession.setUserLogin(userLoginNew); } @@ -80,7 +80,7 @@ public class WebPosEvents { } return responseString; } - + public static WebPosSession getWebPosSession(HttpServletRequest request, String posTerminalId) { HttpSession session = request.getSession(true); GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); @@ -101,7 +101,7 @@ public class WebPosEvents { currencyUomId = productStore.getString("defaultCurrencyUomId"); } } - + if (userLogin != null) { session.setAttribute("userLogin", userLogin); } @@ -116,7 +116,7 @@ public class WebPosEvents { session.setAttribute("webPosSession", webPosSession); } else { Debug.logError("PosTerminalId is empty cannot create a webPosSession", MODULE); - } + } } return webPosSession; } @@ -139,19 +139,18 @@ public class WebPosEvents { } return "success"; } - + public static String emptyCartAndClearAutoSaveList(HttpServletRequest request, HttpServletResponse response) throws GeneralException { HttpSession session = request.getSession(true); WebPosSession webPosSession = (WebPosSession) session.getAttribute("webPosSession"); ShoppingCartEvents.clearCart(request, response); - + if (UtilValidate.isNotEmpty(webPosSession)) { String autoSaveListId = ShoppingListEvents.getAutoSaveListId(webPosSession.getDelegator(), webPosSession.getDispatcher(), null, webPosSession.getUserLogin(), webPosSession.getProductStoreId()); ShoppingListEvents.clearListInfo(webPosSession.getDelegator(), autoSaveListId); } return "success"; - } - + } public static String getProductType(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> featureMap = null; Map<String, Object> variantTreeMap = null; diff --git a/webpos/src/main/java/org/apache/ofbiz/webpos/session/WebPosSession.java b/webpos/src/main/java/org/apache/ofbiz/webpos/session/WebPosSession.java index c3db98a..f88f334 100755 --- a/webpos/src/main/java/org/apache/ofbiz/webpos/session/WebPosSession.java +++ b/webpos/src/main/java/org/apache/ofbiz/webpos/session/WebPosSession.java @@ -81,7 +81,7 @@ public class WebPosSession { public GenericValue getUserLogin() { return this.userLogin; } - + public void setUserLogin(GenericValue userLogin) { this.userLogin = userLogin; } diff --git a/webpos/src/main/java/org/apache/ofbiz/webpos/transaction/WebPosTransaction.java b/webpos/src/main/java/org/apache/ofbiz/webpos/transaction/WebPosTransaction.java index eaaffc2..2fb033e 100755 --- a/webpos/src/main/java/org/apache/ofbiz/webpos/transaction/WebPosTransaction.java +++ b/webpos/src/main/java/org/apache/ofbiz/webpos/transaction/WebPosTransaction.java @@ -491,7 +491,7 @@ public class WebPosTransaction { public BigDecimal getPaymentTotal() { return getCart().getPaymentTotal(); } - + public BigDecimal getTotalQuantity() { return getCart().getTotalQuantity(); } |
Free forum by Nabble | Edit this page |