Keeps in sync with OFBiz trunk HEAD
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23@1645602 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java b/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
index dcbc060..c0fcf16 100644
--- a/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
@@ -57,6 +57,7 @@
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.product.product.ProductWorker;
import org.ofbiz.service.DispatchContext;
@@ -1098,7 +1099,7 @@
// Either no orderShipment exists, or there's a null invoicePerShipment in the OrderHeader.
// In either case, use the default value from the properties
if (invoicePerShipment == null) {
- invoicePerShipment = UtilProperties.getPropertyValue("AccountingConfig","create.invoice.per.shipment");
+ invoicePerShipment = EntityUtilProperties.getPropertyValue("AccountingConfig","create.invoice.per.shipment", delegator);
}
if ("Y".equals(invoicePerShipment)) {
@@ -2426,7 +2427,7 @@
context.put("useHighestAmount","Y");
}
- String defaultInvoiceProcessing = UtilProperties.getPropertyValue("AccountingConfig","invoiceProcessing");
+ String defaultInvoiceProcessing = EntityUtilProperties.getPropertyValue("AccountingConfig","invoiceProcessing", delegator);
boolean debug = true; // show processing messages in the log..or not....
diff --git a/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java b/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
index d1acaf9..eadac66 100644
--- a/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
+++ b/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
@@ -33,7 +33,6 @@
import org.ofbiz.base.util.UtilDateTime;
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.GenericEntityException;
@@ -44,6 +43,7 @@
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
/**
* InvoiceWorker - Worker methods of invoices
@@ -505,7 +505,7 @@
if (UtilValidate.isNotEmpty(party) && party.getString("baseCurrencyUomId") != null) {
otherCurrencyUomId = party.getString("baseCurrencyUomId");
} else {
- otherCurrencyUomId = UtilProperties.getPropertyValue("general", "currency.uom.id.default");
+ otherCurrencyUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", delegator);
}
if (otherCurrencyUomId == null) {
otherCurrencyUomId = "USD"; // final default
diff --git a/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java b/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java
index 6a43b63..57512b5 100644
--- a/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/payment/GiftCertificateServices.java
@@ -1005,7 +1005,7 @@
BigDecimal amount = orderItem.getBigDecimal("unitPrice");
// survey information
- String surveyId = UtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.surveyId");
+ String surveyId = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.surveyId", delegator);
// get the survey response
GenericValue surveyResponse = null;
@@ -1050,8 +1050,8 @@
}
}
- String cardNumberKey = UtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.survey.cardNumber");
- String pinNumberKey = UtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.survey.pinNumber");
+ String cardNumberKey = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.survey.cardNumber", delegator);
+ String pinNumberKey = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.survey.pinNumber", delegator);
String cardNumber = (String) answerMap.get(cardNumberKey);
String pinNumber = (String) answerMap.get(pinNumberKey);
diff --git a/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java b/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
index fd5b529..4594c97 100644
--- a/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
@@ -2838,6 +2838,7 @@
}
public static boolean checkAuthValidity(GenericValue orderPaymentPreference, String paymentConfig) {
+ Delegator delegator = orderPaymentPreference.getDelegator();
Timestamp authTime = PaymentGatewayServices.getAuthTime(orderPaymentPreference);
if (authTime == null) {
return false;
@@ -2863,20 +2864,20 @@
String cardType = creditCard.getString("cardType");
// add more types as necessary -- maybe we should create seed data for credit card types??
if ("CCT_DISCOVER".equals(cardType)) {
- reauthDays = UtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.disc.days", "90");
+ reauthDays = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.disc.days", "90", delegator);
} else if ("CCT_AMERICANEXPRESS".equals(cardType)) {
- reauthDays = UtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.amex.days", "30");
+ reauthDays = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.amex.days", "30", delegator);
} else if ("CCT_MASTERCARD".equals(cardType)) {
- reauthDays = UtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.mc.days", "30");
+ reauthDays = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.mc.days", "30", delegator);
} else if ("CCT_VISA".equals(cardType)) {
- reauthDays = UtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.visa.days", "7");
+ reauthDays = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.visa.days", "7", delegator);
} else {
- reauthDays = UtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.other.days", "7");
+ reauthDays = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.other.days", "7", delegator);
}
}
} else if (paymentMethod != null && "EXT_PAYPAL".equals(paymentMethod.get("paymentMethodTypeId"))) {
- reauthDays = UtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.paypal.days", "3");
+ reauthDays = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.paypal.days", "3", delegator);
}
if (reauthDays != null) {
@@ -3316,9 +3317,9 @@
String amount = null;
if (mode.equalsIgnoreCase("CREATE")) {
- amount = UtilProperties.getPropertyValue(productStorePaymentProperties, "payment.general.cc_create.auth");
+ amount = EntityUtilProperties.getPropertyValue(productStorePaymentProperties, "payment.general.cc_create.auth", delegator);
} else if (mode.equalsIgnoreCase("UPDATE")) {
- amount = UtilProperties.getPropertyValue(productStorePaymentProperties, "payment.general.cc_update.auth");
+ amount = EntityUtilProperties.getPropertyValue(productStorePaymentProperties, "payment.general.cc_update.auth", delegator);
}
if (Debug.infoOn()) Debug.logInfo("Running credit card verification [" + paymentMethodId + "] (" + amount + ") : " + productStorePaymentProperties + " : " + mode, module);
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
index d48b8bb..cec18bc 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
@@ -41,6 +41,7 @@
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.ModelService;
import org.ofbiz.service.ServiceUtil;
@@ -802,7 +803,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java
index 2c332b5..47a6c32 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java
@@ -39,8 +39,10 @@
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ServiceUtil;
import org.w3c.dom.Document;
@@ -59,13 +61,14 @@
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());
}
@@ -87,6 +90,7 @@
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....
}
@@ -95,7 +99,7 @@
(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());
}
@@ -117,6 +121,7 @@
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) {
@@ -125,11 +130,11 @@
}
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());
}
@@ -151,6 +156,7 @@
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) {
@@ -158,11 +164,11 @@
"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());
}
@@ -204,6 +210,7 @@
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) {
@@ -214,11 +221,11 @@
// 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());
}
@@ -240,6 +247,7 @@
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) {
@@ -248,11 +256,11 @@
}
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());
}
@@ -275,7 +283,7 @@
public static Map<String, Object> ccReport(DispatchContext dctx, Map<String, Object> context) {
Locale locale = (Locale) context.get("locale");
-
+ Delegator delegator = dctx.getDelegator();
// configuration file
String paymentConfig = (String) context.get("paymentConfig");
if (UtilValidate.isEmpty(paymentConfig)) {
@@ -299,12 +307,12 @@
Element engineDocElement = UtilXml.addChildElement(engineDocListElement, "EngineDoc", requestDocument);
UtilXml.addChildElementValue(engineDocElement, "ContentType", "ReportDoc", 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);
}
@@ -315,13 +323,13 @@
// 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);
}
@@ -348,7 +356,7 @@
// EngineDocList.EngineDoc.ReportDoc.ReportActionList.ReportAction.ValueList
Element valueList = UtilXml.addChildElement(action, "ValueList",requestDocument);
Element value = UtilXml.addChildElement(valueList, "Value",requestDocument);
- String clientIdConfig = UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.clientId");
+ String clientIdConfig = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.clientId", delegator);
if (UtilValidate.isNotEmpty(clientIdConfig)) {
Element clientId = UtilXml.addChildElementValue(value,"ClientId", clientIdConfig, requestDocument);
clientId.setAttribute("DataType", "S32");
@@ -359,7 +367,7 @@
//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());
}
@@ -649,8 +657,10 @@
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");
@@ -666,14 +676,11 @@
UtilXml.addChildElementValue(consumerElement, "Email", billToEmail.getString("infoString"), requestDocument);
}
- // payment mech
- GenericValue creditCard = (GenericValue) context.get("creditCard");
-
- boolean enableCVM = UtilProperties.propertyValueEqualsIgnoreCase(paymentConfig, "payment.clearcommerce.enableCVM", "Y");
+ boolean enableCVM = EntityUtilProperties.propertyValueEqualsIgnoreCase(paymentConfig, "payment.clearcommerce.enableCVM", "Y", delegator);
String cardSecurityCode = enableCVM ? (String) context.get("cardSecurityCode") : null;
// Default to locale code 840 (United States)
- String localCode = UtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.localeCode", "840");
+ String localCode = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.localeCode", "840", delegator);
appendPaymentMechNode(consumerElement, creditCard, cardSecurityCode, localCode);
@@ -694,7 +701,7 @@
}
// 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);
// transaction
appendTransactionNode(orderFormDocElement, type, amount, currencyCode);
@@ -723,21 +730,21 @@
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);
@@ -819,7 +826,7 @@
}
}
- private static Document createRequestDocument(String paymentConfig) {
+ private static Document createRequestDocument(String paymentConfig, Delegator delegator) {
// EngineDocList
Document requestDocument = UtilXml.makeEmptyXmlDocument("EngineDocList");
@@ -830,12 +837,12 @@
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);
}
@@ -843,13 +850,13 @@
// 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);
}
@@ -867,17 +874,17 @@
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");
}
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
index 1f0a5f5..3daf13f 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
@@ -39,6 +39,7 @@
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ServiceUtil;
@@ -90,7 +91,7 @@
}
// process the reply
Map<String, Object> result = ServiceUtil.returnSuccess();
- processAuthResult(reply, result);
+ processAuthResult(reply, result, delegator);
return result;
}
@@ -534,9 +535,9 @@
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);
@@ -684,7 +685,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/eway/EwayServices.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/eway/EwayServices.java
index 8d1d319..9dfc30f 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/eway/EwayServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/eway/EwayServices.java
@@ -31,6 +31,7 @@
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.ServiceUtil;
@@ -280,7 +281,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, resParamName);
+ String value = EntityUtilProperties.getPropertyValue(resource, resParamName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java
index 5126ad3..15cb055 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java
@@ -33,7 +33,9 @@
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 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 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 @@
}
// 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 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 @@
}
// 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 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 @@
}
// 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 @@
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)) {
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java
index d1b9451..2d59cc2 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java
@@ -38,6 +38,7 @@
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 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 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 @@
}
// 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 @@
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 @@
}
// 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 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 @@
}
// 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 @@
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)) {
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/ideal/IdealEvents.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/ideal/IdealEvents.java
index 4b494cf..5d51cf9 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/ideal/IdealEvents.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/ideal/IdealEvents.java
@@ -49,6 +49,7 @@
import org.ofbiz.entity.transaction.GenericTransactionException;
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderChangeHelper;
import org.ofbiz.product.store.ProductStoreWorker;
import org.ofbiz.service.GenericServiceException;
@@ -417,7 +418,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
index cbb2675..25ebc91 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
@@ -49,6 +49,7 @@
import org.ofbiz.entity.transaction.GenericTransactionException;
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderChangeHelper;
import org.ofbiz.product.store.ProductStoreWorker;
import org.ofbiz.service.GenericServiceException;
@@ -520,7 +521,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java
index 9fe6e9c..93be912 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java
@@ -33,6 +33,7 @@
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.ServiceUtil;
@@ -491,7 +492,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java
index c7eeaa4..cdc5389 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java
@@ -1122,7 +1122,7 @@
}
// survey information
- String surveyId = UtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.purchase.surveyId");
+ String surveyId = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.purchase.surveyId", delegator);
// get the survey response
GenericValue surveyResponse = null;
@@ -1169,11 +1169,11 @@
}
// get the send to email address - key defined in properties file
- String sendToKey = UtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.purchase.survey.sendToEmail");
+ String sendToKey = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.purchase.survey.sendToEmail", delegator);
String sendToEmail = (String) answerMap.get(sendToKey);
// get the copyMe flag and set the order email address
String orderEmails = orh.getOrderEmailString();
- String copyMeField = UtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.purchase.survey.copyMe");
+ String copyMeField = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.purchase.survey.copyMe", delegator);
String copyMeResp = copyMeField != null ? (String) answerMap.get(copyMeField) : null;
boolean copyMe = (UtilValidate.isNotEmpty(copyMeField)
&& UtilValidate.isNotEmpty(copyMeResp) && "true".equalsIgnoreCase(copyMeResp)) ? true : false;
@@ -1217,7 +1217,7 @@
// create the fulfillment record
Map<String, Object> vlFulFill = FastMap.newInstance();
vlFulFill.put("typeEnumId", "GC_ACTIVATE");
- vlFulFill.put("merchantId", UtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId"));
+ vlFulFill.put("merchantId", EntityUtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId", delegator));
vlFulFill.put("partyId", partyId);
vlFulFill.put("orderId", orderId);
vlFulFill.put("orderItemSeqId", orderItem.get("orderItemSeqId"));
@@ -1367,7 +1367,7 @@
BigDecimal amount = orderItem.getBigDecimal("unitPrice");
// survey information
- String surveyId = UtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.surveyId");
+ String surveyId = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.surveyId", delegator);
// get the survey response
GenericValue surveyResponse = null;
@@ -1413,8 +1413,8 @@
}
}
- String cardNumberKey = UtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.survey.cardNumber");
- String pinNumberKey = UtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.survey.pinNumber");
+ String cardNumberKey = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.survey.cardNumber", delegator);
+ String pinNumberKey = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.giftcert.reload.survey.pinNumber", delegator);
String cardNumber = (String) answerMap.get(cardNumberKey);
String pinNumber = (String) answerMap.get(pinNumberKey);
@@ -1441,7 +1441,7 @@
// create the fulfillment record
Map<String, Object> vlFulFill = FastMap.newInstance();
vlFulFill.put("typeEnumId", "GC_RELOAD");
- vlFulFill.put("merchantId", UtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId"));
+ vlFulFill.put("merchantId", EntityUtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId", delegator));
vlFulFill.put("partyId", partyId);
vlFulFill.put("orderId", orderId);
vlFulFill.put("orderItemSeqId", orderItem.get("orderItemSeqId"));
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java
index d7695ae..0e40588 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java
@@ -40,6 +40,7 @@
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.order.shoppingcart.ShoppingCart;
import org.ofbiz.order.shoppingcart.ShoppingCartItem;
@@ -932,7 +933,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java b/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java
index e4f0743..9d9b92a 100644
--- a/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java
+++ b/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java
@@ -43,6 +43,7 @@
import org.ofbiz.entity.transaction.GenericTransactionException;
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderChangeHelper;
import org.ofbiz.product.store.ProductStoreWorker;
import org.ofbiz.service.GenericServiceException;
@@ -507,7 +508,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/content/src/org/ofbiz/content/cms/CmsEvents.java b/applications/content/src/org/ofbiz/content/cms/CmsEvents.java
index 44304bf..6b21bee 100644
--- a/applications/content/src/org/ofbiz/content/cms/CmsEvents.java
+++ b/applications/content/src/org/ofbiz/content/cms/CmsEvents.java
@@ -35,7 +35,6 @@
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.GeneralRuntimeException;
import org.ofbiz.base.util.UtilHttp;
-import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.collections.MapStack;
import org.ofbiz.content.content.ContentWorker;
@@ -44,6 +43,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.webapp.control.RequestHandler;
import org.ofbiz.webapp.website.WebSiteWorker;
@@ -266,7 +266,7 @@
try {
Writer writer = response.getWriter();
// TODO: replace "screen" to support dynamic rendering of different output
- FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen.formrenderer"), request, response);
+ FormStringRenderer formStringRenderer = new MacroFormRenderer(EntityUtilProperties.getPropertyValue("widget", "screen.formrenderer", delegator), request, response);
templateMap.put("formStringRenderer", formStringRenderer);
// if use web analytics
diff --git a/applications/content/src/org/ofbiz/content/content/ContentKeywordIndex.java b/applications/content/src/org/ofbiz/content/content/ContentKeywordIndex.java
index 5fa1c59..e75fbc3 100644
--- a/applications/content/src/org/ofbiz/content/content/ContentKeywordIndex.java
+++ b/applications/content/src/org/ofbiz/content/content/ContentKeywordIndex.java
@@ -37,6 +37,7 @@
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityUtilProperties;
/**
* Does indexing in preparation for a keyword search.
@@ -199,7 +200,7 @@
}
List<GenericValue> toBeStored = FastList.newInstance();
- int keywordMaxLength = Integer.parseInt(UtilProperties.getPropertyValue("contentsearch", "content.keyword.max.length"));
+ int keywordMaxLength = Integer.parseInt(EntityUtilProperties.getPropertyValue("contentsearch", "content.keyword.max.length", delegator));
for (Map.Entry<String, Long> entry: keywords.entrySet()) {
if (entry.getKey().length() <= keywordMaxLength) {
GenericValue contentKeyword = delegator.makeValue("ContentKeyword", UtilMisc.toMap("contentId", content.getString("contentId"), "keyword", entry.getKey(), "relevancyWeight", entry.getValue()));
@@ -209,7 +210,7 @@
if (toBeStored.size() > 0) {
if (Debug.verboseOn()) Debug.logVerbose("[ContentKeywordIndex.indexKeywords] Storing " + toBeStored.size() + " keywords for contentId " + content.getString("contentId"), module);
- if ("true".equals(UtilProperties.getPropertyValue("contentsearch", "index.delete.on_index", "false"))) {
+ if ("true".equals(EntityUtilProperties.getPropertyValue("contentsearch", "index.delete.on_index", "false", delegator))) {
// delete all keywords if the properties file says to
delegator.removeByAnd("ContentKeyword", UtilMisc.toMap("contentId", content.getString("contentId")));
}
diff --git a/applications/content/src/org/ofbiz/content/data/DataEvents.java b/applications/content/src/org/ofbiz/content/data/DataEvents.java
index 79f4d57..39df4bf 100644
--- a/applications/content/src/org/ofbiz/content/data/DataEvents.java
+++ b/applications/content/src/org/ofbiz/content/data/DataEvents.java
@@ -39,6 +39,7 @@
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.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ServiceUtil;
@@ -76,7 +77,7 @@
}
// get the permission service required for streaming data; default is always the genericContentPermission
- String permissionService = UtilProperties.getPropertyValue("content.properties", "stream.permission.service", "genericContentPermission");
+ String permissionService = EntityUtilProperties.getPropertyValue("content.properties", "stream.permission.service", "genericContentPermission", delegator);
// get the content record
GenericValue content;
diff --git a/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java b/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
index 79972c5..17f4ad4 100644
--- a/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
+++ b/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
@@ -623,7 +623,7 @@
// check for a cached template
if (cache) {
- String disableCache = UtilProperties.getPropertyValue("content", "disable.ftl.template.cache");
+ String disableCache = EntityUtilProperties.getPropertyValue("content", "disable.ftl.template.cache", delegator);
if (disableCache == null || !disableCache.equalsIgnoreCase("true")) {
try {
Template cachedTemplate = FreeMarkerWorker.getTemplate("DataResource:" + dataResourceId);
@@ -743,7 +743,7 @@
ScreenRenderer screens = (ScreenRenderer) context.get("screens");
if (screens == null) {
// TODO: replace "screen" to support dynamic rendering of different output
- ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", "screen.name"), UtilProperties.getPropertyValue("widget", "screen.screenrenderer"));
+ ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(EntityUtilProperties.getPropertyValue("widget", "screen.name", delegator), EntityUtilProperties.getPropertyValue("widget", "screen.screenrenderer", delegator));
screens = new ScreenRenderer(out, context, screenStringRenderer);
screens.getContext().put("screens", screens);
}
diff --git a/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java b/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java
index 21419f3..e2430f4 100644
--- a/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java
+++ b/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java
@@ -37,6 +37,7 @@
import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ServiceUtil;
@@ -99,7 +100,7 @@
//OpenOfficeByteArrayOutputStream baos = OpenOfficeWorker.convertOODocByteStreamToByteStream(xmulticomponentfactory, oobais, inputMimeType, outputMimeType);
- String tempDir = UtilProperties.getPropertyValue("content", "content.temp.dir");
+ String tempDir = EntityUtilProperties.getPropertyValue("content", "content.temp.dir", delegator);
fileIn = new File(tempDir + fileInName);
FileOutputStream fos = new FileOutputStream(fileIn);
fos.write(inByteArray);
diff --git a/applications/content/src/org/ofbiz/content/output/OutputServices.java b/applications/content/src/org/ofbiz/content/output/OutputServices.java
index 49d5d0d..1f9b1f8 100644
--- a/applications/content/src/org/ofbiz/content/output/OutputServices.java
+++ b/applications/content/src/org/ofbiz/content/output/OutputServices.java
@@ -58,6 +58,8 @@
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.collections.MapStack;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ServiceUtil;
import org.ofbiz.webapp.view.ApacheFopWorker;
@@ -190,6 +192,7 @@
public static Map<String, Object> createFileFromScreen(DispatchContext dctx, Map<String, ? extends Object> serviceContext) {
Locale locale = (Locale) serviceContext.get("locale");
+ Delegator delegator = dctx.getDelegator();
String screenLocation = (String) serviceContext.remove("screenLocation");
Map<String, Object> screenContext = UtilGenerics.checkMap(serviceContext.remove("screenContext"));
String contentType = (String) serviceContext.remove("contentType");
@@ -237,7 +240,7 @@
fileName += ".txt";
}
if (UtilValidate.isEmpty(filePath)) {
- filePath = UtilProperties.getPropertyValue("content.properties", "content.output.path", "/output");
+ filePath = EntityUtilProperties.getPropertyValue("content.properties", "content.output.path", "/output", delegator);
}
File file = new File(filePath, fileName);
diff --git a/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/FindInventoryEventPlan.groovy b/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/FindInventoryEventPlan.groovy
index 0aa27a5..5789471 100644
--- a/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/FindInventoryEventPlan.groovy
+++ b/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/FindInventoryEventPlan.groovy
@@ -20,7 +20,7 @@
import org.ofbiz.base.util.ObjectType;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.base.util.UtilProperties ;
+import org.ofbiz.entity.util.EntityUtilProperties;
productId = parameters.productId;
@@ -69,7 +69,7 @@
// set the page parameters
viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 0);
-viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: UtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20"));
+viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator));
listSize = 0;
if (inventoryList)
listSize = inventoryList.size();
diff --git a/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java b/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java
index f6067f7..1b76593 100644
--- a/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java
+++ b/applications/marketing/src/org/ofbiz/marketing/tracking/TrackingCodeEvents.java
@@ -220,7 +220,7 @@
}
if (cookieDomain == null) {
- cookieDomain = UtilProperties.getPropertyValue("url", "cookie.domain", "");
+ cookieDomain = EntityUtilProperties.getPropertyValue("url", "cookie.domain", "", delegator);
}
// if trackingCode.trackableLifetime not null and is > 0 write a trackable cookie with name in the form: TKCDT_{trackingCode.trackingCodeTypeId} and timeout will be trackingCode.trackableLifetime
diff --git a/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java b/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
index f813a60..c880d30 100644
--- a/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
+++ b/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
@@ -60,6 +60,7 @@
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.party.party.PartyHelper;
import org.ofbiz.party.party.PartyWorker;
import org.ofbiz.service.DispatchContext;
@@ -263,7 +264,7 @@
}
ContactIOFactory ciof = Pim.getContactIOFactory();
ContactMarshaller marshaller = ciof.createContactMarshaller();
- String saveToDirectory = UtilProperties.getPropertyValue("sfa.properties", "save.outgoing.directory", "");
+ String saveToDirectory = EntityUtilProperties.getPropertyValue("sfa.properties", "save.outgoing.directory", "", delegator);
if (UtilValidate.isEmpty(saveToDirectory)) {
saveToDirectory = System.getProperty("ofbiz.home");
}
diff --git a/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java b/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
index a8d83bf..b5c0395 100644
--- a/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
+++ b/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
@@ -50,6 +50,7 @@
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.thirdparty.paypal.ExpressCheckoutEvents;
import org.ofbiz.product.product.ProductContentWrapper;
import org.ofbiz.product.product.ProductWorker;
@@ -334,7 +335,7 @@
for (GenericValue returnHeader : returnHeaders) {
String returnId = returnHeader.getString("returnId");
Timestamp entryDate = returnHeader.getTimestamp("entryDate");
- String daysTillCancelStr = UtilProperties.getPropertyValue("order.properties", "daysTillCancelReplacementOrder", "30");
+ String daysTillCancelStr = EntityUtilProperties.getPropertyValue("order.properties", "daysTillCancelReplacementOrder", "30", delegator);
int daysTillCancel = 0;
try {
daysTillCancel = Integer.parseInt(daysTillCancelStr);
diff --git a/applications/order/src/org/ofbiz/order/order/OrderServices.java b/applications/order/src/org/ofbiz/order/order/OrderServices.java
index cb708f5..2ed0630 100644
--- a/applications/order/src/org/ofbiz/order/order/OrderServices.java
+++ b/applications/order/src/org/ofbiz/order/order/OrderServices.java
@@ -64,6 +64,7 @@
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityTypeUtil;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.shoppingcart.CartItemModifyException;
import org.ofbiz.order.shoppingcart.CheckOutHelper;
import org.ofbiz.order.shoppingcart.ItemNotFoundException;
@@ -546,7 +547,7 @@
orderHeader.set("createdBy", userLogin.getString("userLoginId"));
}
- String invoicePerShipment = UtilProperties.getPropertyValue("AccountingConfig","create.invoice.per.shipment");
+ String invoicePerShipment = EntityUtilProperties.getPropertyValue("AccountingConfig","create.invoice.per.shipment", delegator);
if (UtilValidate.isNotEmpty(invoicePerShipment)) {
orderHeader.set("invoicePerShipment", invoicePerShipment);
}
diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java b/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
index c212d62..41e069f 100644
--- a/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
+++ b/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
@@ -49,6 +49,7 @@
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityTypeUtil;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.finaccount.FinAccountHelper;
import org.ofbiz.order.order.OrderChangeHelper;
import org.ofbiz.order.order.OrderReadHelper;
@@ -1608,7 +1609,7 @@
// get the payment config
String paymentConfig = ProductStoreWorker.getProductStorePaymentProperties(delegator, cart.getProductStoreId(), "GIFT_CARD", null, true);
- String giftCardType = UtilProperties.getPropertyValue(paymentConfig, "", "ofbiz");
+ String giftCardType = EntityUtilProperties.getPropertyValue(paymentConfig, "", "ofbiz", delegator);
String balanceField = null;
// get the gift card objects to check
diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
index d217b42..c1be354 100644
--- a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
+++ b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
@@ -47,6 +47,7 @@
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityTypeUtil;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.order.shoppingcart.product.ProductPromoWorker;
import org.ofbiz.product.config.ProductConfigWorker;
@@ -231,7 +232,7 @@
// get order item attributes
Map<String, String> orderItemAttributes = FastMap.newInstance();
- String orderItemAttributePrefix = UtilProperties.getPropertyValue("order.properties", "order.item.attr.prefix");
+ String orderItemAttributePrefix = EntityUtilProperties.getPropertyValue("order.properties", "order.item.attr.prefix", delegator);
for (Entry<String, ? extends Object> entry : context.entrySet()) {
if (entry.getKey().toString().contains(orderItemAttributePrefix) && UtilValidate.isNotEmpty(entry.getValue())) {
orderItemAttributes.put(entry.getKey().replaceAll(orderItemAttributePrefix, ""), entry.getValue().toString());
diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
index f4d2828..5f9b84a 100644
--- a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
+++ b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
@@ -54,6 +54,7 @@
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.order.shoppingcart.product.ProductPromoWorker;
import org.ofbiz.order.shoppinglist.ShoppingListEvents;
@@ -1188,7 +1189,7 @@
}
}
}
- if ("true".equals(UtilProperties.getPropertyValue("catalog.properties", "convertProductPriceCurrency"))){
+ if ("true".equals(EntityUtilProperties.getPropertyValue("catalog.properties", "convertProductPriceCurrency", delegator))){
priceContext.put("currencyUomIdTo", cart.getCurrency());
} else {
priceContext.put("currencyUomId", cart.getCurrency());
diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
index d584aa9..8535013 100644
--- a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
+++ b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
@@ -46,6 +46,7 @@
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityTypeUtil;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.order.shoppingcart.ShoppingCart.CartShipInfo;
import org.ofbiz.order.shoppingcart.ShoppingCart.CartShipInfo.CartShipItemInfo;
@@ -988,7 +989,7 @@
}
// If we still have no currency, use the default from general.properties. Failing that, use USD
if (currency == null) {
- currency = UtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD");
+ currency = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator);
}
// create the cart
diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java b/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
index 0c334db..c4e84b8 100644
--- a/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
+++ b/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
@@ -411,6 +411,7 @@
// set a max limit on how many times each promo can be run, for cases where there is no use limit this will be the use limit
//default to 2 times the number of items in the cart
long maxUseLimit = cart.getTotalQuantity().multiply(BigDecimal.valueOf(2)).setScale(0, BigDecimal.ROUND_CEILING).longValue();
+ maxUseLimit = Math.max(1, maxUseLimit);
try {
// repeat until no more rules to run: either all rules are run, or no changes to the cart in a loop
diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java b/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
index 180ce32..9472704 100644
--- a/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
+++ b/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
@@ -41,6 +41,7 @@
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.order.shoppingcart.ShoppingCart;
import org.ofbiz.order.shoppingcart.product.ProductPromoWorker;
@@ -292,6 +293,7 @@
public static BigDecimal getExternalShipEstimate(LocalDispatcher dispatcher, GenericValue storeShipMeth, Map<String, Object> context) throws GeneralException {
String shipmentCustomMethodId = storeShipMeth.getString("shipmentCustomMethodId");
+ Delegator delegator = dispatcher.getDelegator();
String serviceName = "";
if (UtilValidate.isNotEmpty(shipmentCustomMethodId)) {
serviceName = getShipmentCustomMethod(dispatcher.getDelegator(), shipmentCustomMethodId);
@@ -302,10 +304,10 @@
// invoke the external shipping estimate service
BigDecimal externalShipAmt = null;
if (serviceName != null) {
- String doEstimates = UtilProperties.getPropertyValue("shipment.properties", "shipment.doratecheck", "true");
+ String doEstimates = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.doratecheck", "true", delegator);
//If all estimates are not turned off, check for the individual one
if ("true".equals(doEstimates)) {
- String dothisEstimate = UtilProperties.getPropertyValue("shipment.properties", "shipment.doratecheck." + serviceName, "true");
+ String dothisEstimate = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.doratecheck." + serviceName, "true", delegator);
if ("false".equals(dothisEstimate))
serviceName = null;
} else {
diff --git a/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java b/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
index a964af5..edcd79d 100644
--- a/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
+++ b/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
@@ -41,6 +41,7 @@
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityTypeUtil;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.order.shoppingcart.CartItemModifyException;
import org.ofbiz.order.shoppingcart.CheckOutHelper;
@@ -588,7 +589,7 @@
} catch (GenericEntityException e) {
Debug.logError(e.getMessage(), module);
}
- String maxDaysStr = UtilProperties.getPropertyValue("order.properties", "autosave.max.age", "30");
+ String maxDaysStr = EntityUtilProperties.getPropertyValue("order.properties", "autosave.max.age", "30", delegator);
int maxDays = 0;
try {
maxDays = Integer.parseInt(maxDaysStr);
diff --git a/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java b/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java
index bc50161..1ec3901 100644
--- a/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java
+++ b/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java
@@ -46,6 +46,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.security.Security;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ServiceUtil;
@@ -229,7 +230,7 @@
List<List<GenericValue>> itemAdjustments = FastList.newInstance();
// check for a valid state/province geo
- String validStates = UtilProperties.getPropertyValue("zipsales.properties", "zipsales.valid.states");
+ String validStates = EntityUtilProperties.getPropertyValue("zipsales.properties", "zipsales.valid.states", delegator);
if (UtilValidate.isNotEmpty(validStates)) {
List<String> stateSplit = StringUtil.split(validStates, "|");
if (!stateSplit.contains(stateProvince)) {
diff --git a/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy b/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy
index 776339d..3eaa2a9 100644
--- a/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy
+++ b/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy
@@ -150,7 +150,7 @@
context.viewIndex = viewIndex;
viewSize = request.getParameter("viewSize") ? Integer.valueOf(request.getParameter("viewSize")) :
- UtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20");
+ EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator);
context.viewSize = viewSize;
// get the lookup flag
diff --git a/applications/party/script/org/ofbiz/party/user/UserEvents.xml b/applications/party/script/org/ofbiz/party/user/UserEvents.xml
index c418f05..3c900b8 100644
--- a/applications/party/script/org/ofbiz/party/user/UserEvents.xml
+++ b/applications/party/script/org/ofbiz/party/user/UserEvents.xml
@@ -311,8 +311,9 @@
<if-not-empty field="newUserLogin">
<!-- If password encryption is enabled, encrpyt it now -->
+ <set field="delegator" from-field="parameters.delegator" type="Object"/>
<call-bsh><![CDATA[
- boolean useEncryption = "true".equals(org.ofbiz.base.util.UtilProperties.getPropertyValue("security", "password.encrypt"));
+ boolean useEncryption = "true".equals(org.ofbiz.entity.util.EntityUtilProperties.getPropertyValue("security", "password.encrypt", delegator));
if (useEncryption) { newUserLogin.set("currentPassword", org.ofbiz.base.crypto.HashCrypt.getDigestHash((String) newUserLogin.get("currentPassword"))); }
]]></call-bsh>
@@ -322,7 +323,6 @@
<set-current-user-login value-field="newUserLogin"/>
<!-- On successful user creation, create password history record if configured -->
- <set field="delegator" from-field="parameters.delegator" type="Object"/>
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="autoPasswordChangeEnabled">
<string value="security"/>
<string value="user.auto.change.password.enable"/>
diff --git a/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java b/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
index ca343f4..d0d3031 100644
--- a/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
+++ b/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
@@ -62,6 +62,7 @@
import org.ofbiz.entity.util.EntityListIterator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
@@ -715,8 +716,8 @@
if (Debug.verboseOn()) Debug.logVerbose("Processing Incoming Email " + aboutThisEmail, module);
// ignore the message when the spam status = yes
- String spamHeaderName = UtilProperties.getPropertyValue("general.properties", "mail.spam.name", "N");
- String configHeaderValue = UtilProperties.getPropertyValue("general.properties", "mail.spam.value");
+ String spamHeaderName = EntityUtilProperties.getPropertyValue("general.properties", "mail.spam.name", "N", delegator);
+ String configHeaderValue = EntityUtilProperties.getPropertyValue("general.properties", "mail.spam.value", delegator);
// only execute when config file has been set && header variable found
if (!spamHeaderName.equals("N") && wrapper.getHeader(spamHeaderName) != null && wrapper.getHeader(spamHeaderName).length > 0) {
String msgHeaderValue = wrapper.getHeader(spamHeaderName)[0];
@@ -1120,8 +1121,9 @@
private static List<Map<String, Object>> buildListOfWorkEffortInfoFromEmailAddresses(Address [] addresses, GenericValue userLogin, LocalDispatcher dispatcher) throws GenericServiceException {
InternetAddress emailAddress = null;
Map<String, Object> result = null;
+ Delegator delegator = dispatcher.getDelegator();
List<Map<String, Object>> tempResults = new LinkedList<Map<String,Object>>();
- String caseInsensitiveEmail = org.ofbiz.base.util.UtilProperties.getPropertyValue("general.properties", "mail.address.caseInsensitive", "N");
+ String caseInsensitiveEmail = EntityUtilProperties.getPropertyValue("general.properties", "mail.address.caseInsensitive", "N", delegator);
if (addresses != null) {
for (Address addr: addresses) {
diff --git a/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java b/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
index 735e402..22db4a1 100644
--- a/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
+++ b/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
@@ -43,6 +43,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.security.Security;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ModelService;
@@ -1050,7 +1051,7 @@
String emailAddress = (String) context.get("emailAddress");
String verifyHash = null;
- String expireTime = UtilProperties.getPropertyValue("security", "email_verification.expire.hours");
+ String expireTime = EntityUtilProperties.getPropertyValue("security", "email_verification.expire.hours", delegator);
Integer expTime = Integer.valueOf(expireTime);
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR, expTime.intValue());
diff --git a/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy b/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy
index e84a715..48de7ca 100644
--- a/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy
+++ b/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy
@@ -21,7 +21,7 @@
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.product.catalog.CatalogWorker;
import org.ofbiz.webapp.website.WebSiteWorker;
-import org.ofbiz.base.util.UtilProperties ;
+import org.ofbiz.entity.util.EntityUtilProperties;
prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
@@ -105,7 +105,7 @@
context.shoppingListItemDatas = shoppingListItemDatas;
// pagination for the shopping list
viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 0);
- viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: UtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20"));
+ viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator));
listSize = shoppingListItemDatas ? shoppingListItemDatas.size() : 0;
lowIndex = (viewIndex * viewSize) + 1;
diff --git a/applications/party/webapp/partymgr/WEB-INF/actions/visit/ShowVisits.groovy b/applications/party/webapp/partymgr/WEB-INF/actions/visit/ShowVisits.groovy
index cac0eac..d149b73 100644
--- a/applications/party/webapp/partymgr/WEB-INF/actions/visit/ShowVisits.groovy
+++ b/applications/party/webapp/partymgr/WEB-INF/actions/visit/ShowVisits.groovy
@@ -21,6 +21,7 @@
import org.ofbiz.entity.condition.*;
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.base.util.*
+import org.ofbiz.entity.util.EntityUtilProperties;
module = "showvisits.groovy";
@@ -42,7 +43,7 @@
beganTransaction = TransactionUtil.begin();
viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 1);
- viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: UtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20"));
+ viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator));
context.viewIndex = viewIndex;
context.viewSize = viewSize;
diff --git a/applications/product/src/org/ofbiz/product/image/ScaleImage.java b/applications/product/src/org/ofbiz/product/image/ScaleImage.java
index c2c68b2..d033fcc 100644
--- a/applications/product/src/org/ofbiz/product/image/ScaleImage.java
+++ b/applications/product/src/org/ofbiz/product/image/ScaleImage.java
@@ -114,12 +114,12 @@
String type = null;
String id = null;
if (viewType.toLowerCase().contains("main")) {
- String filenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
+ String filenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.format", (Delegator) context.get("delegator"));
filenameExpander = FlexibleStringExpander.getInstance(filenameFormat);
id = (String) context.get("productId");
fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "type", "original"));
} else if (viewType.toLowerCase().contains("additional") && viewNumber != null && !viewNumber.equals("0")) {
- String filenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format");
+ String filenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format", (Delegator) context.get("delegator"));
filenameExpander = FlexibleStringExpander.getInstance(filenameFormat);
id = (String) context.get("productId");
if (filenameFormat.endsWith("${id}")) {
@@ -282,7 +282,7 @@
String imgName = filenameToUse.substring(0, index - 1);
String imgExtension = filenameToUse.substring(index + 1);
// paths
- String mainFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
+ String mainFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.format", (Delegator) context.get("delegator"));
String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", (Delegator)context.get("delegator")), context);
String imageUrlPrefix = EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",(Delegator)context.get("delegator"));
@@ -328,7 +328,7 @@
// new Filename Format
FlexibleStringExpander addFilenameExpander = mainFilenameExpander;
if (viewType.toLowerCase().contains("additional")) {
- String addFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format");
+ String addFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format", (Delegator) context.get("delegator"));
addFilenameExpander = FlexibleStringExpander.getInstance(addFilenameFormat);
}
diff --git a/applications/product/src/org/ofbiz/product/imagemanagement/CropImage.java b/applications/product/src/org/ofbiz/product/imagemanagement/CropImage.java
index ac51c22..53c6ddf 100644
--- a/applications/product/src/org/ofbiz/product/imagemanagement/CropImage.java
+++ b/applications/product/src/org/ofbiz/product/imagemanagement/CropImage.java
@@ -34,7 +34,9 @@
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.string.FlexibleStringExpander;
+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.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
@@ -49,8 +51,9 @@
public static Map<String, Object> imageCrop(DispatchContext dctx, Map<String, ? extends Object> context)
throws IOException, JDOMException {
LocalDispatcher dispatcher = dctx.getDispatcher();
+ Delegator delegator = dispatcher.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
- String nameOfThumb = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail"), context);
+ String nameOfThumb = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail", delegator), context);
String productId = (String) context.get("productId");
String imageName = (String) context.get("imageName");
@@ -87,8 +90,8 @@
String filenameToUse = (String) contentResult.get("contentId") + ".jpg";
String filenameTouseThumb = (String) contentResult.get("contentId") + nameOfThumb + ".jpg";
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context);
BufferedImage bufImg = ImageIO.read(new File(imageServerPath + "/" + productId + "/" + imageName));
int x = Integer.parseInt(imageX);
diff --git a/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java b/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java
index d509875..91c744f 100644
--- a/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java
+++ b/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java
@@ -56,6 +56,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
@@ -71,9 +72,9 @@
Map<String, Object> result = FastMap.newInstance();
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
- String nameOfThumb = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context);
+ String nameOfThumb = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail", delegator), context);
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productId = (String) context.get("productId");
@@ -248,12 +249,13 @@
public static String uploadFrame(HttpServletRequest request, HttpServletResponse response) {
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
+ Delegator delegator = dispatcher.getDelegator();
HttpSession session = request.getSession();
GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context);
Map<String, Object> tempFile = LayoutWorker.uploadImageAndParameters(request, "uploadedFile");
String imageName = tempFile.get("imageFileName").toString();
String mimType = tempFile.get("uploadMimeType").toString();
@@ -326,7 +328,7 @@
Delegator delegator = (Delegator) request.getAttribute("delegator");
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
HttpSession session = request.getSession();
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
String productId = request.getParameter("productId");
String imageName = request.getParameter("imageName");
@@ -425,7 +427,7 @@
public static String deleteFrameImage(HttpServletRequest request, HttpServletResponse response) {
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", (Delegator) context.get("delegator")), context);
File file = new File(imageServerPath + "/preview/" + "/previewImage.jpg");
if (file.exists()) {
file.delete();
diff --git a/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java b/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
index 54826df..ae6a9bf 100644
--- a/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
+++ b/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
@@ -50,6 +50,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
@@ -81,9 +82,9 @@
Locale locale = (Locale) context.get("locale");
if (UtilValidate.isNotEmpty(uploadFileName)) {
- String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ String imageFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.format", delegator);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context);
String rootTargetDirectory = imageServerPath;
File rootTargetDir = new File(rootTargetDirectory);
if (!rootTargetDir.exists()) {
@@ -261,7 +262,7 @@
return ServiceUtil.returnError(e.getMessage());
}
- String autoApproveImage = UtilProperties.getPropertyValue("catalog", "image.management.autoApproveImage");
+ String autoApproveImage = EntityUtilProperties.getPropertyValue("catalog", "image.management.autoApproveImage", delegator);
if (autoApproveImage.equals("Y")) {
Map<String, Object> autoApproveCtx = FastMap.newInstance();
autoApproveCtx.put("contentId", contentId);
@@ -282,10 +283,11 @@
String productId = (String) context.get("productId");
String contentId = (String) context.get("contentId");
String dataResourceName = (String) context.get("dataResourceName");
+ Delegator delegator = dctx.getDelegator();
try {
if (UtilValidate.isNotEmpty(contentId)) {
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
File file = new File(imageServerPath + "/" + productId + "/" + dataResourceName);
file.delete();
}
@@ -334,8 +336,8 @@
index = filenameToUse.lastIndexOf(".");
String imgExtension = filenameToUse.substring(index + 1);
// paths
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", (Delegator) context.get("delegator")), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", (Delegator) context.get("delegator")), context);
/* get original BUFFERED IMAGE */
@@ -488,8 +490,8 @@
Locale locale = (Locale) context.get("locale");
//FIXME can be removed ?
// String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String nameOfThumb = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+ String nameOfThumb = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail", delegator), context);
// Create content for thumbnail
Map<String, Object> contentThumb = FastMap.newInstance();
@@ -696,9 +698,10 @@
public static Map<String, Object> createNewImageThumbnail(DispatchContext dctx, Map<String, ? extends Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
+ Delegator delegator = dispatcher.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context);
String productId = (String) context.get("productId");
String contentId = (String) context.get("contentId");
String dataResourceName = (String) context.get("dataResourceName");
@@ -759,7 +762,8 @@
}
public static Map<String, Object> resizeImageOfProduct(DispatchContext dctx, Map<String, ? extends Object> context) {
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ Delegator delegator = dctx.getDelegator();
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
String productId = (String) context.get("productId");
String dataResourceName = (String) context.get("dataResourceName");
String width = (String) context.get("resizeWidth");
@@ -786,8 +790,8 @@
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context);
String productId = (String) context.get("productId");
String contentId = (String) context.get("contentId");
String filenameToUse = (String) context.get("drDataResourceName");
diff --git a/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java b/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java
index 184cb8b..87d2b6d 100644
--- a/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java
+++ b/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java
@@ -36,6 +36,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ServiceUtil;
@@ -49,7 +50,7 @@
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
String productId = (String) context.get("productId");
String contentIdExist = (String) context.get("contentIdExist");
String contentIdReplace = (String) context.get("contentIdReplace");
diff --git a/applications/product/src/org/ofbiz/product/imagemanagement/RotateImage.java b/applications/product/src/org/ofbiz/product/imagemanagement/RotateImage.java
index 90e733a..63d38de 100644
--- a/applications/product/src/org/ofbiz/product/imagemanagement/RotateImage.java
+++ b/applications/product/src/org/ofbiz/product/imagemanagement/RotateImage.java
@@ -35,7 +35,9 @@
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.string.FlexibleStringExpander;
+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.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
@@ -50,8 +52,9 @@
public static Map<String, Object> imageRotate(DispatchContext dctx, Map<String, ? extends Object> context)
throws IOException, JDOMException {
LocalDispatcher dispatcher = dctx.getDispatcher();
+ Delegator delegator = dctx.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
- String nameOfThumb = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail"), context);
+ String nameOfThumb = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail", delegator), context);
String productId = (String) context.get("productId");
String imageName = (String) context.get("imageName");
@@ -85,8 +88,8 @@
String filenameToUse = (String) contentResult.get("contentId") + ".jpg";
String filenameTouseThumb = (String) contentResult.get("contentId") + nameOfThumb + ".jpg";
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context);
BufferedImage bufImg = ImageIO.read(new File(imageServerPath + "/" + productId + "/" + imageName));
int bufImgType;
diff --git a/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java b/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java
index 9aed40b..46b4dad 100644
--- a/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java
+++ b/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java
@@ -49,6 +49,7 @@
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.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ServiceUtil;
@@ -65,9 +66,10 @@
public static String createWatermarkImage(HttpServletRequest request, HttpServletResponse response) throws WatermarkerException, IOException {
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
- String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
- String nameOfThumb = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail"), context);
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context);
+ String nameOfThumb = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail", delegator), context);
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
String watermarkText = null;
@@ -311,7 +313,8 @@
public static String setPreviewWaterMark(HttpServletRequest request, HttpServletResponse response) {
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
String productId = request.getParameter("productId");
String imageName = request.getParameter("imageName");
String text = request.getParameter("text");
@@ -372,7 +375,8 @@
public static String deletePreviewWatermarkImage(HttpServletRequest request, HttpServletResponse response) {
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
+ String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
String count = request.getParameter("count");
File file = new File(imageServerPath + "/preview/" + "/previewImage" + count + ".jpg");
file.delete();
diff --git a/applications/product/src/org/ofbiz/product/price/PriceServices.java b/applications/product/src/org/ofbiz/product/price/PriceServices.java
index 163efab..50f2ca2 100644
--- a/applications/product/src/org/ofbiz/product/price/PriceServices.java
+++ b/applications/product/src/org/ofbiz/product/price/PriceServices.java
@@ -522,7 +522,7 @@
}
// Convert the value to the price currency, if required
- if ("true".equals(UtilProperties.getPropertyValue("catalog.properties", "convertProductPriceCurrency"))) {
+ if ("true".equals(EntityUtilProperties.getPropertyValue("catalog.properties", "convertProductPriceCurrency", delegator))) {
if (UtilValidate.isNotEmpty(currencyDefaultUomId) && UtilValidate.isNotEmpty(currencyUomIdTo) && !currencyDefaultUomId.equals(currencyUomIdTo)) {
if (UtilValidate.isNotEmpty(result)) {
Map<String, Object> convertPriceMap = FastMap.newInstance();
diff --git a/applications/product/src/org/ofbiz/product/product/KeywordIndex.java b/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
index c13d170..a8259f5 100644
--- a/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
+++ b/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
@@ -40,6 +40,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
/**
* Does indexing in preparation for a keyword search.
@@ -59,22 +60,21 @@
public static void indexKeywords(GenericValue product, boolean doAll) throws GenericEntityException {
if (product == null) return;
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-
+ Delegator delegator = product.getDelegator();
if (!doAll) {
if ("N".equals(product.getString("autoCreateKeywords"))) {
return;
}
- if ("Y".equals(product.getString("isVariant")) && "true".equals(UtilProperties.getPropertyValue("prodsearch", "index.ignore.variants"))) {
+ if ("Y".equals(product.getString("isVariant")) && "true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.ignore.variants", delegator))) {
return;
}
Timestamp salesDiscontinuationDate = product.getTimestamp("salesDiscontinuationDate");
if (salesDiscontinuationDate != null && salesDiscontinuationDate.before(nowTimestamp) &&
- "true".equals(UtilProperties.getPropertyValue("prodsearch", "index.ignore.discontinued.sales"))) {
+ "true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.ignore.discontinued.sales", delegator))) {
return;
}
}
-
- Delegator delegator = product.getDelegator();
+
if (delegator == null) return;
String productId = product.getString("productId");
@@ -90,33 +90,33 @@
int pidWeight = 1;
try {
- pidWeight = Integer.parseInt(UtilProperties.getPropertyValue("prodsearch", "index.weight.Product.productId", "0"));
+ pidWeight = Integer.parseInt(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.Product.productId", "0", delegator));
} catch (Exception e) {
Debug.logWarning("Could not parse weight number: " + e.toString(), module);
}
keywords.put(product.getString("productId").toLowerCase(), Long.valueOf(pidWeight));
// Product fields - default is 0 if not found in the properties file
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Product.productName", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.Product.productName", "0", delegator))) {
addWeightedKeywordSourceString(product, "productName", strings);
}
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Product.internalName", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.Product.internalName", "0", delegator))) {
addWeightedKeywordSourceString(product, "internalName", strings);
}
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Product.brandName", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.Product.brandName", "0", delegator))) {
addWeightedKeywordSourceString(product, "brandName", strings);
}
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Product.description", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.Product.description", "0", delegator))) {
addWeightedKeywordSourceString(product, "description", strings);
}
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Product.longDescription", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.Product.longDescription", "0", delegator))) {
addWeightedKeywordSourceString(product, "longDescription", strings);
}
// ProductFeatureAppl
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.description", "0")) ||
- !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.abbrev", "0")) ||
- !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.idCode", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.description", "0", delegator)) ||
+ !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.abbrev", "0", delegator)) ||
+ !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.idCode", "0", delegator))) {
// get strings from attributes and features
List<GenericValue> productFeatureAndAppls = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where("productId", productId).queryList();
for (GenericValue productFeatureAndAppl: productFeatureAndAppls) {
@@ -127,8 +127,8 @@
}
// ProductAttribute
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrName", "0")) ||
- !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrValue", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrName", "0", delegator)) ||
+ !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrValue", "0", delegator))) {
List<GenericValue> productAttributes = EntityQuery.use(delegator).from("ProductAttribute").where("productId", productId).queryList();
for (GenericValue productAttribute: productAttributes) {
addWeightedKeywordSourceString(productAttribute, "attrName", strings);
@@ -137,7 +137,7 @@
}
// GoodIdentification
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.GoodIdentification.idValue", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.GoodIdentification.idValue", "0", delegator))) {
List<GenericValue> goodIdentifications = EntityQuery.use(delegator).from("GoodIdentification").where("productId", productId).queryList();
for (GenericValue goodIdentification: goodIdentifications) {
addWeightedKeywordSourceString(goodIdentification, "idValue", strings);
@@ -146,12 +146,12 @@
// Variant Product IDs
if ("Y".equals(product.getString("isVirtual"))) {
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0", delegator))) {
List<GenericValue> variantProductAssocs = EntityQuery.use(delegator).from("ProductAssoc").where("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT").filterByDate().queryList();
for (GenericValue variantProductAssoc: variantProductAssocs) {
int weight = 1;
try {
- weight = Integer.parseInt(UtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0"));
+ weight = Integer.parseInt(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0", delegator));
} catch (Exception e) {
Debug.logWarning("Could not parse weight number: " + e.toString(), module);
}
@@ -162,12 +162,12 @@
}
}
- String productContentTypes = UtilProperties.getPropertyValue("prodsearch", "index.include.ProductContentTypes");
+ String productContentTypes = EntityUtilProperties.getPropertyValue("prodsearch", "index.include.ProductContentTypes", delegator);
for (String productContentTypeId: productContentTypes.split(",")) {
int weight = 1;
try {
// this is defaulting to a weight of 1 because you specified you wanted to index this type
- weight = Integer.parseInt(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductContent." + productContentTypeId, "1"));
+ weight = Integer.parseInt(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductContent." + productContentTypeId, "1", delegator));
} catch (Exception e) {
Debug.logWarning("Could not parse weight number: " + e.toString(), module);
}
@@ -191,7 +191,7 @@
}
List<GenericValue> toBeStored = FastList.newInstance();
- int keywordMaxLength = Integer.parseInt(UtilProperties.getPropertyValue("prodsearch", "product.keyword.max.length"));
+ int keywordMaxLength = Integer.parseInt(EntityUtilProperties.getPropertyValue("prodsearch", "product.keyword.max.length", delegator));
for (Map.Entry<String, Long> entry: keywords.entrySet()) {
if (entry.getKey().length() <= keywordMaxLength) {
GenericValue productKeyword = delegator.makeValue("ProductKeyword", UtilMisc.toMap("productId", product.getString("productId"), "keyword", entry.getKey(), "keywordTypeId", "KWT_KEYWORD", "relevancyWeight", entry.getValue()));
@@ -201,7 +201,7 @@
if (toBeStored.size() > 0) {
if (Debug.verboseOn()) Debug.logVerbose("[KeywordIndex.indexKeywords] Storing " + toBeStored.size() + " keywords for productId " + product.getString("productId"), module);
- if ("true".equals(UtilProperties.getPropertyValue("prodsearch", "index.delete.on_index", "false"))) {
+ if ("true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.delete.on_index", "false", delegator))) {
// delete all keywords if the properties file says to
delegator.removeByAnd("ProductKeyword", UtilMisc.toMap("productId", product.getString("productId")));
}
@@ -229,7 +229,8 @@
int weight = 1;
try {
- weight = Integer.parseInt(UtilProperties.getPropertyValue("prodsearch", "index.weight." + value.getEntityName() + "." + fieldName, "1"));
+ Delegator delegator = value.getDelegator();
+ weight = Integer.parseInt(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight." + value.getEntityName() + "." + fieldName, "1", delegator));
} catch (Exception e) {
Debug.logWarning("Could not parse weight number: " + e.toString(), module);
}
diff --git a/applications/product/src/org/ofbiz/product/product/ProductEvents.java b/applications/product/src/org/ofbiz/product/product/ProductEvents.java
index eac49f9..62309bf 100644
--- a/applications/product/src/org/ofbiz/product/product/ProductEvents.java
+++ b/applications/product/src/org/ofbiz/product/product/ProductEvents.java
@@ -54,6 +54,7 @@
import org.ofbiz.entity.util.EntityListIterator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.product.store.ProductStoreWorker;
import org.ofbiz.security.Security;
import org.ofbiz.service.GenericServiceException;
@@ -98,10 +99,10 @@
if (!"Y".equals(doAll)) {
List<EntityCondition> condList = FastList.newInstance();
condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("autoCreateKeywords", EntityOperator.NOT_EQUAL, "N")));
- if ("true".equals(UtilProperties.getPropertyValue("prodsearch", "index.ignore.variants"))) {
+ if ("true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.ignore.variants", delegator))) {
condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("isVariant", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("isVariant", EntityOperator.NOT_EQUAL, "Y")));
}
- if ("true".equals(UtilProperties.getPropertyValue("prodsearch", "index.ignore.discontinued.sales"))) {
+ if ("true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.ignore.discontinued.sales", delegator))) {
condList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp)));
}
condition = EntityCondition.makeCondition(condList, EntityOperator.AND);
diff --git a/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java b/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java
index e02b11d..c9b9924 100644
--- a/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java
+++ b/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java
@@ -55,6 +55,7 @@
import org.ofbiz.entity.util.EntityListIterator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.product.catalog.CatalogWorker;
import org.ofbiz.product.category.CategoryWorker;
import org.ofbiz.product.feature.ParametricSearch;
@@ -913,7 +914,7 @@
List<ProductSearchConstraint> productSearchConstraintList = ProductSearchOptions.getConstraintList(session);
String noConditionFind = (String) requestParams.get("noConditionFind");
if (UtilValidate.isEmpty(noConditionFind)) {
- noConditionFind = UtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind");
+ noConditionFind = EntityUtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind", delegator);
}
// if noConditionFind to Y then find without conditions otherwise search according to constraints.
if ("Y".equals(noConditionFind) || UtilValidate.isNotEmpty(productSearchConstraintList)) {
diff --git a/applications/product/src/org/ofbiz/product/product/ProductServices.java b/applications/product/src/org/ofbiz/product/product/ProductServices.java
index 5bcd392..c5f091e 100644
--- a/applications/product/src/org/ofbiz/product/product/ProductServices.java
+++ b/applications/product/src/org/ofbiz/product/product/ProductServices.java
@@ -901,9 +901,9 @@
}
public static Map<String, Object> updateProductIfAvailableFromShipment(DispatchContext dctx, Map<String, ? extends Object> context) {
- if ("Y".equals(UtilProperties.getPropertyValue("catalog.properties", "reactivate.product.from.receipt", "N"))) {
+ Delegator delegator = dctx.getDelegator();
+ if ("Y".equals(EntityUtilProperties.getPropertyValue("catalog.properties", "reactivate.product.from.receipt", "N", delegator))) {
LocalDispatcher dispatcher = dctx.getDispatcher();
- Delegator delegator = dctx.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
String inventoryItemId = (String) context.get("inventoryItemId");
@@ -975,7 +975,7 @@
Locale locale = (Locale) context.get("locale");
if (UtilValidate.isNotEmpty(context.get("_uploadedFile_fileName"))) {
- String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format");
+ String imageFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format", delegator);
String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
String imageUrlPrefix = EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix", delegator);
@@ -1269,7 +1269,7 @@
Locale locale = (Locale) context.get("locale");
if (UtilValidate.isNotEmpty(context.get("_uploadedFile_fileName"))) {
- String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
+ String imageFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.format", delegator);
String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path",delegator), context);
String imageUrlPrefix = EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix", delegator);
diff --git a/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java b/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
index 56088de..39edf9c 100644
--- a/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
+++ b/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
@@ -501,7 +501,7 @@
String errMsg = null;
if (UtilValidate.isEmpty(pattern)) {
- String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
+ String imageFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.format", delegator);
String imageUrlPrefix = EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator);
pattern = imageUrlPrefix + "/" + imageFilenameFormat;
}
@@ -624,14 +624,14 @@
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
Set<String> productFeatureTypeIdsToExclude = FastSet.newInstance();
- String excludeProp = UtilProperties.getPropertyValue("prodsearch", "attach.feature.type.exclude");
+ String excludeProp = EntityUtilProperties.getPropertyValue("prodsearch", "attach.feature.type.exclude", delegator);
if (UtilValidate.isNotEmpty(excludeProp)) {
List<String> typeList = StringUtil.split(excludeProp, ",");
productFeatureTypeIdsToExclude.addAll(typeList);
}
Set<String> productFeatureTypeIdsToInclude = null;
- String includeProp = UtilProperties.getPropertyValue("prodsearch", "attach.feature.type.include");
+ String includeProp = EntityUtilProperties.getPropertyValue("prodsearch", "attach.feature.type.include", delegator);
if (UtilValidate.isNotEmpty(includeProp)) {
List<String> typeList = StringUtil.split(includeProp, ",");
if (typeList.size() > 0) {
diff --git a/applications/product/src/org/ofbiz/shipment/shipment/ShipmentWorker.java b/applications/product/src/org/ofbiz/shipment/shipment/ShipmentWorker.java
index 1aa527f..028de76 100644
--- a/applications/product/src/org/ofbiz/shipment/shipment/ShipmentWorker.java
+++ b/applications/product/src/org/ofbiz/shipment/shipment/ShipmentWorker.java
@@ -28,10 +28,11 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
@@ -161,8 +162,9 @@
public static BigDecimal calcPackageWeight(DispatchContext dctx, Map<String, BigDecimal> packageMap, List<Map<String, Object>> shippableItemInfo, BigDecimal additionalWeight) {
LocalDispatcher dispatcher = dctx.getDispatcher();
+ Delegator delegator = dctx.getDelegator();
BigDecimal totalWeight = BigDecimal.ZERO;
- String defaultWeightUomId = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom");
+ String defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom", delegator);
for (Map.Entry<String, BigDecimal> entry: packageMap.entrySet()) {
String productId = entry.getKey();
diff --git a/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java b/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
index 77fb0b6..083dccd 100644
--- a/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
+++ b/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
@@ -46,6 +46,7 @@
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;
@@ -212,7 +213,7 @@
}
if ((shippableWeight == null) || (shippableWeight.compareTo(BigDecimal.ZERO) <= 0)) {
- String tmpValue = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.weight.value");
+ String tmpValue = EntityUtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.weight.value", delegator);
if (tmpValue != null) {
try {
shippableWeight = new BigDecimal(tmpValue);
@@ -678,7 +679,7 @@
} else {
// use default weight if available
try {
- packageWeight = new BigDecimal(UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.weight.value"));
+ packageWeight = new BigDecimal(EntityUtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.weight.value", delegator));
} catch (NumberFormatException ne) {
Debug.logWarning("Default shippable weight not configured (shipment.default.weight.value)", module);
packageWeight = BigDecimal.ONE;
@@ -970,7 +971,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java b/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
index a023f8e..c1cae12 100644
--- a/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
+++ b/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
@@ -432,7 +432,7 @@
}
// Get the weight units to be used in the request
- String weightUomId = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.weight.uom");
+ String weightUomId = EntityUtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.weight.uom", delegator);
if (UtilValidate.isEmpty(weightUomId)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"FacilityShipmentDefaultWeightUomIdNotFound", locale));
@@ -442,7 +442,7 @@
}
// Get the dimension units to be used in the request
- String dimensionsUomId = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.dimension.uom");
+ String dimensionsUomId = EntityUtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.dimension.uom", delegator);
if (UtilValidate.isEmpty(dimensionsUomId)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"FacilityShipmentDefaultDimensionUomIdNotFound", locale));
@@ -875,7 +875,7 @@
// Use default weight if available
try {
- packageWeight = new BigDecimal(UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.weight.value"));
+ packageWeight = new BigDecimal(EntityUtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.default.weight.value", delegator));
} catch (NumberFormatException ne) {
Debug.logWarning("Default shippable weight not configured (shipment.default.weight.value), assuming 1.0" + weightUomId , module);
packageWeight = BigDecimal.ONE;
@@ -1076,7 +1076,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java b/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
index 825d48a4..b116358 100644
--- a/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
+++ b/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
@@ -2618,7 +2618,7 @@
Element packageWeightElement = UtilXml.addChildElement(packageElement, "PackageWeight", shipmentConfirmRequestDoc);
Element packageWeightUnitOfMeasurementElement = UtilXml.addChildElement(packageElement, "UnitOfMeasurement", shipmentConfirmRequestDoc);
UtilXml.addChildElementValue(packageWeightUnitOfMeasurementElement, "Code", "LBS", shipmentConfirmRequestDoc);
- UtilXml.addChildElementValue(packageWeightElement, "Weight", UtilProperties.getPropertyValue("shipment", "shipment.default.weight.value"), shipmentConfirmRequestDoc);
+ UtilXml.addChildElementValue(packageWeightElement, "Weight", EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.value", delegator), shipmentConfirmRequestDoc);
String shipmentConfirmRequestString = null;
try {
@@ -2912,7 +2912,7 @@
UtilXml.addChildElementValue(shipperElement, "Name", UtilValidate.isNotEmpty(originPostalAddress.getString("toName")) ? originPostalAddress.getString("toName") : "", rateRequestDoc);
UtilXml.addChildElementValue(shipperElement, "AttentionName", UtilValidate.isNotEmpty(originPostalAddress.getString("attnName")) ? originPostalAddress.getString("attnName") : "", rateRequestDoc);
UtilXml.addChildElementValue(shipperElement, "PhoneNumber", originPhoneNumber, rateRequestDoc);
- UtilXml.addChildElementValue(shipperElement, "ShipperNumber", UtilProperties.getPropertyValue("shipment", "shipment.ups.shipper.number"), rateRequestDoc);
+ UtilXml.addChildElementValue(shipperElement, "ShipperNumber", EntityUtilProperties.getPropertyValue("shipment", "shipment.ups.shipper.number", delegator), rateRequestDoc);
Element shipperAddressElement = UtilXml.addChildElement(shipperElement, "Address", rateRequestDoc);
UtilXml.addChildElementValue(shipperAddressElement, "AddressLine1", originPostalAddress.getString("address1"), rateRequestDoc);
@@ -3198,7 +3198,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java b/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
index bdc8c8f..176479d 100644
--- a/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
+++ b/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
@@ -55,6 +55,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.party.contact.ContactMechWorker;
import org.ofbiz.product.product.ProductWorker;
import org.ofbiz.product.store.ProductStoreWorker;
@@ -1787,7 +1788,7 @@
Debug.logError(e, module);
}
} else {
- String value = UtilProperties.getPropertyValue(resource, parameterName);
+ String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
if (value != null) {
returnValue = value.trim();
}
diff --git a/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageServices.java b/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageServices.java
index 3e568aa..42df839 100644
--- a/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageServices.java
+++ b/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageServices.java
@@ -32,6 +32,7 @@
import org.ofbiz.entity.Delegator;
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.ServiceUtil;
@@ -130,6 +131,7 @@
WeightPackageSession weightPackageSession = (WeightPackageSession) context.get("weightPackageSession");
Locale locale = (Locale) context.get("locale");
+ Delegator delegator = dctx.getDelegator();
String orderId = (String) context.get("orderId");
String shipmentId = (String) context.get("shipmentId");
String invoiceId = (String) context.get("invoiceId");
@@ -151,7 +153,7 @@
Map<String, Object> response = FastMap.newInstance();
try {
- String getActualShippingQuoteFromUps = UtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipping", "N");
+ String getActualShippingQuoteFromUps = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipping", "N", delegator);
String result = weightPackageSession.complete(orderId, locale, getActualShippingQuoteFromUps);
if ("showWarningForm".equals(result)) {
response.put("showWarningForm", true);
@@ -168,6 +170,7 @@
public static Map<String, Object> completeShipment(DispatchContext dctx, Map<String, ? extends Object> context) {
Locale locale = (Locale) context.get("locale");
+ Delegator delegator = dctx.getDelegator();
WeightPackageSession weightPackageSession = (WeightPackageSession) context.get("weightPackageSession");
String shipmentId = (String) context.get("shipmentId");
@@ -175,7 +178,7 @@
Map<String, Object> response = FastMap.newInstance();
try {
- String getActualShippingQuoteFromUps = UtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipping", "N");
+ String getActualShippingQuoteFromUps = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipping", "N", delegator);
if (weightPackageSession.completeShipment(orderId, getActualShippingQuoteFromUps)) {
response.put("shipmentId", shipmentId);
} else {
@@ -189,11 +192,12 @@
public static Map<String, Object> savePackagesInfo(DispatchContext dctx, Map<String, ? extends Object> context) {
Locale locale = (Locale) context.get("locale");
+ Delegator delegator = dctx.getDelegator();
WeightPackageSession weightPackageSession = (WeightPackageSession) context.get("weightPackageSession");
String orderId = (String) context.get("orderId");
- String getActualShippingQuoteFromUps = UtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipping", "N");
+ String getActualShippingQuoteFromUps = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.ups.shipping", "N", delegator);
try {
weightPackageSession.savePackagesInfo(orderId, getActualShippingQuoteFromUps);
} catch (GeneralException e) {
diff --git a/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy b/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy
index 7e04280..b6a4169 100644
--- a/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy
+++ b/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategory.groovy
@@ -36,7 +36,7 @@
// make the image file formats
-imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
+imageFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.format", delegator);
imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
imageUrlPrefix = EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix",delegator);
context.imageFilenameFormat = imageFilenameFormat;
diff --git a/applications/product/webapp/catalog/WEB-INF/actions/find/sidedeepcategory.groovy b/applications/product/webapp/catalog/WEB-INF/actions/find/sidedeepcategory.groovy
index d99c425..d815c0f 100644
--- a/applications/product/webapp/catalog/WEB-INF/actions/find/sidedeepcategory.groovy
+++ b/applications/product/webapp/catalog/WEB-INF/actions/find/sidedeepcategory.groovy
@@ -20,6 +20,7 @@
import org.ofbiz.base.util.*
import org.ofbiz.entity.*
import org.ofbiz.product.category.*
+import org.ofbiz.entity.util.EntityUtilProperties;
state = request.getParameter("BrowseCategoriesState");
isOpen = true;
@@ -35,7 +36,7 @@
context.isOpen = isOpen;
requestParameters = UtilHttp.getParameterMap(request);
-defaultTopCategoryId = requestParameters.TOP_CATEGORY ? requestParameters.TOP_CATEGORY : UtilProperties.getPropertyValue("catalog", "top.category.default");
+defaultTopCategoryId = requestParameters.TOP_CATEGORY ? requestParameters.TOP_CATEGORY : EntityUtilProperties.getPropertyValue("catalog", "top.category.default", delegator);
currentTopCategoryId = CategoryWorker.getCatalogTopCategory(request, defaultTopCategoryId);
currentTopCategory = null;
if (isOpen) {
diff --git a/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/ImageUpload.groovy b/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/ImageUpload.groovy
index 6b0c547..3c72de6 100644
--- a/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/ImageUpload.groovy
+++ b/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/ImageUpload.groovy
@@ -27,7 +27,7 @@
context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
// make the image file formats
-imageFilenameFormat = UtilProperties.getPropertyValue('catalog', 'image.filename.format');
+imageFilenameFormat = EntityUtilProperties.getPropertyValue('catalog', 'image.filename.format', delegator);
imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
imageUrlPrefix = EntityUtilProperties.getPropertyValue('catalog', 'image.url.prefix',delegator);
context.imageFilenameFormat = imageFilenameFormat;
diff --git a/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/SetDefaultImage.groovy b/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/SetDefaultImage.groovy
index 740d6ab..8f93b8e 100644
--- a/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/SetDefaultImage.groovy
+++ b/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/SetDefaultImage.groovy
@@ -33,7 +33,7 @@
context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
-imageManagementPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+imageManagementPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context);
String fileType = "original";
String productId = request.getParameter("productId");
@@ -44,7 +44,7 @@
}
// make the image file formats
-imageFilenameFormat = UtilProperties.getPropertyValue('catalog', 'image.filename.format');
+imageFilenameFormat = EntityUtilProperties.getPropertyValue('catalog', 'image.filename.format', delegator);
imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
imageUrlPrefix = EntityUtilProperties.getPropertyValue('catalog', 'image.url.prefix',delegator);
context.imageFilenameFormat = imageFilenameFormat;
diff --git a/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy b/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy
index ab596b7..8a54217 100644
--- a/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy
+++ b/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy
@@ -26,7 +26,7 @@
context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
// make the image file formats
-imageFilenameFormat = UtilProperties.getPropertyValue('catalog', 'image.filename.format');
+imageFilenameFormat = EntityUtilProperties.getPropertyValue('catalog', 'image.filename.format', delegator);
imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", delegator), context);
imageUrlPrefix = EntityUtilProperties.getPropertyValue('catalog', 'image.url.prefix',delegator);
context.imageFilenameFormat = imageFilenameFormat;
diff --git a/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy b/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy
index 34943ec..2f976c0 100644
--- a/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy
+++ b/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy
@@ -22,6 +22,7 @@
import org.ofbiz.entity.condition.*
import org.ofbiz.entity.util.*
import org.ofbiz.product.product.*
+import org.ofbiz.entity.util.EntityUtilProperties;
context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
@@ -303,7 +304,7 @@
context.selFeatureDesc = selFeatureDesc;
// get "all" category id
-String allCategoryId = UtilProperties.getPropertyValue("catalog", "all.product.category");
+String allCategoryId = EntityUtilProperties.getPropertyValue("catalog", "all.product.category", delegator);
context.allCategoryId = allCategoryId;
// show the publish or unpublish section
diff --git a/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy b/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
index d47e483..93555c4 100644
--- a/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
+++ b/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
@@ -40,7 +40,7 @@
// set the page parameters
viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 0);
-viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: UtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20"));
+viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator));
context.viewIndex = viewIndex;
context.viewSize = viewSize;
diff --git a/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy b/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
index cbab97c..09e14e0 100644
--- a/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
+++ b/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
@@ -20,6 +20,7 @@
import org.ofbiz.base.util.*;
import org.ofbiz.order.order.*;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.entity.condition.EntityCondition;
@@ -179,6 +180,6 @@
defaultWeightUomId = facility.defaultWeightUomId;
}
if (!defaultWeightUomId) {
- defaultWeightUomId = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom", "WT_kg");
+ defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom", "WT_kg", delegator);
}
context.defaultWeightUomId = defaultWeightUomId;
diff --git a/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy b/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy
index 7aa9ac4..3502980 100644
--- a/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy
+++ b/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy
@@ -19,6 +19,7 @@
import org.ofbiz.base.util.*
import org.ofbiz.order.order.*
+import org.ofbiz.entity.util.EntityUtilProperties;
facilityId = parameters.facilityId;
if (facilityId) {
@@ -65,7 +66,7 @@
context.shipmentId = shipmentId;
weightUoms = delegator.findList("Uom", EntityCondition.makeCondition(['uomTypeId' : 'WEIGHT_MEASURE']), null, ['description'], null, false);
- defaultWeightUom = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom");
+ defaultWeightUom = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom", delegator);
if (defaultWeightUom) {
defaultWeight = delegator.findOne("Uom", [uomId : defaultWeightUom], false);
if (defaultWeight) {
diff --git a/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy b/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy
index dde2757..be4fea0 100644
--- a/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy
+++ b/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy
@@ -21,6 +21,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.shipment.weightPackage.WeightPackageSession;
@@ -189,7 +190,7 @@
defaultDimensionUomId = facility.defaultDimensionUomId;
}
if (!defaultDimensionUomId) {
- defaultDimensionUomId = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.dimension.uom", "LEN_in");
+ defaultDimensionUomId = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.default.dimension.uom", "LEN_in", delegator);
}
context.defaultDimensionUomId = defaultDimensionUomId;
@@ -198,6 +199,6 @@
defaultWeightUomId = facility.defaultWeightUomId;
}
if (!defaultWeightUomId) {
- defaultWeightUomId = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom", "WT_kg");
+ defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom", "WT_kg", delegator);
}
context.defaultWeightUomId = defaultWeightUomId;
diff --git a/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java b/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
index 288ca7a..d6ad995 100644
--- a/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
+++ b/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
@@ -72,6 +72,7 @@
public static String saveEntryParams(HttpServletRequest request, HttpServletResponse response) {
GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
HttpSession session = request.getSession();
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
// save entry login parameters if we don't have a valid login object
if (userLogin == null) {
@@ -79,10 +80,10 @@
String username = request.getParameter("USERNAME");
String password = request.getParameter("PASSWORD");
- if ((username != null) && ("true".equalsIgnoreCase(UtilProperties.getPropertyValue("security.properties", "username.lowercase")))) {
+ if ((username != null) && ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security.properties", "username.lowercase", delegator)))) {
username = username.toLowerCase();
}
- if ((password != null) && ("true".equalsIgnoreCase(UtilProperties.getPropertyValue("security.properties", "password.lowercase")))) {
+ if ((password != null) && ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security.properties", "password.lowercase", delegator)))) {
password = password.toLowerCase();
}
@@ -128,7 +129,7 @@
String userLoginId = request.getParameter("USERNAME");
String errMsg = null;
- if ((userLoginId != null) && ("true".equals(UtilProperties.getPropertyValue("security.properties", "username.lowercase")))) {
+ if ((userLoginId != null) && ("true".equals(EntityUtilProperties.getPropertyValue("security.properties", "username.lowercase", delegator)))) {
userLoginId = userLoginId.toLowerCase();
}
@@ -184,11 +185,11 @@
String errMsg = null;
- boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
+ boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.encrypt", delegator));
String userLoginId = request.getParameter("USERNAME");
- if ((userLoginId != null) && ("true".equals(UtilProperties.getPropertyValue("security.properties", "username.lowercase")))) {
+ if ((userLoginId != null) && ("true".equals(EntityUtilProperties.getPropertyValue("security.properties", "username.lowercase", delegator)))) {
userLoginId = userLoginId.toLowerCase();
}
@@ -212,13 +213,13 @@
}
if (useEncryption) {
// password encrypted, can't send, generate new password and email to user
- passwordToSend = RandomStringUtils.randomAlphanumeric(Integer.parseInt(UtilProperties.getPropertyValue("security", "password.length.min", "5")));
- if ("true".equals(UtilProperties.getPropertyValue("security.properties", "password.lowercase"))){
+ passwordToSend = RandomStringUtils.randomAlphanumeric(Integer.parseInt(EntityUtilProperties.getPropertyValue("security", "password.length.min", "5", delegator)));
+ if ("true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.lowercase", delegator))){
passwordToSend=passwordToSend.toLowerCase();
}
supposedUserLogin.set("currentPassword", HashCrypt.cryptUTF8(LoginServices.getHashType(), null, passwordToSend));
supposedUserLogin.set("passwordHint", "Auto-Generated Password");
- if ("true".equals(UtilProperties.getPropertyValue("security.properties", "password.email_password.require_password_change"))){
+ if ("true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.email_password.require_password_change", delegator))){
supposedUserLogin.set("requirePasswordChange", "Y");
}
} else {
@@ -386,7 +387,8 @@
public static void setUsername(HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
- String domain = UtilProperties.getPropertyValue("url.properties", "cookie.domain");
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
+ String domain = EntityUtilProperties.getPropertyValue("url.properties", "cookie.domain", delegator);
// first try to get the username from the cookie
synchronized (session) {
if (UtilValidate.isEmpty(getUsername(request))) {
diff --git a/applications/securityext/src/org/ofbiz/securityext/thirdparty/truition/TruitionCoReg.java b/applications/securityext/src/org/ofbiz/securityext/thirdparty/truition/TruitionCoReg.java
index 5935eb1..fa07fd9 100644
--- a/applications/securityext/src/org/ofbiz/securityext/thirdparty/truition/TruitionCoReg.java
+++ b/applications/securityext/src/org/ofbiz/securityext/thirdparty/truition/TruitionCoReg.java
@@ -33,8 +33,10 @@
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.party.contact.ContactHelper;
public class TruitionCoReg {
@@ -43,6 +45,7 @@
public static final String logPrefix = "Truition Cookie Info: ";
public static String truitionReg(HttpServletRequest req, HttpServletResponse resp) {
+ Delegator delegator = (Delegator) req.getAttribute("delegator");
HttpSession session = req.getSession();
GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
StringBuffer cookieNameB = new StringBuffer();
@@ -57,9 +60,9 @@
}
// locate the domain/cookie name setting
- String domainName = UtilProperties.getPropertyValue("truition.properties", "truition.domain.name");
- String cookiePath = UtilProperties.getPropertyValue("truition.properties", "truition.cookie.path");
- String cookieName = UtilProperties.getPropertyValue("truition.properties", "truition.cookie.name");
+ String domainName = EntityUtilProperties.getPropertyValue("truition.properties", "truition.domain.name", delegator);
+ String cookiePath = EntityUtilProperties.getPropertyValue("truition.properties", "truition.cookie.path", delegator);
+ String cookieName = EntityUtilProperties.getPropertyValue("truition.properties", "truition.cookie.name", delegator);
int time = (int) UtilProperties.getPropertyNumber("truition.properties", "truition.cookie.time");
if (UtilValidate.isEmpty(domainName)) {
Debug.logError("Truition is not properly configured; domainName missing; see truition.properties", module);
@@ -101,9 +104,10 @@
}
public static String truitionLogoff(HttpServletRequest req, HttpServletResponse resp) {
+ Delegator delegator = (Delegator) req.getAttribute("delegator");
// locate the domain/cookie name setting
- String domainName = UtilProperties.getPropertyValue("truition.properties", "truition.domain.name");
- String cookieName = UtilProperties.getPropertyValue("truition.properties", "truition.cookie.name");
+ String domainName = EntityUtilProperties.getPropertyValue("truition.properties", "truition.domain.name", delegator);
+ String cookieName = EntityUtilProperties.getPropertyValue("truition.properties", "truition.cookie.name", delegator);
if (UtilValidate.isEmpty(domainName)) {
Debug.logError("Truition is not properly configured; domainName missing; see truition.properties", module);
return "error";
@@ -128,8 +132,9 @@
}
public static String truitionRedirect(HttpServletRequest req, HttpServletResponse resp) {
+ Delegator delegator = (Delegator) req.getAttribute("delegator");
// redirect URL form field
- String redirectUrlName = UtilProperties.getPropertyValue("truition.properties", "truition.redirect.urlName");
+ String redirectUrlName = EntityUtilProperties.getPropertyValue("truition.properties", "truition.redirect.urlName", delegator);
String redirectUrl = req.getParameter(redirectUrlName);
Debug.logInfo("Redirect to : " + redirectUrl, module);
if (truitionEnabled() && redirectUrl != null) {
@@ -148,8 +153,9 @@
}
public static boolean makeTruitionCookie(GenericValue userLogin, StringBuffer cookieName, StringBuffer cookieValue) {
- String domainName = UtilProperties.getPropertyValue("truition.properties", "truition.domain.name");
- String siteId = UtilProperties.getPropertyValue("truition.properties", "truition.siteId");
+ Delegator delegator = userLogin.getDelegator();
+ String domainName = EntityUtilProperties.getPropertyValue("truition.properties", "truition.domain.name", delegator);
+ String siteId = EntityUtilProperties.getPropertyValue("truition.properties", "truition.siteId", delegator);
if (UtilValidate.isEmpty(domainName)) {
Debug.logError("Truition is not properly configured; domainName missing; see truition.properties!", module);
diff --git a/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java b/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
index 6540b4d..2a6e440 100644
--- a/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
+++ b/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java
@@ -39,6 +39,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
public class WorkEffortKeywordIndex {
public static final String module = WorkEffortKeywordIndex.class.getName();
@@ -58,7 +59,7 @@
List<String> strings = FastList.newInstance();
int widWeight = 1;
try {
- widWeight = Integer.parseInt(UtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffort.workEffortId", "1"));
+ widWeight = Integer.parseInt(EntityUtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffort.workEffortId", "1", delegator));
} catch (Exception e) {
Debug.logWarning("Could not parse weight number: " + e.toString(), module);
}
@@ -68,15 +69,15 @@
addWeightedKeywordSourceString(workEffort, "workEffortTypeId", strings);
addWeightedKeywordSourceString(workEffort, "currentStatusId", strings);
- if (!"0".equals(UtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortNoteAndData.noteInfo", "1"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortNoteAndData.noteInfo", "1", delegator))) {
List<GenericValue> workEffortNotes = EntityQuery.use(delegator).from("WorkEffortNoteAndData").where("workEffortId", workEffortId).queryList();
for (GenericValue workEffortNote : workEffortNotes) {
addWeightedKeywordSourceString(workEffortNote, "noteInfo", strings);
}
}
//WorkEffortAttribute
- if (!"0".equals(UtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortAttribute.attrName", "1")) ||
- !"0".equals(UtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortAttribute.attrValue", "1"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortAttribute.attrName", "1", delegator)) ||
+ !"0".equals(EntityUtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortAttribute.attrValue", "1", delegator))) {
List<GenericValue> workEffortAttributes = EntityQuery.use(delegator).from("WorkEffortAttribute").where("workEffortId", workEffortId).queryList();
for (GenericValue workEffortAttribute : workEffortAttributes) {
addWeightedKeywordSourceString(workEffortAttribute, "attrName", strings);
@@ -84,11 +85,11 @@
}
}
- String workEffortContentTypes = UtilProperties.getPropertyValue("workeffortsearch", "index.include.WorkEffortContentTypes");
+ String workEffortContentTypes = EntityUtilProperties.getPropertyValue("workeffortsearch", "index.include.WorkEffortContentTypes", delegator);
for (String workEffortContentTypeId: workEffortContentTypes.split(",")) {
int weight = 1;
try {
- weight = Integer.parseInt(UtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortContent." + workEffortContentTypeId, "1"));
+ weight = Integer.parseInt(EntityUtilProperties.getPropertyValue("workeffortsearch", "index.weight.WorkEffortContent." + workEffortContentTypeId, "1", delegator));
} catch (Exception e) {
Debug.logWarning("Could not parse weight number: " + e.toString(), module);
}
@@ -136,11 +137,12 @@
}
}
public static void addWeightedKeywordSourceString(GenericValue value, String fieldName, List<String> strings) {
+ Delegator delegator = value.getDelegator();
if (value.getString(fieldName) != null) {
int weight = 1;
try {
- weight = Integer.parseInt(UtilProperties.getPropertyValue("workeffortsearch", "index.weight." + value.getEntityName() + "." + fieldName, "1"));
+ weight = Integer.parseInt(EntityUtilProperties.getPropertyValue("workeffortsearch", "index.weight." + value.getEntityName() + "." + fieldName, "1", delegator));
} catch (Exception e) {
Debug.logWarning("Could not parse weight number: " + e.toString(), module);
}
diff --git a/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java b/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
index 21f6150..4ffce9f 100644
--- a/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
+++ b/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
@@ -53,6 +53,7 @@
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.util.EntityListIterator;
import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.security.Security;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
@@ -1049,8 +1050,8 @@
}
} else {
// TODO: Remove this block after the next release 2010-11-29
- String screenLocation = UtilProperties.getPropertyValue("EventReminders", "eventReminders.emailScreenWidgetLocation");
- String fromAddress = UtilProperties.getPropertyValue("EventReminders", "eventReminders.emailFromAddress");
+ String screenLocation = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailScreenWidgetLocation", delegator);
+ String fromAddress = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailFromAddress", delegator);
String subject = UtilProperties.getMessage("WorkEffortUiLabels", "WorkEffortEventReminder", (Locale) parameters.get("locale"));
Map<String, Object> emailCtx = UtilMisc.toMap("sendFrom", fromAddress, "sendTo", toAddress, "subject", subject, "bodyParameters", parameters, "bodyScreenUri", screenLocation);
try {
@@ -1069,10 +1070,11 @@
@Deprecated
protected static void processEventReminder(DispatchContext ctx, GenericValue reminder, Map<String, Object> parameters) throws GenericEntityException {
LocalDispatcher dispatcher = ctx.getDispatcher();
+ Delegator delegator = ctx.getDelegator();
GenericValue contactMech = reminder.getRelatedOne("ContactMech", false);
if (contactMech != null && "EMAIL_ADDRESS".equals(contactMech.get("contactMechTypeId"))) {
- String screenLocation = UtilProperties.getPropertyValue("EventReminders", "eventReminders.emailScreenWidgetLocation");
- String fromAddress = UtilProperties.getPropertyValue("EventReminders", "eventReminders.emailFromAddress");
+ String screenLocation = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailScreenWidgetLocation", delegator);
+ String fromAddress = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailFromAddress", delegator);
String toAddress = contactMech.getString("infoString");
String subject = UtilProperties.getMessage("WorkEffortUiLabels", "WorkEffortEventReminder", (Locale) parameters.get("locale"));
Map<String, Object> emailCtx = UtilMisc.toMap("sendFrom", fromAddress, "sendTo", toAddress, "subject", subject, "bodyParameters", parameters, "bodyScreenUri", screenLocation);
diff --git a/build.xml b/build.xml
index 82ec613..afa6361 100644
--- a/build.xml
+++ b/build.xml
@@ -1312,7 +1312,7 @@
<property name="sonar.sources" value="specialpurpose/appserver/src, framework/base/src, framework/bi/src,
framework/catalina/src, framework/common/src, framework/datafile/src, framework/entity/src, framework/entityext/src,
framework/example/src, framework/geronimo/src, framework/jetty/src,
- framework/minilang/src, framework/security/src, framework/service/src, framework/sql/src, framework/start/src,
+ framework/minilang/src, framework/security/src, framework/service/src, framework/start/src,
framework/testtools/src, framework/webapp/src, framework/webtools/src, framework/widget/src,
applications/accounting/src, applications/commonext/src, applications/content/src, applications/humanres/src,
applications/manufacturing/src, applications/marketing/src, applications/order/src, applications/party/src,
@@ -1321,7 +1321,7 @@
specialpurpose/googlecheckout/src, specialpurpose/hhfacility/src, specialpurpose/oagis/src, specialpurpose/pos/src,
specialpurpose/scrum/src, specialpurpose/birt/src" />
<property name="sonar.tests" value="framework/base/src/org/ofbiz/base/test, framework/entity/src/org/ofbiz/entity/test,
- framework/service/src/org/ofbiz/service/test, framework/sql/src/org/ofbiz/sql/test,
+ framework/service/src/org/ofbiz/service/test,
applications/accounting/src/org/ofbiz/accounting/test, applications/content/src/org/ofbiz/content/test,
applications/product/src/org/ofbiz/product/test, applications/product/src/org/ofbiz/shipment/test,
applications/securityext/src/org/ofbiz/securityext/test" />
diff --git a/framework/build.xml b/framework/build.xml
index d91cec8..4568603 100644
--- a/framework/build.xml
+++ b/framework/build.xml
@@ -20,7 +20,7 @@
<project name="OFBiz Framework Build" default="build" basedir=".">
<filelist id="framework-builds" dir="framework"
- files="start/build.xml,base/build.xml,sql/build.xml,
+ files="start/build.xml,base/build.xml,
entity/build.xml,geronimo/build.xml,
catalina/build.xml,
security/build.xml,service/build.xml,entityext/build.xml,
@@ -30,5 +30,5 @@
testtools/build.xml,
webtools/build.xml"/>
- <filelist id="test-builds" dir="framework" files="base/build.xml,sql/build.xml,entity/build.xml"/>
+ <filelist id="test-builds" dir="framework" files="base/build.xml,entity/build.xml"/>
</project>
diff --git a/framework/catalina/src/org/ofbiz/catalina/container/CrossSubdomainSessionValve.java b/framework/catalina/src/org/ofbiz/catalina/container/CrossSubdomainSessionValve.java
index 77b413b..e6eab14 100644
--- a/framework/catalina/src/org/ofbiz/catalina/container/CrossSubdomainSessionValve.java
+++ b/framework/catalina/src/org/ofbiz/catalina/container/CrossSubdomainSessionValve.java
@@ -33,6 +33,8 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.util.EntityUtilProperties;
public class CrossSubdomainSessionValve extends ValveBase {
@@ -63,9 +65,10 @@
protected void replaceCookie(Request request, Response response, Cookie cookie) {
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
// copy the existing session cookie, but use a different domain (only if domain is valid)
String cookieDomain = null;
- cookieDomain = UtilProperties.getPropertyValue("url", "cookie.domain", "");
+ cookieDomain = EntityUtilProperties.getPropertyValue("url", "cookie.domain", "", delegator);
if (UtilValidate.isEmpty(cookieDomain)) {
String serverName = request.getServerName();
diff --git a/framework/common/src/org/ofbiz/common/CommonEvents.java b/framework/common/src/org/ofbiz/common/CommonEvents.java
index 72c7b44..b56ac1f 100644
--- a/framework/common/src/org/ofbiz/common/CommonEvents.java
+++ b/framework/common/src/org/ofbiz/common/CommonEvents.java
@@ -57,6 +57,7 @@
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.security.Security;
/**
@@ -392,8 +393,9 @@
public static String getCaptcha(HttpServletRequest request, HttpServletResponse response) {
try {
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
final String captchaSizeConfigName = StringUtils.defaultIfEmpty(request.getParameter("captchaSize"), "default");
- final String captchaSizeConfig = UtilProperties.getPropertyValue("captcha.properties", "captcha." + captchaSizeConfigName);
+ final String captchaSizeConfig = EntityUtilProperties.getPropertyValue("captcha.properties", "captcha." + captchaSizeConfigName, delegator);
final String[] captchaSizeConfigs = captchaSizeConfig.split("\\|");
final String captchaCodeId = StringUtils.defaultIfEmpty(request.getParameter("captchaCodeId"), ""); // this is used to uniquely identify in the user session the attribute where the captcha code for the last captcha for the form is stored
@@ -401,7 +403,7 @@
final int height = Integer.parseInt(captchaSizeConfigs[1]);
final int width = Integer.parseInt(captchaSizeConfigs[2]);
final int charsToPrint = UtilProperties.getPropertyAsInteger("captcha.properties", "captcha.code_length", 6);
- final char[] availableChars = UtilProperties.getPropertyValue("captcha.properties", "captcha.characters").toCharArray();
+ final char[] availableChars = EntityUtilProperties.getPropertyValue("captcha.properties", "captcha.characters", delegator).toCharArray();
//It is possible to pass the font size, image width and height with the request as well
Color backgroundColor = Color.gray;
diff --git a/framework/common/src/org/ofbiz/common/CommonWorkers.java b/framework/common/src/org/ofbiz/common/CommonWorkers.java
index 2639073..0d03a92 100644
--- a/framework/common/src/org/ofbiz/common/CommonWorkers.java
+++ b/framework/common/src/org/ofbiz/common/CommonWorkers.java
@@ -57,7 +57,7 @@
}
List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("geoTypeId", EntityOperator.EQUALS, "COUNTRY"));
- List<String> countriesAvailable = StringUtil.split(UtilProperties.getPropertyValue("general.properties", "countries.geo.id.available"), ",");
+ List<String> countriesAvailable = StringUtil.split(EntityUtilProperties.getPropertyValue("general.properties", "countries.geo.id.available", delegator), ",");
if (UtilValidate.isNotEmpty(countriesAvailable)) {
// only available countries (we don't verify the list of geoId in countries.geo.id.available)
exprs.add(EntityCondition.makeCondition("geoId", EntityOperator.IN, countriesAvailable));
diff --git a/framework/common/src/org/ofbiz/common/FindServices.java b/framework/common/src/org/ofbiz/common/FindServices.java
index 71ca1e5..eb4cdfb 100644
--- a/framework/common/src/org/ofbiz/common/FindServices.java
+++ b/framework/common/src/org/ofbiz/common/FindServices.java
@@ -54,6 +54,7 @@
import org.ofbiz.entity.util.EntityFindOptions;
import org.ofbiz.entity.util.EntityListIterator;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
@@ -462,13 +463,14 @@
List<String> fieldList = UtilGenerics.<String>checkList(context.get("fieldList"));
GenericValue userLogin = (GenericValue) context.get("userLogin");
Locale locale = (Locale) context.get("locale");
+ Delegator delegator = dctx.getDelegator();
if (UtilValidate.isEmpty(noConditionFind)) {
// try finding in inputFields Map
noConditionFind = (String) inputFields.get("noConditionFind");
}
if (UtilValidate.isEmpty(noConditionFind)) {
// Use configured default
- noConditionFind = UtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind");
+ noConditionFind = EntityUtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind", delegator);
}
String filterByDate = (String) context.get("filterByDate");
if (UtilValidate.isEmpty(filterByDate)) {
@@ -529,6 +531,7 @@
*/
public static Map<String, Object> prepareFind(DispatchContext dctx, Map<String, ?> context) {
String entityName = (String) context.get("entityName");
+ Delegator delegator = dctx.getDelegator();
String orderBy = (String) context.get("orderBy");
Map<String, ?> inputFields = checkMap(context.get("inputFields"), String.class, Object.class); // Input
String noConditionFind = (String) context.get("noConditionFind");
@@ -538,7 +541,7 @@
}
if (UtilValidate.isEmpty(noConditionFind)) {
// Use configured default
- noConditionFind = UtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind");
+ noConditionFind = EntityUtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind", delegator);
}
String filterByDate = (String) context.get("filterByDate");
if (UtilValidate.isEmpty(filterByDate)) {
@@ -548,7 +551,6 @@
Timestamp filterByDateValue = (Timestamp) context.get("filterByDateValue");
Map<String, Object> queryStringMap = new LinkedHashMap<String, Object>();
- Delegator delegator = dctx.getDelegator();
ModelEntity modelEntity = delegator.getModelEntity(entityName);
List<EntityCondition> tmpList = createConditionList(inputFields, modelEntity.getFieldsUnmodifiable(), queryStringMap, delegator, context);
diff --git a/framework/common/src/org/ofbiz/common/email/EmailServices.java b/framework/common/src/org/ofbiz/common/email/EmailServices.java
index b04ddb3..e9aa1a6 100644
--- a/framework/common/src/org/ofbiz/common/email/EmailServices.java
+++ b/framework/common/src/org/ofbiz/common/email/EmailServices.java
@@ -135,7 +135,7 @@
String sendBcc = (String) context.get("sendBcc");
// check to see if we should redirect all mail for testing
- String redirectAddress = UtilProperties.getPropertyValue("general.properties", "mail.notifications.redirectTo");
+ String redirectAddress = EntityUtilProperties.getPropertyValue("general.properties", "mail.notifications.redirectTo", delegator);
if (UtilValidate.isNotEmpty(redirectAddress)) {
String originalRecipients = " [To: " + sendTo + ", Cc: " + sendCc + ", Bcc: " + sendBcc + "]";
subject += originalRecipients;
diff --git a/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java b/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java
index 46dab41..432b94e 100644
--- a/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java
+++ b/framework/common/src/org/ofbiz/common/login/LdapAuthenticationServices.java
@@ -37,6 +37,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.transaction.GenericTransactionException;
import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.DispatchContext;
/** LDAP Authentication Services.
@@ -93,7 +94,7 @@
}
// Synchronize user's OFBiz password with user's LDAP password
if (userLogin != null) {
- boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
+ boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.encrypt", delegator));
String currentPassword = userLogin.getString("currentPassword");
boolean samePassword;
if (useEncryption) {
diff --git a/framework/common/src/org/ofbiz/common/login/LoginServices.java b/framework/common/src/org/ofbiz/common/login/LoginServices.java
index 2ea42b2..7666b8e 100644
--- a/framework/common/src/org/ofbiz/common/login/LoginServices.java
+++ b/framework/common/src/org/ofbiz/common/login/LoginServices.java
@@ -50,6 +50,7 @@
import org.ofbiz.entity.util.EntityFindOptions;
import org.ofbiz.entity.util.EntityListIterator;
import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.security.Security;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.LocalDispatcher;
@@ -71,6 +72,7 @@
public static Map<String, Object> userLogin(DispatchContext ctx, Map<String, ?> context) {
LocalDispatcher dispatcher = ctx.getDispatcher();
Locale locale = (Locale) context.get("locale");
+ Delegator delegator = ctx.getDelegator();
// load the external auth modules -- note: this will only run once and cache the objects
if (!AuthHelper.authenticatorsLoaded()) {
@@ -79,10 +81,10 @@
// Authenticate to LDAP if configured to do so
// TODO: this should be moved to using the NEW Authenticator API
- if ("true".equals(UtilProperties.getPropertyValue("security", "security.ldap.enable"))) {
+ if ("true".equals(EntityUtilProperties.getPropertyValue("security", "security.ldap.enable", delegator))) {
if (!LdapAuthenticationServices.userLogin(ctx, context)) {
String errMsg = UtilProperties.getMessage(resource, "loginservices.ldap_authentication_failed", locale);
- if ("true".equals(UtilProperties.getPropertyValue("security", "security.ldap.fail.login"))) {
+ if ("true".equals(EntityUtilProperties.getPropertyValue("security", "security.ldap.fail.login", delegator))) {
return ServiceUtil.returnError(errMsg);
} else {
Debug.logInfo(errMsg, module);
@@ -91,8 +93,7 @@
}
Map<String, Object> result = new LinkedHashMap<String, Object>();
- Delegator delegator = ctx.getDelegator();
- boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
+ boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.encrypt", delegator));
// if isServiceAuth is not specified, default to not a service auth
boolean isServiceAuth = context.get("isServiceAuth") != null && ((Boolean) context.get("isServiceAuth")).booleanValue();
@@ -112,10 +113,10 @@
errMsg = UtilProperties.getMessage(resource,"loginservices.password_missing", locale);
} else {
- if ("true".equalsIgnoreCase(UtilProperties.getPropertyValue("security.properties", "username.lowercase"))) {
+ if ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security.properties", "username.lowercase", delegator))) {
username = username.toLowerCase();
}
- if ("true".equalsIgnoreCase(UtilProperties.getPropertyValue("security.properties", "password.lowercase"))) {
+ if ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security.properties", "password.lowercase", delegator))) {
password = password.toLowerCase();
}
@@ -155,7 +156,7 @@
}
if (userLogin != null) {
- String ldmStr = UtilProperties.getPropertyValue("security.properties", "login.disable.minutes");
+ String ldmStr = EntityUtilProperties.getPropertyValue("security.properties", "login.disable.minutes", delegator);
long loginDisableMinutes = 30;
try {
@@ -265,7 +266,7 @@
userLogin.set("successiveFailedLogins", currentFailedLogins);
// if failed logins over amount in properties file, disable account
- String mflStr = UtilProperties.getPropertyValue("security.properties", "max.failed.logins");
+ String mflStr = EntityUtilProperties.getPropertyValue("security.properties", "max.failed.logins", delegator);
long maxFailedLogins = 3;
try {
maxFailedLogins = Long.parseLong(mflStr);
@@ -302,11 +303,11 @@
userLogin.store();
}
- if ("true".equals(UtilProperties.getPropertyValue("security.properties", "store.login.history"))) {
+ if ("true".equals(EntityUtilProperties.getPropertyValue("security.properties", "store.login.history", delegator))) {
boolean createHistory = true;
// only save info on service auth if option set to true to do so
- if (isServiceAuth && !"true".equals(UtilProperties.getPropertyValue("security.properties", "store.login.history.on.service.auth"))) {
+ if (isServiceAuth && !"true".equals(EntityUtilProperties.getPropertyValue("security.properties", "store.login.history.on.service.auth", delegator))) {
createHistory = false;
}
@@ -320,7 +321,7 @@
}
// ONLY save the password if it was incorrect
- if ("N".equals(successfulLogin) && !"false".equals(UtilProperties.getPropertyValue("security.properties", "store.login.history.incorrect.password"))) {
+ if ("N".equals(successfulLogin) && !"false".equals(EntityUtilProperties.getPropertyValue("security.properties", "store.login.history.incorrect.password", delegator))) {
ulhCreateMap.put("passwordUsed", password);
}
@@ -425,7 +426,7 @@
public static void createUserLoginPasswordHistory(Delegator delegator,String userLoginId, String currentPassword) throws GenericEntityException{
int passwordChangeHistoryLimit = 0;
try {
- passwordChangeHistoryLimit = Integer.parseInt(UtilProperties.getPropertyValue("security.properties", "password.change.history.limit", "0"));
+ passwordChangeHistoryLimit = Integer.parseInt(EntityUtilProperties.getPropertyValue("security.properties", "password.change.history.limit", "0", delegator));
} catch (NumberFormatException nfe) {
//No valid value is found so don't bother to save any password history
passwordChangeHistoryLimit = 0;
@@ -457,7 +458,7 @@
// save this password in history
GenericValue userLoginPwdHistToCreate = delegator.makeValue("UserLoginPasswordHistory", UtilMisc.toMap("userLoginId", userLoginId,"fromDate", nowTimestamp));
- boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
+ boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.encrypt", delegator));
userLoginPwdHistToCreate.set("currentPassword", useEncryption ? HashCrypt.cryptUTF8(getHashType(), null, currentPassword) : currentPassword);
userLoginPwdHistToCreate.create();
}
@@ -475,7 +476,7 @@
List<String> errorMessageList = new LinkedList<String>();
Locale locale = (Locale) context.get("locale");
- boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
+ boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.encrypt", delegator));
String userLoginId = (String) context.get("userLoginId");
String partyId = (String) context.get("partyId");
@@ -515,9 +516,8 @@
}
}
- checkNewPassword(null, null, currentPassword, currentPasswordVerify, passwordHint, errorMessageList, true, locale);
-
GenericValue userLoginToCreate = delegator.makeValue("UserLogin", UtilMisc.toMap("userLoginId", userLoginId));
+ checkNewPassword(userLoginToCreate, null, currentPassword, currentPasswordVerify, passwordHint, errorMessageList, true, locale);
userLoginToCreate.set("externalAuthId", externalAuthId);
userLoginToCreate.set("passwordHint", passwordHint);
userLoginToCreate.set("enabled", enabled);
@@ -579,7 +579,7 @@
AuthHelper.loadAuthenticators(ctx.getDispatcher());
}
- boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
+ boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.encrypt", delegator));
boolean adminUser = false;
String userLoginId = (String) context.get("userLoginId");
@@ -646,7 +646,7 @@
}
}
- if ("true".equals(UtilProperties.getPropertyValue("security.properties", "password.lowercase"))) {
+ if ("true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.lowercase", delegator))) {
currentPassword = currentPassword.toLowerCase();
newPassword = newPassword.toLowerCase();
newPasswordVerify = newPasswordVerify.toLowerCase();
@@ -711,7 +711,7 @@
String userLoginId = (String) context.get("userLoginId");
String errMsg = null;
- if ((userLoginId != null) && ("true".equals(UtilProperties.getPropertyValue("security.properties", "username.lowercase")))) {
+ if ((userLoginId != null) && ("true".equals(EntityUtilProperties.getPropertyValue("security.properties", "username.lowercase", delegator)))) {
userLoginId = userLoginId.toLowerCase();
}
@@ -886,7 +886,8 @@
}
public static void checkNewPassword(GenericValue userLogin, String currentPassword, String newPassword, String newPasswordVerify, String passwordHint, List<String> errorMessageList, boolean ignoreCurrentPassword, Locale locale) {
- boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
+ Delegator delegator = userLogin.getDelegator();
+ boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.encrypt", delegator));
String errMsg = null;
@@ -915,7 +916,7 @@
int passwordChangeHistoryLimit = 0;
try {
- passwordChangeHistoryLimit = Integer.parseInt(UtilProperties.getPropertyValue("security.properties", "password.change.history.limit", "0"));
+ passwordChangeHistoryLimit = Integer.parseInt(EntityUtilProperties.getPropertyValue("security.properties", "password.change.history.limit", "0", delegator));
} catch (NumberFormatException nfe) {
//No valid value is found so don't bother to save any password history
passwordChangeHistoryLimit = 0;
@@ -923,7 +924,6 @@
Debug.logInfo(" password.change.history.limit is set to " + passwordChangeHistoryLimit, module);
if (passwordChangeHistoryLimit > 0 && userLogin != null) {
Debug.logInfo(" checkNewPassword Checking if user is tyring to use old password " + passwordChangeHistoryLimit, module);
- Delegator delegator = userLogin.getDelegator();
try {
List<GenericValue> pwdHistList = delegator.findByAnd("UserLoginPasswordHistory", UtilMisc.toMap("userLoginId",userLogin.getString("userLoginId")), UtilMisc.toList("-fromDate"), false);
for (GenericValue pwdHistValue : pwdHistList) {
@@ -945,14 +945,14 @@
int minPasswordLength = 0;
try {
- minPasswordLength = Integer.parseInt(UtilProperties.getPropertyValue("security.properties", "password.length.min", "0"));
+ minPasswordLength = Integer.parseInt(EntityUtilProperties.getPropertyValue("security.properties", "password.length.min", "0", delegator));
} catch (NumberFormatException nfe) {
minPasswordLength = 0;
}
if (newPassword != null) {
// Matching password with pattern
- String passwordPattern = UtilProperties.getPropertyValue("security.properties", "security.login.password.pattern", "^.*(?=.{5,}).*$");
+ String passwordPattern = EntityUtilProperties.getPropertyValue("security.properties", "security.login.password.pattern", "^.*(?=.{5,}).*$", delegator);
boolean usePasswordPattern = UtilProperties.getPropertyAsBoolean("security.properties", "security.login.password.pattern.enable", true);
if (usePasswordPattern) {
Pattern pattern = Pattern.compile(passwordPattern);
@@ -961,8 +961,8 @@
if (!matched) {
// This is a mix to handle the OOTB pattern which is only a fixed length
Map<String, String> messageMap = UtilMisc.toMap("minPasswordLength", Integer.toString(minPasswordLength));
- String passwordPatternMessage = UtilProperties.getPropertyValue("security.properties",
- "security.login.password.pattern.description", "loginservices.password_must_be_least_characters_long");
+ String passwordPatternMessage = EntityUtilProperties.getPropertyValue("security.properties",
+ "security.login.password.pattern.description", "loginservices.password_must_be_least_characters_long", delegator);
errMsg = UtilProperties.getMessage(resource, passwordPatternMessage, messageMap, locale);
messageMap = UtilMisc.toMap("passwordPatternMessage", errMsg);
errMsg = UtilProperties.getMessage(resource,"loginservices.password.pattern.errmsg", messageMap, locale);
diff --git a/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy b/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
index fb3d16b..b34018c 100644
--- a/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
+++ b/framework/common/webcommon/WEB-INF/actions/includes/FindAutocompleteOptions.groovy
@@ -19,7 +19,6 @@
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.entity.util.EntityFindOptions;
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.condition.EntityConditionList;
@@ -27,6 +26,7 @@
import org.ofbiz.entity.condition.EntityFieldValue;
import org.ofbiz.entity.condition.EntityFunction;
import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityUtilProperties;
def mainAndConds = [];
def orExprs = [];
@@ -107,7 +107,7 @@
String viewSizeStr = context.autocompleterViewSize;
if (viewSizeStr == null) {
- viewSizeStr = UtilProperties.getPropertyValue("widget", "widget.autocompleter.defaultViewSize");
+ viewSizeStr = EntityUtilProperties.getPropertyValue("widget", "widget.autocompleter.defaultViewSize", delegator);
}
Integer autocompleterViewSize = Integer.valueOf(viewSizeStr ?: 10);
EntityFindOptions findOptions = new EntityFindOptions();
diff --git a/framework/component-load.xml b/framework/component-load.xml
index 95f167d..4009ec1 100644
--- a/framework/component-load.xml
+++ b/framework/component-load.xml
@@ -22,7 +22,6 @@
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/component-loader.xsd">
<load-component component-location="base"/>
<load-component component-location="geronimo"/>
- <load-component component-location="sql"/>
<load-component component-location="entity"/>
<load-component component-location="security"/>
<load-component component-location="datafile"/>
diff --git a/framework/entity/build.xml b/framework/entity/build.xml
index 8fce494..1ef7069 100644
--- a/framework/entity/build.xml
+++ b/framework/entity/build.xml
@@ -37,7 +37,6 @@
<fileset dir="../base/lib/j2eespecs" includes="*.jar"/>
<fileset dir="../base/lib/scripting" includes="*.jar"/>
<fileset dir="../base/build/lib" includes="*.jar"/>
- <fileset dir="../sql/build/lib" includes="*.jar"/>
</path>
<patternset id="src.exc.set">
diff --git a/framework/entity/dtd/entitymodel.xsd b/framework/entity/dtd/entitymodel.xsd
index 13bbac4..8a5db7c 100644
--- a/framework/entity/dtd/entitymodel.xsd
+++ b/framework/entity/dtd/entitymodel.xsd
@@ -39,6 +39,9 @@
<xs:enumeration value="count-distinct"/>
<xs:enumeration value="upper"/>
<xs:enumeration value="lower"/>
+ <xs:enumeration value="extract-year"/>
+ <xs:enumeration value="extract-month"/>
+ <xs:enumeration value="extract-day"/>
</xs:restriction>
</xs:simpleType>
diff --git a/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java b/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
index d1ba7ff..1c1678d 100644
--- a/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
+++ b/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
@@ -1152,14 +1152,14 @@
ResultSet rsPks = dbData.getPrimaryKeys(null, lookupSchemaName, null);
pkCount += checkPrimaryKeyInfo(rsPks, lookupSchemaName, needsUpperCase, colInfo, messages);
} catch (Exception e1) {
- Debug.logWarning("Error getting primary key info from database with null tableName, will try other means: " + e1.toString(), module);
+ Debug.logInfo("Error getting primary key info from database with null tableName, will try other means: " + e1.toString(), module);
}
if (pkCount == 0) {
try {
ResultSet rsPks = dbData.getPrimaryKeys(null, lookupSchemaName, "%");
pkCount += checkPrimaryKeyInfo(rsPks, lookupSchemaName, needsUpperCase, colInfo, messages);
} catch (Exception e1) {
- Debug.logWarning("Error getting primary key info from database with % tableName, will try other means: " + e1.toString(), module);
+ Debug.logInfo("Error getting primary key info from database with % tableName, will try other means: " + e1.toString(), module);
}
}
if (pkCount == 0) {
diff --git a/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java b/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
index c0d0bbe..cbe2189 100644
--- a/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
+++ b/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java
@@ -55,7 +55,8 @@
public class ModelViewEntity extends ModelEntity {
public static final String module = ModelViewEntity.class.getName();
- public static Map<String, String> functionPrefixMap = new HashMap<String, String>();
+ private static final Map<String, String> functionPrefixMap = new HashMap<String, String>();
+ private static final Set<String> numericFunctionsSet = new HashSet<String>(); // names of functions that return a numeric type
static {
functionPrefixMap.put("min", "MIN(");
functionPrefixMap.put("max", "MAX(");
@@ -65,6 +66,14 @@
functionPrefixMap.put("count-distinct", "COUNT(DISTINCT ");
functionPrefixMap.put("upper", "UPPER(");
functionPrefixMap.put("lower", "LOWER(");
+ functionPrefixMap.put("extract-year", "EXTRACT(YEAR FROM ");
+ functionPrefixMap.put("extract-month", "EXTRACT(MONTH FROM ");
+ functionPrefixMap.put("extract-day", "EXTRACT(DAY FROM ");
+ numericFunctionsSet.add("count");
+ numericFunctionsSet.add("count-distinct");
+ numericFunctionsSet.add("extract-year");
+ numericFunctionsSet.add("extract-month");
+ numericFunctionsSet.add("extract-day");
}
/** Contains member-entity alias name definitions: key is alias, value is ModelMemberEntity */
@@ -480,8 +489,8 @@
fieldSet = alias.getFieldSet();
}
}
- if ("count".equals(alias.function) || "count-distinct".equals(alias.function)) {
- // if we have a "count" function we have to change the type
+ if (numericFunctionsSet.contains(alias.function)) {
+ // if we have a numeric function we have to change the type
type = "numeric";
}
if (UtilValidate.isNotEmpty(alias.function)) {
diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntityConditionPlanner.java b/framework/entity/src/org/ofbiz/entity/sql/EntityConditionPlanner.java
deleted file mode 100644
index 8dd607d..0000000
--- a/framework/entity/src/org/ofbiz/entity/sql/EntityConditionPlanner.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.entity.sql;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.condition.EntityFieldValue;
-import org.ofbiz.entity.condition.EntityOperator;
-import org.ofbiz.sql.BooleanCondition;
-import org.ofbiz.sql.Condition;
-import org.ofbiz.sql.ConditionList;
-import org.ofbiz.sql.ConditionPlanner;
-import org.ofbiz.sql.FieldValue;
-import org.ofbiz.sql.Joiner;
-import org.ofbiz.sql.NumberValue;
-import org.ofbiz.sql.ParameterValue;
-import org.ofbiz.sql.ParameterizedConditionException;
-import org.ofbiz.sql.StringValue;
-import org.ofbiz.sql.Value;
-
-public class EntityConditionPlanner implements ConditionPlanner<EntityCondition> {
- public EntityCondition parse(Condition condition, Map<String, ? extends Object> params) throws ParameterizedConditionException {
- if (condition == null) return null;
- if (condition instanceof BooleanCondition) {
- BooleanCondition bc = (BooleanCondition) condition;
- return EntityCondition.makeCondition(buildFieldValue(bc.getLeft()), EntityOperator.lookupComparison(bc.getOp()), buildValue(bc.getRight(), params));
- } else if (condition instanceof ConditionList) {
- ConditionList cl = (ConditionList) condition;
- List<EntityCondition> conditions = new LinkedList<EntityCondition>();
- for (Condition subCondition: cl) {
- conditions.add(parse(subCondition, params));
- }
- return EntityCondition.makeCondition(conditions, cl.getJoiner() == Joiner.AND ? EntityOperator.AND : EntityOperator.OR);
- } else {
- throw new UnsupportedOperationException(condition.toString());
- }
- }
-
- private static EntityFieldValue buildFieldValue(Value value) {
- if (value instanceof FieldValue) {
- FieldValue fv = (FieldValue) value;
- return EntityFieldValue.makeFieldValue(fv.getFieldName(), fv.getTableName(), null, null);
- }
- throw new UnsupportedOperationException(value.toString());
- }
-
- private static Object buildValue(Object value, Map<String, ? extends Object> params) throws ParameterizedConditionException {
- if (value instanceof NumberValue<?>) {
- return ((NumberValue<?>) value).getNumber();
- } else if (value instanceof StringValue) {
- return ((StringValue) value).getString();
- } else if (value instanceof FieldValue) {
- FieldValue fv = (FieldValue) value;
- return EntityFieldValue.makeFieldValue(fv.getFieldName(), fv.getTableName(), null, null);
- } else if (value instanceof List<?>) {
- List<Object> values = new LinkedList<Object>();
- for (Object sqlValue: (List<?>) value) {
- values.add(buildValue(sqlValue, params));
- }
- return values;
- } else if (value == Value.NULL) {
- return null;
- } else if (value instanceof ParameterValue) {
- if (params == null) {
- throw new ParameterizedConditionException();
- }
- return params.get(((ParameterValue) value).getName());
- }
- throw new UnsupportedOperationException(value.getClass().getName() + ":" + value.toString());
- }
-}
diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java b/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java
deleted file mode 100644
index 1dbe389..0000000
--- a/framework/entity/src/org/ofbiz/entity/sql/EntityDeletePlan.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.entity.sql;
-
-import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.sql.ConditionPlan;
-import org.ofbiz.sql.DeletePlan;
-
-public class EntityDeletePlan extends DeletePlan<EntityDeletePlan, EntityCondition> {
- public EntityDeletePlan(ConditionPlan<EntityCondition> wherePlan) {
- super(wherePlan);
- }
-}
diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntityInsertPlan.java b/framework/entity/src/org/ofbiz/entity/sql/EntityInsertPlan.java
deleted file mode 100644
index 431acd3..0000000
--- a/framework/entity/src/org/ofbiz/entity/sql/EntityInsertPlan.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.entity.sql;
-
-import org.ofbiz.sql.InsertPlan;
-
-public class EntityInsertPlan extends InsertPlan<EntityInsertPlan> {
-}
diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java b/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java
deleted file mode 100644
index 2832e91..0000000
--- a/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.entity.sql;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.model.DynamicViewEntity;
-import org.ofbiz.entity.model.ModelKeyMap;
-import org.ofbiz.entity.model.ModelViewEntity.ComplexAlias;
-import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasField;
-import org.ofbiz.entity.model.ModelViewEntity.ComplexAliasMember;
-import org.ofbiz.sql.ConstantValue;
-import org.ofbiz.sql.FieldAll;
-import org.ofbiz.sql.FieldDef;
-import org.ofbiz.sql.FieldValue;
-import org.ofbiz.sql.FunctionCall;
-import org.ofbiz.sql.Joined;
-import org.ofbiz.sql.KeyMap;
-import org.ofbiz.sql.MathValue;
-import org.ofbiz.sql.NumberValue;
-import org.ofbiz.sql.OrderByItem;
-import org.ofbiz.sql.Planner;
-import org.ofbiz.sql.Relation;
-import org.ofbiz.sql.SQLDelete;
-import org.ofbiz.sql.SQLInsert;
-import org.ofbiz.sql.SQLSelect;
-import org.ofbiz.sql.SQLUpdate;
-import org.ofbiz.sql.SQLView;
-import org.ofbiz.sql.SelectGroup;
-import org.ofbiz.sql.StaticValue;
-import org.ofbiz.sql.StringValue;
-import org.ofbiz.sql.Table;
-import org.ofbiz.sql.TableName;
-import org.ofbiz.sql.Unioned;
-import org.ofbiz.sql.Value;
-
-public class EntityPlanner extends Planner<EntityPlanner, EntityCondition, EntityDeletePlan, EntityInsertPlan, EntitySelectPlan, EntityUpdatePlan, EntityViewPlan> {
- public EntityPlanner() {
- super(new EntityConditionPlanner());
- }
-
- @Override
- public EntityDeletePlan planDelete(SQLDelete deleteStatement) {
- return null;
- }
-
- @Override
- public EntityInsertPlan planInsert(SQLInsert insertStatement) {
- return null;
- }
-
- @Override
- public EntitySelectPlan planSelect(SQLSelect selectStatement) {
- DynamicViewEntity dve = new DynamicViewEntity();
- Unioned unioned = selectStatement.getUnioned();
- if (unioned != null) {
- throw new IllegalArgumentException("union views not yet supported");
- }
- SelectGroup selectGroup = unioned.getGroup();
- Table table = selectGroup.getTable();
- addMember(dve, table.getTableName());
- addJoined(dve, table.getTableName().getAlias(), table.getJoined());
- if (selectGroup.getFieldAlls() != null) {
- for (FieldAll fieldAll: selectGroup.getFieldAlls()) {
- List<String> excludes = new LinkedList<String>();
- for (String exclude: fieldAll) {
- excludes.add(exclude);
- }
- if (excludes.isEmpty()) {
- excludes = null;
- }
- dve.addAliasAll(fieldAll.getAlias(), null, excludes);
- }
- }
- if (selectStatement.getRelations() != null) {
- for (Relation relation: selectStatement.getRelations().values()) {
- dve.addRelation(relation.getType(), relation.getTitle(), relation.getEntityName(), buildKeyMaps(relation));
- }
- }
- List<String> groupBy = selectGroup.getGroupBy();
- if (groupBy == null) {
- groupBy = Collections.emptyList();
- }
- if (selectGroup.getFieldDefs() != null) {
- for (FieldDef fieldDef: selectGroup.getFieldDefs()) {
- addFieldDef(dve, groupBy, fieldDef.getAlias(), fieldDef);
- }
- }
- List<String> orderBy;
- if (selectStatement.getOrderBy() == null) {
- orderBy = null;
- } else {
- orderBy = new LinkedList<String>();
- for (OrderByItem orderByItem: selectStatement.getOrderBy()) {
- orderBy.add(orderByItem.toString());
- }
- }
- return new EntitySelectPlan(dve, plan(selectGroup.getWhereCondition()), plan(selectGroup.getHavingCondition()), orderBy);
- }
-
- @Override
- public EntityUpdatePlan planUpdate(SQLUpdate updateStatement) {
- return null;
- }
-
- @Override
- public EntityViewPlan planView(SQLView viewStatement) {
- return null;
- }
-
- private static void addFieldDef(DynamicViewEntity dve, List<String> groupBy, String alias, FieldDef fieldDef) {
- StaticValue value = fieldDef.getValue();
- if (value instanceof FieldValue) {
- addFieldDef(dve, groupBy, fieldDef.getAlias(), (FieldValue) value, null);
- } else if (value instanceof ConstantValue) {
- addFieldDef(dve, groupBy, fieldDef.getAlias(), value);
- } else {
- throw new UnsupportedOperationException(alias + "[" + fieldDef + "]:" + fieldDef.getClass());
- }
- }
-
- private static void addFieldDef(DynamicViewEntity dve, List<String> groupBy, String alias, FieldValue fieldValue, String function) {
- dve.addAlias(fieldValue.getTableName(), alias, fieldValue.getFieldName(), null, null, groupBy.contains(alias), function);
- }
-
- private static void addFieldDef(DynamicViewEntity dve, List<String> groupBy, String alias, ComplexAliasMember member) {
- dve.addAlias(null, alias, null, null, null, groupBy.contains(alias), null, member);
- }
-
- private static void addFieldDef(DynamicViewEntity dve, List<String> groupBy, String alias, ConstantValue value) {
- if (value instanceof FieldValue) {
- addFieldDef(dve, groupBy, alias, (FieldValue) value, null);
- return;
- } else if (value instanceof FunctionCall) {
- FunctionCall fc = (FunctionCall) value;
- String name = fc.getName().toLowerCase();
- Iterator<Value> it = fc.iterator();
- if (it.hasNext()) {
- Value firstValue = it.next();
- if (!it.hasNext()) {
- if (firstValue instanceof FieldValue) {
- addFieldDef(dve, groupBy, alias, (FieldValue) firstValue, name);
- return;
- }
- }
- }
- }
- addFieldDef(dve, groupBy, alias, buildComplexMember(value));
- }
-
- private static ComplexAliasMember buildComplexMember(Value value) {
- if (value instanceof FieldValue) {
- FieldValue fv = (FieldValue) value;
- return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), null, null);
- } else if (value instanceof FunctionCall) {
- FunctionCall fc = (FunctionCall) value;
- String name = fc.getName().toLowerCase();
- if (fc.getArgCount() == 1) {
- Value firstValue = fc.iterator().next();
- if (firstValue instanceof FieldValue) {
- FieldValue fv = (FieldValue) firstValue;
- return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), null, name);
- } else if (firstValue instanceof FunctionCall) {
- FunctionCall fc2 = (FunctionCall) firstValue;
- if (fc2.getName().equalsIgnoreCase("coalesce") && fc2.getArgCount() == 2) {
- Iterator<Value> it = fc2.iterator();
- Value f1 = it.next(), f2 = it.next();
- if (f1 instanceof FieldValue) {
- FieldValue fv = (FieldValue) f1;
- if (f2 instanceof NumberValue<?>) {
- return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), ((NumberValue<?>) f2).getNumber().toString(), name);
- } else if (f2 instanceof StringValue) {
- return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), "'" + ((StringValue) f2).getString() + "'", name);
- }
- }
- }
- }
- } else if (fc.getName().equalsIgnoreCase("coalesce") && fc.getArgCount() == 2) {
- Iterator<Value> it = fc.iterator();
- Value f1 = it.next(), f2 = it.next();
- if (f1 instanceof FieldValue) {
- FieldValue fv = (FieldValue) f1;
- if (f2 instanceof NumberValue<?>) {
- return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), ((NumberValue<?>) f2).getNumber().toString(), null);
- } else if (f2 instanceof StringValue) {
- return new ComplexAliasField(fv.getTableName(), fv.getFieldName(), "'" + ((StringValue) f2).getString() + "'", null);
- }
- }
- }
- } else if (value instanceof MathValue) {
- MathValue mv = (MathValue) value;
- ComplexAlias complexAlias = new ComplexAlias(mv.getOp());
- for (ConstantValue constantValue: mv) {
- complexAlias.addComplexAliasMember(buildComplexMember(constantValue));
- }
- return complexAlias;
- }
- throw new UnsupportedOperationException(value + ":" + value.getClass());
- }
-
- private static void addMember(DynamicViewEntity dve, TableName member) {
- dve.addMemberEntity(member.getAlias(), member.getTableName());
- }
-
- private static void addJoined(DynamicViewEntity dve, String leftAlias, Joined joined) {
- if (joined == null) return;
- addMember(dve, joined.getTableName());
- dve.addViewLink(leftAlias, joined.getTableName().getAlias(), joined.isOptional(), buildKeyMaps(joined));
- addJoined(dve, joined.getTableName().getAlias(), joined.getJoined());
- }
-
- private static List<ModelKeyMap> buildKeyMaps(Iterable<KeyMap> keyMaps) {
- List<ModelKeyMap> entityKeyMaps = new ArrayList<ModelKeyMap>();
- for (KeyMap keyMap: keyMaps) {
- entityKeyMaps.add(new ModelKeyMap(keyMap.getLeftFieldName(), keyMap.getRightFieldName()));
- }
- return entityKeyMaps;
- }
-}
diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java b/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java
deleted file mode 100644
index 6bd6d7c..0000000
--- a/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.entity.sql;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.model.DynamicViewEntity;
-import org.ofbiz.entity.transaction.TransactionUtil;
-import org.ofbiz.entity.util.EntityListIterator;
-import org.ofbiz.sql.ConditionPlan;
-import org.ofbiz.sql.ParameterizedConditionException;
-import org.ofbiz.sql.SelectPlan;
-
-public final class EntitySelectPlan extends SelectPlan<EntitySelectPlan, EntityCondition> {
- private final DynamicViewEntity dve;
- private final List<String> orderBy;
- private final int offset = -1;
- private final int limit = -1;
-
- public EntitySelectPlan(DynamicViewEntity dve, ConditionPlan<EntityCondition> wherePlan, ConditionPlan<EntityCondition> havingPlan, List<String> orderBy) {
- super(wherePlan, havingPlan);
- this.dve = dve;
- this.orderBy = orderBy;
- //this.offset = offset;
- //this.limit = limit;
- }
-
- public EntityListIterator getEntityListIterator(Delegator delegator, Map<String, ? extends Object> params) throws GenericEntityException {
- EntityCondition whereCondition;
- EntityCondition havingCondition;
- try {
- whereCondition = getWherePlan().getCondition(params);
- havingCondition = getHavingPlan().getCondition(params);
- } catch (ParameterizedConditionException e) {
- throw (GenericEntityException) new GenericEntityException(e.getMessage()).initCause(e);
- }
- return delegator.findListIteratorByCondition(dve, whereCondition, havingCondition, null, orderBy, null);
- }
-
- public List<GenericValue> getAll(final Delegator delegator, final Map<String, ? extends Object> params) throws GenericEntityException {
- return TransactionUtil.doTransaction(new Callable<List<GenericValue>>() {
- public List<GenericValue> call() throws Exception {
- EntityListIterator it = null;
- try {
- it = getEntityListIterator(delegator, params);
- return it.getCompleteList();
- } finally {
- if (it != null) it.close();
- }
- }
- }, "sql select", 0, true);
- }
-
- public DynamicViewEntity getDynamicViewEntity() {
- return dve;
- }
-
- public List<String> getOrderBy() {
- return orderBy;
- }
-
- public int getOffset() {
- return offset;
- }
-
- public int getLimit() {
- return limit;
- }
-
- @Override
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("dve=").append(dve);
- if (getWherePlan() != null) {
- if (sb.length() > 0) sb.append(", ");
- sb.append("where=(");
- getWherePlan().appendTo(sb);
- sb.append(")");
- }
- if (getHavingPlan() != null) {
- if (sb.length() > 0) sb.append(", ");
- sb.append("having=(");
- getHavingPlan().appendTo(sb);
- sb.append(")");
- }
- /*TODO death code can be removed ?
- if (offset != -1) {
- if (sb.length() > 0) sb.append(", ");
- sb.append("offset=").append(offset);
- }
- if (limit != -1) {
- if (sb.length() > 0) sb.append(", ");
- sb.append("limit=").append(limit);
- }
- */
- sb.append("]");
- sb.insert(0, "[");
- return sb;
- }
-}
diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java b/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java
deleted file mode 100644
index 45e8ffb..0000000
--- a/framework/entity/src/org/ofbiz/entity/sql/EntityUpdatePlan.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.entity.sql;
-
-import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.sql.ConditionPlan;
-import org.ofbiz.sql.UpdatePlan;
-
-public class EntityUpdatePlan extends UpdatePlan<EntityUpdatePlan, EntityCondition> {
- public EntityUpdatePlan(ConditionPlan<EntityCondition> wherePlan) {
- super(wherePlan);
- }
-}
diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntityViewPlan.java b/framework/entity/src/org/ofbiz/entity/sql/EntityViewPlan.java
deleted file mode 100644
index 57ded02..0000000
--- a/framework/entity/src/org/ofbiz/entity/sql/EntityViewPlan.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.entity.sql;
-
-import org.ofbiz.sql.ViewPlan;
-
-public final class EntityViewPlan extends ViewPlan<EntityViewPlan> {
-}
diff --git a/framework/service/src/org/ofbiz/service/rmi/RemoteDispatcherImpl.java b/framework/service/src/org/ofbiz/service/rmi/RemoteDispatcherImpl.java
index 084017e..a28083e 100644
--- a/framework/service/src/org/ofbiz/service/rmi/RemoteDispatcherImpl.java
+++ b/framework/service/src/org/ofbiz/service/rmi/RemoteDispatcherImpl.java
@@ -25,6 +25,8 @@
import java.util.Map;
import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.service.GenericRequester;
import org.ofbiz.service.GenericResultWaiter;
import org.ofbiz.service.GenericServiceException;
@@ -45,7 +47,8 @@
public RemoteDispatcherImpl(LocalDispatcher dispatcher, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
super(0, csf, ssf);
this.dispatcher = dispatcher;
- exportAll = "true".equals(UtilProperties.getPropertyValue("service", "remotedispatcher.exportall", "false"));
+ Delegator delegator = dispatcher.getDelegator();
+ exportAll = "true".equals(EntityUtilProperties.getPropertyValue("service", "remotedispatcher.exportall", "false", delegator));
}
// RemoteDispatcher methods
diff --git a/framework/sql/build.xml b/framework/sql/build.xml
deleted file mode 100644
index baa8300..0000000
--- a/framework/sql/build.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project name="OFBiz - SQL" default="jar" basedir=".">
- <import file="../../common.xml"/>
-
- <!-- ================================================================== -->
- <!-- Initialization of all property settings -->
- <!-- ================================================================== -->
-
- <property name="desc" value="SQL Component"/>
- <property name="name" value="ofbiz-sql"/>
- <property name="ofbiz.home.dir" value="../.."/>
-
- <path id="local.class.path">
- <fileset dir="../base/lib" includes="*.jar"/>
- <fileset dir="../base/build/lib" includes="*.jar"/>
- </path>
- <path id="test.class.path">
- <path refid="local.class.path"/>
- <fileset dir="../base/lib" includes="*.jar"/>
- <fileset dir="../base/lib/commons" includes="*.jar"/>
- <fileset dir="../base/lib/j2eespecs" includes="*.jar"/>
- <pathelement location="config"/>
- <pathelement location="src"/>
- </path>
- <filelist id="test.classes" dir="${src.dir}">
- <file name="org/ofbiz/sql/test/ValuesTest.java"/>
- <file name="org/ofbiz/sql/test/ConditionsTest.java"/>
- <file name="org/ofbiz/sql/test/SelectTest.java"/>
- </filelist>
- <patternset id="cobertura-src-dirs">
- <include name="src"/>
- </patternset>
-
- <!-- ================================================================== -->
- <!-- Compilation of the source files -->
- <!-- ================================================================== -->
-
- <target name="jar" depends="classes">
- <main-jar/>
- <test-jar/>
- </target>
-
- <!-- ================================================================== -->
- <!-- Build JavaDoc -->
- <!-- ================================================================== -->
-
- <target name="docs" depends="prepare-docs">
- <default-javadoc>
- <fileset dir="${src.dir}" defaultexcludes="yes">
- <patternset refid="src.inc.set"/>
- <patternset refid="src.exc.set"/>
- </fileset>
- </default-javadoc>
- </target>
-</project>
diff --git a/framework/sql/ofbiz-component.xml b/framework/sql/ofbiz-component.xml
deleted file mode 100644
index 5b828f5..0000000
--- a/framework/sql/ofbiz-component.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<ofbiz-component name="sql"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
- <resource-loader name="main" type="component"/>
- <classpath type="jar" location="build/lib/*"/>
-
-</ofbiz-component>
diff --git a/framework/sql/src/org/ofbiz/sql/AggregateFunction.java b/framework/sql/src/org/ofbiz/sql/AggregateFunction.java
deleted file mode 100644
index d9c0efc..0000000
--- a/framework/sql/src/org/ofbiz/sql/AggregateFunction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class AggregateFunction extends StaticValue {
- public static final String module = AggregateFunction.class.getName();
-
- private final String name;
- private final boolean isDistinct;
- private final StaticValue value;
-
- public AggregateFunction(String name, boolean isDistinct, StaticValue value) {
- this.name = name;
- this.isDistinct = isDistinct;
- this.value = value;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isDistinct() {
- return isDistinct;
- }
-
- @Override
- public String getDefaultName() {
- return name;
- }
-
- public StaticValue getValue() {
- return value;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof AggregateFunction) {
- AggregateFunction other = (AggregateFunction) o;
- return name.equals(other.name) && isDistinct == other.isDistinct && value.equals(other.value);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append(name).append('(');
- if (isDistinct) {
- sb.append("DISTINCT ");
- }
- value.appendTo(sb);
- sb.append(')');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/Atom.java b/framework/sql/src/org/ofbiz/sql/Atom.java
deleted file mode 100644
index 9c31561..0000000
--- a/framework/sql/src/org/ofbiz/sql/Atom.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.ofbiz.base.lang.Appender;
-import org.ofbiz.base.util.UtilObject;
-import org.ofbiz.base.util.UtilValidate;
-
-public abstract class Atom implements Appender<StringBuilder> {
- public static boolean equalsHelper(Object l, Object r) {
- return UtilObject.equalsHelper(l, r);
- }
-
- public static <T extends Collection<I>, I> T checkEmpty(T col) {
- return UtilValidate.isEmpty(col) ? null : col;
- }
-
- public static <T extends Map<K, V>, K, V> T checkEmpty(T map) {
- return UtilValidate.isEmpty(map) ? null : map;
- }
-
- @Override
- public String toString() {
- return appendTo(new StringBuilder()).toString();
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/BetweenCondition.java b/framework/sql/src/org/ofbiz/sql/BetweenCondition.java
deleted file mode 100644
index 3eb1dfc..0000000
--- a/framework/sql/src/org/ofbiz/sql/BetweenCondition.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class BetweenCondition extends Condition {
- private final Value left;
- private final Value r1;
- private final Value r2;
-
- public BetweenCondition(Value left, Value r1, Value r2) {
- this.left = left;
- this.r1 = r1;
- this.r2 = r2;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public Value getLeft() {
- return left;
- }
-
- public Value getR1() {
- return r1;
- }
-
- public Value getR2() {
- return r2;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof BetweenCondition) {
- BetweenCondition other = (BetweenCondition) o;
- return left.equals(other.left) && r1.equals(other.r1) && r2.equals(other.r2);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- left.appendTo(sb);
- sb.append(" BETWEEN ");
- r1.appendTo(sb);
- sb.append(" AND ");
- r2.appendTo(sb);
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/BooleanCondition.java b/framework/sql/src/org/ofbiz/sql/BooleanCondition.java
deleted file mode 100644
index 4bf01f2..0000000
--- a/framework/sql/src/org/ofbiz/sql/BooleanCondition.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class BooleanCondition extends Condition {
- private final Value left;
- private final String op;
- private final Value right;
-
- public BooleanCondition(Value left, String op, Value right) {
- this.left = left;
- this.op = op.toLowerCase();
- this.right = right;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public Value getLeft() {
- return left;
- }
-
- public String getOp() {
- return op;
- }
-
- public Value getRight() {
- return right;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof BooleanCondition) {
- BooleanCondition other = (BooleanCondition) o;
- return left.equals(other.left) & op.equals(other.op) && right.equals(other.right);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- left.appendTo(sb);
- sb.append(' ').append(op).append(' ');
- right.appendTo(sb);
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/Condition.java b/framework/sql/src/org/ofbiz/sql/Condition.java
deleted file mode 100644
index e76e204..0000000
--- a/framework/sql/src/org/ofbiz/sql/Condition.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class Condition extends Atom {
- public interface Visitor {
- void visit(BetweenCondition condition);
- void visit(BooleanCondition condition);
- void visit(ConditionList condition);
- void visit(ListCondition condition);
- }
-
- public static class BaseVisitor implements Visitor {
- public void visit(BetweenCondition condition) {
- }
-
- public void visit(BooleanCondition condition) {
- }
-
- public void visit(ConditionList condition) {
- }
-
- public void visit(ListCondition condition) {
- }
- }
-
- public abstract void accept(Visitor visitor);
-}
diff --git a/framework/sql/src/org/ofbiz/sql/ConditionList.java b/framework/sql/src/org/ofbiz/sql/ConditionList.java
deleted file mode 100644
index 5ec0c56..0000000
--- a/framework/sql/src/org/ofbiz/sql/ConditionList.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.ofbiz.base.lang.SourceMonitored;
-import org.ofbiz.base.util.StringUtil;
-
-@SourceMonitored
-public final class ConditionList extends Condition implements Iterable<Condition> {
- private final Joiner joiner;
- private final List<Condition> conditions;
-
- public ConditionList(Joiner joiner, List<Condition> conditions) {
- this.joiner = joiner;
- this.conditions = conditions;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public void add(Condition condition) {
- conditions.add(condition);
- }
-
- public Joiner getJoiner() {
- return joiner;
- }
-
- public Iterator<Condition> iterator() {
- return conditions.iterator();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof ConditionList) {
- ConditionList other = (ConditionList) o;
- return joiner.equals(other.joiner) && conditions.equals(other.conditions);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append('(');
- StringUtil.appendTo(sb, conditions, " ", " ", joiner.toString());
- sb.append(')');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/ConditionPlan.java b/framework/sql/src/org/ofbiz/sql/ConditionPlan.java
deleted file mode 100644
index e8310e1..0000000
--- a/framework/sql/src/org/ofbiz/sql/ConditionPlan.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Map;
-
-public final class ConditionPlan<C> extends SQLPlan<ConditionPlan<C>> {
- private final ConditionPlanner<C> planner;
- private final Condition originalCondition;
- private final C condition;
-
- public ConditionPlan(ConditionPlanner<C> planner, Condition originalCondition, C condition) {
- this.planner = planner;
- this.originalCondition = originalCondition;
- this.condition = condition;
- }
-
- public C getCondition(Map<String, ? extends Object> params) throws ParameterizedConditionException {
- if (originalCondition != null) {
- return planner.parse(originalCondition, params);
- } else {
- return condition;
- }
- }
-
- @Override
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("ConditionPlan[");
- if (originalCondition != null) {
- sb.append("original=" + originalCondition);
- } else {
- sb.append("condition=" + condition);
- }
- return sb.append("]");
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/ConditionPlanner.java b/framework/sql/src/org/ofbiz/sql/ConditionPlanner.java
deleted file mode 100644
index 8cca39e..0000000
--- a/framework/sql/src/org/ofbiz/sql/ConditionPlanner.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Map;
-
-public interface ConditionPlanner<C> {
- C parse(Condition originalCondition, Map<String, ? extends Object> params) throws ParameterizedConditionException;
-}
diff --git a/framework/sql/src/org/ofbiz/sql/ConstantValue.java b/framework/sql/src/org/ofbiz/sql/ConstantValue.java
deleted file mode 100644
index 2fdbd25..0000000
--- a/framework/sql/src/org/ofbiz/sql/ConstantValue.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class ConstantValue extends Value {
-}
diff --git a/framework/sql/src/org/ofbiz/sql/CountAllFunction.java b/framework/sql/src/org/ofbiz/sql/CountAllFunction.java
deleted file mode 100644
index 527ef40..0000000
--- a/framework/sql/src/org/ofbiz/sql/CountAllFunction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class CountAllFunction extends StaticValue {
- private final String tableName;
-
- public CountAllFunction(String tableName) {
- this.tableName = tableName;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- @Override
- public String getDefaultName() {
- return "COUNT";
- }
-
- public String getTableName() {
- return tableName;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof CountAllFunction) {
- CountAllFunction other = (CountAllFunction) o;
- return equalsHelper(tableName, other.tableName);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("COUNT(");
- if (tableName != null) {
- sb.append(tableName).append('.');
- }
- sb.append("*)");
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/DeletePlan.java b/framework/sql/src/org/ofbiz/sql/DeletePlan.java
deleted file mode 100644
index 51e90e0..0000000
--- a/framework/sql/src/org/ofbiz/sql/DeletePlan.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class DeletePlan<P extends DeletePlan<P, C>, C> extends SQLPlan<P> {
- private final ConditionPlan<C> wherePlan;
-
- protected DeletePlan(ConditionPlan<C> wherePlan) {
- this.wherePlan = wherePlan;
- }
-
- public ConditionPlan<C> getWherePlan() {
- return wherePlan;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/FieldAll.java b/framework/sql/src/org/ofbiz/sql/FieldAll.java
deleted file mode 100644
index f0a366f..0000000
--- a/framework/sql/src/org/ofbiz/sql/FieldAll.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.ofbiz.base.lang.SourceMonitored;
-import org.ofbiz.base.util.StringUtil;
-
-@SourceMonitored
-public final class FieldAll extends Atom implements Iterable<String> {
- private final String alias;
- private final Set<String> exclude;
-
- public FieldAll(String alias, Set<String> exclude) {
- this.alias = alias;
- this.exclude = exclude;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public Iterator<String> iterator() {
- return exclude.iterator();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof FieldAll) {
- FieldAll other = (FieldAll) o;
- return alias.equals(other.alias) && exclude.equals(other.exclude);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append(alias).append(".*");
- if (!exclude.isEmpty()) {
- sb.append(" EXCLUDE (");
- StringUtil.append(sb, exclude, null, null, ", ");
- sb.append(')');
- }
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/FieldDef.java b/framework/sql/src/org/ofbiz/sql/FieldDef.java
deleted file mode 100644
index 4570a96..0000000
--- a/framework/sql/src/org/ofbiz/sql/FieldDef.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class FieldDef extends Atom {
- private final String alias;
- private final StaticValue value;
-
- public FieldDef(StaticValue value, String alias) {
- this.alias = alias;
- this.value = value;
- }
-
- public final String getAlias() {
- return alias;
- }
-
- public String getDefaultName() {
- return alias == null ? value.getDefaultName() : alias;
- }
-
- public StaticValue getValue() {
- return value;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof FieldDef) {
- FieldDef other = (FieldDef) o;
- return equalsHelper(alias, other.alias) && value.equals(other.value);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- value.appendTo(sb);
- if (alias != null) {
- sb.append(" AS ").append(alias);
- }
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/FieldValue.java b/framework/sql/src/org/ofbiz/sql/FieldValue.java
deleted file mode 100644
index 532cc72..0000000
--- a/framework/sql/src/org/ofbiz/sql/FieldValue.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class FieldValue extends StaticValue {
- private final String fieldName;
- private final String tableName;
-
- public FieldValue(String fieldName) {
- this(null, fieldName);
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public FieldValue(String tableName, String fieldName) {
- this.tableName = tableName;
- this.fieldName = fieldName;
- }
-
- public final String getTableName() {
- return tableName;
- }
-
- public final String getFieldName() {
- return fieldName;
- }
-
- @Override
- public String getDefaultName() {
- return fieldName;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof FieldValue) {
- FieldValue other = (FieldValue) o;
- return fieldName.equals(other.fieldName) && equalsHelper(tableName, other.tableName);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- if (tableName != null) {
- sb.append(tableName).append('.');
- }
- sb.append(fieldName);
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/FunctionCall.java b/framework/sql/src/org/ofbiz/sql/FunctionCall.java
deleted file mode 100644
index 417df91..0000000
--- a/framework/sql/src/org/ofbiz/sql/FunctionCall.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.ofbiz.base.lang.SourceMonitored;
-import org.ofbiz.base.util.StringUtil;
-
-@SourceMonitored
-public final class FunctionCall extends StaticValue implements Iterable<Value> {
- private final String name;
- private final List<Value> values;
-
- public FunctionCall(String name, List<Value> values) {
- this.name = name;
- this.values = values;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public String getDefaultName() {
- return name;
- }
-
- public int getArgCount() {
- return values.size();
- }
-
- public Iterator<Value> iterator() {
- return values.iterator();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof FunctionCall) {
- FunctionCall other = (FunctionCall) o;
- return name.equals(other.name) && values.equals(other.values);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append(name).append('(');
- StringUtil.appendTo(sb, values, null, null, ", ");
- sb.append(')');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/InsertPlan.java b/framework/sql/src/org/ofbiz/sql/InsertPlan.java
deleted file mode 100644
index eb7fa85..0000000
--- a/framework/sql/src/org/ofbiz/sql/InsertPlan.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class InsertPlan<P extends InsertPlan<P>> extends SQLPlan<P> {
-}
diff --git a/framework/sql/src/org/ofbiz/sql/InsertRow.java b/framework/sql/src/org/ofbiz/sql/InsertRow.java
deleted file mode 100644
index 57f8387..0000000
--- a/framework/sql/src/org/ofbiz/sql/InsertRow.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.ofbiz.base.util.StringUtil;
-
-public final class InsertRow extends Atom implements Iterable<Value> {
- private final List<Value> values;
-
- public InsertRow(List<Value> values) {
- this.values = values;
- }
-
- public Iterator<Value> iterator() {
- return values.iterator();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof InsertRow) {
- InsertRow other = (InsertRow) o;
- return values.equals(other.values);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append('(');
- StringUtil.appendTo(sb, values, null, null, ", ");
- sb.append(')');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/InsertSource.java b/framework/sql/src/org/ofbiz/sql/InsertSource.java
deleted file mode 100644
index 700b18c..0000000
--- a/framework/sql/src/org/ofbiz/sql/InsertSource.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.Appender;
-
-public interface InsertSource extends Appender<StringBuilder> {
-}
diff --git a/framework/sql/src/org/ofbiz/sql/InsertValues.java b/framework/sql/src/org/ofbiz/sql/InsertValues.java
deleted file mode 100644
index ad08079..0000000
--- a/framework/sql/src/org/ofbiz/sql/InsertValues.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.ofbiz.base.util.StringUtil;
-
-public final class InsertValues extends Atom implements InsertSource, Iterable<InsertRow> {
- private final List<InsertRow> rows;
-
- public InsertValues(List<InsertRow> rows) {
- this.rows = rows;
- }
-
- public Iterator<InsertRow> iterator() {
- return rows.iterator();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof InsertValues) {
- InsertValues other = (InsertValues) o;
- return rows.equals(other.rows);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("VALUES ");
- StringUtil.appendTo(sb, rows, null, null, ", ");
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/Joined.java b/framework/sql/src/org/ofbiz/sql/Joined.java
deleted file mode 100644
index dc9e1c1..0000000
--- a/framework/sql/src/org/ofbiz/sql/Joined.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.List;
-
-public final class Joined extends Atom implements Iterable<KeyMap> {
- private final boolean isOptional;
- private final TableName tableName;
- private final List<KeyMap> keyMaps;
- private final Joined joined;
-
- public Joined(boolean isOptional, TableName tableName, List<KeyMap> keyMaps) {
- this(isOptional, tableName, keyMaps, null);
- }
-
- public Joined(boolean isOptional, TableName tableName, List<KeyMap> keyMaps, Joined joined) {
- this.isOptional = isOptional;
- this.tableName = tableName;
- this.keyMaps = keyMaps;
- this.joined = joined;
- }
-
- public boolean isOptional() {
- return isOptional;
- }
-
- public TableName getTableName() {
- return tableName;
- }
-
- public Iterator<KeyMap> iterator() {
- return keyMaps.iterator();
- }
-
- public Joined getJoined() {
- return joined;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof Joined) {
- Joined other = (Joined) o;
- return tableName.equals(other.tableName) && keyMaps.equals(other.keyMaps) && equalsHelper(joined, other.joined);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- return appendTo("left", sb);
- }
-
- public StringBuilder appendTo(String leftAlias, StringBuilder sb) {
- sb.append(isOptional ? " LEFT JOIN " : " JOIN ");
- return appendToRest(leftAlias, sb);
- }
-
- public StringBuilder appendToRest(String leftAlias, StringBuilder sb) {
- tableName.appendTo(sb);
- sb.append(" ON ");
- for (int i = 0; i < keyMaps.size(); i++) {
- KeyMap keyMap = keyMaps.get(i);
- if (i != 0) sb.append(" AND ");
- sb.append(' ').append(leftAlias).append('.').append(keyMap.getLeftFieldName());
- sb.append(" = ").append(tableName.getAlias()).append('.').append(keyMap.getRightFieldName());
- }
- if (joined != null) {
- joined.appendTo(tableName.getAlias(), sb);
- }
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/Joiner.java b/framework/sql/src/org/ofbiz/sql/Joiner.java
deleted file mode 100644
index f63dcda..0000000
--- a/framework/sql/src/org/ofbiz/sql/Joiner.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public enum Joiner {
- AND, OR
-}
diff --git a/framework/sql/src/org/ofbiz/sql/KeyMap.java b/framework/sql/src/org/ofbiz/sql/KeyMap.java
deleted file mode 100644
index 12c0a66..0000000
--- a/framework/sql/src/org/ofbiz/sql/KeyMap.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public final class KeyMap {
- private final String leftFieldName;
- private final String rightFieldName;
-
- public KeyMap(String leftFieldName, String rightFieldName) {
- this.leftFieldName = leftFieldName;
- this.rightFieldName = rightFieldName;
- }
-
- public String getLeftFieldName() {
- return leftFieldName;
- }
-
- public String getRightFieldName() {
- return rightFieldName;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof KeyMap) {
- KeyMap other = (KeyMap) o;
- return leftFieldName.equals(other.leftFieldName) && rightFieldName.equals(other.rightFieldName);
- } else {
- return false;
- }
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/ListCondition.java b/framework/sql/src/org/ofbiz/sql/ListCondition.java
deleted file mode 100644
index 112492d..0000000
--- a/framework/sql/src/org/ofbiz/sql/ListCondition.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.List;
-
-import org.ofbiz.base.lang.SourceMonitored;
-import org.ofbiz.base.util.StringUtil;
-
-@SourceMonitored
-public final class ListCondition extends Condition {
- private final Value left;
- private final String op;
- private final List<Value> values;
-
- public ListCondition(Value left, String op, List<Value> values) {
- this.left = left;
- this.op = op.toLowerCase();
- this.values = values;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public Value getLeft() {
- return left;
- }
-
- public String getOp() {
- return op;
- }
-
- public List<Value> getValues() {
- return values;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof ListCondition) {
- ListCondition other = (ListCondition) o;
- return left.equals(other.left) && op.equals(other.op) && values.equals(other.values);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- left.appendTo(sb);
- sb.append(' ').append(op).append(" (");
- StringUtil.appendTo(sb, values, null, null, ", ");
- return sb.append(')');
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/MathValue.java b/framework/sql/src/org/ofbiz/sql/MathValue.java
deleted file mode 100644
index 486777e..0000000
--- a/framework/sql/src/org/ofbiz/sql/MathValue.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.ofbiz.base.lang.SourceMonitored;
-import org.ofbiz.base.util.StringUtil;
-
-@SourceMonitored
-public final class MathValue extends StaticValue implements Iterable<ConstantValue> {
- private final String op;
- private final List<ConstantValue> values;
-
- public MathValue(String op, List<ConstantValue> values) {
- this.op = op.toLowerCase();
- this.values = values;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public String getOp() {
- return op;
- }
-
- @Override
- public String getDefaultName() {
- return null;
- }
-
- public Iterator<ConstantValue> iterator() {
- return values.iterator();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof MathValue) {
- MathValue other = (MathValue) o;
- return op.equals(other.op) && values.equals(other.values);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append('(');
- StringUtil.appendTo(sb, values, null, null, " ", op, " ");
- sb.append(')');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/NumberValue.java b/framework/sql/src/org/ofbiz/sql/NumberValue.java
deleted file mode 100644
index 90ee4b2..0000000
--- a/framework/sql/src/org/ofbiz/sql/NumberValue.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class NumberValue<N extends Number> extends ConstantValue {
- private final N number;
-
- public static NumberValue<Long> valueOf(long v) {
- return new NumberValue<Long>(v);
- }
-
- public static NumberValue<Double> valueOf(double v) {
- return new NumberValue<Double>(v);
- }
-
- public NumberValue(N number) {
- this.number = number;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public N getNumber() {
- return number;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof NumberValue<?>) {
- NumberValue<?> other = (NumberValue<?>) o;
- return number.equals(other.number);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append(number);
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/OrderByItem.java b/framework/sql/src/org/ofbiz/sql/OrderByItem.java
deleted file mode 100644
index 1845979..0000000
--- a/framework/sql/src/org/ofbiz/sql/OrderByItem.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class OrderByItem extends Atom {
- public enum Order { DEFAULT, ASCENDING, DESCENDING }
- public enum Nulls { DEFAULT, FIRST, LAST }
-
- private final Order order;
- private final Nulls nulls;
- private final ConstantValue value;
-
- public OrderByItem(Order order, Nulls nulls, ConstantValue value) {
- this.order = order;
- this.nulls = nulls;
- this.value = value;
- }
-
- public final Order getOrder() {
- return order;
- }
-
- public final Nulls getNulls() {
- return nulls;
- }
-
- public final ConstantValue getValue() {
- return value;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof OrderByItem) {
- OrderByItem other = (OrderByItem) o;
- return order.equals(other.order) && nulls.equals(other.nulls) && value.equals(other.value);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- value.appendTo(sb);
- switch (order) {
- case ASCENDING:
- sb.append(" ASC");
- break;
- case DESCENDING:
- sb.append(" DESC");
- break;
- }
- switch (nulls) {
- case FIRST:
- sb.append(" NULLS FIRST");
- break;
- case LAST:
- sb.append(" NULLS LAST");
- break;
- }
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/ParameterValue.java b/framework/sql/src/org/ofbiz/sql/ParameterValue.java
deleted file mode 100644
index 4a9b66a..0000000
--- a/framework/sql/src/org/ofbiz/sql/ParameterValue.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class ParameterValue extends Value {
- private final String name;
-
- public ParameterValue(String name) {
- this.name = name;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof ParameterValue) {
- ParameterValue other = (ParameterValue) o;
- return name.equals(other.name);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append('?').append(name);
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/ParameterizedConditionException.java b/framework/sql/src/org/ofbiz/sql/ParameterizedConditionException.java
deleted file mode 100644
index 23c0f33..0000000
--- a/framework/sql/src/org/ofbiz/sql/ParameterizedConditionException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.util.GeneralException;
-
-@SuppressWarnings("serial")
-public final class ParameterizedConditionException extends GeneralException {
- public ParameterizedConditionException() {
- super();
- }
-
- public ParameterizedConditionException(String msg) {
- super(msg);
- }
-
- public ParameterizedConditionException(String msg, Throwable nested) {
- super(msg, nested);
- }
-
- public ParameterizedConditionException(Throwable nested) {
- super(nested);
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/Planner.java b/framework/sql/src/org/ofbiz/sql/Planner.java
deleted file mode 100644
index 939c312..0000000
--- a/framework/sql/src/org/ofbiz/sql/Planner.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class Planner<P extends Planner<P, C, D, I, S, U, V>, C, D extends DeletePlan<D, C>, I extends InsertPlan<I>, S extends SelectPlan<S, C>, U extends UpdatePlan<U, C>, V extends ViewPlan<V>> {
- private final ConditionPlanner<C> conditionPlanner;
-
- protected Planner(ConditionPlanner<C> conditionPlanner) {
- this.conditionPlanner = conditionPlanner;
- }
-
- public ConditionPlanner<C> getConditionPlanner() {
- return conditionPlanner;
- }
-
- public ConditionPlan<C> plan(Condition condition) {
- try {
- return new ConditionPlan<C>(conditionPlanner, null, conditionPlanner.parse(condition, null));
- } catch (ParameterizedConditionException e) {
- return new ConditionPlan<C>(conditionPlanner, condition, null);
- }
- }
-
- public <STMNT extends SQLStatement<?>> SQLPlan<?> plan(STMNT statement) {
- if (statement instanceof SQLDelete) return planDelete((SQLDelete) statement);
- if (statement instanceof SQLInsert) return planInsert((SQLInsert) statement);
- if (statement instanceof SQLSelect) return planSelect((SQLSelect) statement);
- if (statement instanceof SQLUpdate) return planUpdate((SQLUpdate) statement);
- if (statement instanceof SQLView) return planView((SQLView) statement);
- return null;
- }
-
- public abstract D planDelete(SQLDelete deleteStatement);
- public abstract I planInsert(SQLInsert insertStatement);
- public abstract S planSelect(SQLSelect selectStatement);
- public abstract U planUpdate(SQLUpdate updateStatement);
- public abstract V planView(SQLView viewStatement);
-}
diff --git a/framework/sql/src/org/ofbiz/sql/Relation.java b/framework/sql/src/org/ofbiz/sql/Relation.java
deleted file mode 100644
index 82b75db..0000000
--- a/framework/sql/src/org/ofbiz/sql/Relation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.List;
-
-public final class Relation extends Atom implements Iterable<KeyMap> {
- private final String name;
- private final String type;
- private final String title;
- private final String entityName;
- private final List<KeyMap> keyMaps;
-
- public Relation(String type, String title, String entityName, List<KeyMap> keyMaps) {
- this.type = type;
- this.title = title;
- this.entityName = entityName;
- this.keyMaps = keyMaps;
- this.name = title == null ? entityName : title + entityName;
- }
-
- public String getName() {
- return name;
- }
-
- public String getType() {
- return type;
- }
-
- public String getTitle() {
- return title;
- }
-
- public String getEntityName() {
- return entityName;
- }
-
- public Iterator<KeyMap> iterator() {
- return keyMaps.iterator();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof Relation) {
- Relation other = (Relation) o;
- return equalsHelper(type, other.type) && equalsHelper(title, other.title) && entityName.equals(other.entityName) && keyMaps.equals(other.keyMaps);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("RELATION");
- if (type != null) {
- sb.append(" TYPE ").append(type);
- }
- if (title != null) {
- sb.append(" TITLE ").append(title);
- }
- sb.append(' ').append(entityName);
- sb.append(" MAP");
- for (int i = 0; i < keyMaps.size(); i++) {
- KeyMap keyMap = keyMaps.get(i);
- if (i != 0) sb.append(" AND ");
- sb.append(' ').append(keyMap.getLeftFieldName());
- sb.append(" = ").append(keyMap.getRightFieldName());
- }
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SQLDelete.java b/framework/sql/src/org/ofbiz/sql/SQLDelete.java
deleted file mode 100644
index 8718086..0000000
--- a/framework/sql/src/org/ofbiz/sql/SQLDelete.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public final class SQLDelete extends SQLStatement<SQLDelete> {
- private final Table table;
- private final Condition whereCondition;
-
- public SQLDelete(Table table, Condition whereCondition) {
- this.table = table;
- this.whereCondition = whereCondition;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public Table getTable() {
- return table;
- }
-
- public Condition getWhereCondition() {
- return whereCondition;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof SQLDelete) {
- SQLDelete other = (SQLDelete) o;
- return table.equals(other.table) && equalsHelper(whereCondition, other.whereCondition);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("DELETE FROM ");
- table.getTableName().appendTo(sb);
- if (table.getJoined() != null) {
- sb.append(" USING");
- table.getJoined().appendToRest(table.getTableName().getAlias(), sb);
- }
- if (whereCondition != null) {
- sb.append(" WHERE ");
- whereCondition.appendTo(sb);
- }
- sb.append(';');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SQLIndex.java b/framework/sql/src/org/ofbiz/sql/SQLIndex.java
deleted file mode 100644
index 6db3468..0000000
--- a/framework/sql/src/org/ofbiz/sql/SQLIndex.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.List;
-
-import org.ofbiz.base.util.StringUtil;
-
-public final class SQLIndex extends SQLStatement<SQLIndex> {
- private final boolean isUnique;
- private final String name;
- private final String table;
- private final String using;
- private final List<ConstantValue> values;
-
- public SQLIndex(boolean isUnique, String name, String table, String using, List<ConstantValue> values) {
- this.isUnique = isUnique;
- this.name = name;
- this.table = table;
- this.using = using;
- this.values = values;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public boolean getIsUnique() {
- return isUnique;
- }
-
- public String getName() {
- return name;
- }
-
- public String getTable() {
- return table;
- }
-
- public String getUsing() {
- return using;
- }
-
- public List<ConstantValue> getValues() {
- return values;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof SQLIndex) {
- SQLIndex other = (SQLIndex) o;
- return isUnique == other.isUnique && name.equals(other.name) && table.equals(other.table) && equalsHelper(using, other.using) && values.equals(other.values);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("CREATE");
- if (isUnique) {
- sb.append(" UNIQUE");
- }
- sb.append(" INDEX ");
- sb.append(name);
- sb.append(" ON ");
- sb.append(table);
- if (using != null) {
- sb.append(" USING ").append(using);
- }
- sb.append(" (");
- StringUtil.append(sb, values, null, null, ", ");
- sb.append(')');
- sb.append(';');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SQLInsert.java b/framework/sql/src/org/ofbiz/sql/SQLInsert.java
deleted file mode 100644
index afa18d1..0000000
--- a/framework/sql/src/org/ofbiz/sql/SQLInsert.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.ofbiz.base.util.StringUtil;
-import org.ofbiz.base.util.UtilValidate;
-
-public final class SQLInsert extends SQLStatement<SQLInsert> {
- private final TableName tableName;
- private final InsertSource source;
- private final List<String> columns;
-
- public SQLInsert(TableName tableName, InsertSource source, List<String> columns) {
- this.tableName = tableName;
- this.source = source;
- this.columns = columns;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public TableName getTableName() {
- return tableName;
- }
-
- public InsertSource getSource() {
- return source;
- }
-
- public Iterator<String> iterator() {
- return columns.iterator();
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof SQLInsert) {
- SQLInsert other = (SQLInsert) o;
- return tableName.equals(other.tableName) && equalsHelper(columns, other.columns) && source.equals(other.source);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("INSERT INTO ");
- tableName.appendTo(sb);
- if (UtilValidate.isNotEmpty(columns)) {
- sb.append(" (");
- StringUtil.append(sb, columns, null, null, ", ");
- sb.append(')');
- }
- sb.append(' ');
- source.appendTo(sb);
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SQLPlan.java b/framework/sql/src/org/ofbiz/sql/SQLPlan.java
deleted file mode 100644
index 517019f..0000000
--- a/framework/sql/src/org/ofbiz/sql/SQLPlan.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class SQLPlan<P extends SQLPlan<P>> extends Atom {
- public StringBuilder appendTo(StringBuilder sb) {
- return sb.append("SQLPlan[").append(getClass().getName()).append("]");
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SQLSelect.java b/framework/sql/src/org/ofbiz/sql/SQLSelect.java
deleted file mode 100644
index f32ea0a..0000000
--- a/framework/sql/src/org/ofbiz/sql/SQLSelect.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.List;
-import java.util.Map;
-
-import org.ofbiz.base.util.StringUtil;
-
-public final class SQLSelect extends SQLStatement<SQLSelect> implements InsertSource {
- private final SelectGroup selectGroup;
- private final Unioned unioned;
- private final Map<String, Relation> relations;
- private final int offset;
- private final int limit;
- private final List<OrderByItem> orderBy;
-
- public SQLSelect(boolean isDistinct, List<FieldAll> fieldAlls, Map<String, FieldDef> fieldDefs, Table table, Map<String, Relation> relations, Condition whereCondition, Condition havingCondition, List<String> groupBy, List<OrderByItem> orderBy, int offset, int limit) {
- this(new SelectGroup(isDistinct, fieldAlls, fieldDefs, table, whereCondition, havingCondition, groupBy), null, relations, orderBy, offset, limit);
- }
-
- public SQLSelect(SelectGroup selectGroup, Unioned unioned, Map<String, Relation> relations, List<OrderByItem> orderBy, int offset, int limit) {
- this.selectGroup = selectGroup;
- this.unioned = unioned;
- this.relations = checkEmpty(relations);
- this.orderBy = orderBy;
- this.offset = offset;
- this.limit = limit;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public SelectGroup getSelectGroup() {
- return selectGroup;
- }
-
- public Unioned getUnioned() {
- return unioned;
- }
-
- public Map<String, Relation> getRelations() {
- return relations;
- }
-
- public List<OrderByItem> getOrderBy() {
- return orderBy;
- }
-
- public int getOffset() {
- return offset;
- }
-
- public int getLimit() {
- return limit;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof SQLSelect)) {
- return false;
- }
-
- SQLSelect other = (SQLSelect) o;
- return selectGroup.equals(other.selectGroup)
- && equalsHelper(unioned, other.unioned)
- && equalsHelper(relations, other.relations)
- && offset == other.offset
- && limit == other.limit
- && equalsHelper(orderBy, other.orderBy)
- ;
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- selectGroup.appendTo(sb);
- if (unioned != null) {
- unioned.appendTo(sb);
- }
- if (relations != null) {
- StringUtil.appendTo(sb, relations.values(), " ", null, null);
- }
- if (orderBy != null) {
- sb.append(" ORDER BY ");
- StringUtil.append(sb, orderBy, null, null, ", ");
- }
- if (offset != -1) {
- sb.append(" OFFSET ").append(offset);
- }
- if (limit != -1) {
- sb.append(" LIMIT ").append(limit);
- }
- sb.append(';');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SQLStatement.java b/framework/sql/src/org/ofbiz/sql/SQLStatement.java
deleted file mode 100644
index acc5e26..0000000
--- a/framework/sql/src/org/ofbiz/sql/SQLStatement.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class SQLStatement<S extends SQLStatement<S>> extends Atom {
- public interface Visitor {
- void visit(SQLDelete statement);
- void visit(SQLIndex statement);
- void visit(SQLInsert statement);
- void visit(SQLSelect statement);
- void visit(SQLUpdate statement);
- void visit(SQLView statement);
- }
-
- public static class BaseVisitor implements Visitor {
- public void visit(SQLDelete statement) {
- }
-
- public void visit(SQLIndex statement) {
- }
-
- public void visit(SQLInsert statement) {
- }
-
- public void visit(SQLSelect statement) {
- }
-
- public void visit(SQLUpdate statement) {
- }
-
- public void visit(SQLView statement) {
- }
- }
-
- public abstract void accept(Visitor visitor);
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SQLUpdate.java b/framework/sql/src/org/ofbiz/sql/SQLUpdate.java
deleted file mode 100644
index f995838..0000000
--- a/framework/sql/src/org/ofbiz/sql/SQLUpdate.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.ofbiz.base.util.StringUtil;
-
-public final class SQLUpdate extends SQLStatement<SQLUpdate> implements Iterable<SetField> {
- private final Table table;
- private final List<SetField> setFields;
- private final Condition whereCondition;
-
- public SQLUpdate(Table table, List<SetField> setFields, Condition whereCondition) {
- this.table = table;
- this.setFields = setFields;
- this.whereCondition = whereCondition;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public Table getTable() {
- return table;
- }
-
- public Iterator<SetField> iterator() {
- return setFields.iterator();
- }
-
- public Condition getWhereCondition() {
- return whereCondition;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof SQLUpdate) {
- SQLUpdate other = (SQLUpdate) o;
- return table.equals(other.table) && setFields.equals(other.setFields) && equalsHelper(whereCondition, other.whereCondition);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("UPDATE ");
- table.getTableName().appendTo(sb);
- // n=4;1+(n-1)*2+3+(n-1)*2+1;3*n+(n-1)*2
- // 17
- // 18
- sb.append(" SET ");
- if (setFields.size() <= 3) {
- StringUtil.appendTo(sb, setFields, null, null, ", ");
- } else {
- Iterator<SetField> it = setFields.iterator();
- sb.append('(');
- while (it.hasNext()) {
- SetField setField = it.next();
- sb.append(setField.getName());
- if (it.hasNext()) {
- sb.append(", ");
- }
- }
- sb.append(") = (");
- it = setFields.iterator();
- while (it.hasNext()) {
- SetField setField = it.next();
- setField.getValue().appendTo(sb);
- if (it.hasNext()) {
- sb.append(", ");
- }
- }
- sb.append(')');
- it = setFields.iterator();
- }
- if (table.getJoined() != null) {
- sb.append(" FROM ");
- table.getJoined().appendToRest(table.getTableName().getAlias(), sb);
- }
- if (whereCondition != null) {
- sb.append(" WHERE ");
- whereCondition.appendTo(sb);
- }
- sb.append(';');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SQLView.java b/framework/sql/src/org/ofbiz/sql/SQLView.java
deleted file mode 100644
index 3e69bb7..0000000
--- a/framework/sql/src/org/ofbiz/sql/SQLView.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public final class SQLView extends SQLStatement<SQLView> {
- private final String name;
- private final SQLSelect sqlSelect;
-
- public SQLView(String name, SQLSelect sqlSelect) {
- this.name = name;
- this.sqlSelect = sqlSelect;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public String getName() {
- return name;
- }
-
- public SQLSelect getSelect() {
- return sqlSelect;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof SQLView) {
- SQLView other = (SQLView) o;
- return name.equals(other.name) && sqlSelect.equals(other.sqlSelect);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("CREATE VIEW ").append(name).append(" AS ");
- sqlSelect.appendTo(sb);
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SelectGroup.java b/framework/sql/src/org/ofbiz/sql/SelectGroup.java
deleted file mode 100644
index c8cee37..0000000
--- a/framework/sql/src/org/ofbiz/sql/SelectGroup.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.ofbiz.base.util.StringUtil;
-
-public final class SelectGroup extends Atom {
- private final boolean isDistinct;
- private final List<FieldAll> fieldAlls;
- private final Map<String, FieldDef> fieldDefs;
- private final Table table;
- private final Condition whereCondition;
- private final Condition havingCondition;
- private final List<String> groupBy;
-
- public SelectGroup(boolean isDistinct, List<FieldAll> fieldAlls, Map<String, FieldDef> fieldDefs, Table table, Condition whereCondition, Condition havingCondition, List<String> groupBy) {
- this.isDistinct = isDistinct;
- this.fieldAlls = checkEmpty(fieldAlls);
- this.fieldDefs = checkEmpty(fieldDefs);
- this.table = table;
- this.whereCondition = whereCondition;
- this.havingCondition = havingCondition;
- this.groupBy = groupBy;
- }
-
- public boolean getIsDistinct() {
- return isDistinct;
- }
-
- public Collection<FieldAll> getFieldAlls() {
- return fieldAlls;
- }
-
- public Collection<FieldDef> getFieldDefs() {
- return fieldDefs != null ? fieldDefs.values() : null;
- }
-
- public Table getTable() {
- return table;
- }
-
- public Condition getWhereCondition() {
- return whereCondition;
- }
-
- public Condition getHavingCondition() {
- return havingCondition;
- }
-
- public List<String> getGroupBy() {
- return groupBy;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof SelectGroup)) {
- return false;
- }
-
- SelectGroup other = (SelectGroup) o;
- return isDistinct == other.isDistinct
- && equalsHelper(fieldAlls, other.fieldAlls)
- && equalsHelper(fieldDefs, other.fieldDefs)
- && table.equals(other.table)
- && equalsHelper(whereCondition, other.whereCondition)
- && equalsHelper(havingCondition, other.havingCondition)
- && equalsHelper(groupBy, other.groupBy)
- ;
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append("SELECT");
- if (isDistinct) {
- sb.append(" DISTINCT");
- }
- if (fieldAlls != null) {
- StringUtil.appendTo(sb, fieldAlls, " ", null, ",");
- }
- if (fieldAlls != null && fieldDefs != null) {
- sb.append(',');
- }
- if (fieldDefs != null) {
- StringUtil.appendTo(sb, fieldDefs.values(), " ", null, ",");
- }
- sb.append(" FROM ");
- table.appendTo(sb);
- if (whereCondition != null) {
- sb.append(" WHERE ");
- whereCondition.appendTo(sb);
- }
- if (havingCondition != null) {
- sb.append(" HAVING ");
- havingCondition.appendTo(sb);
- }
- if (groupBy != null) {
- sb.append(" GROUP BY ");
- StringUtil.append(sb, groupBy, null, null, ", ");
- }
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SelectPlan.java b/framework/sql/src/org/ofbiz/sql/SelectPlan.java
deleted file mode 100644
index bd1747b..0000000
--- a/framework/sql/src/org/ofbiz/sql/SelectPlan.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class SelectPlan<P extends SelectPlan<P, C>, C> extends SQLPlan<P> {
- private final ConditionPlan<C> wherePlan;
- private final ConditionPlan<C> havingPlan;
-
- protected SelectPlan(ConditionPlan<C> wherePlan, ConditionPlan<C> havingPlan) {
- this.wherePlan = wherePlan;
- this.havingPlan = havingPlan;
- }
-
- public ConditionPlan<C> getWherePlan() {
- return wherePlan;
- }
-
- public ConditionPlan<C> getHavingPlan() {
- return havingPlan;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/SetField.java b/framework/sql/src/org/ofbiz/sql/SetField.java
deleted file mode 100644
index 34c571c..0000000
--- a/framework/sql/src/org/ofbiz/sql/SetField.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public final class SetField extends Atom {
- private final String name;
- private final Value value;
-
- public SetField(String name, Value value) {
- this.name = name;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public Value getValue() {
- return value;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof SetField) {
- SetField other = (SetField) o;
- return name.equals(other.name) && value.equals(other.value);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append(name).append(" = ");
- value.appendTo(sb);
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/StaticValue.java b/framework/sql/src/org/ofbiz/sql/StaticValue.java
deleted file mode 100644
index f1babf9..0000000
--- a/framework/sql/src/org/ofbiz/sql/StaticValue.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class StaticValue extends ConstantValue {
- public abstract String getDefaultName();
-}
diff --git a/framework/sql/src/org/ofbiz/sql/StringValue.java b/framework/sql/src/org/ofbiz/sql/StringValue.java
deleted file mode 100644
index 0612f9a..0000000
--- a/framework/sql/src/org/ofbiz/sql/StringValue.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-import org.ofbiz.base.lang.SourceMonitored;
-
-@SourceMonitored
-public final class StringValue extends ConstantValue {
- private final String str;
-
- public StringValue(String str) {
- this.str = str;
- }
-
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public String getString() {
- return str;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof StringValue) {
- StringValue other = (StringValue) o;
- return str.equals(other.str);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append('\'').append(str.replaceAll("'", "''")).append('\'');
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/Table.java b/framework/sql/src/org/ofbiz/sql/Table.java
deleted file mode 100644
index 47961b4..0000000
--- a/framework/sql/src/org/ofbiz/sql/Table.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public final class Table extends Atom {
- private final TableName tableName;
- private final Joined joined;
-
- public Table(TableName tableName) {
- this(tableName, null);
- }
-
- public Table(TableName tableName, Joined joined) {
- this.tableName = tableName;
- this.joined = joined;
- }
-
- public TableName getTableName() {
- return tableName;
- }
-
- public Joined getJoined() {
- return joined;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof Table) {
- Table other = (Table) o;
- return tableName.equals(other.tableName) && equalsHelper(joined, other.joined);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- tableName.appendTo(sb);
- if (joined != null) {
- joined.appendTo(tableName.getAlias(), sb);
- }
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/TableName.java b/framework/sql/src/org/ofbiz/sql/TableName.java
deleted file mode 100644
index 1403633..0000000
--- a/framework/sql/src/org/ofbiz/sql/TableName.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public final class TableName extends Atom {
- private final String tableName;
- private final String alias;
-
- public TableName(String tableName, String alias) {
- this.tableName = tableName;
- this.alias = alias != null ? alias : tableName;
- }
-
- public final String getTableName() {
- return tableName;
- }
-
- public final String getAlias() {
- return alias;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof TableName) {
- TableName other = (TableName) o;
- return tableName.equals(other.tableName) && alias.equals(other.alias);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append(tableName);
- if (!alias.equals(tableName)) {
- sb.append(' ').append(alias);
- }
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/Unioned.java b/framework/sql/src/org/ofbiz/sql/Unioned.java
deleted file mode 100644
index 5a33e1f..0000000
--- a/framework/sql/src/org/ofbiz/sql/Unioned.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public final class Unioned extends Atom {
- public enum Operator { UNION, UNION_ALL, INTERSECT, INTERSECT_ALL, EXCEPT, EXCEPT_ALL }
-
- private final Operator operator;
- private final SelectGroup group;
- private final Unioned next;
-
- public Unioned(Operator operator, SelectGroup group, Unioned next) {
- this.operator = operator;
- this.group = group;
- this.next = next;
- }
-
- public Operator getOperator() {
- return operator;
- }
-
- public SelectGroup getGroup() {
- return group;
- }
-
- public Unioned getNext() {
- return next;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof Unioned) {
- Unioned other = (Unioned) o;
- return operator.equals(other.operator) && group.equals(other.group) && equalsHelper(next, other.next);
- } else {
- return false;
- }
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- sb.append(' ').append(operator.toString().replace('_', ' ')).append(' ');
- group.appendTo(sb);
- if (next != null) {
- next.appendTo(sb);
- }
- return sb;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/UpdatePlan.java b/framework/sql/src/org/ofbiz/sql/UpdatePlan.java
deleted file mode 100644
index 7f6ba70..0000000
--- a/framework/sql/src/org/ofbiz/sql/UpdatePlan.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class UpdatePlan<P extends UpdatePlan<P, C>, C> extends SQLPlan<P> {
- private final ConditionPlan<C> wherePlan;
-
- protected UpdatePlan(ConditionPlan<C> wherePlan) {
- this.wherePlan = wherePlan;
- }
-
- public ConditionPlan<C> getWherePlan() {
- return wherePlan;
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/Value.java b/framework/sql/src/org/ofbiz/sql/Value.java
deleted file mode 100644
index 7e33549..0000000
--- a/framework/sql/src/org/ofbiz/sql/Value.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class Value extends Atom {
- public static final class Null extends Value {
- private Null() {
- }
- @Override
- public void accept(Visitor visitor) {
- visitor.visit(this);
- }
-
- public StringBuilder appendTo(StringBuilder sb) {
- return sb.append("NULL");
- }
- }
-
- public static final Null NULL = new Null();
-
- public interface Visitor {
- void visit(AggregateFunction value);
- void visit(FieldValue value);
- void visit(FunctionCall value);
- void visit(MathValue value);
- void visit(Null value);
- void visit(NumberValue<?> value);
- void visit(ParameterValue value);
- void visit(StringValue value);
- void visit(CountAllFunction value);
- }
-
- public static class BaseVisitor implements Visitor {
- public void visit(AggregateFunction value) {
- }
-
- public void visit(FieldValue value) {
- }
-
- public void visit(FunctionCall value) {
- }
-
- public void visit(MathValue value) {
- }
-
- public void visit(Null value) {
- }
-
- public void visit(NumberValue<?> value) {
- }
-
- public void visit(ParameterValue value) {
- }
-
- public void visit(StringValue value) {
- }
-
- public void visit(CountAllFunction value) {
- }
- }
-
- public abstract void accept(Visitor visitor);
-}
diff --git a/framework/sql/src/org/ofbiz/sql/ViewPlan.java b/framework/sql/src/org/ofbiz/sql/ViewPlan.java
deleted file mode 100644
index cd6793b..0000000
--- a/framework/sql/src/org/ofbiz/sql/ViewPlan.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql;
-
-public abstract class ViewPlan<P extends ViewPlan<P>> extends SQLPlan<P> {
-}
diff --git a/framework/sql/src/org/ofbiz/sql/test/ConditionsTest.java b/framework/sql/src/org/ofbiz/sql/test/ConditionsTest.java
deleted file mode 100644
index 7b03c48..0000000
--- a/framework/sql/src/org/ofbiz/sql/test/ConditionsTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql.test;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.ofbiz.sql.BetweenCondition;
-import org.ofbiz.sql.BooleanCondition;
-import org.ofbiz.sql.Condition;
-import org.ofbiz.sql.ConditionList;
-import org.ofbiz.sql.Joiner;
-import org.ofbiz.sql.ListCondition;
-import org.ofbiz.sql.NumberValue;
-import org.ofbiz.sql.Value;
-
-import org.ofbiz.base.lang.SourceMonitored;
-import org.ofbiz.base.test.GenericTestCaseBase;
-
-@SourceMonitored
-public class ConditionsTest extends GenericTestCaseBase {
- private static final NumberValue<Long> l1 = NumberValue.valueOf(1);
- private static final NumberValue<Long> l2 = NumberValue.valueOf(5);
- private static final NumberValue<Long> l3 = NumberValue.valueOf(10);
-
- public ConditionsTest(String name) {
- super(name);
- }
-
- private static <C extends Condition> void basicTest(String label, Class<C> clz, C c, String s, C o, boolean matches) {
- assertEquals(label + ":toString", s, c.toString());
- assertNotEquals(label + ":not-equals-this", c, ConditionsTest.class);
- if (o != null) {
- if (matches) {
- assertEquals(label + ":equals", o, c);
- } else {
- assertNotEquals(label + ":not-equals", o, c);
- }
- }
- ConditionVisitorRecorder visitor = new ConditionVisitorRecorder();
- c.accept(visitor);
- c.accept(visitor);
- assertEquals(label + ":visited", 2, visitor.counts.remove(clz).intValue());
- assertTrue(label + ":nothing-else-visited", visitor.counts.isEmpty());
- }
-
- private static void betweenConditionTest(String label, BetweenCondition c, Value left, Value r1, Value r2, String s, BetweenCondition o, boolean matches) {
- assertEquals(label + ":left", left, c.getLeft());
- assertEquals(label + ":r1", r1, c.getR1());
- assertEquals(label + ":r2", r2, c.getR2());
- basicTest(label, BetweenCondition.class, c, s, o, matches);
- }
-
- public void testBetweenCondition() {
- BetweenCondition c1 = new BetweenCondition(l1, l2, l3);
- betweenConditionTest("c1", c1, l1, l2, l3, "1 BETWEEN 5 AND 10", null, false);
- BetweenCondition c2 = new BetweenCondition(l3, l1, l2);
- betweenConditionTest("c2", c2, l3, l1, l2, "10 BETWEEN 1 AND 5", c1, false);
- BetweenCondition c3 = new BetweenCondition(l1, l2, l3);
- betweenConditionTest("c3", c3, l1, l2, l3, "1 BETWEEN 5 AND 10", c1, true);
- BetweenCondition c4 = new BetweenCondition(l1, l3, l2);
- betweenConditionTest("c4", c4, l1, l3, l2, "1 BETWEEN 10 AND 5", c1, false);
- BetweenCondition c5 = new BetweenCondition(l1, l2, l1);
- betweenConditionTest("c5", c5, l1, l2, l1, "1 BETWEEN 5 AND 1", c1, false);
- }
-
- private static void booleanConditionTest(String label, BooleanCondition c, Value left, String op, Value right, String s, BooleanCondition o, boolean matches) {
- assertEquals(label + ":left", left, c.getLeft());
- assertEquals(label + ":op", op, c.getOp());
- assertEquals(label + ":right", right, c.getRight());
- basicTest(label, BooleanCondition.class, c, s, o, matches);
- }
-
- public void testBooleanCondition() {
- BooleanCondition c1 = new BooleanCondition(l1, "=", l2);
- booleanConditionTest("c1", c1, l1, "=", l2, "1 = 5", null, false);
- BooleanCondition c2 = new BooleanCondition(l1, "=", l3);
- booleanConditionTest("c2", c2, l1, "=", l3, "1 = 10", c1, false);
- BooleanCondition c3 = new BooleanCondition(l1, "<", l2);
- booleanConditionTest("c3", c3, l1, "<", l2, "1 < 5", c1, false);
- BooleanCondition c4 = new BooleanCondition(l2, ">", l3);
- booleanConditionTest("c4", c4, l2, ">", l3, "5 > 10", c1, false);
- BooleanCondition c5 = new BooleanCondition(l1, "=", l2);
- booleanConditionTest("c5", c5, l1, "=", l2, "1 = 5", c1, true);
- }
-
- private static void conditionListTest(String label, ConditionList c, Joiner joiner, List<? extends Condition> conditions, String s, ConditionList o, boolean matches) {
- assertEquals(label + ":joiner", joiner, c.getJoiner());
- basicTest(label, ConditionList.class, c, s, o, matches);
- BooleanCondition b = new BooleanCondition(l1, "=", l3);
- c.add(b);
- assertEqualsIterable(label + ":iterable", conditions, Collections.<Condition>emptyList(), false, c, list(b), true);
- }
-
- public void testConditionList() {
- BooleanCondition b1 = new BooleanCondition(l1, "=", l2);
- BooleanCondition b2 = new BooleanCondition(l2, "=", l3);
- ConditionList c1 = new ConditionList(Joiner.AND, GenericTestCaseBase.<Condition>list(b1));
- conditionListTest("c1", c1, Joiner.AND, list(b1), "( 1 = 5 )", null, false);
- ConditionList c2 = new ConditionList(Joiner.AND, GenericTestCaseBase.<Condition>list(b1, b2));
- conditionListTest("c2", c2, Joiner.AND, list(b1, b2), "( 1 = 5 AND 5 = 10 )", c1, false);
- ConditionList c3 = new ConditionList(Joiner.OR, GenericTestCaseBase.<Condition>list(b2, b1));
- conditionListTest("c3", c3, Joiner.OR, list(b2, b1), "( 5 = 10 OR 1 = 5 )", c1, false);
- ConditionList c4 = new ConditionList(Joiner.AND, GenericTestCaseBase.<Condition>list(b1));
- conditionListTest("c4", c4, Joiner.AND, list(b1), "( 1 = 5 )", c1, true);
- }
-
- private static void listConditionTest(String label, ListCondition c, Value left, String op, List<? extends Value> values, String s, ListCondition o, boolean matches) {
- assertEquals(label + ":left", left, c.getLeft());
- assertEquals(label + ":op", op, c.getOp());
- assertEquals(label + ":right", values, c.getValues());
- basicTest(label, ListCondition.class, c, s, o, matches);
- }
-
- @SuppressWarnings("unchecked")
- public void testListCondition() {
- ListCondition c1 = new ListCondition(l1, "IN", GenericTestCaseBase.<Value>list(l2));
- listConditionTest("c1", c1, l1, "in", list(l2), "1 in (5)", null, false);
- ListCondition c2 = new ListCondition(l1, "NOT IN", GenericTestCaseBase.<Value>list(l2));
- listConditionTest("c2", c2, l1, "not in", list(l2), "1 not in (5)", c1, false);
- ListCondition c3 = new ListCondition(l2, "IN", GenericTestCaseBase.<Value>list(l3));
- listConditionTest("c3", c3, l2, "in", list(l3), "5 in (10)", c1, false);
- ListCondition c4 = new ListCondition(l1, "IN", GenericTestCaseBase.<Value>list(l2, l3));
- listConditionTest("c4", c4, l1, "in", list(l2, l3), "1 in (5, 10)", c1, false);
- ListCondition c5 = new ListCondition(l1, "IN", GenericTestCaseBase.<Value>list(l2));
- listConditionTest("c5", c5, l1, "in", list(l2), "1 in (5)", c1, true);
- }
-
- public static class ConditionVisitorRecorder extends Recorder<Class<? extends Condition>> implements Condition.Visitor {
- public void visit(BetweenCondition condition) {
- record(BetweenCondition.class);
- }
-
- public void visit(BooleanCondition condition) {
- record(BooleanCondition.class);
- }
-
- public void visit(ConditionList condition) {
- record(ConditionList.class);
- }
-
- public void visit(ListCondition condition) {
- record(ListCondition.class);
- }
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/test/GoodParseAll.sql b/framework/sql/src/org/ofbiz/sql/test/GoodParseAll.sql
deleted file mode 100644
index 1379255..0000000
--- a/framework/sql/src/org/ofbiz/sql/test/GoodParseAll.sql
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-SELECT
- a.*,
- b.* EXCLUDE (partyId, partyId),
- c.* EXCLUDE (partyId),
- d.roleTypeId,
- d.description AS roleDescription,
- SUM(a.partyId),
- FOO(a.partyId, 1) AS baz,
- (a.partyId || '-' || a.partyTypeId) AS one,
- COUNT(a.partyId) AS cnt1,
- COUNT(partyId) AS cnt2,
- COUNT(DISTINCT a.partyId) AS cnt3
-FROM
- Party a LEFT JOIN Person b USING partyId
- LEFT JOIN PartyGroup c ON b.partyId = c.partyId
- JOIN PartyRole d ON c.partyId = d.partyId AND c.partyId = d.partyId
-WHERE
- a.partyTypeId = 'PERSON'
- AND
- b.lastName LIKE ?lastName
- AND
- b.birthDate BETWEEN '1974-12-01' AND '1974-12-31'
- OR
- (
- b.partyId IN ('1', '2', '3', '4')
- AND
- b.gender = 'M'
- )
-
-HAVING
- b.firstName LIKE '%foo%'
-RELATION TYPE one TITLE MainA Person MAP partyId
-RELATION TITLE MainB Person MAP partyId
-RELATION TYPE one Person MAP partyId
-RELATION PartyGroup MAP partyId
-ORDER BY
- LOWER(lastName), firstName, -birthDate
-OFFSET 5
-LIMIT 10
-;
-
-INSERT INTO Party (partyId, partyTypeId, statusId) VALUES
- ('a', 'PERSON', 'PARTY_DISABLED'),
- (5, 'PARTY_GROUP', ?name);
-INSERT INTO Person (partyId, firstName) SELECT partyId, (partyId || '-auto') AS firstName FROM Party WHERE partyId IN ('a', 'b');
-UPDATE Person SET (lastName) = (('auto-' || partyId)) WHERE partyId IN ('a', 'b');
-UPDATE Person SET (lastName, height, width) = (('auto-' || partyId), 5, 7) WHERE partyId IN ('a', 'b');
-UPDATE Person SET lastName = ('auto-' || partyId), height = 6, width = 5, nickname = 'a' WHERE partyId IN ('a', 'b');
-DELETE FROM Person WHERE partyId IN ('a', 'b');
-DELETE FROM Party WHERE partyId IN ('a', 'b');
-CREATE VIEW viewOne AS SELECT a.* FROM Party a;
-CREATE INDEX testIndex ON Party USING btree (partyId);
-/*
-UPDATE Person SET firstName = partyId || '-auto' WHERE partyId IN ('a', 'b');
-*/
diff --git a/framework/sql/src/org/ofbiz/sql/test/Recorder.java b/framework/sql/src/org/ofbiz/sql/test/Recorder.java
deleted file mode 100644
index 83f6cac..0000000
--- a/framework/sql/src/org/ofbiz/sql/test/Recorder.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.ofbiz.sql.test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public abstract class Recorder<I> {
- public Map<I, Integer> counts = new HashMap<I, Integer>();
-
- protected void record(I key) {
- Integer count = counts.get(key);
- if (count == null) {
- counts.put(key, Integer.valueOf(1));
- } else {
- counts.put(key, Integer.valueOf(count.intValue() + 1));
- }
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/test/SelectTest.java b/framework/sql/src/org/ofbiz/sql/test/SelectTest.java
deleted file mode 100644
index f5480b3..0000000
--- a/framework/sql/src/org/ofbiz/sql/test/SelectTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql.test;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.ofbiz.base.lang.SourceMonitored;
-import org.ofbiz.base.test.GenericTestCaseBase;
-import org.ofbiz.sql.ConstantValue;
-import org.ofbiz.sql.FieldAll;
-import org.ofbiz.sql.FieldDef;
-import org.ofbiz.sql.FieldValue;
-import org.ofbiz.sql.FunctionCall;
-import org.ofbiz.sql.OrderByItem;
-import org.ofbiz.sql.StaticValue;
-import org.ofbiz.sql.Value;
-
-@SourceMonitored
-public class SelectTest extends GenericTestCaseBase {
- private static final FieldValue fv1 = new FieldValue("partyId");
- private static final FieldValue fv4 = new FieldValue(null, "firstName");
- private static final FunctionCall fc1 = new FunctionCall("LOWER", GenericTestCaseBase.<Value>list(fv1));
-
- public SelectTest(String name) {
- super(name);
- }
-
- private static <V> void basicTest(String label, Class<V> clz, V v, V o, boolean matches) {
- assertNotEquals(label + ":not-equals-this", v, SelectTest.class);
- if (o != null) {
- if (matches) {
- assertEquals(label + ":equals", o, v);
- } else {
- assertNotEquals(label + ":not-equals", o, v);
- }
- }
- }
-
- private static void fieldAllTest(String label, FieldAll v, String alias, Set<String> exclude, FieldAll o, boolean matches) throws Exception {
- assertEquals(label + ":alias", alias, v.getAlias());
- assertEquals(label + ":exclude", exclude, set(v));
- basicTest(label, FieldAll.class, v, o, matches);
- }
-
- public void testFieldAll() throws Exception {
- FieldAll v1 = new FieldAll("a", set("a", "b"));
- fieldAllTest("v1", v1, "a", set("a", "b"), null, false);
- FieldAll v2 = new FieldAll("b", set("a", "b"));
- fieldAllTest("v2", v2, "b", set("a", "b"), v1, false);
- FieldAll v3 = new FieldAll("a", set("b", "c"));
- fieldAllTest("v3", v3, "a", set("b", "c"), v1, false);
- FieldAll v4 = new FieldAll("a", Collections.<String>emptySet());
- fieldAllTest("v4", v4, "a", Collections.<String>emptySet(), v1, false);
- FieldAll v5 = new FieldAll("a", set("b", "a"));
- fieldAllTest("v5", v5, "a", set("b", "a"), v1, true);
- }
-
- private static void fieldDefTest(String label, FieldDef v, StaticValue value, String alias, String defaultName, FieldDef o, boolean matches) throws Exception {
- assertEquals(label + ":value", value, v.getValue());
- assertEquals(label + ":alias", alias, v.getAlias());
- assertEquals(label + ":default-name", defaultName, v.getDefaultName());
- basicTest(label, FieldDef.class, v, o, matches);
- }
-
- public void testFieldDef() throws Exception {
- FieldDef v1 = new FieldDef(fv1, null);
- fieldDefTest("v1", v1, fv1, null, "partyId", null, false);
- FieldDef v2 = new FieldDef(fv1, "partyId");
- fieldDefTest("v2", v2, fv1, "partyId", "partyId", v1, false);
- FieldDef v3 = new FieldDef(fv4, null);
- fieldDefTest("v3", v3, fv4, null, "firstName", v1, false);
- FieldDef v4 = new FieldDef(fv4, "partyId");
- fieldDefTest("v4", v4, fv4, "partyId", "partyId", v1, false);
- FieldDef v5 = new FieldDef(fv1, null);
- fieldDefTest("v5", v5, fv1, null, "partyId", v1, true);
- }
-
- private static void orderByItemTest(String label, OrderByItem v, OrderByItem.Order order, OrderByItem.Nulls nulls, ConstantValue value, OrderByItem o, boolean matches) throws Exception {
- assertEquals(label + ":order", order, v.getOrder());
- assertEquals(label + ":nulls", nulls, v.getNulls());
- assertEquals(label + ":value", value, v.getValue());
- basicTest(label, OrderByItem.class, v, o, matches);
- }
-
- public void testOrderByItem() throws Exception {
- OrderByItem v1 = new OrderByItem(OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, fv1);
- orderByItemTest("v1", v1, OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, fv1, null, false);
- OrderByItem v2 = new OrderByItem(OrderByItem.Order.ASCENDING, OrderByItem.Nulls.FIRST, fv1);
- orderByItemTest("v3", v2, OrderByItem.Order.ASCENDING, OrderByItem.Nulls.FIRST, fv1, v1, false);
- OrderByItem v3 = new OrderByItem(OrderByItem.Order.DESCENDING, OrderByItem.Nulls.LAST, fv1);
- orderByItemTest("v2", v3, OrderByItem.Order.DESCENDING, OrderByItem.Nulls.LAST, fv1, v1, false);
- OrderByItem v4 = new OrderByItem(OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, fc1);
- orderByItemTest("v4", v4, OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, fc1, v1, false);
- OrderByItem v5 = new OrderByItem(OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, fv4);
- orderByItemTest("v5", v5, OrderByItem.Order.DEFAULT, OrderByItem.Nulls.DEFAULT, fv4, v1, false);
- OrderByItem v6 = new OrderByItem(OrderByItem.Order.DEFAULT, OrderByItem.Nulls.LAST, fv4);
- orderByItemTest("v6", v6, OrderByItem.Order.DEFAULT, OrderByItem.Nulls.LAST, fv4, v1, false);
- }
-}
diff --git a/framework/sql/src/org/ofbiz/sql/test/TestSelect.sql b/framework/sql/src/org/ofbiz/sql/test/TestSelect.sql
deleted file mode 100644
index f326d65..0000000
--- a/framework/sql/src/org/ofbiz/sql/test/TestSelect.sql
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-SELECT
- a.*,
- b.firstName,
- b.lastName
-FROM
- Party a JOIN Person b ON a.partyId = b.partyId
-WHERE
- a.partyTypeId = 'PERSON'
- AND
- b.lastName LIKE ?lastName
-HAVING
- b.firstName LIKE '%foo%'
-OFFSET 5
-LIMIT 10
-;
-SELECT
- a.partyTypeId,
- COUNT(a.partyId) AS count
-FROM
- Party a LEFT JOIN Person b USING partyId
- LEFT JOIN PartyGroup c USING partyId
-GROUP BY
- partyTypeId
-;
-
diff --git a/framework/sql/src/org/ofbiz/sql/test/ValuesTest.java b/framework/sql/src/org/ofbiz/sql/test/ValuesTest.java
deleted file mode 100644
index 5f2846f..0000000
--- a/framework/sql/src/org/ofbiz/sql/test/ValuesTest.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.ofbiz.sql.test;
-
-import java.util.List;
-import org.ofbiz.sql.ConstantValue;
-import org.ofbiz.sql.CountAllFunction;
-import org.ofbiz.sql.AggregateFunction;
-import org.ofbiz.sql.FieldValue;
-import org.ofbiz.sql.FunctionCall;
-import org.ofbiz.sql.MathValue;
-import org.ofbiz.sql.NumberValue;
-import org.ofbiz.sql.ParameterValue;
-import org.ofbiz.sql.StaticValue;
-import org.ofbiz.sql.StringValue;
-import org.ofbiz.sql.Value;
-
-import org.ofbiz.base.lang.SourceMonitored;
-import org.ofbiz.base.test.GenericTestCaseBase;
-
-@SourceMonitored
-public class ValuesTest extends GenericTestCaseBase {
- private static final FieldValue fv1 = new FieldValue("partyId");
- private static final FieldValue fv2 = new FieldValue("a", "partyId");
- private static final FieldValue fv3 = new FieldValue(null, "partyId");
- private static final FieldValue fv4 = new FieldValue(null, "firstName");
- private static final NumberValue<Long> nv1 = NumberValue.valueOf(1);
- private static final NumberValue<Double> nv2 = NumberValue.valueOf(2D);
- private static final NumberValue<Long> nv3 = NumberValue.valueOf(3);
-
- public ValuesTest(String name) {
- super(name);
- }
-
- private static <V extends Value> void basicTest(String label, Class<V> clz, V v, String defaultName, String s, V o, boolean matches) {
- if (v instanceof StaticValue) {
- assertEquals(label + ":default-name", defaultName, ((StaticValue) v).getDefaultName());
- }
- assertEquals(label + ":toString", s, v.toString());
- assertNotEquals(label + ":not-equals-this", v, ValuesTest.class);
- if (o != null) {
- if (matches) {
- assertEquals(label + ":equals", o, v);
- } else {
- assertNotEquals(label + ":not-equals", o, v);
- }
- }
- ValueVisitorRecorder visitor = new ValueVisitorRecorder();
- v.accept(visitor);
- v.accept(visitor);
- assertEquals(label + ":visited", 2, visitor.counts.remove(clz).intValue());
- assertTrue(label + ":nothing-else-visited", visitor.counts.isEmpty());
- }
-
- private static void countAllFunctionTest(String label, CountAllFunction v, String tableName, String s, CountAllFunction o, boolean matches) {
- assertEquals(label + ":left", tableName, v.getTableName());
- basicTest(label, CountAllFunction.class, v, "COUNT", s, o, matches);
- }
-
- public void testCountAllFunction() {
- CountAllFunction v1 = new CountAllFunction("a");
- countAllFunctionTest("v1", v1, "a", "COUNT(a.*)", null, false);
- CountAllFunction v2 = new CountAllFunction(null);
- countAllFunctionTest("v2", v2, null, "COUNT(*)", v1, false);
- CountAllFunction v3 = new CountAllFunction("a");
- countAllFunctionTest("v3", v3, "a", "COUNT(a.*)", v1, true);
- }
-
- private static void aggregateFunctionTest(String label, AggregateFunction v, String name, boolean isDistinct, FieldValue fv, String s, AggregateFunction o, boolean matches) {
- assertEquals(label + ":name", name, v.getName());
- assertEquals(label + ":left", isDistinct, v.isDistinct());
- assertEquals(label + ":field-value", fv, v.getValue());
- basicTest(label, AggregateFunction.class, v, name, s, o, matches);
- }
-
- public void testAggregateFunction() {
- AggregateFunction v1 = new AggregateFunction("COUNT", false, fv2);
- aggregateFunctionTest("v1", v1, "COUNT", false, fv2, "COUNT(a.partyId)", null, false);
- AggregateFunction v2 = new AggregateFunction("COUNT", true, fv2);
- aggregateFunctionTest("v2", v2, "COUNT", true, fv2, "COUNT(DISTINCT a.partyId)", v1, false);
- AggregateFunction v3 = new AggregateFunction("COUNT", true, fv1);
- aggregateFunctionTest("v3", v3, "COUNT", true, fv1, "COUNT(DISTINCT partyId)", v1, false);
- AggregateFunction v4 = new AggregateFunction("COUNT", false, fv1);
- aggregateFunctionTest("v4", v4, "COUNT", false, fv1, "COUNT(partyId)", v1, false);
- AggregateFunction v5 = new AggregateFunction("MAX", false, fv2);
- aggregateFunctionTest("v5", v5, "MAX", false, fv2, "MAX(a.partyId)", v1, false);
- AggregateFunction v6 = new AggregateFunction("COUNT", false, fv2);
- aggregateFunctionTest("v6", v6, "COUNT", false, fv2, "COUNT(a.partyId)", v1, true);
- }
-
- private static void fieldValueTest(String label, FieldValue v, String tableName, String fieldName, String s, FieldValue o, boolean matches) {
- assertEquals(label + ":table-name", tableName, v.getTableName());
- assertEquals(label + ":field-name", fieldName, v.getFieldName());
- basicTest(label, FieldValue.class, v, fieldName, s, o, matches);
- }
-
- public void testFieldValue() {
- fieldValueTest("fv1", fv1, null, "partyId", "partyId", null, false);
- fieldValueTest("fv2", fv2, "a", "partyId", "a.partyId", fv1, false);
- fieldValueTest("fv3", fv3, null, "partyId", "partyId", fv1, true);
- fieldValueTest("fv4", fv4, null, "firstName", "firstName", fv1, false);
- }
-
- private static void functionCallTest(String label, FunctionCall v, String name, List<? extends Value> values, String s, FunctionCall o, boolean matches) {
- assertEquals(label + ":name", name, v.getName());
- assertEquals(label + ":arg-count", values.size(), v.getArgCount());
- assertEqualsIterable(label, values, v);
- basicTest(label, FunctionCall.class, v, name, s, o, matches);
- }
-
- @SuppressWarnings("unchecked")
- public void testFunctionCall() {
- FunctionCall v1 = new FunctionCall("LENGTH", GenericTestCaseBase.<Value>list(nv1, nv2));
- functionCallTest("v1", v1, "LENGTH", list(nv1, nv2), "LENGTH(1, 2.0)", null, false);
- FunctionCall v2 = new FunctionCall("LENGTH", GenericTestCaseBase.<Value>list(nv1, nv3));
- functionCallTest("v2", v2, "LENGTH", list(nv1, nv3), "LENGTH(1, 3)", v1, false);
- FunctionCall v3 = new FunctionCall("LENGTH", GenericTestCaseBase.<Value>list(nv1, nv2));
- functionCallTest("v3", v3, "LENGTH", list(nv1, nv2), "LENGTH(1, 2.0)", v1, true);
- FunctionCall v4 = new FunctionCall("TRIM", GenericTestCaseBase.<Value>list(nv1, nv2));
- functionCallTest("v4", v4, "TRIM", list(nv1, nv2), "TRIM(1, 2.0)", v1, false);
- }
-
- private static void mathValueTest(String label, MathValue v, String op, List<? extends ConstantValue> values, String s, MathValue o, boolean matches) {
- assertEquals(label + ":op", op, v.getOp());
- assertEqualsIterable(label, values, v);
- basicTest(label, MathValue.class, v, null, s, o, matches);
- }
-
- @SuppressWarnings("unchecked")
- public void testMathValue() {
- MathValue v1 = new MathValue("+", GenericTestCaseBase.<ConstantValue>list(nv1, nv2));
- mathValueTest("v1", v1, "+", list(nv1, nv2), "(1 + 2.0)", null, false);
- MathValue v2 = new MathValue("+", GenericTestCaseBase.<ConstantValue>list(nv1, nv3));
- mathValueTest("v2", v2, "+", list(nv1, nv3), "(1 + 3)", v1, false);
- MathValue v3 = new MathValue("+", GenericTestCaseBase.<ConstantValue>list(nv1, nv2));
- mathValueTest("v3", v3, "+", list(nv1, nv2), "(1 + 2.0)", v1, true);
- MathValue v4 = new MathValue("-", GenericTestCaseBase.<ConstantValue>list(nv1, nv3));
- mathValueTest("v4", v4, "-", list(nv1, nv3), "(1 - 3)", v1, false);
- }
-
- public void testNull() {
- basicTest("null", Value.Null.class, Value.NULL, null, "NULL", null, false);
- }
-
- private static <N extends Number> void numberValueTest(String label, NumberValue<N> v, N n, String s, NumberValue<?> o, boolean matches) {
- assertEquals(label + ":number", n, v.getNumber());
- basicTest(label, NumberValue.class, v, null, s, o, matches);
- }
-
- public void testNumberValue() {
- numberValueTest("nv1", nv1, Long.valueOf(1), "1", null, false);
- numberValueTest("nv2", nv2, Double.valueOf(2), "2.0", nv1, false);
- NumberValue<Long> nv3 = NumberValue.valueOf(1);
- numberValueTest("nv3", nv3, Long.valueOf(1), "1", nv1, true);
- }
-
- private static void parameterValueTest(String label, ParameterValue v, String name, String s, ParameterValue o, boolean matches) {
- assertEquals(label + ":name", name, v.getName());
- basicTest(label, ParameterValue.class, v, null, s, o, matches);
- }
-
- public void testParameterValue() {
- ParameterValue v1 = new ParameterValue("a");
- parameterValueTest("v1", v1, "a", "?a", null, false);
- ParameterValue v2 = new ParameterValue("b");
- parameterValueTest("v2", v2, "b", "?b", v1, false);
- ParameterValue v3 = new ParameterValue("a");
- parameterValueTest("v3", v3, "a", "?a", v1, true);
- }
-
- private static void stringValueTest(String label, StringValue v, String string, String s, StringValue o, boolean matches) {
- assertEquals(label + ":name", string, v.getString());
- basicTest(label, StringValue.class, v, null, s, o, matches);
- }
-
- public void testStringValue() {
- StringValue v1 = new StringValue("foo");
- stringValueTest("v1", v1, "foo", "'foo'", null, false);
- StringValue v2 = new StringValue("b'r");
- stringValueTest("v2", v2, "b'r", "'b''r'", v1, false);
- StringValue v3 = new StringValue("foo");
- stringValueTest("v3", v3, "foo", "'foo'", v1, true);
- }
-
- public static class ValueVisitorRecorder extends Recorder<Class<? extends Value>> implements Value.Visitor {
-
- public void visit(AggregateFunction value) {
- record(AggregateFunction.class);
- }
-
- public void visit(FieldValue value) {
- record(FieldValue.class);
- }
-
- public void visit(FunctionCall value) {
- record(FunctionCall.class);
- }
-
- public void visit(MathValue value) {
- record(MathValue.class);
- }
-
- public void visit(Value.Null value) {
- record(Value.Null.class);
- }
-
- public void visit(NumberValue<?> value) {
- record(NumberValue.class);
- }
-
- public void visit(ParameterValue value) {
- record(ParameterValue.class);
- }
-
- public void visit(StringValue value) {
- record(StringValue.class);
- }
-
- public void visit(CountAllFunction value) {
- record(CountAllFunction.class);
- }
- }
-}
diff --git a/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java b/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
index 74668b8..f9e4d19 100644
--- a/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
+++ b/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
@@ -67,6 +67,7 @@
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.security.Security;
import org.ofbiz.security.SecurityConfigurationException;
import org.ofbiz.security.SecurityFactory;
@@ -124,7 +125,8 @@
* Gets (and creates if necessary) a key to be used for an external login parameter
*/
public static String getExternalLoginKey(HttpServletRequest request) {
- boolean externalLoginKeyEnabled = "true".equals(UtilProperties.getPropertyValue("security", "security.login.externalLoginKey.enabled", "true"));
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
+ boolean externalLoginKeyEnabled = "true".equals(EntityUtilProperties.getPropertyValue("security", "security.login.externalLoginKey.enabled", "true", delegator));
if (!externalLoginKeyEnabled) {
return null;
}
@@ -543,7 +545,7 @@
if (userLogin != null && "Y".equals(userLogin.getString("requirePasswordChange"))) {
return "requirePasswordChange";
}
- String autoChangePassword = UtilProperties.getPropertyValue("security.properties", "user.auto.change.password.enable", "false");
+ String autoChangePassword = EntityUtilProperties.getPropertyValue("security.properties", "user.auto.change.password.enable", "false", delegator);
if ("true".equalsIgnoreCase(autoChangePassword)) {
if ("requirePasswordChange".equals(autoChangePassword(request, response))) {
return "requirePasswordChange";
@@ -733,7 +735,7 @@
Delegator delegator = (Delegator) request.getAttribute("delegator");
HttpSession session = request.getSession();
GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
- String domain = UtilProperties.getPropertyValue("url.properties", "cookie.domain");
+ String domain = EntityUtilProperties.getPropertyValue("url.properties", "cookie.domain", delegator);
if (userLogin != null) {
Cookie autoLoginCookie = new Cookie(getAutoLoginCookieName(request), userLogin.getString("userLoginId"));
autoLoginCookie.setMaxAge(60 * 60 * 24 * 365);
@@ -867,7 +869,8 @@
// preprocessor method to login a user from a HTTP request header (configured in security.properties)
public static String checkRequestHeaderLogin(HttpServletRequest request, HttpServletResponse response) {
- String httpHeader = UtilProperties.getPropertyValue("security.properties", "security.login.http.header", null);
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
+ String httpHeader = EntityUtilProperties.getPropertyValue("security.properties", "security.login.http.header", null, delegator);
// make sure the header field is set in security.properties; if not, then this is disabled and just return
if (UtilValidate.isNotEmpty(httpHeader)) {
@@ -891,7 +894,8 @@
// preprocessor method to login a user from HttpServletRequest.getRemoteUser() (configured in security.properties)
public static String checkServletRequestRemoteUserLogin(HttpServletRequest request, HttpServletResponse response) {
- Boolean allowRemoteUserLogin = "true".equals(UtilProperties.getPropertyValue("security", "security.login.http.servlet.remoteuserlogin.allow", "false"));
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
+ Boolean allowRemoteUserLogin = "true".equals(EntityUtilProperties.getPropertyValue("security", "security.login.http.servlet.remoteuserlogin.allow", "false", delegator));
// make sure logging users via remote user is allowed in security.properties; if not just return
if (allowRemoteUserLogin) {
@@ -913,9 +917,9 @@
}
// preprocessor method to login a user w/ client certificate see security.properties to configure the pattern of CN
public static String check509CertLogin(HttpServletRequest request, HttpServletResponse response) {
- boolean doCheck = "true".equalsIgnoreCase(UtilProperties.getPropertyValue("security.properties", "security.login.cert.allow", "true"));
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
+ boolean doCheck = "true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security.properties", "security.login.cert.allow", "true", delegator));
if (doCheck) {
- Delegator delegator = (Delegator) request.getAttribute("delegator");
HttpSession session = request.getSession();
GenericValue currentUserLogin = (GenericValue) session.getAttribute("userLogin");
if (currentUserLogin != null) {
@@ -925,7 +929,7 @@
}
}
- String cnPattern = UtilProperties.getPropertyValue("security.properties", "security.login.cert.pattern", "(.*)");
+ String cnPattern = EntityUtilProperties.getPropertyValue("security.properties", "security.login.cert.pattern", "(.*)", delegator);
Pattern pattern = Pattern.compile(cnPattern);
//Debug.logInfo("CN Pattern: " + cnPattern, module);
@@ -1171,8 +1175,8 @@
Delegator delegator = (Delegator) request.getAttribute("delegator");
String userName = request.getParameter("USERNAME");
Timestamp now = UtilDateTime.nowTimestamp();
- Integer reqToChangePwdInDays = Integer.valueOf(UtilProperties.getPropertyValue("security.properties", "user.change.password.days", "0"));
- Integer passwordNoticePeriod = Integer.valueOf(UtilProperties.getPropertyValue("security.properties", "user.change.password.notification.days", "0"));
+ Integer reqToChangePwdInDays = Integer.valueOf(EntityUtilProperties.getPropertyValue("security.properties", "user.change.password.days", "0", delegator));
+ Integer passwordNoticePeriod = Integer.valueOf(EntityUtilProperties.getPropertyValue("security.properties", "user.change.password.notification.days", "0", delegator));
if (reqToChangePwdInDays > 0) {
List<GenericValue> passwordHistories = null;
try {
diff --git a/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java b/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
index 4bb3a7a..26c49ea 100644
--- a/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
+++ b/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
@@ -51,6 +51,7 @@
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.webapp.OfbizUrlBuilder;
import org.ofbiz.webapp.event.EventFactory;
import org.ofbiz.webapp.event.EventHandler;
@@ -62,6 +63,7 @@
import org.ofbiz.webapp.website.WebSiteProperties;
import org.ofbiz.webapp.website.WebSiteWorker;
import org.owasp.esapi.errors.EncodingException;
+import org.python.modules.re;
/**
* RequestHandler - Request Processor Object
@@ -395,7 +397,7 @@
if (protectView != null) {
overrideViewUri = protectView;
} else {
- overrideViewUri = UtilProperties.getPropertyValue("security.properties", "default.error.response.view");
+ overrideViewUri = EntityUtilProperties.getPropertyValue("security.properties", "default.error.response.view", delegator);
overrideViewUri = overrideViewUri.replace("view:", "");
if ("none:".equals(overrideViewUri)) {
interruptRequest = true;
@@ -1020,6 +1022,7 @@
*/
@Deprecated
public static String getDefaultServerRootUrl(HttpServletRequest request, boolean secure) {
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
String httpsPort = UtilProperties.getPropertyValue("url.properties", "port.https", "443");
String httpsServer = UtilProperties.getPropertyValue("url.properties", "force.https.host");
String httpPort = UtilProperties.getPropertyValue("url.properties", "port.http", "80");
diff --git a/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy b/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy
index cea9c72..baf6c29 100644
--- a/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy
+++ b/framework/webtools/webapp/webtools/WEB-INF/actions/entity/FindGeneric.groovy
@@ -39,6 +39,7 @@
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.entity.util.EntityFindOptions;
import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.base.util.Debug;
import java.sql.Timestamp;
import java.sql.Date;
@@ -47,6 +48,7 @@
import javolution.util.FastMap;
import javolution.util.FastSet;
+
entityName = parameters.entityName;
ModelReader reader = delegator.getModelReader();
@@ -125,7 +127,7 @@
try {
viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue();
} catch (NumberFormatException nfe) {
- viewSize = Integer.valueOf(UtilProperties.getPropertyValue("widget.properties", "widget.form.defaultViewSize")).intValue();
+ viewSize = Integer.valueOf(EntityUtilProperties.getPropertyValue("widget.properties", "widget.form.defaultViewSize", delegator)).intValue();
}
context.viewSize = viewSize;
diff --git a/framework/widget/src/org/ofbiz/widget/WidgetWorker.java b/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
index fd31822..7cf7352 100644
--- a/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
+++ b/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
@@ -20,7 +20,6 @@
import java.io.IOException;
import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.nio.charset.Charset;
@@ -145,8 +144,8 @@
externalWriter.append(parameter.getKey());
externalWriter.append('=');
StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder");
- if (simpleEncoder != null) {
- externalWriter.append(simpleEncoder.encode(parameterValue));
+ if (simpleEncoder != null && parameterValue != null) {
+ externalWriter.append(simpleEncoder.encode(URLEncoder.encode(parameterValue, Charset.forName("UTF-8").displayName())));
} else {
externalWriter.append(parameterValue);
}
@@ -298,15 +297,10 @@
for (Map.Entry<String, String> parameter: parameterMap.entrySet()) {
if (parameter.getValue() != null) {
- String key = parameter.getKey();
-
writer.append("<input name=\"");
- writer.append(key);
+ writer.append(parameter.getKey());
writer.append("\" value=\"");
-
- String valueFromContext = context.containsKey(key) && context.get(key)!= null ?
- context.get(key).toString() : parameter.getValue();
- writer.append(valueFromContext);
+ writer.append(StringUtil.htmlEncoder.encode(parameter.getValue()));
writer.append("\" type=\"hidden\"/>");
}
}
@@ -362,12 +356,7 @@
public String getValue(Map<String, Object> context) {
if (this.value != null) {
- try {
- return URLEncoder.encode(this.value.expandString(context), Charset.forName("UTF-8").displayName());
- } catch (UnsupportedEncodingException e) {
- Debug.logError(e, module);
- return this.value.expandString(context);
- }
+ return this.value.expandString(context);
}
Object retVal = null;
@@ -398,11 +387,7 @@
DateFormat df = UtilDateTime.toDateTimeFormat("EEE MMM dd hh:mm:ss z yyyy", timeZone, null);
returnValue = df.format((java.util.Date) retVal);
} else {
- try {
- returnValue = URLEncoder.encode(retVal.toString(), Charset.forName("UTF-8").displayName());
- } catch (UnsupportedEncodingException e) {
- Debug.logError(e, module);
- }
+ returnValue = retVal.toString();
}
return returnValue;
} else {
diff --git a/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java b/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
index cbaa5c2..73c735e 100644
--- a/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
+++ b/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
@@ -3083,7 +3083,7 @@
parameters.append(parameter.getName());
parameters.append("'");
parameters.append(",'value':'");
- parameters.append(parameter.getValue(context));
+ parameters.append(StringUtil.htmlEncoder.encode(parameter.getValue(context)));
parameters.append("'}");
}
parameters.append("]");
diff --git a/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java b/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java
index a3900df..60aab28 100644
--- a/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java
+++ b/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java
@@ -31,6 +31,8 @@
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.webapp.view.AbstractViewHandler;
import org.ofbiz.webapp.view.ViewHandlerException;
import org.ofbiz.widget.form.FormStringRenderer;
@@ -39,6 +41,7 @@
import org.ofbiz.widget.menu.MenuStringRenderer;
import org.ofbiz.widget.tree.MacroTreeRenderer;
import org.ofbiz.widget.tree.TreeStringRenderer;
+import org.python.modules.re;
import org.xml.sax.SAXException;
import freemarker.template.TemplateException;
@@ -57,14 +60,14 @@
public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
try {
Writer writer = response.getWriter();
-
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
// compress output if configured to do so
if (UtilValidate.isEmpty(encoding)) {
- encoding = UtilProperties.getPropertyValue("widget", getName() + ".default.encoding", "none");
+ encoding = EntityUtilProperties.getPropertyValue("widget", getName() + ".default.encoding", "none", delegator);
}
boolean compressOutput = "compressed".equals(encoding);
if (!compressOutput) {
- compressOutput = "true".equals(UtilProperties.getPropertyValue("widget", getName() + ".compress"));
+ compressOutput = "true".equals(EntityUtilProperties.getPropertyValue("widget", getName() + ".compress", delegator));
}
if (!compressOutput && this.servletContext != null) {
compressOutput = "true".equals(this.servletContext.getAttribute("compressHTML"));
@@ -74,25 +77,25 @@
// to speed up output.
writer = new StandardCompress().getWriter(writer, null);
}
- ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".name"), UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"));
+ ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(EntityUtilProperties.getPropertyValue("widget", getName() + ".name", delegator), EntityUtilProperties.getPropertyValue("widget", getName() + ".screenrenderer", delegator));
ScreenRenderer screens = new ScreenRenderer(writer, null, screenStringRenderer);
screens.populateContextForRequest(request, response, servletContext);
- String macroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".formrenderer");
+ String macroLibraryPath = EntityUtilProperties.getPropertyValue("widget", getName() + ".formrenderer", delegator);
if (UtilValidate.isNotEmpty(macroLibraryPath)) {
FormStringRenderer formStringRenderer = new MacroFormRenderer(macroLibraryPath, request, response);
screens.getContext().put("formStringRenderer", formStringRenderer);
}
- macroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".treerenderer");
+ macroLibraryPath = EntityUtilProperties.getPropertyValue("widget", getName() + ".treerenderer", delegator);
if (UtilValidate.isNotEmpty(macroLibraryPath)) {
TreeStringRenderer treeStringRenderer = new MacroTreeRenderer(macroLibraryPath, writer);
screens.getContext().put("treeStringRenderer", treeStringRenderer);
}
- macroLibraryPath = UtilProperties.getPropertyValue("widget", getName() + ".menurenderer");
+ macroLibraryPath = EntityUtilProperties.getPropertyValue("widget", getName() + ".menurenderer", delegator);
if (UtilValidate.isNotEmpty(macroLibraryPath)) {
MenuStringRenderer menuStringRenderer = new MacroMenuRenderer(macroLibraryPath, request, response);
screens.getContext().put("menuStringRenderer", menuStringRenderer);
}
- screens.getContext().put("simpleEncoder", StringUtil.getEncoder(UtilProperties.getPropertyValue("widget", getName() + ".encoder")));
+ screens.getContext().put("simpleEncoder", StringUtil.getEncoder(EntityUtilProperties.getPropertyValue("widget", getName() + ".encoder", delegator)));
screenStringRenderer.renderScreenBegin(writer, screens.getContext());
screens.render(page);
screenStringRenderer.renderScreenEnd(writer, screens.getContext());
diff --git a/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java b/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java
index f0a2a62..5b7f7af 100644
--- a/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java
+++ b/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java
@@ -35,6 +35,8 @@
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.webapp.view.AbstractViewHandler;
import org.ofbiz.webapp.view.ApacheFopWorker;
import org.ofbiz.webapp.view.ViewHandlerException;
@@ -64,11 +66,12 @@
*/
public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException {
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
// render and obtain the XSL-FO
Writer writer = new StringWriter();
try {
- ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".name"), UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"));
- FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), request, response);
+ ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(EntityUtilProperties.getPropertyValue("widget", getName() + ".name", delegator), EntityUtilProperties.getPropertyValue("widget", getName() + ".screenrenderer", delegator));
+ FormStringRenderer formStringRenderer = new MacroFormRenderer(EntityUtilProperties.getPropertyValue("widget", getName() + ".formrenderer", delegator), request, response);
// TODO: uncomment these lines when the renderers are implemented
//TreeStringRenderer treeStringRenderer = new MacroTreeRenderer(UtilProperties.getPropertyValue("widget", getName() + ".treerenderer"), writer);
//MenuStringRenderer menuStringRenderer = new MacroMenuRenderer(UtilProperties.getPropertyValue("widget", getName() + ".menurenderer"), writer);
@@ -77,7 +80,7 @@
// this is the object used to render forms from their definitions
screens.getContext().put("formStringRenderer", formStringRenderer);
- screens.getContext().put("simpleEncoder", StringUtil.getEncoder(UtilProperties.getPropertyValue("widget", getName() + ".encoder")));
+ screens.getContext().put("simpleEncoder", StringUtil.getEncoder(EntityUtilProperties.getPropertyValue("widget", getName() + ".encoder", delegator)));
screens.render(page);
} catch (Exception e) {
renderError("Problems with the response writer/output stream", e, "[Not Yet Rendered]", request, response);
diff --git a/specialpurpose/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java b/specialpurpose/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java
index 878ad62..715647b 100644
--- a/specialpurpose/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java
+++ b/specialpurpose/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java
@@ -42,7 +42,9 @@
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.birt.BirtFactory;
import org.ofbiz.birt.BirtWorker;
+import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.webapp.view.ViewHandler;
import org.ofbiz.webapp.view.ViewHandlerException;
import org.xml.sax.SAXException;
@@ -112,7 +114,8 @@
}
context.put(BirtWorker.BIRT_LOCALE, locale);
- String birtImageDirectory = UtilProperties.getPropertyValue("birt", "birt.html.image.directory");
+ Delegator delegator = (Delegator) request.getAttribute("delegator");
+ String birtImageDirectory = EntityUtilProperties.getPropertyValue("birt", "birt.html.image.directory", delegator);
context.put(BirtWorker.BIRT_IMAGE_DIRECTORY, birtImageDirectory);
BirtWorker.exportReport(design, context, contentType, response.getOutputStream());
} catch (BirtException e) {
diff --git a/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java b/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
index 551fa86..2ad44f4 100644
--- a/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
+++ b/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
@@ -49,6 +49,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.shoppingcart.ShoppingCart;
import org.ofbiz.party.contact.ContactHelper;
import org.ofbiz.service.GenericServiceException;
@@ -86,14 +87,14 @@
buildEbayConfigContext.put("apiServerUrl", eBayConfig.getString("apiServerUrl"));
}
} else {
- buildEbayConfigContext.put("devID", UtilProperties.getPropertyValue(configFileName, "eBayExport.devID"));
- buildEbayConfigContext.put("appID", UtilProperties.getPropertyValue(configFileName, "eBayExport.appID"));
- buildEbayConfigContext.put("certID", UtilProperties.getPropertyValue(configFileName, "eBayExport.certID"));
- buildEbayConfigContext.put("token", UtilProperties.getPropertyValue(configFileName, "eBayExport.token"));
- buildEbayConfigContext.put("compatibilityLevel", UtilProperties.getPropertyValue(configFileName, "eBayExport.compatibilityLevel"));
- buildEbayConfigContext.put("siteID", UtilProperties.getPropertyValue(configFileName, "eBayExport.siteID"));
- buildEbayConfigContext.put("xmlGatewayUri", UtilProperties.getPropertyValue(configFileName, "eBayExport.xmlGatewayUri"));
- buildEbayConfigContext.put("apiServerUrl", UtilProperties.getPropertyValue(configFileName, "eBayExport.xmlGatewayUri"));
+ 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));
}
return buildEbayConfigContext;
}
diff --git a/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java b/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
index a26c39d..1c5e777 100755
--- a/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
+++ b/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
@@ -492,7 +492,7 @@
if (UtilValidate.isNotEmpty(customXmlFromUI)) {
customXml = customXmlFromUI;
} else {
- customXml = UtilProperties.getPropertyValue(configFileName, "eBayExport.customXml");
+ customXml = EntityUtilProperties.getPropertyValue(configFileName, "eBayExport.customXml", delegator);
}
if (UtilValidate.isNotEmpty(customXml)) {
Document customXmlDoc = UtilXml.readXmlDocument(customXml);
diff --git a/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/PopularTags.groovy b/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/PopularTags.groovy
index 9e98b96..3d3256d 100644
--- a/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/PopularTags.groovy
+++ b/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/PopularTags.groovy
@@ -27,10 +27,11 @@
import org.ofbiz.base.util.string.*;
import org.ofbiz.content.content.*;
import org.apache.commons.lang.StringEscapeUtils;
+import org.ofbiz.entity.util.EntityUtilProperties;
-int minFontSize = Integer.parseInt(UtilProperties.getPropertyValue("ecommerce.properties", "tagcloud.min.fontsize"));
-int maxFontSize = Integer.parseInt(UtilProperties.getPropertyValue("ecommerce.properties", "tagcloud.max.fontsize"));
-int limitTagCloud = Integer.parseInt(UtilProperties.getPropertyValue("ecommerce.properties", "tagcloud.limit"));
+int minFontSize = Integer.parseInt(EntityUtilProperties.getPropertyValue("ecommerce.properties", "tagcloud.min.fontsize", delegator));
+int maxFontSize = Integer.parseInt(EntityUtilProperties.getPropertyValue("ecommerce.properties", "tagcloud.max.fontsize", delegator));
+int limitTagCloud = Integer.parseInt(EntityUtilProperties.getPropertyValue("ecommerce.properties", "tagcloud.limit", delegator));
tagCloudList = [] as LinkedList;
tagList = [] as LinkedList;
diff --git a/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy b/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy
index 6d54e08..29dafcd 100644
--- a/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy
+++ b/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/shoppinglist/EditShoppingList.groovy
@@ -145,7 +145,7 @@
context.shoppingListItemDatas = shoppingListItemDatas;
// pagination for the shopping list
viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 1);
- viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: UtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20"));
+ viewSize = Integer.valueOf(parameters.VIEW_SIZE ?: EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator));
listSize = shoppingListItemDatas ? shoppingListItemDatas.size() : 0;
lowIndex = ((viewIndex - 1) * viewSize) + 1;
diff --git a/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java b/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java
index efe45bc..3c970f0 100644
--- a/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java
+++ b/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java
@@ -37,6 +37,7 @@
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.shoppingcart.ShoppingCart;
import org.ofbiz.order.shoppingcart.ShoppingCartItem;
import org.ofbiz.service.DispatchContext;
@@ -114,8 +115,8 @@
}
// flow support URLs
- String contShoppingUrl = UtilProperties.getPropertyValue("googleCheckout.properties", "continueShoppingUrl");
- String editCartUrl = UtilProperties.getPropertyValue("googleCheckout.properties", "editCartUrl");
+ String contShoppingUrl = EntityUtilProperties.getPropertyValue("googleCheckout.properties", "continueShoppingUrl", delegator);
+ String editCartUrl = EntityUtilProperties.getPropertyValue("googleCheckout.properties", "editCartUrl", delegator);
req.setContinueShoppingUrl(contShoppingUrl);
req.setEditCartUrl(editCartUrl);
@@ -640,13 +641,13 @@
}
// base URLs
- String productionRoot = UtilProperties.getPropertyValue("google-checkout.properties", "production.root.url");
- String sandboxRoot = UtilProperties.getPropertyValue("google-checkout.properties", "sandbox.root.url");
+ String productionRoot = EntityUtilProperties.getPropertyValue("google-checkout.properties", "production.root.url", delegator);
+ String sandboxRoot = EntityUtilProperties.getPropertyValue("google-checkout.properties", "sandbox.root.url", delegator);
// command strings
- String merchantCheckoutCommand = UtilProperties.getPropertyValue("google-checkout.properties", "merchant.checkout.command", "merchantCheckout");
- String checkoutCommand = UtilProperties.getPropertyValue("google-checkout.properties", "checkout.command", "checkout");
- String requestCommand = UtilProperties.getPropertyValue("google-checkout.properties", "request.command", "request");
+ String merchantCheckoutCommand = EntityUtilProperties.getPropertyValue("google-checkout.properties", "merchant.checkout.command", "merchantCheckout", delegator);
+ String checkoutCommand = EntityUtilProperties.getPropertyValue("google-checkout.properties", "checkout.command", "checkout", delegator);
+ String requestCommand = EntityUtilProperties.getPropertyValue("google-checkout.properties", "request.command", "request", delegator);
String environment = null;
String checkoutUrl = "";
diff --git a/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java b/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java
index dad246e..b0fa2fb 100644
--- a/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java
+++ b/specialpurpose/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java
@@ -40,6 +40,7 @@
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.ldap.LdapLoginWorker;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.LocalDispatcher;
@@ -97,7 +98,7 @@
String visitId = VisitHandler.getVisitId(session);
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
Delegator delegator = dispatcher.getDelegator();
- boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
+ boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security.properties", "password.encrypt", delegator));
GenericValue userLoginToCreate = delegator.makeValue("UserLogin", UtilMisc.toMap("userLoginId", username));
userLoginToCreate.set("passwordHint", "");
userLoginToCreate.set("enabled", "Y");
diff --git a/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java b/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java
index 537a7b8..640c722 100644
--- a/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java
+++ b/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java
@@ -22,7 +22,6 @@
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;
@@ -32,6 +31,7 @@
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.DoubleField;
@@ -74,7 +74,7 @@
// Return a null document (we will remove the document from the index)
return null;
} else {
- if ("Y".equals(product.getString("isVariant")) && "true".equals(UtilProperties.getPropertyValue("prodsearch", "index.ignore.variants"))) {
+ if ("Y".equals(product.getString("isVariant")) && "true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.ignore.variants", delegator))) {
return null;
}
Document doc = new Document();
@@ -82,11 +82,11 @@
// 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);
@@ -95,9 +95,9 @@
doc.add(new StringField("isVariant", product.get("isVariant") != null && product.getBoolean("isVariant") ? "true" : "false", Field.Store.NO));
// ProductFeature Fields, check that at least one of the fields is set to be indexed
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.description", "0")) ||
- !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.abbrev", "0")) ||
- !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.idCode", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.description", "0", delegator)) ||
+ !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.abbrev", "0", delegator)) ||
+ !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.idCode", "0", delegator))) {
List<GenericValue> productFeatureAndAppls = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where("productId", productId).queryList();
productFeatureAndAppls = this.filterByThruDate(productFeatureAndAppls);
@@ -115,9 +115,9 @@
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);
@@ -137,31 +137,31 @@
}
// ProductAttribute Fields
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrName", "0")) ||
- !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrValue", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrName", "0", delegator)) ||
+ !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrValue", "0", delegator))) {
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);
}
}
// GoodIdentification
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.GoodIdentification.idValue", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.GoodIdentification.idValue", "0", delegator))) {
List<GenericValue> goodIdentifications = EntityQuery.use(delegator).from("GoodIdentification").where("productId", productId).queryList();
for (GenericValue goodIdentification: goodIdentifications) {
String goodIdentificationTypeId = goodIdentification.getString("goodIdentificationTypeId");
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);
}
}
// Virtual ProductIds
if ("Y".equals(product.getString("isVirtual"))) {
- if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0"))) {
+ if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0", delegator))) {
List<GenericValue> variantProductAssocs = EntityQuery.use(delegator).from("ProductAssoc").where("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT").queryList();
variantProductAssocs = this.filterByThruDate(variantProductAssocs);
for (GenericValue variantProductAssoc: variantProductAssocs) {
@@ -174,18 +174,18 @@
} 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);
}
}
}
// Index product content
- String productContentTypes = UtilProperties.getPropertyValue("prodsearch", "index.include.ProductContentTypes");
+ String productContentTypes = EntityUtilProperties.getPropertyValue("prodsearch", "index.include.ProductContentTypes", delegator);
for (String productContentTypeId: productContentTypes.split(",")) {
int weight = 1;
try {
// this is defaulting to a weight of 1 because you specified you wanted to index this type
- weight = Integer.parseInt(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductContent." + productContentTypeId, "1"));
+ weight = Integer.parseInt(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductContent." + productContentTypeId, "1", delegator));
} catch (Exception e) {
Debug.logWarning("Could not parse weight number: " + e.toString(), module);
}
@@ -205,7 +205,7 @@
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) {
@@ -281,13 +281,13 @@
}
// 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);
}
diff --git a/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java b/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
index 3c9982e..bcbffc2 100644
--- a/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
+++ b/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
@@ -44,6 +44,7 @@
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.product.product.ProductWorker;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
@@ -219,7 +220,7 @@
// prepare information to send mail
Map<String, Object> sendMap = FastMap.newInstance();
- String sendToEmail = UtilProperties.getPropertyValue("oagis.properties", "oagis.notification.email.sendTo");
+ String sendToEmail = EntityUtilProperties.getPropertyValue("oagis.properties", "oagis.notification.email.sendTo", delegator);
/* DEJ20070802 changed to get email address from properties file, should be way easier to manage
// get facility email address
@@ -253,7 +254,7 @@
*/
if (UtilValidate.isNotEmpty(sendToEmail)) {
- String productStoreId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.SyncInventoryProductStoreId");
+ String productStoreId = EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.SyncInventoryProductStoreId", delegator);
GenericValue productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", productStoreId, "emailType", "PRDS_OAGIS_CONFIRM").queryOne();
if (productStoreEmail != null) {
String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation");
@@ -451,7 +452,7 @@
Element dataAreaElement = UtilXml.firstChildElement(receivePoElement, "ns:DATAAREA");
Element acknowledgeDeliveryElement = UtilXml.firstChildElement(dataAreaElement, "ns:ACKNOWLEDGE_DELIVERY");
- String facilityId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.PoReceiptFacilityId");
+ String facilityId = EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.PoReceiptFacilityId", delegator);
String orderId = null;
// get RECEIPTLN elements from message
List<? extends Element> acknowledgeElementList = UtilXml.childElementList(acknowledgeDeliveryElement, "ns:RECEIPTLN");
@@ -503,7 +504,7 @@
// Case : New record entry when PO not exists in the Database
orderHeader = delegator.makeValue("OrderHeader", UtilMisc.toMap("orderId", orderId, "orderTypeId",orderTypeId ,
"orderDate", timestampItemReceived, "statusId", "ORDER_CREATED", "entryDate", UtilDateTime.nowTimestamp(),
- "productStoreId", UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.SyncInventoryProductStoreId","9001")));
+ "productStoreId", EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.SyncInventoryProductStoreId","9001", delegator)));
toStore.add(orderHeader);
GenericValue orderItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderId", orderId,
"orderItemSeqId", UtilFormatOut.formatPaddedNumber(1L, 5),
@@ -686,8 +687,8 @@
Element firstDocRefElement = UtilXml.firstChildElement(firstReceiptlnElement, "os:DOCUMNTREF");
String firstReturnId = UtilXml.childElementValue(firstDocRefElement, "of:DOCUMENTID");
- String facilityId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.PoReceiptFacilityId");
- String locationSeqId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.ReturnReceiptLocationSeqId");
+ String facilityId = EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.PoReceiptFacilityId", delegator);
+ String locationSeqId = EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.ReturnReceiptLocationSeqId", delegator);
Timestamp timestamp = UtilDateTime.nowTimestamp();
Map<String, Object> comiCtx = FastMap.newInstance();
@@ -1196,8 +1197,8 @@
Element dataAreaElement = UtilXml.firstChildElement(receiveStatusElement, "ns:DATAAREA");
Element acknowledgeDeliveryElement = UtilXml.firstChildElement(dataAreaElement, "ns:ACKNOWLEDGE_DELIVERY");
- String facilityId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.PoReceiptFacilityId");
- String locationSeqId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.ReturnReceiptLocationSeqId");
+ String facilityId = EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.PoReceiptFacilityId", delegator);
+ String locationSeqId = EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.ReturnReceiptLocationSeqId", delegator);
Timestamp timestamp = UtilDateTime.nowTimestamp();
Map<String, Object> comiCtx = FastMap.newInstance();
diff --git a/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java b/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java
index 8aa259f..0c2c483 100644
--- a/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java
+++ b/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java
@@ -58,6 +58,7 @@
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;
@@ -110,19 +111,19 @@
String sendToUrl = (String) context.get("sendToUrl");
if (UtilValidate.isEmpty(sendToUrl)) {
- sendToUrl = UtilProperties.getPropertyValue("oagis.properties", "url.send.confirmBod");
+ sendToUrl = EntityUtilProperties.getPropertyValue("oagis.properties", "url.send.confirmBod", delegator);
}
String saveToFilename = (String) context.get("saveToFilename");
if (UtilValidate.isEmpty(saveToFilename)) {
- String saveToFilenameBase = UtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.filename.base", "");
+ String saveToFilenameBase = EntityUtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.filename.base", "", delegator);
if (UtilValidate.isNotEmpty(saveToFilenameBase)) {
saveToFilename = saveToFilenameBase + "ConfirmBod" + errorReferenceId + ".xml";
}
}
String saveToDirectory = (String) context.get("saveToDirectory");
if (UtilValidate.isEmpty(saveToDirectory)) {
- saveToDirectory = UtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.directory");
+ saveToDirectory = EntityUtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.directory", delegator);
}
OutputStream out = (OutputStream) context.get("outputStream");
@@ -134,8 +135,8 @@
Debug.logError(e, "Error getting userLogin", module);
}
- String logicalId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.LOGICALID");
- String authId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.AUTHID");
+ String logicalId = EntityUtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.LOGICALID", delegator);
+ String authId = EntityUtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.AUTHID", delegator);
MapStack<String> bodyParameters = MapStack.create();
bodyParameters.put("logicalId", logicalId);
@@ -189,7 +190,7 @@
bodyParameters.put("errorReferenceId", errorReferenceId);
bodyParameters.put("errorMapList", errorMapList);
bodyParameters.put("origRef", context.get("origRefId"));
- String bodyScreenUri = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Template.ConfirmBod");
+ String bodyScreenUri = EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Template.ConfirmBod", delegator);
String outText = null;
try {
diff --git a/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java b/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java
index 28be5cd..8df3a19 100644
--- a/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java
+++ b/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java
@@ -53,6 +53,7 @@
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.party.party.PartyWorker;
import org.ofbiz.product.product.ProductWorker;
@@ -655,19 +656,19 @@
String sendToUrl = (String) context.get("sendToUrl");
if (UtilValidate.isEmpty(sendToUrl)) {
- sendToUrl = UtilProperties.getPropertyValue("oagis.properties", "url.send.processShipment");
+ sendToUrl = EntityUtilProperties.getPropertyValue("oagis.properties", "url.send.processShipment", delegator);
}
String saveToFilename = (String) context.get("saveToFilename");
if (UtilValidate.isEmpty(saveToFilename)) {
- String saveToFilenameBase = UtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.filename.base", "");
+ String saveToFilenameBase = EntityUtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.filename.base", "", delegator);
if (UtilValidate.isNotEmpty(saveToFilenameBase)) {
saveToFilename = saveToFilenameBase + "ProcessShipment" + orderId + ".xml";
}
}
String saveToDirectory = (String) context.get("saveToDirectory");
if (UtilValidate.isEmpty(saveToDirectory)) {
- saveToDirectory = UtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.directory");
+ saveToDirectory = EntityUtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.directory", delegator);
}
OutputStream out = (OutputStream) context.get("outputStream");
@@ -689,7 +690,7 @@
GenericValue orderHeader = null;
GenericValue orderItemShipGroup = null;
- String logicalId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.LOGICALID");
+ String logicalId = EntityUtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.LOGICALID", delegator);
String referenceId = null;
String task = "SHIPREQUEST"; // Actual value of task is "SHIPREQUEST" which is more than 10 char, need this in the db so it will match Confirm BODs, etc
String component = "INVENTORY";
@@ -714,7 +715,7 @@
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OagisOrderIdNotFound", UtilMisc.toMap("orderId", orderId), locale));
}
- List<String> validStores = StringUtil.split(UtilProperties.getPropertyValue("oagis.properties", "Oagis.Order.ValidProductStores"), ",");
+ List<String> validStores = StringUtil.split(EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Order.ValidProductStores", delegator), ",");
if (UtilValidate.isNotEmpty(validStores)) {
if (!validStores.contains(orderHeader.getString("productStoreId"))) {
return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "OagisOrderIdNotValidStore", UtilMisc.toMap("orderId", orderId), locale));
@@ -752,7 +753,7 @@
referenceId = delegator.getNextSeqId("OagisMessageInfo");
omiPkMap = UtilMisc.toMap("logicalId", logicalId, "component", component, "task", task, "referenceId", referenceId);
- String authId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.AUTHID");
+ String authId = EntityUtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.AUTHID", delegator);
Timestamp timestamp = UtilDateTime.nowTimestamp();
String sentDate = OagisServices.isoDateFormat.format(timestamp);
@@ -881,7 +882,7 @@
bodyParameters.put("orderId", orderId);
bodyParameters.put("userLogin", userLogin);
- String bodyScreenUri = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Template.ProcessShipment");
+ String bodyScreenUri = EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Template.ProcessShipment", delegator);
String outText = null;
Writer writer = new StringWriter();
ScreenRenderer screens = new ScreenRenderer(writer, bodyParameters, htmlScreenRenderer);
@@ -977,19 +978,19 @@
Locale locale = (Locale) context.get("locale");
String sendToUrl = (String) context.get("sendToUrl");
if (UtilValidate.isEmpty(sendToUrl)) {
- sendToUrl = UtilProperties.getPropertyValue("oagis.properties", "url.send.receiveDelivery");
+ sendToUrl = EntityUtilProperties.getPropertyValue("oagis.properties", "url.send.receiveDelivery", delegator);
}
String saveToFilename = (String) context.get("saveToFilename");
if (UtilValidate.isEmpty(saveToFilename)) {
- String saveToFilenameBase = UtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.filename.base", "");
+ String saveToFilenameBase = EntityUtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.filename.base", "", delegator);
if (UtilValidate.isNotEmpty(saveToFilenameBase)) {
saveToFilename = saveToFilenameBase + "ReceiveDelivery" + returnId + ".xml";
}
}
String saveToDirectory = (String) context.get("saveToDirectory");
if (UtilValidate.isEmpty(saveToDirectory)) {
- saveToDirectory = UtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.directory");
+ saveToDirectory = EntityUtilProperties.getPropertyValue("oagis.properties", "test.save.outgoing.directory", delegator);
}
GenericValue userLogin = null;
@@ -1037,8 +1038,8 @@
orderId = EntityUtil.getFirst(returnItems).getString("orderId");
- String logicalId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.LOGICALID");
- String authId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.AUTHID");
+ String logicalId = EntityUtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.LOGICALID", delegator);
+ String authId = EntityUtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.AUTHID", delegator);
referenceId = delegator.getNextSeqId("OagisMessageInfo");
omiPkMap = UtilMisc.toMap("logicalId", logicalId, "component", component, "task", task, "referenceId", referenceId);
@@ -1127,7 +1128,7 @@
bodyParameters.put("returnId", returnId);
- String bodyScreenUri = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Template.ReceiveDelivery");
+ String bodyScreenUri = EntityUtilProperties.getPropertyValue("oagis.properties", "Oagis.Template.ReceiveDelivery", delegator);
Writer writer = new StringWriter();
ScreenRenderer screens = new ScreenRenderer(writer, bodyParameters, htmlScreenRenderer);
screens.render(bodyScreenUri);
diff --git a/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiContainer.java b/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiContainer.java
index 499de95..31d7a62 100644
--- a/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiContainer.java
+++ b/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiContainer.java
@@ -31,6 +31,7 @@
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 @@
jframe.setUndecorated(true);
new XuiScreen(
new String[] { this.startupDir + this.startupFile,
- classPackageName}, jframe);
+ classPackageName}, jframe, delegator);
return true;
}
@@ -136,12 +137,12 @@
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 @@
} 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);
}
diff --git a/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java b/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
index d3bb167..5b2b00b 100644
--- a/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
+++ b/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
@@ -58,6 +58,7 @@
import org.ofbiz.entity.util.EntityListIterator;
import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityUtilProperties;
import org.ofbiz.guiapp.xui.XuiSession;
import org.ofbiz.order.shoppingcart.CartItemModifyException;
import org.ofbiz.order.shoppingcart.CheckOutHelper;
@@ -1732,6 +1733,7 @@
// We suppose only one email address (should be ok anyway because of the contactMechPurposeTypeId == "PRIMARY_EMAIL")
// we suppose only one phone number (should be ok anyway because of the contactMechPurposeTypeId == "PHONE_HOME")
LocalDispatcher dispatcher = session.getDispatcher();
+ Delegator delegator = dispatcher.getDelegator();
GenericValue userLogin = session.getUserLogin();
GenericValue partyUserLogin = null;
String result = null;
@@ -1937,7 +1939,8 @@
trace("updatePassword");
String passwordAcceptEncryptedAndPlain = null;
try {
- passwordAcceptEncryptedAndPlain = UtilProperties.getPropertyValue("security.properties", "password.accept.encrypted.and.plain");
+
+ passwordAcceptEncryptedAndPlain = EntityUtilProperties.getPropertyValue("security.properties", "password.accept.encrypted.and.plain", delegator);
UtilProperties.setPropertyValueInMemory("security.properties", "password.accept.encrypted.and.plain", "true");
svcRes = dispatcher.runSync("updatePassword",
UtilMisc.toMap("userLogin", userLogin,