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 1207d24 Improved: Make data members of class as private and added accessor methods for the same, also corrected occurences of the same in plugins component. (OFBIZ-11963) Also made some related checkstyle code enhancements. Thanks jacques for finalizing Javadoc pattern during this effort. 1207d24 is described below commit 1207d240621c96e614ab276fe3e383387ac49923 Author: Suraj Khurana <[hidden email]> AuthorDate: Sat Aug 22 13:22:19 2020 +0530 Improved: Make data members of class as private and added accessor methods for the same, also corrected occurences of the same in plugins component. (OFBIZ-11963) Also made some related checkstyle code enhancements. Thanks jacques for finalizing Javadoc pattern during this effort. --- .../apache/ofbiz/birt/container/BirtContainer.java | 5 +- .../ofbiz/cmssite/multisite/WebSiteFilter.java | 18 ++-- .../java/org/apache/ofbiz/ebay/EbayHelper.java | 45 +++++---- .../org/apache/ofbiz/ebay/EbayOrderServices.java | 43 ++++---- .../apache/ofbiz/ebay/ImportOrdersFromEbay.java | 44 +++++---- .../ofbiz/ebaystore/EbayStoreAutoPrefEvents.java | 2 +- .../ofbiz/ecommerce/janrain/JanrainHelper.java | 67 ++++++++++--- .../org/apache/ofbiz/example/ExampleServices.java | 2 +- .../ofbiz/ws/rs/ServiceRequestProcessor.java | 4 +- .../ofbiz/ws/rs/listener/ApiContextListener.java | 2 - .../ofbiz/ws/rs/openapi/OFBizOpenApiReader.java | 30 +++--- .../ofbiz/ws/rs/openapi/OFBizResourceScanner.java | 2 - .../ws/rs/resources/AuthenticationResource.java | 1 - .../ws/rs/resources/OFBizServiceResource.java | 8 +- .../ofbiz/ws/rs/security/auth/APIAuthFilter.java | 1 - .../ws/rs/spi/impl/GlobalExceptionMapper.java | 4 +- .../apache/ofbiz/ws/rs/spi/impl/JacksonConfig.java | 4 +- .../spi/impl/JsonifiedParamConverterProvider.java | 7 +- .../ofbiz/ws/rs/spi/impl/LinkSerializer.java | 7 +- .../java/org/apache/ofbiz/scrum/ScrumEvents.java | 4 +- .../apache/ofbiz/webpos/session/WebPosSession.java | 110 +++++++++++++++++++++ 21 files changed, 291 insertions(+), 119 deletions(-) diff --git a/birt/src/main/java/org/apache/ofbiz/birt/container/BirtContainer.java b/birt/src/main/java/org/apache/ofbiz/birt/container/BirtContainer.java index 93be95b..c6db064 100644 --- a/birt/src/main/java/org/apache/ofbiz/birt/container/BirtContainer.java +++ b/birt/src/main/java/org/apache/ofbiz/birt/container/BirtContainer.java @@ -38,8 +38,7 @@ public class BirtContainer implements Container { private static final String MODULE = BirtContainer.class.getName(); - protected String configFile; - + private String configFile; private String name; @Override @@ -82,7 +81,7 @@ public class BirtContainer implements Container { // create report engine Debug.logInfo("Create factory object", MODULE); IReportEngineFactory factory = (IReportEngineFactory) Platform - .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY); + .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY); if (factory == null) { throw new ContainerException("can not create birt engine factory"); } 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 20cc00a..d50c244 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 @@ -53,12 +53,12 @@ public class WebSiteFilter implements Filter { private static final String MODULE = WebSiteFilter.class.getName(); - protected FilterConfig m_config = null; + private FilterConfig mConfig = null; @Override public void init(FilterConfig filterConfig) throws ServletException { - m_config = filterConfig; - m_config.getServletContext().setAttribute("MULTI_SITE_ENABLED", true); + mConfig = filterConfig; + mConfig.getServletContext().setAttribute("MULTI_SITE_ENABLED", true); } @Override @@ -67,7 +67,7 @@ public class WebSiteFilter implements Filter { HttpServletResponse httpResponse = (HttpServletResponse) response; HttpSession session = httpRequest.getSession(); - String webSiteId = (String) m_config.getServletContext().getAttribute("webSiteId"); + String webSiteId = (String) mConfig.getServletContext().getAttribute("webSiteId"); String pathInfo = httpRequest.getPathInfo(); // get the WebSite id segment, cheat here and use existing logic String webSiteAlias = RequestHandler.getRequestUri(pathInfo); @@ -103,12 +103,13 @@ public class WebSiteFilter implements Filter { newLocale = session.getAttribute("locale").toString(); } - if (newLocale == null) + if (newLocale == null) { newLocale = UtilHttp.getLocale(httpRequest).toString(); + } // If the webSiteId has changed then invalidate the existing session if (!webSiteId.equals(session.getAttribute("webSiteId"))) { ShoppingCart cart = (ShoppingCart) session.getAttribute("shoppingCart"); - if (cart != null && !(webSite.getString("productStoreId").equals(cart.getProductStoreId())) ) { + if (cart != null && !(webSite.getString("productStoreId").equals(cart.getProductStoreId()))) { // clearing cart items from previous store cart.clear(); // Put product Store for this webSite in cart @@ -143,7 +144,8 @@ public class WebSiteFilter implements Filter { chain.doFilter(httpRequest, response); } - private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher) { + private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, + LocalDispatcher dispatcher) { HttpSession session = request.getSession(); Security security = null; try { @@ -169,4 +171,4 @@ public class WebSiteFilter implements Filter { @Override public void destroy() { } -} \ No newline at end of file +} diff --git a/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java b/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java index 2b1fa1c..5742f2c 100644 --- a/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java +++ b/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java @@ -58,7 +58,7 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; public class EbayHelper { - private static final String configFileName = "ebayExport.properties"; + private static final String CONFIG_FILE_NAME = "ebayExport.properties"; private static final String MODULE = EbayHelper.class.getName(); private static final String RESOURCE = "EbayUiLabels"; @@ -85,14 +85,17 @@ public class EbayHelper { buildEbayConfigContext.put("apiServerUrl", eBayConfig.getString("xmlGatewayUri")); } } else { - buildEbayConfigContext.put("devID", EntityUtilProperties.getPropertyValue(configFileName, "eBayExport.devID", delegator)); - buildEbayConfigContext.put("appID", EntityUtilProperties.getPropertyValue(configFileName, "eBayExport.appID", delegator)); - buildEbayConfigContext.put("certID", EntityUtilProperties.getPropertyValue(configFileName, "eBayExport.certID", delegator)); - buildEbayConfigContext.put("token", EntityUtilProperties.getPropertyValue(configFileName, "eBayExport.token", delegator)); - buildEbayConfigContext.put("compatibilityLevel", EntityUtilProperties.getPropertyValue(configFileName, "eBayExport.compatibilityLevel", delegator)); - buildEbayConfigContext.put("siteID", EntityUtilProperties.getPropertyValue(configFileName, "eBayExport.siteID", delegator)); - buildEbayConfigContext.put("xmlGatewayUri", EntityUtilProperties.getPropertyValue(configFileName, "eBayExport.xmlGatewayUri", delegator)); - buildEbayConfigContext.put("apiServerUrl", EntityUtilProperties.getPropertyValue(configFileName, "eBayExport.xmlGatewayUri", delegator)); + buildEbayConfigContext.put("devID", EntityUtilProperties.getPropertyValue(CONFIG_FILE_NAME, "eBayExport.devID", delegator)); + buildEbayConfigContext.put("appID", EntityUtilProperties.getPropertyValue(CONFIG_FILE_NAME, "eBayExport.appID", delegator)); + buildEbayConfigContext.put("certID", EntityUtilProperties.getPropertyValue(CONFIG_FILE_NAME, "eBayExport.certID", delegator)); + buildEbayConfigContext.put("token", EntityUtilProperties.getPropertyValue(CONFIG_FILE_NAME, "eBayExport.token", delegator)); + buildEbayConfigContext.put("compatibilityLevel", EntityUtilProperties.getPropertyValue(CONFIG_FILE_NAME, "eBayExport.compatibilityLevel", + delegator)); + buildEbayConfigContext.put("siteID", EntityUtilProperties.getPropertyValue(CONFIG_FILE_NAME, "eBayExport.siteID", delegator)); + buildEbayConfigContext.put("xmlGatewayUri", EntityUtilProperties.getPropertyValue(CONFIG_FILE_NAME, "eBayExport.xmlGatewayUri", + delegator)); + buildEbayConfigContext.put("apiServerUrl", EntityUtilProperties.getPropertyValue(CONFIG_FILE_NAME, "eBayExport.xmlGatewayUri", + delegator)); } return buildEbayConfigContext; } @@ -146,7 +149,7 @@ public class EbayHelper { String dateOut; try { SimpleDateFormat formatIn = new SimpleDateFormat(fromDateFormat); - SimpleDateFormat formatOut= new SimpleDateFormat(toDateFormat); + SimpleDateFormat formatOut = new SimpleDateFormat(toDateFormat); Date data = formatIn.parse(dateIn, new ParsePosition(0)); dateOut = formatOut.format(data); } catch (Exception e) { @@ -171,12 +174,14 @@ public class EbayHelper { String partyId = "_NA_"; String shipmentMethodTypeId = "NO_SHIPPING"; try { - GenericValue ebayShippingMethod = EntityQuery.use(delegator).from("EbayShippingMethod").where("shipmentMethodName", shippingService, "productStoreId", productStoreId).queryOne(); + GenericValue ebayShippingMethod = EntityQuery.use(delegator).from("EbayShippingMethod").where("shipmentMethodName", shippingService, + "productStoreId", productStoreId).queryOne(); if (ebayShippingMethod != null) { partyId = ebayShippingMethod.getString("carrierPartyId"); shipmentMethodTypeId = ebayShippingMethod.getString("shipmentMethodTypeId"); } else { - //Find ebay shipping method on the basis of shipmentMethodName so that we can create new record with productStorId, EbayShippingMethod data is required for atleast one productStore + //Find ebay shipping method on the basis of shipmentMethodName so that we can create new record with productStorId, + // EbayShippingMethod data is required for atleast one productStore ebayShippingMethod = EntityQuery.use(delegator).from("EbayShippingMethod").where("shipmentMethodName", shippingService).queryFirst(); ebayShippingMethod.put("productStoreId", productStoreId); delegator.create(ebayShippingMethod); @@ -191,21 +196,24 @@ public class EbayHelper { } public static boolean createPaymentFromPaymentPreferences(Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin, - String orderId, String externalId, Timestamp orderDate, BigDecimal amount, String partyIdFrom) { + String orderId, String externalId, Timestamp orderDate, BigDecimal amount, String partyIdFrom) { List<GenericValue> paymentPreferences = null; try { - paymentPreferences = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderId", orderId, "statusId", "PAYMENT_RECEIVED", "paymentMethodTypeId", "EXT_EBAY").queryList(); + paymentPreferences = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderId", orderId, "statusId", "PAYMENT_RECEIVED", + "paymentMethodTypeId", "EXT_EBAY").queryList(); if (UtilValidate.isNotEmpty(paymentPreferences)) { Iterator<GenericValue> i = paymentPreferences.iterator(); while (i.hasNext()) { GenericValue pref = i.next(); boolean okay = createPayment(dispatcher, userLogin, pref, orderId, externalId, orderDate, partyIdFrom); - if (!okay) + if (!okay) { return false; + } } } else { - paymentPreferences = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderId", orderId, "statusId", "PAYMENT_NOT_RECEIVED", "paymentMethodTypeId", "EXT_EBAY").queryList(); + paymentPreferences = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderId", orderId, "statusId", + "PAYMENT_NOT_RECEIVED", "paymentMethodTypeId", "EXT_EBAY").queryList(); if (UtilValidate.isNotEmpty(paymentPreferences)) { Iterator<GenericValue> i = paymentPreferences.iterator(); while (i.hasNext()) { @@ -216,8 +224,9 @@ public class EbayHelper { pref.store(); } boolean okay = createPayment(dispatcher, userLogin, pref, orderId, externalId, orderDate, partyIdFrom); - if (!okay) + if (!okay) { return false; + } } } } @@ -311,7 +320,7 @@ public class EbayHelper { lastName = name; } - Map<String, Object> summaryResult = dispatcher.runSync("createPerson", UtilMisc.<String, Object> toMap("description", + Map<String, Object> summaryResult = dispatcher.runSync("createPerson", UtilMisc.<String, Object>toMap("description", name, "firstName", firstName, "lastName", lastName, "userLogin", userLogin, "comments", "Created via eBay")); if (ServiceUtil.isError(summaryResult)) { 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 07402e0..a7b64c9 100644 --- a/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java +++ b/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java @@ -85,13 +85,13 @@ public class EbayOrderServices { Map<String, Object> eBayConfigResult = EbayHelper.buildEbayConfig(context, delegator); if (UtilValidate.isEmpty(eBayConfigResult)) { String eBayConfigErrorMsg = UtilProperties.getMessage(RESOURCE, "EbayConfigurationSettingsAreMissingForConnectingToEbayServer", - locale); + locale); return ServiceUtil.returnError(eBayConfigErrorMsg); } StringBuffer sellerTransactionsItemsXml = new StringBuffer(); if (!ServiceUtil.isFailure(buildGetSellerTransactionsRequest(context, sellerTransactionsItemsXml, - eBayConfigResult.get("token").toString()))) { + eBayConfigResult.get("token").toString()))) { result = EbayHelper.postItem(eBayConfigResult.get("xmlGatewayUri").toString(), sellerTransactionsItemsXml, eBayConfigResult.get( "devID").toString(), eBayConfigResult.get("appID").toString(), eBayConfigResult.get("certID").toString(), "GetSellerTransactions", eBayConfigResult.get("compatibilityLevel").toString(), eBayConfigResult.get("siteID").toString()); @@ -287,7 +287,7 @@ public class EbayOrderServices { GenericValue userLogin = (GenericValue) context.get("userLogin"); if (isGetSellerTransactionsCall) { List<Map<String, Object>> getSellerTransactionList = readGetSellerTransactionResponse(responseMsg, locale, (String) context.get( - "productStoreId"), delegator, dispatcher, errorMessage, userLogin); + "productStoreId"), delegator, dispatcher, errorMessage, userLogin); if (UtilValidate.isNotEmpty(getSellerTransactionList)) { orderList.addAll(getSellerTransactionList); } @@ -295,7 +295,7 @@ public class EbayOrderServices { return ServiceUtil.returnSuccess(); } else if (isGetOrdersCall) { List<Map<String, Object>> getOrdersList = readGetOrdersResponse(responseMsg, locale, (String) context.get("productStoreId"), delegator, - dispatcher, errorMessage, userLogin); + dispatcher, errorMessage, userLogin); if (UtilValidate.isNotEmpty(getOrdersList)) { orderList.addAll(getOrdersList); } @@ -304,7 +304,7 @@ public class EbayOrderServices { } else if (isGetMyeBaySellingCall) { // for now fetching only deleted transaction & orders value from the sold list. List<String> eBayDeletedOrdersAndTransactionList = readGetMyeBaySellingResponse(responseMsg, locale, (String) context.get( - "productStoreId"), delegator, dispatcher, errorMessage, userLogin); + "productStoreId"), delegator, dispatcher, errorMessage, userLogin); if (UtilValidate.isNotEmpty(eBayDeletedOrdersAndTransactionList)) { Debug.logInfo("The value of getMyeBaySellingList" + eBayDeletedOrdersAndTransactionList, MODULE); Iterator<Map<String, Object>> orderListIter = orderList.iterator(); @@ -507,7 +507,7 @@ public class EbayOrderServices { shippingAddressCtx.put("shippingAddressStreet2", UtilXml.childElementValue(shippingAddressElement, "Street2")); shippingAddressCtx.put("shippingAddressCityName", UtilXml.childElementValue(shippingAddressElement, "CityName")); shippingAddressCtx.put("shippingAddressStateOrProvince", UtilXml.childElementValue(shippingAddressElement, - "StateOrProvince")); + "StateOrProvince")); shippingAddressCtx.put("shippingAddressCountry", UtilXml.childElementValue(shippingAddressElement, "Country")); shippingAddressCtx.put("shippingAddressCountryName", UtilXml.childElementValue(shippingAddressElement, "CountryName")); @@ -528,9 +528,9 @@ public class EbayOrderServices { while (shippingServiceSelectedElemIter.hasNext()) { Element shippingServiceSelectedElement = shippingServiceSelectedElemIter.next(); shippingServiceSelectedCtx.put("shippingService", UtilXml.childElementValue(shippingServiceSelectedElement, - "ShippingService")); + "ShippingService")); shippingServiceSelectedCtx.put("shippingServiceCost", UtilXml.childElementValue(shippingServiceSelectedElement, - "ShippingServiceCost", "0")); + "ShippingServiceCost", "0")); String insuranceCost = UtilXml.childElementValue(shippingServiceSelectedElement, "ShippingInsuranceCost", "0"); if (UtilValidate.isNotEmpty(insuranceCost)) { shippingServiceSelectedCtx.put("shippingTotalAdditionalCost", insuranceCost); @@ -779,9 +779,9 @@ public class EbayOrderServices { while (shippingServiceSelectedElemIter.hasNext()) { Element shippingServiceSelectedElement = shippingServiceSelectedElemIter.next(); shippingServiceSelectedCtx.put("shippingService", UtilXml.childElementValue(shippingServiceSelectedElement, - "ShippingService", "")); + "ShippingService", "")); shippingServiceSelectedCtx.put("shippingServiceCost", UtilXml.childElementValue(shippingServiceSelectedElement, - "ShippingServiceCost", "0")); + "ShippingServiceCost", "0")); String incuranceCost = UtilXml.childElementValue(shippingServiceSelectedElement, "ShippingInsuranceCost", "0"); String additionalCost = UtilXml.childElementValue(shippingServiceSelectedElement, "ShippingServiceAdditionalCost", @@ -844,7 +844,7 @@ public class EbayOrderServices { shippingDetailsCtx.put("jurisdictionID", UtilXml.childElementValue(taxJurisdictionElement, "JurisdictionID", "")); shippingDetailsCtx.put("jurisdictionSalesTaxPercent", UtilXml.childElementValue(taxJurisdictionElement, - "SalesTaxPercent", "0")); + "SalesTaxPercent", "0")); shippingDetailsCtx.put("jurisdictionShippingIncludedInTax", UtilXml.childElementValue(taxJurisdictionElement, "ShippingIncludedInTax", "0")); } @@ -1158,7 +1158,7 @@ public class EbayOrderServices { salesPercent = Double.parseDouble(salesTaxPercent); } GenericValue salesTaxAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SALES_TAX", cart.getOrderId(), null, null, - salesTaxAmountTotal, salesPercent); + salesTaxAmountTotal, salesPercent); if (salesTaxAdjustment != null) { cart.addAdjustment(salesTaxAdjustment); } @@ -1183,11 +1183,11 @@ public class EbayOrderServices { EbayHelper.correctCityStateCountry(dispatcher, shippingAddressCtx, city, state, country); List<GenericValue> shipInfo = - PartyWorker.findMatchingPersonPostalAddresses(delegator, - shippingAddressCtx.get("shippingAddressStreet1").toString(),( + PartyWorker.findMatchingPersonPostalAddresses(delegator, + shippingAddressCtx.get("shippingAddressStreet1").toString(), ( UtilValidate.isEmpty(shippingAddressCtx.get("shippingAddressStreet2")) ? null : shippingAddressCtx.get( "shippingAddressStreet2").toString()), - shippingAddressCtx.get("city").toString(),( + shippingAddressCtx.get("city").toString(), ( UtilValidate.isEmpty(shippingAddressCtx.get("stateProvinceGeoId")) ? null : shippingAddressCtx.get( "stateProvinceGeoId").toString()), shippingAddressCtx.get("shippingAddressPostalCode").toString(), @@ -1241,7 +1241,8 @@ public class EbayOrderServices { Debug.logInfo("Creating new postal address for party: " + partyId, MODULE); contactMechId = EbayHelper.createAddress(dispatcher, partyId, userLogin, "SHIPPING_LOCATION", shippingAddressCtx); if (UtilValidate.isEmpty(contactMechId)) { - return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "EbayStoreUnableToCreatePostalAddress", locale) + shippingAddressCtx); + return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "EbayStoreUnableToCreatePostalAddress", locale) + + shippingAddressCtx); } Debug.logInfo("Created postal address: " + contactMechId, MODULE); Debug.logInfo("Creating new phone number for party: " + partyId, MODULE); @@ -1283,8 +1284,8 @@ public class EbayOrderServices { Debug.logInfo("Created order with id: " + orderId, MODULE); if (UtilValidate.isNotEmpty(orderId)) { - String orderCreatedMsg = - "Order created successfully with ID (" + orderId + ") & eBay Order ID associated with this order is (" + externalId + ")."; + String orderCreatedMsg = "Order created successfully with ID (" + orderId + ") & eBay Order ID associated with this order is (" + + externalId + ")."; orderImportSuccessMessageList.add(orderCreatedMsg); } @@ -1321,7 +1322,8 @@ public class EbayOrderServices { return orderHeader; } - private static void addItem(ShoppingCart cart, Map<String, Object> orderItem, LocalDispatcher dispatcher, Delegator delegator, int groupIdx) throws GeneralException { + private static void addItem(ShoppingCart cart, Map<String, Object> orderItem, LocalDispatcher dispatcher, Delegator delegator, int groupIdx) + throws GeneralException { String productId = (String) orderItem.get("productId"); GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (UtilValidate.isEmpty(product)) { @@ -1366,7 +1368,8 @@ public class EbayOrderServices { cartItem.setIsModifiedPrice(true); cartItem.setBasePrice(price); cart.setHoldOrder(true); - cart.addInternalOrderNote("Price received [" + price + "] (for item # " + productId + ") from eBay Checkout does not match the price in the database [" + cartPrice + "]. Order is held for manual review."); + cart.addInternalOrderNote("Price received [" + price + "] (for item # " + productId + + ") from eBay Checkout does not match the price in the database [" + cartPrice + "]. Order is held for manual review."); } // assign the item to its ship group cart.setItemShipGroupQty(cartItem, qty, groupIdx); 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 35d379e..40c2296 100755 --- a/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java +++ b/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java @@ -66,7 +66,7 @@ public class ImportOrdersFromEbay { StringBuffer sellerTransactionsItemsXml = new StringBuffer(); if (!ServiceUtil.isFailure(buildGetSellerTransactionsRequest(context, sellerTransactionsItemsXml, - eBayConfigResult.get("token").toString()))) { + eBayConfigResult.get("token").toString()))) { result = EbayHelper.postItem(eBayConfigResult.get("xmlGatewayUri").toString(), sellerTransactionsItemsXml, eBayConfigResult.get( "devID").toString(), eBayConfigResult.get("appID").toString(), eBayConfigResult.get("certID").toString(), "GetSellerTransactions", eBayConfigResult.get("compatibilityLevel").toString(), eBayConfigResult.get("siteID").toString()); @@ -170,7 +170,7 @@ public class ImportOrdersFromEbay { StringBuffer completeSaleXml = new StringBuffer(); if (!ServiceUtil.isFailure(buildCompleteSaleRequest(delegator, locale, externalId, transactionId, context, completeSaleXml, - eBayConfigResult.get("token").toString()))) { + eBayConfigResult.get("token").toString()))) { result = EbayHelper.postItem(eBayConfigResult.get("xmlGatewayUri").toString(), completeSaleXml, eBayConfigResult.get("devID").toString(), eBayConfigResult.get("appID").toString(), eBayConfigResult.get("certID").toString(), "CompleteSale", eBayConfigResult.get("compatibilityLevel").toString(), eBayConfigResult.get("siteID").toString()); @@ -238,7 +238,7 @@ public class ImportOrdersFromEbay { UtilXml.addChildElementValue(transElem, "ModTimeFrom", fromDateOut, transDoc); } else { Debug.logError("Cannot convert from date from yyyy-MM-dd HH:mm:ss.SSS date format to yyyy-MM-dd'T'HH:mm:ss.SSS'Z' date format", - MODULE); + MODULE); return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "ordersImportFromEbay.cannotConvertFromDate", locale)); } @@ -248,7 +248,7 @@ public class ImportOrdersFromEbay { UtilXml.addChildElementValue(transElem, "ModTimeTo", fromDateOut, transDoc); } else { Debug.logError("Cannot convert thru date from yyyy-MM-dd HH:mm:ss.SSS date format to yyyy-MM-dd'T'HH:mm:ss.SSS'Z' date format", - MODULE); + MODULE); return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "ordersImportFromEbay.cannotConvertThruDate", locale)); } //Debug.logInfo("The value of generated string is ======= " + UtilXml.writeXmlDocument(transDoc), MODULE); @@ -256,7 +256,7 @@ public class ImportOrdersFromEbay { } catch (Exception e) { Debug.logError("Exception during building get seller transactions request", MODULE); return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "ordersImportFromEbay" - + ".exceptionDuringBuildingGetSellerTransactionRequest", locale)); + + ".exceptionDuringBuildingGetSellerTransactionRequest", locale)); } return ServiceUtil.returnSuccess(); } @@ -269,7 +269,7 @@ public class ImportOrdersFromEbay { try { if (externalId == null) { return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "ordersImportFromEbay" - + ".errorDuringBuildItemAndTransactionIdFromExternalId", locale)); + + ".errorDuringBuildItemAndTransactionIdFromExternalId", locale)); } Document transDoc = UtilXml.makeEmptyXmlDocument("CompleteSaleRequest"); @@ -416,7 +416,7 @@ public class ImportOrdersFromEbay { order.put("shippingAddressStreet2", UtilXml.childElementValue(shippingAddressElement, "Street2", "")); order.put("shippingAddressCityName", UtilXml.childElementValue(shippingAddressElement, "CityName", "")); order.put("shippingAddressStateOrProvince", UtilXml.childElementValue(shippingAddressElement, - "StateOrProvince", "")); + "StateOrProvince", "")); order.put("shippingAddressCountry", UtilXml.childElementValue(shippingAddressElement, "Country", "")); order.put("shippingAddressCountryName", UtilXml.childElementValue(shippingAddressElement, "CountryName", "")); order.put("shippingAddressPhone", UtilXml.childElementValue(shippingAddressElement, "Phone", "")); @@ -457,9 +457,10 @@ public class ImportOrdersFromEbay { Element taxJurisdictionElement = taxJurisdictionElemIter.next(); order.put("jurisdictionID", UtilXml.childElementValue(taxJurisdictionElement, "JurisdictionID", "")); - order.put("jurisdictionSalesTaxPercent", UtilXml.childElementValue(taxJurisdictionElement, "SalesTaxPercent", "0")); + order.put("jurisdictionSalesTaxPercent", UtilXml.childElementValue(taxJurisdictionElement, + "SalesTaxPercent", "0")); order.put("jurisdictionShippingIncludedInTax", UtilXml.childElementValue(taxJurisdictionElement, - "ShippingIncludedInTax", "0")); + "ShippingIncludedInTax", "0")); } } } @@ -541,11 +542,12 @@ public class ImportOrdersFromEbay { while (externalTransactionElemIter.hasNext()) { Element externalTransactionElement = externalTransactionElemIter.next(); order.put("externalTransactionID", UtilXml.childElementValue(externalTransactionElement, "ExternalTransactionID", - "")); - order.put("externalTransactionTime", UtilXml.childElementValue(externalTransactionElement, "ExternalTransactionTime", "")); + "")); + order.put("externalTransactionTime", UtilXml.childElementValue(externalTransactionElement, "ExternalTransactionTime", + "")); order.put("feeOrCreditAmount", UtilXml.childElementValue(externalTransactionElement, "FeeOrCreditAmount", "0")); order.put("paymentOrRefundAmount", UtilXml.childElementValue(externalTransactionElement, "PaymentOrRefundAmount", - "0")); + "0")); } // retrieve shipping service selected @@ -555,11 +557,11 @@ public class ImportOrdersFromEbay { Element shippingServiceSelectedElement = shippingServiceSelectedElemIter.next(); order.put("shippingService", UtilXml.childElementValue(shippingServiceSelectedElement, "ShippingService", "")); order.put("shippingServiceCost", UtilXml.childElementValue(shippingServiceSelectedElement, "ShippingServiceCost", - "0")); + "0")); String incuranceCost = UtilXml.childElementValue(shippingServiceSelectedElement, "ShippingInsuranceCost", "0"); String additionalCost = UtilXml.childElementValue(shippingServiceSelectedElement, "ShippingServiceAdditionalCost", - "0"); + "0"); String surchargeCost = UtilXml.childElementValue(shippingServiceSelectedElement, "ShippingSurcharge", "0"); double shippingInsuranceCost = 0; @@ -707,7 +709,7 @@ public class ImportOrdersFromEbay { double shippingAmount = Double.parseDouble(shippingCost); if (shippingAmount > 0) { GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SHIPPING_CHARGES", cart.getOrderId(), null, null, - shippingAmount, 0.0); + shippingAmount, 0.0); if (shippingAdjustment != null) { cart.addAdjustment(shippingAdjustment); } @@ -720,7 +722,7 @@ public class ImportOrdersFromEbay { double shippingAdditionalCost = Double.parseDouble(shippingTotalAdditionalCost); if (shippingAdditionalCost > 0) { GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "MISCELLANEOUS_CHARGE", cart.getOrderId(), null, - null, shippingAdditionalCost, 0.0); + null, shippingAdditionalCost, 0.0); if (shippingAdjustment != null) { cart.addAdjustment(shippingAdjustment); } @@ -738,7 +740,7 @@ public class ImportOrdersFromEbay { salesPercent = Double.parseDouble(salesTaxPercent); } GenericValue salesTaxAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SALES_TAX", cart.getOrderId(), null, null, - salesTaxAmountTotal, salesPercent); + salesTaxAmountTotal, salesPercent); if (salesTaxAdjustment != null) { cart.addAdjustment(salesTaxAdjustment); } @@ -793,7 +795,7 @@ public class ImportOrdersFromEbay { EbayHelper.createPartyPhone(dispatcher, partyId, (String) parameters.get("shippingAddressPhone"), userLogin); Debug.logInfo("Creating association to eBay buyer for party: " + partyId, MODULE); EbayHelper.createEbayCustomer(dispatcher, partyId, (String) parameters.get("ebayUserIdBuyer"), (String) parameters.get( - "eiasTokenBuyer"), userLogin); + "eiasTokenBuyer"), userLogin); String emailBuyer = (String) parameters.get("emailBuyer"); if (UtilValidate.isNotEmpty(emailBuyer) && !"Invalid Request".equalsIgnoreCase(emailBuyer)) { Debug.logInfo("Creating new email for party: " + partyId, MODULE); @@ -835,7 +837,7 @@ public class ImportOrdersFromEbay { if (approved) { Debug.logInfo("Creating payment for approved order.", MODULE); EbayHelper.createPaymentFromPaymentPreferences(delegator, dispatcher, userLogin, orderId, externalId, cart.getOrderDate(), - amountPaid, partyId); + amountPaid, partyId); Debug.logInfo("Payment created.", MODULE); } } @@ -852,8 +854,8 @@ public class ImportOrdersFromEbay { private static GenericValue externalOrderExists(Delegator delegator, String externalId) throws GenericEntityException { Debug.logInfo("Checking for existing externalId: " + externalId, MODULE); EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("externalId", - EntityComparisonOperator.EQUALS, externalId), EntityCondition.makeCondition("statusId", EntityComparisonOperator.NOT_EQUAL, - "ORDER_CANCELLED")), EntityComparisonOperator.AND); + EntityComparisonOperator.EQUALS, externalId), EntityCondition.makeCondition("statusId", EntityComparisonOperator.NOT_EQUAL, + "ORDER_CANCELLED")), EntityComparisonOperator.AND); GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where(condition).cache(true).queryFirst(); return orderHeader; } diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java index 3ef494c..348bc7d 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java @@ -103,7 +103,7 @@ public class EbayStoreAutoPrefEvents { Map<String, Object> result = dispatcher.runSync("ebayBestOfferPrefCond", bestOfferCondition); if (ServiceUtil.isError(result)) { request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result)); - Debug.log( ServiceUtil.getErrorMessage(result), MODULE); + Debug.log(ServiceUtil.getErrorMessage(result), MODULE); return "error"; } } catch (GenericServiceException e) { 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 1bfe860..ca2d8e9 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 @@ -65,18 +65,38 @@ public class JanrainHelper { private static String apiKey = UtilProperties.getPropertyValue("ecommerce", "janrain.apiKey"); private static String baseUrl = UtilProperties.getPropertyValue("ecommerce", "janrain.baseUrl"); public JanrainHelper(String apiKey, String baseUrl) { - while (baseUrl.endsWith("/")) + while (baseUrl.endsWith("/")) { baseUrl = baseUrl.substring(0, baseUrl.length() - 1); + } JanrainHelper.apiKey = apiKey; JanrainHelper.baseUrl = baseUrl; } - public String getApiKey() { return apiKey; } - public String getBaseUrl() { return baseUrl; } + + /** + * Gets api key. + * @return the api key + */ + public String getApiKey() { + return apiKey; + } + + /** + * Gets base url. + * @return the base url + */ + public String getBaseUrl() { + return baseUrl; + } public static Element authInfo(String token) { Map<String, Object> query = new HashMap<>(); query.put("token", token); return apiCall("auth_info", query); } + + /** + * All mappings hash map. + * @return the hash map + */ public HashMap<String, List<String>> allMappings() { Element rsp = apiCall("all_mappings", null); rsp.getFirstChild(); @@ -85,26 +105,32 @@ public class JanrainHelper { for (int i = 0; i < mappings.getLength(); i++) { Element mapping = (Element) mappings.item(i); List<String> identifiers = new ArrayList<>(); - NodeList rk_list = getNodeList("primaryKey", mapping); - NodeList id_list = getNodeList("identifiers/identifier", mapping); - String remote_key = ((Element) rk_list.item(0)).getTextContent(); - for (int j = 0; j < id_list.getLength(); j++) { - Element ident = (Element) id_list.item(j); + NodeList rkList = getNodeList("primaryKey", mapping); + NodeList idList = getNodeList("identifiers/identifier", mapping); + String remoteKey = ((Element) rkList.item(0)).getTextContent(); + for (int j = 0; j < idList.getLength(); j++) { + Element ident = (Element) idList.item(j); identifiers.add(ident.getTextContent()); } - result.put(remote_key, identifiers); + result.put(remoteKey, identifiers); } return result; } - private static NodeList getNodeList(String xpath_expr, Element root) { + private static NodeList getNodeList(String xpathExpr, Element root) { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); try { - return (NodeList) xpath.evaluate(xpath_expr, root, XPathConstants.NODESET); + return (NodeList) xpath.evaluate(xpathExpr, root, XPathConstants.NODESET); } catch (XPathExpressionException e) { return null; } } + + /** + * Mappings list. + * @param primaryKey the primary key + * @return the list + */ public List<String> mappings(Object primaryKey) { Map<String, Object> query = new HashMap<>(); query.put("primaryKey", primaryKey); @@ -118,12 +144,24 @@ public class JanrainHelper { } return result; } + + /** + * Map. + * @param identifier the identifier + * @param primaryKey the primary key + */ public void map(String identifier, Object primaryKey) { Map<String, Object> query = new HashMap<>(); query.put("identifier", identifier); query.put("primaryKey", primaryKey); apiCall("map", query); } + + /** + * Unmap. + * @param identifier the identifier + * @param primaryKey the primary key + */ public void unmap(String identifier, Object primaryKey) { Map<String, Object> query = new HashMap<>(); query.put("identifier", identifier); @@ -141,8 +179,9 @@ public class JanrainHelper { query.put("apiKey", apiKey); StringBuffer sb = new StringBuffer(); for (Iterator<Map.Entry<String, Object>> it = query.entrySet().iterator(); it.hasNext();) { - if (sb.length() > 0) + if (sb.length() > 0) { sb.append('&'); + } try { Map.Entry<String, Object> e = it.next(); sb.append(URLEncoder.encode(e.getKey().toString(), "UTF-8")); @@ -160,7 +199,7 @@ public class JanrainHelper { conn.setDoOutput(true); conn.connect(); OutputStreamWriter osw = new OutputStreamWriter( - conn.getOutputStream(), "UTF-8"); + conn.getOutputStream(), "UTF-8"); osw.write(data); osw.close(); @@ -168,7 +207,7 @@ public class JanrainHelper { String line = ""; StringBuilder buf = new StringBuilder(); while ((line = post.readLine()) != null) { - buf.append(line); + buf.append(line); } post.close(); Document tagXml = UtilXml.readXmlDocument(buf.toString()); diff --git a/example/src/main/java/org/apache/ofbiz/example/ExampleServices.java b/example/src/main/java/org/apache/ofbiz/example/ExampleServices.java index 2252719..d54f7f8 100644 --- a/example/src/main/java/org/apache/ofbiz/example/ExampleServices.java +++ b/example/src/main/java/org/apache/ofbiz/example/ExampleServices.java @@ -46,4 +46,4 @@ public class ExampleServices { } return ServiceUtil.returnSuccess(); } -} \ No newline at end of file +} diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceRequestProcessor.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceRequestProcessor.java index 18ac305..9b737db 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceRequestProcessor.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceRequestProcessor.java @@ -58,7 +58,7 @@ public class ServiceRequestProcessor { } catch (GenericServiceException gse) { throw new NotFoundException(gse.getMessage()); } - if (UtilValidate.isNotEmpty(service.action) && !service.action.equalsIgnoreCase(httpVerb)) { + if (UtilValidate.isNotEmpty(service.getAction()) && !service.getAction().equalsIgnoreCase(httpVerb)) { throw new MethodNotAllowedException("HTTP " + httpVerb + " is not allowed on this service."); } Map<String, Object> serviceContext = dispatchContext.makeValidContext(serviceName, ModelService.IN_PARAM, requestMap); @@ -69,7 +69,7 @@ public class ServiceRequestProcessor { Set<String> outParams = service.getOutParamNames(); for (String outParamName : outParams) { ModelParam outParam = service.getParam(outParamName); - if (!outParam.internal) { + if (!outParam.isInternal()) { Object value = result.get(outParamName); if (UtilValidate.isNotEmpty(value)) { responseData.put(outParamName, value); diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/listener/ApiContextListener.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/listener/ApiContextListener.java index 3517b6f..256ca01 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/listener/ApiContextListener.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/listener/ApiContextListener.java @@ -33,7 +33,6 @@ public class ApiContextListener implements ServletContextListener { private static ServletContext servletContext; /** - * */ public void contextInitialized(ServletContextEvent sce) { servletContext = sce.getServletContext(); @@ -46,7 +45,6 @@ public class ApiContextListener implements ServletContextListener { } /** - * */ public void contextDestroyed(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizOpenApiReader.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizOpenApiReader.java index dcf8c19..de1c9e8 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizOpenApiReader.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizOpenApiReader.java @@ -114,27 +114,27 @@ public final class OFBizOpenApiReader extends Reader implements OpenApiReader { } catch (GenericServiceException e) { e.printStackTrace(); } - if (service != null && service.export && UtilValidate.isNotEmpty(service.action)) { + if (service != null && service.isExport() && UtilValidate.isNotEmpty(service.getAction())) { SecurityRequirement security = new SecurityRequirement(); security.addList("jwtToken"); - final Operation operation = new Operation().summary(service.description) - .description(service.description).addTagsItem("Exported Services").operationId(service.name) + final Operation operation = new Operation().summary(service.getDescription()) + .description(service.getDescription()).addTagsItem("Exported Services").operationId(service.getName()) .deprecated(false).addSecurityItem(security); PathItem pathItemObject = new PathItem(); - if (service.action.equalsIgnoreCase(HttpMethod.GET)) { + if (service.getAction().equalsIgnoreCase(HttpMethod.GET)) { final QueryParameter serviceInParam = (QueryParameter) new QueryParameter().required(true) .description("Service In Parameters in JSON").name("inParams"); Schema<?> refSchema = new Schema<>(); - refSchema.$ref(service.name + "Request"); + refSchema.$ref(service.getName() + "Request"); serviceInParam.schema(refSchema); operation.addParametersItem(serviceInParam); - } else if (service.action.equalsIgnoreCase(HttpMethod.POST)) { - RequestBody request = new RequestBody().description("Request Body for service " + service.name) + } else if (service.getAction().equalsIgnoreCase(HttpMethod.POST)) { + RequestBody request = new RequestBody().description("Request Body for service " + service.getName()) .content(new Content().addMediaType(javax.ws.rs.core.MediaType.APPLICATION_JSON, - new MediaType().schema(new Schema<>().$ref(service.name + "Request")))); + new MediaType().schema(new Schema<>().$ref(service.getName() + "Request")))); operation.setRequestBody(request); } @@ -143,16 +143,16 @@ public final class OFBizOpenApiReader extends Reader implements OpenApiReader { Content content = new Content(); MediaType jsonMediaType = new MediaType(); Schema<?> refSchema = new Schema<>(); - refSchema.$ref(service.name + "Response"); + refSchema.$ref(service.getName() + "Response"); jsonMediaType.setSchema(refSchema); setOutSchemaForService(service); setInSchemaForService(service); content.addMediaType(javax.ws.rs.core.MediaType.APPLICATION_JSON, jsonMediaType); apiResponsesObject.addApiResponse("200", successResponse.content(content)); - setPathItemOperation(pathItemObject, service.action.toUpperCase(), operation); + setPathItemOperation(pathItemObject, service.getAction().toUpperCase(), operation); operation.setResponses(apiResponsesObject); - paths.addPathItem("/services/" + service.name, pathItemObject); + paths.addPathItem("/services/" + service.getName(), pathItemObject); } } @@ -194,7 +194,7 @@ public final class OFBizOpenApiReader extends Reader implements OpenApiReader { private void setOutSchemaForService(ModelService service) { Schema<Object> parentSchema = new Schema<Object>(); - parentSchema.setDescription("Out Schema for service: " + service.name + " response"); + parentSchema.setDescription("Out Schema for service: " + service.getName() + " response"); parentSchema.setType("object"); parentSchema.addProperties("statusCode", new IntegerSchema().description("HTTP Status Code")); parentSchema.addProperties("statusDescription", new StringSchema().description("HTTP Status Code Description")); @@ -217,12 +217,12 @@ public final class OFBizOpenApiReader extends Reader implements OpenApiReader { } dataSchema.addProperties(name, schema.description(name)); }); - schemas.put(service.name + "Response", parentSchema); + schemas.put(service.getName() + "Response", parentSchema); } private void setInSchemaForService(ModelService service) { Schema<Object> parentSchema = new Schema<Object>(); - parentSchema.setDescription("In Schema for service: " + service.name + " request"); + parentSchema.setDescription("In Schema for service: " + service.getName() + " request"); parentSchema.setType("object"); service.getInParamNamesMap().forEach((name, type) -> { Schema<?> schema = null; @@ -236,7 +236,7 @@ public final class OFBizOpenApiReader extends Reader implements OpenApiReader { } parentSchema.addProperties(name, schema.description(name)); }); - schemas.put(service.name + "Request", parentSchema); + schemas.put(service.getName() + "Request", parentSchema); } } diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizResourceScanner.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizResourceScanner.java index 0484224..96c0c74 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizResourceScanner.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/openapi/OFBizResourceScanner.java @@ -38,7 +38,6 @@ public class OFBizResourceScanner extends JaxrsApplicationAndResourcePackagesAnn } /** - * */ public Set<Class<?>> classes() { Set<Class<?>> classes = super.classes(); @@ -52,7 +51,6 @@ public class OFBizResourceScanner extends JaxrsApplicationAndResourcePackagesAnn } /** - * */ protected boolean isIgnored(String classOrPackageName) { if (UtilValidate.isEmpty(classOrPackageName)) { diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/resources/AuthenticationResource.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/resources/AuthenticationResource.java index 848c5ba..c675e7d 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/resources/AuthenticationResource.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/resources/AuthenticationResource.java @@ -54,7 +54,6 @@ public class AuthenticationResource extends OFBizResource { private HttpServletResponse httpResponse; /** - * */ @POST @Produces(MediaType.APPLICATION_JSON) diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/resources/OFBizServiceResource.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/resources/OFBizServiceResource.java index d19c9f4..0a3a9c5 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/resources/OFBizServiceResource.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/resources/OFBizServiceResource.java @@ -77,11 +77,11 @@ public class OFBizServiceResource extends OFBizResource { List<Map<String, Object>> serviceList = new ArrayList<>(); for (String serviceName : serviceNames) { ModelService service = context.getModelService(serviceName); - if (service != null && service.export && UtilValidate.isNotEmpty(service.action)) { + if (service != null && service.isExport() && UtilValidate.isNotEmpty(service.getAction())) { Map<String, Object> serviceMap = new LinkedHashMap<String, Object>(); - serviceMap.put("name", service.name); - serviceMap.put("description", service.description); - Link selfLink = Link.fromUriBuilder(uriInfo.getAbsolutePathBuilder().path(service.name)).type(service.action).rel("self").build(); + serviceMap.put("name", service.getName()); + serviceMap.put("description", service.getDescription()); + Link selfLink = Link.fromUriBuilder(uriInfo.getAbsolutePathBuilder().path(service.getName())).type(service.getAction()).rel("self").build(); serviceMap.put("link", selfLink); serviceList.add(serviceMap); } diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/security/auth/APIAuthFilter.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/security/auth/APIAuthFilter.java index 4709ed2..35e331d 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/security/auth/APIAuthFilter.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/security/auth/APIAuthFilter.java @@ -64,7 +64,6 @@ public class APIAuthFilter implements ContainerRequestFilter { private static final String REALM = "OFBiz"; /** - * */ @Override public void filter(ContainerRequestContext requestContext) throws IOException { diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/GlobalExceptionMapper.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/GlobalExceptionMapper.java index af08942..68d15c9 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/GlobalExceptionMapper.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/GlobalExceptionMapper.java @@ -34,7 +34,9 @@ public class GlobalExceptionMapper extends AbstractExceptionMapper implements ja private static final String MODULE = GlobalExceptionMapper.class.getName(); /** - * + * To response response. + * @param throwable the throwable + * @return the response */ @Override public Response toResponse(Throwable throwable) { diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/JacksonConfig.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/JacksonConfig.java index 7b3f14c..50b860b 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/JacksonConfig.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/JacksonConfig.java @@ -48,7 +48,9 @@ public class JacksonConfig implements ContextResolver<ObjectMapper> { } /** - * + * Gets context. + * @param type the type + * @return the context */ @Override public ObjectMapper getContext(Class<?> type) { diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/JsonifiedParamConverterProvider.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/JsonifiedParamConverterProvider.java index fff65ec..9e46178 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/JsonifiedParamConverterProvider.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/JsonifiedParamConverterProvider.java @@ -41,7 +41,12 @@ public class JsonifiedParamConverterProvider implements ParamConverterProvider { } /** - * + * Gets converter. + * @param <T> the type parameter + * @param rawType the raw type + * @param genericType the generic type + * @param annotations the annotations + * @return the converter */ @Override public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) { diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/LinkSerializer.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/LinkSerializer.java index e7eac98..590d5a5 100644 --- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/LinkSerializer.java +++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/spi/impl/LinkSerializer.java @@ -30,8 +30,13 @@ import com.fasterxml.jackson.databind.SerializerProvider; public class LinkSerializer extends JsonSerializer<javax.ws.rs.core.Link> { static final String HREF_PROPERTY = "href"; + /** - * + * Serialize. + * @param link the link + * @param jsonGenerator the json generator + * @param serializerProvider the serializer provider + * @throws IOException the io exception */ public void serialize(Link link, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeStartObject(); diff --git a/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumEvents.java b/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumEvents.java index a22aef9..62df0ce 100644 --- a/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumEvents.java +++ b/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumEvents.java @@ -90,8 +90,8 @@ public class ScrumEvents { List<GenericValue> timeEntryList = timesheetMap.getRelated("TimeEntry", UtilMisc.toMap("partyId", partyId, "timesheetId", timesheetId, "fromDate", realTimeDate), null, false); //check EmplLeave - List<GenericValue> emplLeaveList = EntityQuery.use(delegator).from("EmplLeave").where("partyId", partyId, "fromDate" - , realTimeDate).cache(true).queryList(); + List<GenericValue> emplLeaveList = EntityQuery.use(delegator).from("EmplLeave").where("partyId", partyId, "fromDate", + realTimeDate).cache(true).queryList(); if (UtilValidate.isEmpty(timeEntryList) && UtilValidate.isEmpty(emplLeaveList)) { Map<String, Object> noEntryMap = new HashMap<>(); noEntryMap.put("timesheetId", timesheetId); 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 f88f334..69256d3 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 @@ -78,26 +78,52 @@ public class WebPosSession { Debug.logInfo("Created WebPosSession [" + id + "]", MODULE); } + /** + * Gets user login. + * @return the user login + */ public GenericValue getUserLogin() { return this.userLogin; } + /** + * Sets user login. + * @param userLogin the user login + */ public void setUserLogin(GenericValue userLogin) { this.userLogin = userLogin; } + /** + * Sets attribute. + * @param name the name + * @param value the value + */ public void setAttribute(String name, Object value) { this.attributes.put(name, value); } + /** + * Gets attribute. + * @param name the name + * @return the attribute + */ public Object getAttribute(String name) { return this.attributes.get(name); } + /** + * Gets id. + * @return the id + */ public String getId() { return this.id; } + /** + * Gets user login id. + * @return the user login id + */ public String getUserLoginId() { if (UtilValidate.isEmpty(getUserLogin())) { return null; @@ -106,6 +132,10 @@ public class WebPosSession { } } + /** + * Gets user party id. + * @return the user party id + */ public String getUserPartyId() { if (UtilValidate.isEmpty(getUserLogin())) { return null; @@ -114,38 +144,74 @@ public class WebPosSession { } } + /** + * Gets locale. + * @return the locale + */ public Locale getLocale() { return this.locale; } + /** + * Sets locale. + * @param locale the locale + */ public void setLocale(Locale locale) { this.locale = locale; } + /** + * Gets product store id. + * @return the product store id + */ public String getProductStoreId() { return this.productStoreId; } + /** + * Sets product store id. + * @param productStoreId the product store id + */ public void setProductStoreId(String productStoreId) { this.productStoreId = productStoreId; } + /** + * Gets facility id. + * @return the facility id + */ public String getFacilityId() { return this.facilityId; } + /** + * Sets facility id. + * @param facilityId the facility id + */ public void setFacilityId(String facilityId) { this.facilityId = facilityId; } + /** + * Gets currency uom id. + * @return the currency uom id + */ public String getCurrencyUomId() { return this.currencyUomId; } + /** + * Sets currency uom id. + * @param currencyUomId the currency uom id + */ public void setCurrencyUomId(String currencyUomId) { this.currencyUomId = currencyUomId; } + /** + * Gets delegator. + * @return the delegator + */ public Delegator getDelegator() { if (UtilValidate.isEmpty(delegator)) { delegator = DelegatorFactory.getDelegator(delegatorName); @@ -153,14 +219,25 @@ public class WebPosSession { return delegator; } + /** + * Gets dispatcher. + * @return the dispatcher + */ public LocalDispatcher getDispatcher() { return dispatcher; } + /** + * Gets cart. + * @return the cart + */ public ShoppingCart getCart() { return this.cart; } + /** + * Logout. + */ public void logout() { if (UtilValidate.isNotEmpty(webPosTransaction)) { webPosTransaction.closeTx(); @@ -172,10 +249,25 @@ public class WebPosSession { } } + /** + * Login. + * @param username the username + * @param password the password + * @param dispatcher the dispatcher + * @throws UserLoginFailure the user login failure + */ public void login(String username, String password, LocalDispatcher dispatcher) throws UserLoginFailure { this.checkLogin(username, password, dispatcher); } + /** + * Check login generic value. + * @param username the username + * @param password the password + * @param dispatcher the dispatcher + * @return the generic value + * @throws UserLoginFailure the user login failure + */ public GenericValue checkLogin(String username, String password, LocalDispatcher dispatcher) throws UserLoginFailure { // check the required parameters and objects if (UtilValidate.isEmpty(dispatcher)) { @@ -211,6 +303,12 @@ public class WebPosSession { } } + /** + * Has role boolean. + * @param userLogin the user login + * @param roleTypeId the role type id + * @return the boolean + */ public boolean hasRole(GenericValue userLogin, String roleTypeId) { if (UtilValidate.isEmpty(userLogin) || UtilValidate.isEmpty(roleTypeId)) { return false; @@ -231,6 +329,10 @@ public class WebPosSession { return true; } + /** + * Is manager logged in boolean. + * @return the boolean + */ public boolean isManagerLoggedIn() { if (UtilValidate.isEmpty(mgrLoggedIn)) { mgrLoggedIn = hasRole(getUserLogin(), "MANAGER"); @@ -238,6 +340,10 @@ public class WebPosSession { return mgrLoggedIn; } + /** + * Gets current transaction. + * @return the current transaction + */ public WebPosTransaction getCurrentTransaction() { if (UtilValidate.isEmpty(webPosTransaction)) { webPosTransaction = new WebPosTransaction(this); @@ -245,6 +351,10 @@ public class WebPosSession { return webPosTransaction; } + /** + * Sets current transaction. + * @param webPosTransaction the web pos transaction + */ public void setCurrentTransaction(WebPosTransaction webPosTransaction) { this.webPosTransaction = webPosTransaction; } |
Free forum by Nabble | Edit this page |