Author: ashish
Date: Tue Dec 9 11:38:24 2014 New Revision: 1644030 URL: http://svn.apache.org/r1644030 Log: Applied patch from jira issue - OFBIZ-5902 - Fetch configurable settings data driven by replacing UtilProperties.getPropertyValue() method with EntityUtilProperties.getPropertyValue() Thanks so much Arun for this important contribution. Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiContainer.java Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java?rev=1644030&r1=1644029&r2=1644030&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java Tue Dec 9 11:38:24 2014 @@ -61,13 +61,14 @@ public class CCPaymentServices { public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, Object> context) { String ccAction = (String) context.get("ccAction"); + Delegator delegator = dctx.getDelegator(); if (ccAction == null) ccAction = "PreAuth"; Document authRequestDoc = buildPrimaryTxRequest(context, ccAction, (BigDecimal) context.get("processAmount"), (String) context.get("orderId")); Document authResponseDoc = null; try { - authResponseDoc = sendRequest(authRequestDoc, (String) context.get("paymentConfig")); + authResponseDoc = sendRequest(authRequestDoc, (String) context.get("paymentConfig"), delegator); } catch (ClearCommerceException cce) { return ServiceUtil.returnError(cce.getMessage()); } @@ -89,6 +90,7 @@ public class CCPaymentServices { public static Map<String, Object> ccCredit(DispatchContext dctx, Map<String, Object> context) { String action = "Credit"; + Delegator delegator = dctx.getDelegator(); if (context.get("pbOrder") != null) { action = "Auth"; // required for periodic billing.... } @@ -97,7 +99,7 @@ public class CCPaymentServices { (String) context.get("referenceCode")); Document creditResponseDoc = null; try { - creditResponseDoc = sendRequest(creditRequestDoc, (String) context.get("paymentConfig")); + creditResponseDoc = sendRequest(creditRequestDoc, (String) context.get("paymentConfig"), delegator); } catch (ClearCommerceException cce) { return ServiceUtil.returnError(cce.getMessage()); } @@ -119,6 +121,7 @@ public class CCPaymentServices { public static Map<String, Object> ccCapture(DispatchContext dctx, Map<String, Object> context) { Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { @@ -127,11 +130,11 @@ public class CCPaymentServices { } Document captureRequestDoc = buildSecondaryTxRequest(context, authTransaction.getString("referenceNum"), - "PostAuth", (BigDecimal) context.get("captureAmount")); + "PostAuth", (BigDecimal) context.get("captureAmount"), delegator); Document captureResponseDoc = null; try { - captureResponseDoc = sendRequest(captureRequestDoc, (String) context.get("paymentConfig")); + captureResponseDoc = sendRequest(captureRequestDoc, (String) context.get("paymentConfig"), delegator); } catch (ClearCommerceException cce) { return ServiceUtil.returnError(cce.getMessage()); } @@ -153,6 +156,7 @@ public class CCPaymentServices { public static Map<String, Object> ccRelease(DispatchContext dctx, Map<String, Object> context) { Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { @@ -160,11 +164,11 @@ public class CCPaymentServices { "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } - Document releaseRequestDoc = buildSecondaryTxRequest(context, authTransaction.getString("referenceNum"), "Void", null); + Document releaseRequestDoc = buildSecondaryTxRequest(context, authTransaction.getString("referenceNum"), "Void", null, delegator); Document releaseResponseDoc = null; try { - releaseResponseDoc = sendRequest(releaseRequestDoc, (String) context.get("paymentConfig")); + releaseResponseDoc = sendRequest(releaseRequestDoc, (String) context.get("paymentConfig"), delegator); } catch (ClearCommerceException cce) { return ServiceUtil.returnError(cce.getMessage()); } @@ -206,6 +210,7 @@ public class CCPaymentServices { public static Map<String, Object> ccRefund(DispatchContext dctx, Map<String, Object> context) { Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { @@ -216,11 +221,11 @@ public class CCPaymentServices { // Although refunds are applied to captured transactions, using the auth reference number is ok here // Related auth and capture transactions will always have the same reference number Document refundRequestDoc = buildSecondaryTxRequest(context, authTransaction.getString("referenceNum"), - "Credit", (BigDecimal) context.get("refundAmount")); + "Credit", (BigDecimal) context.get("refundAmount"), delegator); Document refundResponseDoc = null; try { - refundResponseDoc = sendRequest(refundRequestDoc, (String) context.get("paymentConfig")); + refundResponseDoc = sendRequest(refundRequestDoc, (String) context.get("paymentConfig"), delegator); } catch (ClearCommerceException cce) { return ServiceUtil.returnError(cce.getMessage()); } @@ -242,6 +247,7 @@ public class CCPaymentServices { public static Map<String, Object> ccReAuth(DispatchContext dctx, Map<String, Object> context) { Locale locale = (Locale) context.get("locale"); + Delegator delegator = dctx.getDelegator(); GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { @@ -250,11 +256,11 @@ public class CCPaymentServices { } Document reauthRequestDoc = buildSecondaryTxRequest(context, authTransaction.getString("referenceNum"), - "RePreAuth", (BigDecimal) context.get("reauthAmount")); + "RePreAuth", (BigDecimal) context.get("reauthAmount"), delegator); Document reauthResponseDoc = null; try { - reauthResponseDoc = sendRequest(reauthRequestDoc, (String) context.get("paymentConfig")); + reauthResponseDoc = sendRequest(reauthRequestDoc, (String) context.get("paymentConfig"), delegator); } catch (ClearCommerceException cce) { return ServiceUtil.returnError(cce.getMessage()); } @@ -361,7 +367,7 @@ public class CCPaymentServices { //Document reportResponseDoc = null; try { //reportResponseDoc = - sendRequest(requestDocument, (String) context.get("paymentConfig")); + sendRequest(requestDocument, (String) context.get("paymentConfig"), delegator); } catch (ClearCommerceException cce) { return ServiceUtil.returnError(cce.getMessage()); } @@ -651,8 +657,10 @@ public class CCPaymentServices { if (UtilValidate.isEmpty(paymentConfig)) { paymentConfig = "payment.properties"; } - - Document requestDocument = createRequestDocument(paymentConfig); + // payment mech + GenericValue creditCard = (GenericValue) context.get("creditCard"); + Delegator delegator = creditCard.getDelegator(); + Document requestDocument = createRequestDocument(paymentConfig, delegator); Element engineDocElement = UtilXml.firstChildElement(requestDocument.getDocumentElement(), "EngineDoc"); Element orderFormDocElement = UtilXml.firstChildElement(engineDocElement, "OrderFormDoc"); @@ -726,21 +734,21 @@ public class CCPaymentServices { return requestDocument; } - private static Document buildSecondaryTxRequest(Map<String, Object> context, String id, String type, BigDecimal amount) { + private static Document buildSecondaryTxRequest(Map<String, Object> context, String id, String type, BigDecimal amount, Delegator delegator) { String paymentConfig = (String) context.get("paymentConfig"); if (UtilValidate.isEmpty(paymentConfig)) { paymentConfig = "payment.properties"; } - Document requestDocument = createRequestDocument(paymentConfig); + Document requestDocument = createRequestDocument(paymentConfig, delegator); Element engineDocElement = UtilXml.firstChildElement(requestDocument.getDocumentElement(), "EngineDoc"); Element orderFormDocElement = UtilXml.firstChildElement(engineDocElement, "OrderFormDoc"); UtilXml.addChildElementValue(orderFormDocElement, "Id", id, requestDocument); // Default to currency code 840 (USD) - String currencyCode = UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.currencyCode", "840"); + String currencyCode = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.currencyCode", "840", delegator); appendTransactionNode(orderFormDocElement, type, amount, currencyCode); @@ -822,7 +830,7 @@ public class CCPaymentServices { } } - private static Document createRequestDocument(String paymentConfig) { + private static Document createRequestDocument(String paymentConfig, Delegator delegator) { // EngineDocList Document requestDocument = UtilXml.makeEmptyXmlDocument("EngineDocList"); @@ -833,12 +841,12 @@ public class CCPaymentServices { Element engineDocElement = UtilXml.addChildElement(engineDocListElement, "EngineDoc", requestDocument); UtilXml.addChildElementValue(engineDocElement, "ContentType", "OrderFormDoc", requestDocument); - String sourceId = UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.sourceId"); + String sourceId = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.sourceId", delegator); if (UtilValidate.isNotEmpty(sourceId)) { UtilXml.addChildElementValue(engineDocElement, "SourceId", sourceId, requestDocument); } - String groupId = UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.groupId"); + String groupId = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.groupId", delegator); if (UtilValidate.isNotEmpty(groupId)) { UtilXml.addChildElementValue(engineDocElement, "GroupId", groupId, requestDocument); } @@ -846,13 +854,13 @@ public class CCPaymentServices { // EngineDocList.EngineDoc.User Element userElement = UtilXml.addChildElement(engineDocElement, "User", requestDocument); UtilXml.addChildElementValue(userElement, "Name", - UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.username", ""), requestDocument); + EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.username", "", delegator), requestDocument); UtilXml.addChildElementValue(userElement, "Password", - UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.password", ""), requestDocument); + EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.password", "", delegator), requestDocument); UtilXml.addChildElementValue(userElement, "Alias", - UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.alias", ""), requestDocument); + EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.alias", "", delegator), requestDocument); - String effectiveAlias = UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.effectiveAlias"); + String effectiveAlias = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.effectiveAlias", delegator); if (UtilValidate.isNotEmpty(effectiveAlias)) { UtilXml.addChildElementValue(userElement, "EffectiveAlias", effectiveAlias, requestDocument); } @@ -870,17 +878,17 @@ public class CCPaymentServices { Element orderFormDocElement = UtilXml.addChildElement(engineDocElement, "OrderFormDoc", requestDocument); // default to "P" for Production Mode - String mode = UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.processMode", "P"); + String mode = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.processMode", "P", delegator); UtilXml.addChildElementValue(orderFormDocElement, "Mode", mode, requestDocument); return requestDocument; } - private static Document sendRequest(Document requestDocument, String paymentConfig) throws ClearCommerceException { + private static Document sendRequest(Document requestDocument, String paymentConfig, Delegator delegator) throws ClearCommerceException { if (UtilValidate.isEmpty(paymentConfig)) { paymentConfig = "payment.properties"; } - String serverURL = UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.serverURL"); + String serverURL = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.serverURL", delegator); if (UtilValidate.isEmpty(serverURL)) { throw new ClearCommerceException("Missing server URL; check your ClearCommerce configuration"); } Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1644030&r1=1644029&r2=1644030&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Tue Dec 9 11:38:24 2014 @@ -91,7 +91,7 @@ public class IcsPaymentServices { } // process the reply Map<String, Object> result = ServiceUtil.returnSuccess(); - processAuthResult(reply, result); + processAuthResult(reply, result, delegator); return result; } @@ -535,9 +535,9 @@ public class IcsPaymentServices { return processAmount.setScale(decimals, rounding).toPlainString(); } - private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) { + private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result, Delegator delegator) { String decision = getDecision(reply); - String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus"); + String checkModeStatus = EntityUtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus", delegator); if ("ACCEPT".equalsIgnoreCase(decision)) { result.put("authCode", reply.get("ccAuthReply_authorizationCode")); result.put("authResult", Boolean.TRUE); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java?rev=1644030&r1=1644029&r2=1644030&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java Tue Dec 9 11:38:24 2014 @@ -33,7 +33,9 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilNumber; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.ServiceUtil; @@ -47,7 +49,8 @@ public class PcChargeServices { public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, ? extends Object> context) { Locale locale = (Locale) context.get("locale"); - Properties props = buildPccProperties(context); + Delegator delegator = dctx.getDelegator(); + Properties props = buildPccProperties(context, delegator); PcChargeApi api = getApi(props); if (api == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -137,7 +140,7 @@ public class PcChargeServices { public static Map<String, Object> ccCapture(DispatchContext dctx, Map<String, ? extends Object> context) { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); Locale locale = (Locale) context.get("locale"); - + Delegator delegator = dctx.getDelegator(); //lets see if there is a auth transaction already in context GenericValue authTransaction = (GenericValue) context.get("authTrans"); @@ -151,7 +154,7 @@ public class PcChargeServices { } // setup the PCCharge Interface - Properties props = buildPccProperties(context); + Properties props = buildPccProperties(context, delegator); PcChargeApi api = getApi(props); if (api == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -196,7 +199,7 @@ public class PcChargeServices { public static Map<String, Object> ccRelease(DispatchContext dctx, Map<String, ? extends Object> context) { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); - + Delegator delegator = dctx.getDelegator(); //lets see if there is a auth transaction already in context GenericValue authTransaction = (GenericValue) context.get("authTrans"); Locale locale = (Locale) context.get("locale"); @@ -211,7 +214,7 @@ public class PcChargeServices { } // setup the PCCharge Interface - Properties props = buildPccProperties(context); + Properties props = buildPccProperties(context, delegator); PcChargeApi api = getApi(props); if (api == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -262,7 +265,7 @@ public class PcChargeServices { public static Map<String, Object> ccRefund(DispatchContext dctx, Map<String, ? extends Object> context) { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); - + Delegator delegator = dctx.getDelegator(); //lets see if there is a auth transaction already in context GenericValue authTransaction = (GenericValue) context.get("authTrans"); Locale locale = (Locale) context.get("locale"); @@ -277,7 +280,7 @@ public class PcChargeServices { } // setup the PCCharge Interface - Properties props = buildPccProperties(context); + Properties props = buildPccProperties(context, delegator); PcChargeApi api = getApi(props); if (api == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -403,18 +406,18 @@ public class PcChargeServices { return api; } - private static Properties buildPccProperties(Map<String, ? extends Object> context) { + private static Properties buildPccProperties(Map<String, ? extends Object> context, Delegator delegator) { String configString = (String) context.get("paymentConfig"); if (configString == null) { configString = "payment.properties"; } - String processorId = UtilProperties.getPropertyValue(configString, "payment.pccharge.processorID"); - String merchantId = UtilProperties.getPropertyValue(configString, "payment.pccharge.merchantID"); - String userId = UtilProperties.getPropertyValue(configString, "payment.pccharge.userID"); - String host = UtilProperties.getPropertyValue(configString, "payment.pccharge.host"); - String port = UtilProperties.getPropertyValue(configString, "payment.pccharge.port"); - String autoBill = UtilProperties.getPropertyValue(configString, "payment.pccharge.autoBill", "true"); + String processorId = EntityUtilProperties.getPropertyValue(configString, "payment.pccharge.processorID", delegator); + String merchantId = EntityUtilProperties.getPropertyValue(configString, "payment.pccharge.merchantID", delegator); + String userId = EntityUtilProperties.getPropertyValue(configString, "payment.pccharge.userID", delegator); + String host = EntityUtilProperties.getPropertyValue(configString, "payment.pccharge.host", delegator); + String port = EntityUtilProperties.getPropertyValue(configString, "payment.pccharge.port", delegator); + String autoBill = EntityUtilProperties.getPropertyValue(configString, "payment.pccharge.autoBill", "true", delegator); // some property checking if (UtilValidate.isEmpty(processorId)) { Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java?rev=1644030&r1=1644029&r2=1644030&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java Tue Dec 9 11:38:24 2014 @@ -38,6 +38,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.util.EntityQuery; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -54,7 +55,8 @@ public class RitaServices { public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, ? extends Object> context) { Locale locale = (Locale) context.get("locale"); - Properties props = buildPccProperties(context); + Delegator delegator = dctx.getDelegator(); + Properties props = buildPccProperties(context, delegator); RitaApi api = getApi(props, "CREDIT"); if (api == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -142,7 +144,8 @@ public class RitaServices { public static Map<String, Object> ccCapture(DispatchContext dctx, Map<String, ? extends Object> context) { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); Locale locale = (Locale) context.get("locale"); - + Delegator delegator = dctx.getDelegator(); + //lets see if there is a auth transaction already in context GenericValue authTransaction = (GenericValue) context.get("authTrans"); @@ -156,7 +159,7 @@ public class RitaServices { } // setup the RiTA Interface - Properties props = buildPccProperties(context); + Properties props = buildPccProperties(context, delegator); RitaApi api = getApi(props, "CREDIT"); if (api == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -210,7 +213,8 @@ public class RitaServices { private static Map<String, Object> ccVoid(DispatchContext dctx, Map<String, ? extends Object> context, boolean isRefund) { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); Locale locale = (Locale) context.get("locale"); - + Delegator delegator = dctx.getDelegator(); + //lets see if there is a auth transaction already in context GenericValue authTransaction = (GenericValue) context.get("authTrans"); @@ -224,7 +228,7 @@ public class RitaServices { } // setup the RiTA Interface - Properties props = buildPccProperties(context); + Properties props = buildPccProperties(context, delegator); RitaApi api = getApi(props, "CREDIT"); if (api == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -277,7 +281,8 @@ public class RitaServices { public static Map<String, Object> ccCreditRefund(DispatchContext dctx, Map<String, ? extends Object> context) { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); Locale locale = (Locale) context.get("locale"); - + Delegator delegator = dctx.getDelegator(); + //lets see if there is a auth transaction already in context GenericValue authTransaction = (GenericValue) context.get("authTrans"); @@ -291,7 +296,7 @@ public class RitaServices { } // setup the RiTA Interface - Properties props = buildPccProperties(context); + Properties props = buildPccProperties(context, delegator); RitaApi api = getApi(props, "CREDIT"); if (api == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -503,20 +508,20 @@ public class RitaServices { return api; } - private static Properties buildPccProperties(Map<String, ? extends Object> context) { + private static Properties buildPccProperties(Map<String, ? extends Object> context, Delegator delegator) { String configString = (String) context.get("paymentConfig"); if (configString == null) { configString = "payment.properties"; } - String clientId = UtilProperties.getPropertyValue(configString, "payment.rita.clientID"); - String userId = UtilProperties.getPropertyValue(configString, "payment.rita.userID"); - String userPw = UtilProperties.getPropertyValue(configString, "payment.rita.userPW"); - String host = UtilProperties.getPropertyValue(configString, "payment.rita.host"); - String port = UtilProperties.getPropertyValue(configString, "payment.rita.port"); - String ssl = UtilProperties.getPropertyValue(configString, "payment.rita.ssl", "N"); - String autoBill = UtilProperties.getPropertyValue(configString, "payment.rita.autoBill", "0"); - String forceTx = UtilProperties.getPropertyValue(configString, "payment.rita.forceTx", "0"); + String clientId = EntityUtilProperties.getPropertyValue(configString, "payment.rita.clientID", delegator); + String userId = EntityUtilProperties.getPropertyValue(configString, "payment.rita.userID", delegator); + String userPw = EntityUtilProperties.getPropertyValue(configString, "payment.rita.userPW", delegator); + String host = EntityUtilProperties.getPropertyValue(configString, "payment.rita.host", delegator); + String port = EntityUtilProperties.getPropertyValue(configString, "payment.rita.port", delegator); + String ssl = EntityUtilProperties.getPropertyValue(configString, "payment.rita.ssl", "N", delegator); + String autoBill = EntityUtilProperties.getPropertyValue(configString, "payment.rita.autoBill", "0", delegator); + String forceTx = EntityUtilProperties.getPropertyValue(configString, "payment.rita.forceTx", "0", delegator); // some property checking if (UtilValidate.isEmpty(clientId)) { Modified: ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java?rev=1644030&r1=1644029&r2=1644030&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java (original) +++ ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java Tue Dec 9 11:38:24 2014 @@ -22,7 +22,6 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.content.data.DataResourceWorker; import org.ofbiz.entity.Delegator; @@ -83,11 +82,11 @@ public class ProductDocument implements // Product Fields doc.add(new StringField("productId", productId, Field.Store.YES)); - this.addTextFieldByWeight(doc, "productName", product.getString("productName"), "index.weight.Product.productName", 0, false, "fullText"); - this.addTextFieldByWeight(doc, "internalName", product.getString("internalName"), "index.weight.Product.internalName", 0, false, "fullText"); - this.addTextFieldByWeight(doc, "brandName", product.getString("brandName"), "index.weight.Product.brandName", 0, false, "fullText"); - this.addTextFieldByWeight(doc, "description", product.getString("description"), "index.weight.Product.description", 0, false, "fullText"); - this.addTextFieldByWeight(doc, "longDescription", product.getString("longDescription"), "index.weight.Product.longDescription", 0, false, "fullText"); + this.addTextFieldByWeight(doc, "productName", product.getString("productName"), "index.weight.Product.productName", 0, false, "fullText", delegator); + this.addTextFieldByWeight(doc, "internalName", product.getString("internalName"), "index.weight.Product.internalName", 0, false, "fullText", delegator); + this.addTextFieldByWeight(doc, "brandName", product.getString("brandName"), "index.weight.Product.brandName", 0, false, "fullText", delegator); + this.addTextFieldByWeight(doc, "description", product.getString("description"), "index.weight.Product.description", 0, false, "fullText", delegator); + this.addTextFieldByWeight(doc, "longDescription", product.getString("longDescription"), "index.weight.Product.longDescription", 0, false, "fullText", delegator); //doc.add(new StringField("introductionDate", checkValue(product.getString("introductionDate")), Store.NO)); doc.add(new LongField("introductionDate", quantizeTimestampToDays(product.getTimestamp("introductionDate")), Field.Store.NO)); nextReIndex = this.checkSetNextReIndex(product.getTimestamp("introductionDate"), nextReIndex); @@ -116,9 +115,9 @@ public class ProductDocument implements doc.add(new StringField("productFeatureId", productFeatureAndAppl.getString("productFeatureId"), Field.Store.NO)); doc.add(new StringField("productFeatureCategoryId", productFeatureAndAppl.getString("productFeatureCategoryId"), Field.Store.NO)); doc.add(new StringField("productFeatureTypeId", productFeatureAndAppl.getString("productFeatureTypeId"), Field.Store.NO)); - this.addTextFieldByWeight(doc, "featureDescription", productFeatureAndAppl.getString("description"), "index.weight.ProductFeatureAndAppl.description", 0, false, "fullText"); - this.addTextFieldByWeight(doc, "featureAbbreviation", productFeatureAndAppl.getString("abbrev"), "index.weight.ProductFeatureAndAppl.abbrev", 0, false, "fullText"); - this.addTextFieldByWeight(doc, "featureCode", productFeatureAndAppl.getString("idCode"), "index.weight.ProductFeatureAndAppl.idCode", 0, false, "fullText"); + this.addTextFieldByWeight(doc, "featureDescription", productFeatureAndAppl.getString("description"), "index.weight.ProductFeatureAndAppl.description", 0, false, "fullText", delegator); + this.addTextFieldByWeight(doc, "featureAbbreviation", productFeatureAndAppl.getString("abbrev"), "index.weight.ProductFeatureAndAppl.abbrev", 0, false, "fullText", delegator); + this.addTextFieldByWeight(doc, "featureCode", productFeatureAndAppl.getString("idCode"), "index.weight.ProductFeatureAndAppl.idCode", 0, false, "fullText", delegator); // Get the ProductFeatureGroupIds List<GenericValue> productFeatureGroupAppls = EntityQuery.use(delegator).from("ProductFeatureGroupAppl").where("productFeatureId", productFeatureAndAppl.get("productFeatureId")).queryList(); productFeatureGroupAppls = this.filterByThruDate(productFeatureGroupAppls); @@ -143,8 +142,8 @@ public class ProductDocument implements List<GenericValue> productAttributes = EntityQuery.use(delegator).from("ProductAttribute").where("productId", productId).queryList(); for (GenericValue productAttribute: productAttributes) { - this.addTextFieldByWeight(doc, "attributeName", productAttribute.getString("attrName"), "index.weight.ProductAttribute.attrName", 0, false, "fullText"); - this.addTextFieldByWeight(doc, "attributeValue", productAttribute.getString("attrValue"), "index.weight.ProductAttribute.attrValue", 0, false, "fullText"); + this.addTextFieldByWeight(doc, "attributeName", productAttribute.getString("attrName"), "index.weight.ProductAttribute.attrName", 0, false, "fullText", delegator); + this.addTextFieldByWeight(doc, "attributeValue", productAttribute.getString("attrValue"), "index.weight.ProductAttribute.attrValue", 0, false, "fullText", delegator); } } @@ -156,7 +155,7 @@ public class ProductDocument implements String idValue = goodIdentification.getString("idValue"); doc.add(new StringField("goodIdentificationTypeId", goodIdentificationTypeId, Field.Store.NO)); doc.add(new StringField(goodIdentificationTypeId + "_GoodIdentification", idValue, Field.Store.NO)); - this.addTextFieldByWeight(doc, "identificationValue", idValue, "index.weight.GoodIdentification.idValue", 0, false, "fullText"); + this.addTextFieldByWeight(doc, "identificationValue", idValue, "index.weight.GoodIdentification.idValue", 0, false, "fullText", delegator); } } @@ -175,7 +174,7 @@ public class ProductDocument implements } else if (thruDate != null) { nextReIndex = this.checkSetNextReIndex(thruDate, nextReIndex); } - this.addTextFieldByWeight(doc, "variantProductId", variantProductAssoc.getString("productIdTo"), "index.weight.Variant.Product.productId", 0, false, "fullText"); + this.addTextFieldByWeight(doc, "variantProductId", variantProductAssoc.getString("productIdTo"), "index.weight.Variant.Product.productId", 0, false, "fullText", delegator); } } } @@ -206,7 +205,7 @@ public class ProductDocument implements try { Map<String, Object> drContext = UtilMisc.<String, Object>toMap("product", product); String contentText = DataResourceWorker.renderDataResourceAsText(delegator, productContentAndInfo.getString("dataResourceId"), drContext, null, null, false); - this.addTextFieldByWeight(doc, "content", contentText, null, weight, false, "fullText"); + this.addTextFieldByWeight(doc, "content", contentText, null, weight, false, "fullText", delegator); } catch (IOException e1) { Debug.logError(e1, "Error getting content text to index", module); } catch (GeneralException e1) { @@ -282,13 +281,13 @@ public class ProductDocument implements } // An attempt to boost/weight values in a similar manner to what OFBiz product search does. - private void addTextFieldByWeight(Document doc, String fieldName, String value, String property, int defaultWeight, boolean store, String fullTextFieldName) { + private void addTextFieldByWeight(Document doc, String fieldName, String value, String property, int defaultWeight, boolean store, String fullTextFieldName, Delegator delegator) { if (fieldName == null) return; float weight = 0; if (property != null) { try { - weight = Float.parseFloat(UtilProperties.getPropertyValue("prodsearch", property, "0")); + weight = Float.parseFloat(EntityUtilProperties.getPropertyValue("prodsearch", property, "0", delegator)); } catch (Exception e) { Debug.logWarning("Could not parse weight number: " + e.toString(), module); } Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiContainer.java?rev=1644030&r1=1644029&r2=1644030&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiContainer.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiContainer.java Tue Dec 9 11:38:24 2014 @@ -31,6 +31,7 @@ import org.ofbiz.base.container.Containe import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; +import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.service.ServiceContainer; @@ -103,7 +104,7 @@ public abstract class XuiContainer imple jframe.setUndecorated(true); new XuiScreen( new String[] { this.startupDir + this.startupFile, - classPackageName}, jframe); + classPackageName}, jframe, delegator); return true; } @@ -136,12 +137,12 @@ public abstract class XuiContainer imple class XuiScreen extends XApplet { protected String startupProperties = ""; - public XuiScreen(String[] args, JFrame frame) { + public XuiScreen(String[] args, JFrame frame, Delegator delegator) { super(args, frame); if (args.length > 0) { startupProperties = args[0]; } - String languageSuffix = UtilProperties.getPropertyValue("xui.properties", "languageSuffix", ""); + String languageSuffix = EntityUtilProperties.getPropertyValue("xui.properties", "languageSuffix", "", delegator); String suffix = null; if(UtilValidate.isEmpty(languageSuffix)) { suffix = Locale.getDefault().getLanguage(); @@ -153,7 +154,7 @@ public abstract class XuiContainer imple } else { suffix = "_" + suffix; } - String language = UtilProperties.getPropertyValue(startupProperties, "Language"); + String language = EntityUtilProperties.getPropertyValue(startupProperties, "Language", delegator); if (language.compareTo("XuiLabels" + suffix) != 0) { UtilProperties.setPropertyValue(startupProperties, "Language", "XuiLabels" + suffix); } |
Free forum by Nabble | Edit this page |