Sorry for the big commit, got a bit carried away.

Added override and deprecated annotations wherever they were missing
Removed the use of any deprecated classes/methods (except OutputFormat in UtilXml)
A few other random generics and misc. cleanups

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@791212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Scott Gray
2009-07-05 10:01:19 +00:00
parent ae3fa014f3
commit dec24b29f2
396 changed files with 1574 additions and 180 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
<classpathentry kind="src" path="framework/base/src"/>
<classpathentry kind="src" path="framework/start/src"/>
<classpathentry kind="src" path="framework/geronimo/src"/>
<classpathentry excluding="org/ofbiz/accounting/thirdparty/clearcommerce/**|org/ofbiz/accounting/thirdparty/cybersource/**|org/ofbiz/accounting/thirdparty/verisign/**|org/ofbiz/accounting/thirdparty/worldpay/**" kind="src" path="applications/accounting/src"/>
<classpathentry excluding="org/ofbiz/accounting/thirdparty/cybersource/**|org/ofbiz/accounting/thirdparty/verisign/**|org/ofbiz/accounting/thirdparty/worldpay/**" kind="src" path="applications/accounting/src"/>
<classpathentry excluding="org/ofbiz/content/openoffice/|org/ofbiz/content/report/" kind="src" path="applications/content/src"/>
<classpathentry kind="src" path="specialpurpose/ecommerce/src"/>
<classpathentry kind="src" path="applications/manufacturing/src"/>
@@ -54,6 +54,7 @@ public class PaymentWorker {
private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
/** @deprecated */
@Deprecated
public static void getPartyPaymentMethodValueMaps(PageContext pageContext, String partyId, Boolean showOld, String paymentMethodValueMapsAttr) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
List paymentMethodValueMaps = getPartyPaymentMethodValueMaps(delegator, partyId, showOld);
@@ -98,6 +99,7 @@ public class PaymentWorker {
/** TODO: REMOVE (DEJ 20030301): This is the OLD style and should be removed when the eCommerce and party mgr JSPs are */
/** @deprecated */
@Deprecated
public static void getPaymentMethodAndRelated(PageContext pageContext, String partyId,
String paymentMethodAttr, String creditCardAttr, String eftAccountAttr, String paymentMethodIdAttr, String curContactMechIdAttr,
String donePageAttr, String tryEntityAttr) {
@@ -40,10 +40,12 @@ public class FinAccountTests extends OFBizTestCase {
super(name);
}
@Override
protected void setUp() throws Exception {
userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
}
@Override
protected void tearDown() throws Exception {
}
@@ -18,29 +18,35 @@
*******************************************************************************/
package org.ofbiz.accounting.thirdparty.clearcommerce;
import java.util.Map;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
import java.text.DecimalFormat;
import java.io.OutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.ofbiz.base.util.*;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.accounting.payment.PaymentGatewayServices;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.HttpClient;
import org.ofbiz.base.util.HttpClientException;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilNumber;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ServiceUtil;
import org.ofbiz.accounting.payment.PaymentGatewayServices;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import org.apache.xml.serialize.XMLSerializer;
import org.apache.xml.serialize.OutputFormat;
/**
@@ -53,7 +59,7 @@ public class CCPaymentServices {
private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
public static Map ccAuth(DispatchContext dctx, Map context) {
public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, Object> context) {
String ccAction = (String) context.get("ccAction");
if (ccAction == null) ccAction = new String("PreAuth");
Document authRequestDoc = buildPrimaryTxRequest(context, ccAction, (BigDecimal) context.get("processAmount"),
@@ -67,11 +73,11 @@ public class CCPaymentServices {
}
if (getMessageListMaxSev(authResponseDoc) > 4) { // 5 and higher, process error from HSBC
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("authResult", new Boolean(false));
result.put("processAmount", new BigDecimal("0.00"));
result.put("authRefNum", getReferenceNum(authResponseDoc));
List messages = getMessageList(authResponseDoc);
List<String> messages = getMessageList(authResponseDoc);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
@@ -81,7 +87,7 @@ public class CCPaymentServices {
return processAuthResponse(authResponseDoc);
}
public static Map ccCredit(DispatchContext dctx, Map context) {
public static Map<String, Object> ccCredit(DispatchContext dctx, Map<String, Object> context) {
String action = new String("Credit");
if (context.get("pbOrder") != null) {
action = new String("Auth"); // required for periodic billing....
@@ -97,11 +103,11 @@ public class CCPaymentServices {
}
if (getMessageListMaxSev(creditResponseDoc) > 4) {
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("creditResult", new Boolean(false));
result.put("creditAmount", new BigDecimal("0.00"));
result.put("creditRefNum", getReferenceNum(creditResponseDoc));
List messages = getMessageList(creditResponseDoc);
List<String> messages = getMessageList(creditResponseDoc);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
@@ -111,7 +117,7 @@ public class CCPaymentServices {
return processCreditResponse(creditResponseDoc);
}
public static Map ccCapture(DispatchContext dctx, Map context) {
public static Map<String, Object> ccCapture(DispatchContext dctx, Map<String, Object> context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
@@ -130,11 +136,11 @@ public class CCPaymentServices {
}
if (getMessageListMaxSev(captureResponseDoc) > 4) {
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("captureResult", new Boolean(false));
result.put("captureAmount", new BigDecimal("0.00"));
result.put("captureRefNum", getReferenceNum(captureResponseDoc));
List messages = getMessageList(captureResponseDoc);
List<String> messages = getMessageList(captureResponseDoc);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
@@ -144,7 +150,7 @@ public class CCPaymentServices {
return processCaptureResponse(captureResponseDoc);
}
public static Map ccRelease(DispatchContext dctx, Map context) {
public static Map<String, Object> ccRelease(DispatchContext dctx, Map<String, Object> context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
@@ -162,11 +168,11 @@ public class CCPaymentServices {
}
if (getMessageListMaxSev(releaseResponseDoc) > 4) {
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("releaseResult", new Boolean(false));
result.put("releaseAmount", new BigDecimal("0.00"));
result.put("releaseRefNum", getReferenceNum(releaseResponseDoc));
List messages = getMessageList(releaseResponseDoc);
List<String> messages = getMessageList(releaseResponseDoc);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
@@ -176,7 +182,7 @@ public class CCPaymentServices {
return processReleaseResponse(releaseResponseDoc);
}
public static Map ccReleaseNoop(DispatchContext dctx, Map context) {
public static Map<String, Object> ccReleaseNoop(DispatchContext dctx, Map<String, Object> context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
@@ -184,7 +190,7 @@ public class CCPaymentServices {
return ServiceUtil.returnError("No authorization transaction found; cannot release");
}
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("releaseResult", Boolean.valueOf(true));
result.put("releaseCode", authTransaction.getString("gatewayCode"));
result.put("releaseAmount", authTransaction.getBigDecimal("amount"));
@@ -195,7 +201,7 @@ public class CCPaymentServices {
return result;
}
public static Map ccRefund(DispatchContext dctx, Map context) {
public static Map<String, Object> ccRefund(DispatchContext dctx, Map<String, Object> context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
@@ -216,11 +222,11 @@ public class CCPaymentServices {
}
if (getMessageListMaxSev(refundResponseDoc) > 4) {
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("refundResult", new Boolean(false));
result.put("refundAmount", new BigDecimal("0.00"));
result.put("refundRefNum", getReferenceNum(refundResponseDoc));
List messages = getMessageList(refundResponseDoc);
List<String> messages = getMessageList(refundResponseDoc);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
@@ -230,7 +236,7 @@ public class CCPaymentServices {
return processRefundResponse(refundResponseDoc);
}
public static Map ccReAuth(DispatchContext dctx, Map context) {
public static Map<String, Object> ccReAuth(DispatchContext dctx, Map<String, Object> context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
@@ -249,11 +255,11 @@ public class CCPaymentServices {
}
if (getMessageListMaxSev(reauthResponseDoc) > 4) {
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("reauthResult", new Boolean(false));
result.put("reauthAmount", new BigDecimal("0.00"));
result.put("reauthRefNum", getReferenceNum(reauthResponseDoc));
List messages = getMessageList(reauthResponseDoc);
List<String> messages = getMessageList(reauthResponseDoc);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
@@ -264,7 +270,7 @@ public class CCPaymentServices {
}
public static Map ccReport(DispatchContext dctx, Map context) {
public static Map<String, Object> ccReport(DispatchContext dctx, Map<String, Object> context) {
// configuration file
String paymentConfig = (String) context.get("paymentConfig");
@@ -345,28 +351,29 @@ public class CCPaymentServices {
UtilXml.addChildElementValue(value,"OrderId", orderId, requestDocument);
Debug.set(Debug.VERBOSE, true);
Document reportResponseDoc = null;
//Document reportResponseDoc = null;
try {
reportResponseDoc = sendRequest(requestDocument, (String) context.get("paymentConfig"));
//reportResponseDoc =
sendRequest(requestDocument, (String) context.get("paymentConfig"));
} catch (ClearCommerceException cce) {
return ServiceUtil.returnError(cce.getMessage());
}
Debug.set(Debug.VERBOSE, true);
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
return result;
}
private static Map processAuthResponse(Document responseDocument) {
private static Map<String, Object> processAuthResponse(Document responseDocument) {
Element engineDocElement = UtilXml.firstChildElement(responseDocument.getDocumentElement(), "EngineDoc");
Element orderFormElement = UtilXml.firstChildElement(engineDocElement, "OrderFormDoc");
Element transactionElement = UtilXml.firstChildElement(orderFormElement, "Transaction");
Element procResponseElement = UtilXml.firstChildElement(transactionElement, "CardProcResp");
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
String errorCode = UtilXml.childElementValue(procResponseElement, "CcErrCode");
if ("1".equals(errorCode)) {
@@ -398,21 +405,21 @@ public class CCPaymentServices {
result.put("scoreCode", UtilXml.childElementValue(fraudInfoElement, "TotalScore"));
}
List messages = getMessageList(responseDocument);
List<String> messages = getMessageList(responseDocument);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
return result;
}
private static Map processCreditResponse(Document responseDocument) {
private static Map<String, Object> processCreditResponse(Document responseDocument) {
Element engineDocElement = UtilXml.firstChildElement(responseDocument.getDocumentElement(), "EngineDoc");
Element orderFormElement = UtilXml.firstChildElement(engineDocElement, "OrderFormDoc");
Element transactionElement = UtilXml.firstChildElement(orderFormElement, "Transaction");
Element procResponseElement = UtilXml.firstChildElement(transactionElement, "CardProcResp");
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
String errorCode = UtilXml.childElementValue(procResponseElement, "CcErrCode");
if ("1".equals(errorCode)) {
@@ -432,21 +439,21 @@ public class CCPaymentServices {
result.put("creditFlag", UtilXml.childElementValue(procResponseElement, "Status"));
result.put("creditMessage", UtilXml.childElementValue(procResponseElement, "CcReturnMsg"));
List messages = getMessageList(responseDocument);
List<String> messages = getMessageList(responseDocument);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
return result;
}
private static Map processCaptureResponse(Document responseDocument) {
private static Map<String, Object> processCaptureResponse(Document responseDocument) {
Element engineDocElement = UtilXml.firstChildElement(responseDocument.getDocumentElement(), "EngineDoc");
Element orderFormElement = UtilXml.firstChildElement(engineDocElement, "OrderFormDoc");
Element transactionElement = UtilXml.firstChildElement(orderFormElement, "Transaction");
Element procResponseElement = UtilXml.firstChildElement(transactionElement, "CardProcResp");
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
String errorCode = UtilXml.childElementValue(procResponseElement, "CcErrCode");
if ("1".equals(errorCode)) {
@@ -466,21 +473,21 @@ public class CCPaymentServices {
result.put("captureFlag", UtilXml.childElementValue(procResponseElement, "Status"));
result.put("captureMessage", UtilXml.childElementValue(procResponseElement, "CcReturnMsg"));
List messages = getMessageList(responseDocument);
List<String> messages = getMessageList(responseDocument);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
return result;
}
private static Map processReleaseResponse(Document responseDocument) {
private static Map<String, Object> processReleaseResponse(Document responseDocument) {
Element engineDocElement = UtilXml.firstChildElement(responseDocument.getDocumentElement(), "EngineDoc");
Element orderFormElement = UtilXml.firstChildElement(engineDocElement, "OrderFormDoc");
Element transactionElement = UtilXml.firstChildElement(orderFormElement, "Transaction");
Element procResponseElement = UtilXml.firstChildElement(transactionElement, "CardProcResp");
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
String errorCode = UtilXml.childElementValue(procResponseElement, "CcErrCode");
if ("1".equals(errorCode)) {
@@ -500,21 +507,21 @@ public class CCPaymentServices {
result.put("releaseFlag", UtilXml.childElementValue(procResponseElement, "Status"));
result.put("releaseMessage", UtilXml.childElementValue(procResponseElement, "CcReturnMsg"));
List messages = getMessageList(responseDocument);
List<String> messages = getMessageList(responseDocument);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
return result;
}
private static Map processRefundResponse(Document responseDocument) {
private static Map<String, Object> processRefundResponse(Document responseDocument) {
Element engineDocElement = UtilXml.firstChildElement(responseDocument.getDocumentElement(), "EngineDoc");
Element orderFormElement = UtilXml.firstChildElement(engineDocElement, "OrderFormDoc");
Element transactionElement = UtilXml.firstChildElement(orderFormElement, "Transaction");
Element procResponseElement = UtilXml.firstChildElement(transactionElement, "CardProcResp");
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
String errorCode = UtilXml.childElementValue(procResponseElement, "CcErrCode");
if ("1".equals(errorCode)) {
@@ -534,21 +541,21 @@ public class CCPaymentServices {
result.put("refundFlag", UtilXml.childElementValue(procResponseElement, "Status"));
result.put("refundMessage", UtilXml.childElementValue(procResponseElement, "CcReturnMsg"));
List messages = getMessageList(responseDocument);
List<String> messages = getMessageList(responseDocument);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
return result;
}
private static Map processReAuthResponse(Document responseDocument) {
private static Map<String, Object> processReAuthResponse(Document responseDocument) {
Element engineDocElement = UtilXml.firstChildElement(responseDocument.getDocumentElement(), "EngineDoc");
Element orderFormElement = UtilXml.firstChildElement(engineDocElement, "OrderFormDoc");
Element transactionElement = UtilXml.firstChildElement(orderFormElement, "Transaction");
Element procResponseElement = UtilXml.firstChildElement(transactionElement, "CardProcResp");
Map result = ServiceUtil.returnSuccess();
Map<String, Object> result = ServiceUtil.returnSuccess();
String errorCode = UtilXml.childElementValue(procResponseElement, "CcErrCode");
if ("1".equals(errorCode)) {
@@ -568,23 +575,23 @@ public class CCPaymentServices {
result.put("reauthFlag", UtilXml.childElementValue(procResponseElement, "Status"));
result.put("reauthMessage", UtilXml.childElementValue(procResponseElement, "CcReturnMsg"));
List messages = getMessageList(responseDocument);
List<String> messages = getMessageList(responseDocument);
if (UtilValidate.isNotEmpty(messages)) {
result.put("internalRespMsgs", messages);
}
return result;
}
private static List getMessageList(Document responseDocument) {
private static List<String> getMessageList(Document responseDocument) {
List messageList = new ArrayList();
List<String> messageList = new ArrayList<String>();
Element engineDocElement = UtilXml.firstChildElement(responseDocument.getDocumentElement(), "EngineDoc");
Element messageListElement = UtilXml.firstChildElement(engineDocElement, "MessageList");
List messageElementList = UtilXml.childElementList(messageListElement, "Message");
List<? extends Element> messageElementList = UtilXml.childElementList(messageListElement, "Message");
if (UtilValidate.isNotEmpty(messageElementList)) {
for (Iterator i = messageElementList.iterator(); i.hasNext();) {
Element messageElement = (Element) i.next();
for (Iterator<? extends Element> i = messageElementList.iterator(); i.hasNext();) {
Element messageElement = i.next();
int severity = 0;
try {
severity = Integer.parseInt(UtilXml.childElementValue(messageElement, "Sev"));
@@ -631,7 +638,7 @@ public class CCPaymentServices {
return referenceNum;
}
private static Document buildPrimaryTxRequest(Map context, String type, BigDecimal amount, String refNum) {
private static Document buildPrimaryTxRequest(Map<String, Object> context, String type, BigDecimal amount, String refNum) {
String paymentConfig = (String) context.get("paymentConfig");
if (UtilValidate.isEmpty(paymentConfig)) {
@@ -689,7 +696,7 @@ public class CCPaymentServices {
// TODO: determine if adding OrderItemList is worthwhile - JFE 2004.02.14
Map pbOrder = (Map) context.get("pbOrder");
Map<String, Object> pbOrder = UtilGenerics.checkMap(context.get("pbOrder"));
if (pbOrder != null) {
if (Debug.verboseOn()) Debug.logInfo("pbOrder Map not empty:" + pbOrder.toString(),module);
Element pbOrderElement = UtilXml.addChildElement(orderFormDocElement, "PbOrder", requestDocument); // periodic billing order
@@ -702,16 +709,16 @@ public class CCPaymentServices {
else if (context.get("OrderFrequencyCycle") != null && context.get("OrderFrequencyInterval") != null && context.get("TotalNumberPayments") != null) {
Element pbOrderElement = UtilXml.addChildElement(orderFormDocElement, "PbOrder", requestDocument); // periodic billing order
UtilXml.addChildElementValue(pbOrderElement, "OrderFrequencyCycle", (String) context.get("OrderFrequencyCycle"), requestDocument);
Element interval = UtilXml.addChildElementValue(pbOrderElement, "OrderFrequencyInterval", (String) pbOrder.get("OrderFrequencyInterval"), requestDocument);
Element interval = UtilXml.addChildElementValue(pbOrderElement, "OrderFrequencyInterval", (String) context.get("OrderFrequencyInterval"), requestDocument);
interval.setAttribute("DataType", "S32");
Element total = UtilXml.addChildElementValue(pbOrderElement, "TotalNumberPayments", (String) pbOrder.get("TotalNumberPayments"), requestDocument);
Element total = UtilXml.addChildElementValue(pbOrderElement, "TotalNumberPayments", (String) context.get("TotalNumberPayments"), requestDocument);
total.setAttribute("DataType", "S32");
}
return requestDocument;
}
private static Document buildSecondaryTxRequest(Map context, String id, String type, BigDecimal amount) {
private static Document buildSecondaryTxRequest(Map<String, Object> context, String id, String type, BigDecimal amount) {
String paymentConfig = (String) context.get("paymentConfig");
if (UtilValidate.isEmpty(paymentConfig)) {
@@ -875,17 +882,10 @@ public class CCPaymentServices {
OutputStream os = new ByteArrayOutputStream();
OutputFormat format = new OutputFormat();
format.setOmitDocumentType(true);
format.setOmitXMLDeclaration(true);
format.setIndenting(false);
XMLSerializer serializer = new XMLSerializer(os, format);
try {
serializer.asDOMSerializer();
serializer.serialize(requestDocument.getDocumentElement());
} catch (IOException ioe) {
throw new ClearCommerceException("Error serializing requestDocument: " + ioe.getMessage());
UtilXml.writeXmlDocument(requestDocument, os, "UTF-8", true, false, 0);
} catch (TransformerException e) {
throw new ClearCommerceException("Error serializing requestDocument: " + e.getMessage());
}
String xmlString = os.toString();
@@ -62,6 +62,7 @@ public class CCServicesTest extends OFBizTestCase {
super(name);
}
@Override
protected void setUp() throws Exception {
// populate test data
configFile = new String("paymentTest.properties");
@@ -165,6 +165,7 @@ public class PcChargeApi {
return UtilXml.childElementValue(req, name);
}
@Override
public String toString() {
try {
return UtilXml.writeXmlDocument(document);
@@ -148,6 +148,7 @@ public class RitaApi {
return (String) document.get(name);
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder();
Iterator i = document.entrySet().iterator();
@@ -57,6 +57,7 @@ public class ControlApplet extends Applet implements Runnable {
protected Thread thread = null;
@Override
public void init() {
ctx = this.getAppletContext();
this.sessionId = this.getParameter("sessionId");
@@ -106,6 +107,7 @@ public class ControlApplet extends Applet implements Runnable {
}
}
@Override
public void destroy() {
this.stopped = true;
}
@@ -283,6 +283,7 @@ public class ContentMapFacade implements Map {
}
}
@Override
public String toString() {
return this.renderThis();
}
@@ -342,6 +343,7 @@ public class ContentMapFacade implements Map {
}
class Content extends AbstractInfo {
@Override
public Object get(Object key) {
if (!(key instanceof String)) {
Debug.logWarning("Key parameters must be a string", module);
@@ -372,6 +374,7 @@ public class ContentMapFacade implements Map {
}
class SubContent extends AbstractInfo {
@Override
public Object get(Object key) {
if (!(key instanceof String)) {
Debug.logWarning("Key parameters must be a string", module);
@@ -406,6 +409,7 @@ public class ContentMapFacade implements Map {
}
class MetaData extends AbstractInfo {
@Override
public Object get(Object key) {
if (!(key instanceof String)) {
Debug.logWarning("Key parameters must be a string", module);
@@ -427,6 +431,7 @@ public class ContentMapFacade implements Map {
}
class DataResource extends AbstractInfo {
@Override
public Object get(Object key) {
if (!(key instanceof String)) {
Debug.logWarning("Key parameters must be a string", module);
@@ -393,6 +393,7 @@ public class DataResourceWorker implements org.ofbiz.widget.DataResourceWorkerI
}
/** @deprecated */
@Deprecated
public static String getImageType(GenericDelegator delegator, GenericValue dataResource) {
String imageType = null;
if (dataResource != null) {
@@ -715,24 +716,28 @@ public class DataResourceWorker implements org.ofbiz.widget.DataResourceWorkerI
/** @deprecated */
@Deprecated
public static String renderDataResourceAsText(GenericDelegator delegator, String dataResourceId, Map templateContext,
GenericValue view, Locale locale, String mimeTypeId) throws GeneralException, IOException {
return renderDataResourceAsText(delegator, dataResourceId, templateContext, locale, mimeTypeId, false);
}
/** @deprecated */
@Deprecated
public static void renderDataResourceAsText(GenericDelegator delegator, String dataResourceId, Appendable out,
Map templateContext, GenericValue view, Locale locale, String targetMimeTypeId) throws GeneralException, IOException {
renderDataResourceAsText(delegator, dataResourceId, out, templateContext, locale, targetMimeTypeId, false);
}
/** @deprecated */
@Deprecated
public static String renderDataResourceAsTextCache(GenericDelegator delegator, String dataResourceId, Map templateContext,
GenericValue view, Locale locale, String mimeTypeId) throws GeneralException, IOException {
return renderDataResourceAsText(delegator, dataResourceId, templateContext, locale, mimeTypeId, true);
}
/** @deprecated */
@Deprecated
public static void renderDataResourceAsTextCache(GenericDelegator delegator, String dataResourceId, Appendable out,
Map templateContext, GenericValue view, Locale locale, String targetMimeTypeId) throws GeneralException, IOException {
renderDataResourceAsText(delegator, dataResourceId, out, templateContext, locale, targetMimeTypeId, true);
@@ -844,24 +849,28 @@ public class DataResourceWorker implements org.ofbiz.widget.DataResourceWorkerI
}
/** @deprecated */
@Deprecated
public static String getDataResourceTextCache(GenericValue dataResource, String mimeTypeId, Locale locale, Map context,
GenericDelegator delegator) throws IOException, GeneralException {
return getDataResourceText(dataResource, mimeTypeId, locale, context, delegator, true);
}
/** @deprecated */
@Deprecated
public static void writeDataResourceTextCache(GenericValue dataResource, String mimeTypeId, Locale locale, Map context,
GenericDelegator delegator, Appendable outWriter) throws IOException, GeneralException {
writeDataResourceText(dataResource, mimeTypeId, locale, context, delegator, outWriter, true);
}
/** @deprecated */
@Deprecated
public static String getDataResourceText(GenericValue dataResource, String mimeTypeId, Locale locale, Map context,
GenericDelegator delegator) throws IOException, GeneralException {
return getDataResourceText(dataResource, mimeTypeId, locale, context, delegator, false);
}
/** @deprecated */
@Deprecated
public static void writeDataResourceText(GenericValue dataResource, String mimeTypeId, Locale locale, Map context,
GenericDelegator delegator, Appendable out) throws IOException, GeneralException {
writeDataResourceText(dataResource, mimeTypeId, locale, context, delegator, out, false);
@@ -76,7 +76,7 @@ public class ContentDocument {
// make a new, empty document
doc = new Document();
String contentId = content.getString("contentId");
doc.add(new Field("contentId", contentId, Store.YES, Index.UN_TOKENIZED, TermVector.NO));
doc.add(new Field("contentId", contentId, Store.YES, Index.NOT_ANALYZED, TermVector.NO));
// Add the last modified date of the file a field named "modified". Use
// a
// Keyword field, so that it's searchable, but so that no attempt is
@@ -87,14 +87,14 @@ public class ContentDocument {
modDate = (Timestamp) content.get("createdDate");
}
if (modDate != null) {
doc.add(new Field("modified", modDate.toString(), Store.YES, Index.UN_TOKENIZED, TermVector.NO));
doc.add(new Field("modified", modDate.toString(), Store.YES, Index.NOT_ANALYZED, TermVector.NO));
}
String contentName = content.getString("contentName");
if (UtilValidate.isNotEmpty(contentName))
doc.add(new Field("title", contentName, Store.YES, Index.TOKENIZED, TermVector.NO));
doc.add(new Field("title", contentName, Store.YES, Index.ANALYZED, TermVector.NO));
String description = content.getString("description");
if (UtilValidate.isNotEmpty(description))
doc.add(new Field("description", description, Store.YES, Index.TOKENIZED, TermVector.NO));
doc.add(new Field("description", description, Store.YES, Index.ANALYZED, TermVector.NO));
List ancestorList = FastList.newInstance();
GenericDelegator delegator = content.getDelegator();
ContentWorker.getContentAncestryAll(delegator, contentId, "WEB_SITE_PUB_PT", "TO", ancestorList);
@@ -102,7 +102,7 @@ public class ContentDocument {
//Debug.logInfo("in ContentDocument, ancestorString:" + ancestorString,
// module);
if (UtilValidate.isNotEmpty(ancestorString)) {
Field field = new Field("site", ancestorString, Store.NO, Index.TOKENIZED, TermVector.NO);
Field field = new Field("site", ancestorString, Store.NO, Index.ANALYZED, TermVector.NO);
//Debug.logInfo("in ContentDocument, field:" + field.stringValue(),
// module);
doc.add(field);
@@ -165,7 +165,7 @@ public class ContentDocument {
}
//Debug.logInfo("in DataResourceDocument, text:" + text, module);
if (UtilValidate.isNotEmpty(text)) {
Field field = new Field("content", text, Store.NO, Index.TOKENIZED, TermVector.NO);
Field field = new Field("content", text, Store.NO, Index.ANALYZED, TermVector.NO);
//Debug.logInfo("in ContentDocument, field:" + field.stringValue(), module);
doc.add(field);
}
@@ -188,7 +188,7 @@ public class ContentDocument {
String featureString = StringUtil.join(featureList, " ");
//Debug.logInfo("in ContentDocument, featureString:" + featureString, module);
if (UtilValidate.isNotEmpty(featureString)) {
Field field = new Field("feature", featureString, Store.NO, Index.TOKENIZED, TermVector.NO);
Field field = new Field("feature", featureString, Store.NO, Index.ANALYZED, TermVector.NO);
doc.add(field);
}
return true;
@@ -60,7 +60,7 @@ public class DataResourceDocument {
// make a new, empty document
doc = new Document();
doc.add(new Field("dataResourceId", id, Store.YES, Index.UN_TOKENIZED, TermVector.NO));
doc.add(new Field("dataResourceId", id, Store.YES, Index.NOT_ANALYZED, TermVector.NO));
String mimeTypeId = dataResource.getString("mimeTypeId");
if (UtilValidate.isEmpty(mimeTypeId)) {
@@ -84,7 +84,7 @@ public class DataResourceDocument {
String text = outWriter.toString();
Debug.logInfo("in DataResourceDocument, text:" + text, module);
if (UtilValidate.isNotEmpty(text))
doc.add(new Field("content", text, Store.NO, Index.TOKENIZED, TermVector.NO));
doc.add(new Field("content", text, Store.NO, Index.ANALYZED, TermVector.NO));
return doc;
}
@@ -139,9 +139,9 @@ public class SearchWorker {
// Now create
IndexWriter writer = null;
try {
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), false);
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), false, IndexWriter.MaxFieldLength.UNLIMITED);
} catch (Exception e) {
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), true);
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED);
}
//if (Debug.infoOn()) Debug.logInfo("in indexContent, writer:" +
// writer, module);
@@ -189,10 +189,10 @@ public class SearchWorker {
String indexAllPath = getIndexPath(path);
IndexWriter writer = null;
try {
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), false);
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), false, IndexWriter.MaxFieldLength.UNLIMITED);
if (Debug.infoOn()) Debug.logInfo("Used old directory:" + indexAllPath, module);
} catch (FileNotFoundException e) {
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), true);
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED);
if (Debug.infoOn()) Debug.logInfo("Created new directory:" + indexAllPath, module);
}
@@ -229,13 +229,13 @@ public class SearchWorker {
String indexAllPath = getIndexPath(path);
IndexWriter writer = null;
try {
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), false);
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), false, IndexWriter.MaxFieldLength.UNLIMITED);
} catch (FileNotFoundException e) {
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), true);
writer = new IndexWriter(indexAllPath, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED);
}
indexDataResource(delegator, context, id, writer);
writer.optimize();
writer.close();
writer.close();
}
@@ -90,14 +90,17 @@ public class CheckPermissionTransform implements TemplateTransformModel {
return new LoopWriter(out) {
@Override
public void write(char cbuf[], int off, int len) {
buf.append(cbuf, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public int onStart() throws TemplateModelException, IOException {
List trail = (List)templateCtx.get("globalNodeTrail");
String trailCsv = ContentWorker.nodeTrailToCsv(trail);
@@ -195,6 +198,7 @@ public class CheckPermissionTransform implements TemplateTransformModel {
}
@Override
public void close() throws IOException {
FreeMarkerWorker.reloadValues(templateCtx, savedValues, env);
String wrappedContent = buf.toString();
@@ -122,14 +122,17 @@ public class EditRenderSubContentCacheTransform implements TemplateTransformMode
return new Writer(out) {
@Override
public void write(char cbuf[], int off, int len) {
buf.append(cbuf, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
FreeMarkerWorker.reloadValues(templateCtx, savedValues, env);
String wrappedContent = buf.toString();
@@ -161,14 +161,17 @@ public class EditRenderSubContentTransform implements TemplateTransformModel {
return new Writer(out) {
@Override
public void write(char cbuf[], int off, int len) {
buf.append(cbuf, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
String wrappedFTL = buf.toString();
if (editTemplate != null && editTemplate.equalsIgnoreCase("true")) {
@@ -80,14 +80,17 @@ public class InjectNodeTrailCsvTransform implements TemplateTransformModel {
final String passedCsv = (String)templateCtx.get("nodeTrailCsv");
@Override
public void write(char cbuf[], int off, int len) {
buf.append(cbuf, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public int onStart() throws TemplateModelException, IOException {
String csvTrail = null;
@@ -160,6 +163,7 @@ public class InjectNodeTrailCsvTransform implements TemplateTransformModel {
}
@Override
public void close() throws IOException {
templateCtx.put("nodeTrailCsv", passedCsv);
String wrappedContent = buf.toString();
@@ -156,16 +156,19 @@ public class LimitedSubContentCacheTransform implements TemplateTransformModel {
return new LoopWriter(out) {
@Override
public void write(char cbuf[], int off, int len) {
buf.append(cbuf, off, len);
//StringBuilder ctxBuf = (StringBuilder) templateRoot.get("buf");
//ctxBuf.append(cbuf, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public int onStart() throws TemplateModelException, IOException {
List globalNodeTrail = (List) templateRoot.get("globalNodeTrail");
@@ -184,6 +187,7 @@ public class LimitedSubContentCacheTransform implements TemplateTransformModel {
}
}
@Override
public int afterBody() throws TemplateModelException, IOException {
FreeMarkerWorker.reloadValues(templateRoot, savedValues, env);
List list = (List) templateRoot.get("globalNodeTrail");
@@ -207,6 +211,7 @@ public class LimitedSubContentCacheTransform implements TemplateTransformModel {
}
}
@Override
public void close() throws IOException {
FreeMarkerWorker.reloadValues(templateRoot, savedValuesUp, env);
String wrappedContent = buf.toString();
@@ -178,14 +178,17 @@ public class LoopSubContentTransform implements TemplateTransformModel {
return new LoopWriter(out) {
@Override
public void write(char cbuf[], int off, int len) {
buf.append(cbuf, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public int onStart() throws TemplateModelException, IOException {
templateCtx.put("entityIndex", Integer.valueOf(0));
boolean inProgress = prepCtx(delegator, templateCtx);
@@ -196,6 +199,7 @@ public class LoopSubContentTransform implements TemplateTransformModel {
}
}
@Override
public int afterBody() throws TemplateModelException, IOException {
boolean inProgress = prepCtx(delegator, templateCtx);
if (inProgress) {
@@ -205,6 +209,7 @@ public class LoopSubContentTransform implements TemplateTransformModel {
}
}
@Override
public void close() throws IOException {
String wrappedFTL = buf.toString();
@@ -76,13 +76,16 @@ public class RenderContentAndSubContent implements TemplateTransformModel {
return new Writer(out) {
@Override
public void write(char cbuf[], int off, int len) {
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
renderSubContent();
//if (Debug.verboseOn()) Debug.logVerbose("in Render(2), globalNodeTrail ." + getWrapped(env, "globalNodeTrail") , module);
@@ -127,13 +127,16 @@ public class RenderContentAsText implements TemplateTransformModel {
return new Writer(out) {
@Override
public void write(char cbuf[], int off, int len) {
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
List globalNodeTrail = (List)templateRoot.get("globalNodeTrail");
if (Debug.verboseOn()) Debug.logVerbose("Render close, globalNodeTrail(2a):" + ContentWorker.nodeTrailToCsv(globalNodeTrail), "");
@@ -66,13 +66,16 @@ public class RenderContentTransform implements TemplateTransformModel {
return new Writer(out) {
@Override
public void write(char cbuf[], int off, int len) {
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
renderSubContent();
}
@@ -126,13 +126,16 @@ public class RenderSubContentAsText implements TemplateTransformModel {
return new Writer(out) {
@Override
public void write(char cbuf[], int off, int len) {
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
List globalNodeTrail = (List)templateRoot.get("globalNodeTrail");
if (Debug.infoOn()) Debug.logInfo("Render close, globalNodeTrail(2a):" + ContentWorker.nodeTrailToCsv(globalNodeTrail), "");
@@ -126,13 +126,16 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel {
return new Writer(out) {
@Override
public void write(char cbuf[], int off, int len) {
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
List globalNodeTrail = (List)templateRoot.get("globalNodeTrail");
//if (Debug.infoOn()) Debug.logInfo("Render close, globalNodeTrail(2a):" + FreeMarkerWorker.nodeTrailToCsv(globalNodeTrail), "");
@@ -102,13 +102,16 @@ public class RenderSubContentTransform implements TemplateTransformModel {
return new Writer(out) {
@Override
public void write(char cbuf[], int off, int len) {
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
try {
renderSubContent();
@@ -138,16 +138,19 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel
return new LoopWriter(out) {
@Override
public void write(char cbuf[], int off, int len) {
//StringBuilder ctxBuf = (StringBuilder) templateContext.get("buf");
//ctxBuf.append(cbuf, off, len);
buf.append(cbuf, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public int onStart() throws TemplateModelException, IOException {
//templateContext.put("buf", new StringBuilder());
List nodeTrail = null;
@@ -200,6 +203,7 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel
}
}
@Override
public int afterBody() throws TemplateModelException, IOException {
@@ -221,6 +225,7 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel
return TransformControl.END_EVALUATION;
}
@Override
public void close() throws IOException {
FreeMarkerWorker.reloadValues(templateRoot, savedValuesUp, env);
@@ -155,16 +155,19 @@ public class TraverseSubContentTransform implements TemplateTransformModel {
return new LoopWriter(out) {
@Override
public void write(char cbuf[], int off, int len) {
//StringBuilder ctxBuf = (StringBuilder) templateContext.get("buf");
//ctxBuf.append(cbuf, off, len);
buf.append(cbuf, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public int onStart() throws TemplateModelException, IOException {
//templateContext.put("buf", new StringBuilder());
List nodeTrail = FastList.newInstance();
@@ -201,6 +204,7 @@ public class TraverseSubContentTransform implements TemplateTransformModel {
}
}
@Override
public int afterBody() throws TemplateModelException, IOException {
//out.write(buf.toString());
//buf.setLength(0);
@@ -217,6 +221,7 @@ public class TraverseSubContentTransform implements TemplateTransformModel {
return TransformControl.END_EVALUATION;
}
@Override
public void close() throws IOException {
String wrappedFTL = buf.toString();
@@ -137,14 +137,17 @@ public class WrapSubContentCacheTransform implements TemplateTransformModel {
return new Writer(out) {
@Override
public void write(char cbuf[], int off, int len) {
buf.append(cbuf, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
FreeMarkerWorker.reloadValues(templateCtx, savedValues, env);
//if (Debug.infoOn()) Debug.logInfo("in Wrap(2), savedValues ." + savedValues , module);
@@ -259,6 +259,7 @@ public class OrderListState {
return orders;
}
@Override
public String toString() {
StringBuilder buff = new StringBuilder("OrderListState:\n\t");
buff.append("viewIndex=").append(viewIndex).append(", viewSize=").append(viewSize).append("\n\t");
@@ -471,6 +471,7 @@ public class OrderReadHelper {
}
/** @deprecated */
@Deprecated
public GenericValue getShippingAddress() {
try {
GenericValue orderContactMech = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderContactMech", UtilMisc.toMap(
@@ -513,6 +514,7 @@ public class OrderReadHelper {
}
/** @deprecated */
@Deprecated
public GenericValue getBillingAddress() {
GenericValue billingAddress = null;
try {
@@ -341,6 +341,7 @@ public class ProductDisplayWorker {
return ((Comparable) value).compareTo(value2);
}
@Override
public boolean equals(java.lang.Object obj) {
if ((obj != null) && (obj instanceof ProductByMapComparator)) {
ProductByMapComparator that = (ProductByMapComparator) obj;
@@ -39,10 +39,12 @@ public class PurchaseOrderTest extends OFBizTestCase {
super(name);
}
@Override
protected void setUp() throws Exception {
userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
}
@Override
protected void tearDown() throws Exception {
}
@@ -37,10 +37,12 @@ public class SalesOrderTest extends OFBizTestCase {
super(name);
}
@Override
protected void setUp() throws Exception {
userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
}
@Override
protected void tearDown() throws Exception {
}
@@ -48,6 +48,7 @@ public class ContactMechWorker {
public static final String module = ContactMechWorker.class.getName();
/** @deprecated */
@Deprecated
public static void getPartyContactMechValueMaps(PageContext pageContext, String partyId, boolean showOld, String partyContactMechValueMapsAttr) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
List<Map<String, Object>> partyContactMechValueMaps = getPartyContactMechValueMaps(delegator, partyId, showOld);
@@ -204,6 +205,7 @@ public class ContactMechWorker {
/** @deprecated */
@Deprecated
public static void getOrderContactMechValueMaps(PageContext pageContext, String orderId, String orderContactMechValueMapsAttr) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
List<Map<String, GenericValue>> maps = getOrderContactMechValueMaps(delegator, orderId);
@@ -84,6 +84,7 @@ public class PartyWorker {
}
/** @deprecated */
@Deprecated
public static void getPartyOtherValues(PageContext pageContext, String partyId, String partyAttr, String personAttr, String partyGroupAttr) {
Map<String, GenericValue> partyMap = getPartyOtherValues(pageContext.getRequest(), partyId, partyAttr, personAttr, partyGroupAttr);
for (Map.Entry<String, GenericValue> e: partyMap.entrySet()) {
@@ -57,6 +57,7 @@ public class CatalogUrlServlet extends HttpServlet {
/**
* @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
*/
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
@@ -64,6 +65,7 @@ public class CatalogUrlServlet extends HttpServlet {
/**
* @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
@@ -71,6 +73,7 @@ public class CatalogUrlServlet extends HttpServlet {
/**
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
GenericDelegator delegator = (GenericDelegator) getServletContext().getAttribute("delegator");
@@ -146,6 +149,7 @@ public class CatalogUrlServlet extends HttpServlet {
/**
* @see javax.servlet.Servlet#destroy()
*/
@Override
public void destroy() {
super.destroy();
}
@@ -52,6 +52,7 @@ public class CategoryWorker {
public static final String module = CategoryWorker.class.getName();
/** @deprecated */
@Deprecated
public static String getCatalogTopCategory(PageContext pageContext, String defaultTopCategory) {
return getCatalogTopCategory(pageContext.getRequest(), defaultTopCategory);
}
@@ -84,6 +85,7 @@ public class CategoryWorker {
}
/** @deprecated */
@Deprecated
public static void getCategoriesWithNoParent(PageContext pageContext, String attributeName) {
getCategoriesWithNoParent(pageContext.getRequest(), attributeName);
}
@@ -110,6 +112,7 @@ public class CategoryWorker {
}
/** @deprecated */
@Deprecated
public static void getRelatedCategories(PageContext pageContext, String attributeName, boolean limitView) {
getRelatedCategories(pageContext.getRequest(), attributeName, limitView);
}
@@ -128,6 +131,7 @@ public class CategoryWorker {
}
/** @deprecated */
@Deprecated
public static void getRelatedCategories(PageContext pageContext, String attributeName, String parentId, boolean limitView) {
getRelatedCategories(pageContext.getRequest(), attributeName, parentId, limitView);
}
@@ -144,6 +148,7 @@ public class CategoryWorker {
}
/** @deprecated */
@Deprecated
public static List<GenericValue> getRelatedCategoriesRet(PageContext pageContext, String attributeName, String parentId, boolean limitView) {
return getRelatedCategoriesRet(pageContext.getRequest(), attributeName, parentId, limitView);
}
@@ -267,6 +272,7 @@ public class CategoryWorker {
}
/** @deprecated */
@Deprecated
public static void setTrail(PageContext pageContext, String currentCategory) {
setTrail(pageContext.getRequest(), currentCategory);
}
@@ -349,6 +355,7 @@ public class CategoryWorker {
}
/** @deprecated */
@Deprecated
public static List<String> getTrail(PageContext pageContext) {
return getTrail(pageContext.getRequest());
}
@@ -360,6 +367,7 @@ public class CategoryWorker {
}
/** @deprecated */
@Deprecated
public static List<String> setTrail(PageContext pageContext, List<String> crumb) {
return setTrail(pageContext.getRequest(), crumb);
}
@@ -371,6 +379,7 @@ public class CategoryWorker {
}
/** @deprecated */
@Deprecated
public static boolean checkTrailItem(PageContext pageContext, String category) {
return checkTrailItem(pageContext.getRequest(), category);
}
@@ -386,6 +395,7 @@ public class CategoryWorker {
}
/** @deprecated */
@Deprecated
public static String lastTrailItem(PageContext pageContext) {
return lastTrailItem(pageContext.getRequest());
}
@@ -202,6 +202,7 @@ public class ProductConfigWrapper implements Serializable {
return configId;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof ProductConfigWrapper)) {
return false;
@@ -223,6 +224,7 @@ public class ProductConfigWrapper implements Serializable {
return true;
}
@Override
public String toString() {
return questions.toString();
}
@@ -492,6 +494,7 @@ public class ProductConfigWrapper implements Serializable {
return null;
}
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof ConfigItem)) {
return false;
@@ -513,6 +516,7 @@ public class ProductConfigWrapper implements Serializable {
return true;
}
@Override
public String toString() {
return configItem.getString("configItemId");
}
@@ -740,6 +744,7 @@ public class ProductConfigWrapper implements Serializable {
return componentOptions;
}
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof ConfigOption)) {
return false;
@@ -752,6 +757,7 @@ public class ProductConfigWrapper implements Serializable {
return isSelected() == co.isSelected();
}
@Override
public String toString() {
return configOption.getString("configItemId") + "/" + configOption.getString("configOptionId") + (isSelected()? "*": "");
}
@@ -37,7 +37,6 @@ import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilParse;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.GenericDelegator;
@@ -433,10 +432,10 @@ public class ProductEvents {
product.set("lastModifiedDate", nowTimestamp);
product.setString("lastModifiedByUserLogin", userLogin.getString("userLoginId"));
try {
product.set("productHeight", UtilParse.parseBigDecimalForEntity(request.getParameter("productHeight")));
product.set("productWidth", UtilParse.parseBigDecimalForEntity(request.getParameter("productWidth")));
product.set("productDepth", UtilParse.parseBigDecimalForEntity(request.getParameter("productDepth")));
product.set("weight", UtilParse.parseBigDecimalForEntity(request.getParameter("weight")));
product.set("productHeight", new BigDecimal(request.getParameter("productHeight")));
product.set("productWidth", parseBigDecimalForEntity(request.getParameter("productWidth")));
product.set("productDepth", parseBigDecimalForEntity(request.getParameter("productDepth")));
product.set("weight", parseBigDecimalForEntity(request.getParameter("weight")));
// default unit settings for shipping parameters
product.set("heightUomId", "LEN_in");
@@ -444,10 +443,10 @@ public class ProductEvents {
product.set("depthUomId", "LEN_in");
product.set("weightUomId", "WT_oz");
BigDecimal floz = UtilParse.parseBigDecimalForEntity(request.getParameter("~floz"));
BigDecimal ml = UtilParse.parseBigDecimalForEntity(request.getParameter("~ml"));
BigDecimal ntwt = UtilParse.parseBigDecimalForEntity(request.getParameter("~ntwt"));
BigDecimal grams = UtilParse.parseBigDecimalForEntity(request.getParameter("~grams"));
BigDecimal floz = parseBigDecimalForEntity(request.getParameter("~floz"));
BigDecimal ml = parseBigDecimalForEntity(request.getParameter("~ml"));
BigDecimal ntwt = parseBigDecimalForEntity(request.getParameter("~ntwt"));
BigDecimal grams = parseBigDecimalForEntity(request.getParameter("~grams"));
List<GenericValue> currentProductFeatureAndAppls = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId, "productFeatureApplTypeId", "STANDARD_FEATURE")), true);
setOrCreateProdFeature(delegator, productId, currentProductFeatureAndAppls, "VLIQ_ozUS", "AMOUNT", floz);
@@ -470,14 +469,14 @@ public class ProductEvents {
do {
GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId));
try {
product.set("productHeight", UtilParse.parseBigDecimalForEntity(request.getParameter("productHeight" + attribIdx)));
product.set("productWidth", UtilParse.parseBigDecimalForEntity(request.getParameter("productWidth" + attribIdx)));
product.set("productDepth", UtilParse.parseBigDecimalForEntity(request.getParameter("productDepth" + attribIdx)));
product.set("weight", UtilParse.parseBigDecimalForEntity(request.getParameter("weight" + attribIdx)));
BigDecimal floz = UtilParse.parseBigDecimalForEntity(request.getParameter("~floz" + attribIdx));
BigDecimal ml = UtilParse.parseBigDecimalForEntity(request.getParameter("~ml" + attribIdx));
BigDecimal ntwt = UtilParse.parseBigDecimalForEntity(request.getParameter("~ntwt" + attribIdx));
BigDecimal grams = UtilParse.parseBigDecimalForEntity(request.getParameter("~grams" + attribIdx));
product.set("productHeight", parseBigDecimalForEntity(request.getParameter("productHeight" + attribIdx)));
product.set("productWidth", parseBigDecimalForEntity(request.getParameter("productWidth" + attribIdx)));
product.set("productDepth", parseBigDecimalForEntity(request.getParameter("productDepth" + attribIdx)));
product.set("weight", parseBigDecimalForEntity(request.getParameter("weight" + attribIdx)));
BigDecimal floz = parseBigDecimalForEntity(request.getParameter("~floz" + attribIdx));
BigDecimal ml = parseBigDecimalForEntity(request.getParameter("~ml" + attribIdx));
BigDecimal ntwt = parseBigDecimalForEntity(request.getParameter("~ntwt" + attribIdx));
BigDecimal grams = parseBigDecimalForEntity(request.getParameter("~grams" + attribIdx));
List<GenericValue> currentProductFeatureAndAppls = EntityUtil.filterByDate(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId, "productFeatureApplTypeId", "STANDARD_FEATURE")), true);
setOrCreateProdFeature(delegator, productId, currentProductFeatureAndAppls, "VLIQ_ozUS", "AMOUNT", floz);
@@ -1041,12 +1040,7 @@ public class ProductEvents {
return "success";
}
/**
* Return nulls for empty strings, as the entity engine can deal with nulls. This will provide blanks
* in fields where doubles display. Blank meaning null, vs. 0 which means 0
* @param doubleString
* @return a Double for the parsed value
*/
@Deprecated
public static Double parseDoubleForEntity(String doubleString) throws NumberFormatException {
if (doubleString == null) {
return null;
@@ -1058,4 +1052,23 @@ public class ProductEvents {
}
return Double.valueOf(doubleString);
}
/**
* Return nulls for empty strings, as the entity engine can deal with nulls. This will provide blanks
* in fields where BigDecimal display. Blank meaning null, vs. 0 which means 0
* @param bigDecimalString
* @return a BigDecimal for the parsed value
*/
public static BigDecimal parseBigDecimalForEntity(String bigDecimalString) throws NumberFormatException {
if (bigDecimalString == null) {
return null;
}
bigDecimalString = bigDecimalString.trim();
bigDecimalString = bigDecimalString.replaceAll(",", "");
if (bigDecimalString.length() < 1) {
return null;
}
return new BigDecimal(bigDecimalString);
}
}
@@ -829,6 +829,7 @@ public class ProductSearch {
this.productCategories = productCategories;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
List<String> productCategoryIds = FastList.newInstance();
for (GenericValue category: productCategories) {
@@ -854,6 +855,7 @@ public class ProductSearch {
}
/** pretty print for log messages and even UI stuff */
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
GenericValue prodCatalog = null;
try {
@@ -869,6 +871,7 @@ public class ProductSearch {
return ppBuf.toString();
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof CatalogConstraint) {
@@ -908,6 +911,7 @@ public class ProductSearch {
this.exclude = exclude;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
Set<String> productCategoryIdSet = FastSet.newInstance();
if (includeSubCategories) {
@@ -931,6 +935,7 @@ public class ProductSearch {
}
/** pretty print for log messages and even UI stuff */
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
GenericValue productCategory = null;
try {
@@ -958,6 +963,7 @@ public class ProductSearch {
return ppBuf.toString();
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof CategoryConstraint) {
@@ -997,6 +1003,7 @@ public class ProductSearch {
this.exclude = exclude;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
// just add to global sets
if (exclude == null) {
@@ -1011,6 +1018,7 @@ public class ProductSearch {
productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.productFeatureId)));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
GenericValue productFeature = null;
GenericValue productFeatureType = null;
@@ -1039,6 +1047,7 @@ public class ProductSearch {
return (ppBuf.toString());
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof FeatureConstraint) {
@@ -1076,6 +1085,7 @@ public class ProductSearch {
this.exclude = exclude;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
// just add to global sets
if (exclude == null) {
@@ -1090,6 +1100,7 @@ public class ProductSearch {
productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.productFeatureCategoryId)));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
GenericValue productFeatureCategory = null;
try {
@@ -1117,6 +1128,7 @@ public class ProductSearch {
return (ppBuf.toString());
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof FeatureCategoryConstraint) {
@@ -1153,6 +1165,7 @@ public class ProductSearch {
this.exclude = exclude;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
// just add to global sets
if (exclude == null) {
@@ -1167,6 +1180,7 @@ public class ProductSearch {
productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.productFeatureGroupId)));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
GenericValue productFeatureGroup = null;
try {
@@ -1193,6 +1207,7 @@ public class ProductSearch {
return (ppBuf.toString());
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof FeatureGroupConstraint) {
@@ -1231,6 +1246,7 @@ public class ProductSearch {
this.exclude = exclude;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
// just add to global sets
if (exclude == null) {
@@ -1253,6 +1269,7 @@ public class ProductSearch {
productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", featureIdInfo.toString())));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder infoOut = new StringBuilder();
try {
@@ -1284,6 +1301,7 @@ public class ProductSearch {
return infoOut.toString();
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof FeatureConstraint) {
@@ -1341,6 +1359,7 @@ public class ProductSearch {
return fullKeywordSet;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
// just make the fixed keyword lists and put them in the context
if (isAnd) {
@@ -1381,6 +1400,7 @@ public class ProductSearch {
}
/** pretty print for log messages and even UI stuff */
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder ppBuf = new StringBuilder();
ppBuf.append(UtilProperties.getMessage(resource, "ProductKeywords", locale)).append(": \"");
@@ -1389,6 +1409,7 @@ public class ProductSearch {
return ppBuf.toString();
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof KeywordConstraint) {
@@ -1431,16 +1452,19 @@ public class ProductSearch {
this.thruDate = thruDate;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
// TODO: implement LastUpdatedRangeConstraint makeEntityCondition
}
/** pretty print for log messages and even UI stuff */
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
// TODO: implement the pretty print for log messages and even UI stuff
return null;
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof LastUpdatedRangeConstraint) {
@@ -1482,6 +1506,7 @@ public class ProductSearch {
this.currencyUomId = currencyUomId;
}
@Override
public void addConstraint(ProductSearchContext context) {
String entityAlias = "PSPP" + context.index;
String prefix = "PSPP" + context.index;
@@ -1504,6 +1529,7 @@ public class ProductSearch {
context.entityConditionList.add(EntityCondition.makeCondition(prefix + "FromDate", EntityOperator.LESS_THAN, context.nowTimestamp));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder buff = new StringBuilder();
buff.append("Product Store Mandatory Price Constraint: ");
@@ -1513,6 +1539,7 @@ public class ProductSearch {
return buff.toString();
}
@Override
public boolean equals(Object o) {
if (o instanceof StoreGroupPriceConstraint) {
StoreGroupPriceConstraint other = (StoreGroupPriceConstraint) o;
@@ -1538,6 +1565,7 @@ public class ProductSearch {
this.currencyUomId = UtilValidate.isNotEmpty(currencyUomId) ? currencyUomId : "USD";
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
// make index based values and increment
String entityAlias = "PP" + productSearchContext.index;
@@ -1574,6 +1602,7 @@ public class ProductSearch {
UtilMisc.toMap("constraintName", constraintName, "infoString", "low [" + this.lowPrice + "] high [" + this.highPrice + "] currency [" + this.currencyUomId + "]")));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
if (this.lowPrice == null && this.highPrice == null) {
// dummy constraint, no values
@@ -1600,6 +1629,7 @@ public class ProductSearch {
return msgBuf.toString();
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof ListPriceRangeConstraint) {
@@ -1637,6 +1667,7 @@ public class ProductSearch {
this.supplierPartyId = supplierPartyId;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
// make index based values and increment
String entityAlias = "SP" + productSearchContext.index;
@@ -1652,10 +1683,12 @@ public class ProductSearch {
productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.supplierPartyId)));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
return UtilProperties.getMessage(resource, "ProductSupplier", locale)+": " + PartyHelper.getPartyName(delegator, supplierPartyId, false);
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof SupplierConstraint) {
@@ -1682,6 +1715,7 @@ public class ProductSearch {
public ExcludeVariantsConstraint() {
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
productSearchContext.dynamicViewEntity.addAlias("PROD", "prodIsVariant", "isVariant", null, null, null, null);
productSearchContext.entityConditionList.add(EntityCondition.makeCondition("prodIsVariant", EntityOperator.NOT_EQUAL, "Y"));
@@ -1690,10 +1724,12 @@ public class ProductSearch {
productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", "")));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
return UtilProperties.getMessage(resource, "ProductExcludeVariants", locale);
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof ExcludeVariantsConstraint) {
@@ -1710,6 +1746,7 @@ public class ProductSearch {
public AvailabilityDateConstraint() {
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
productSearchContext.dynamicViewEntity.addAlias("PROD", "prodIntroductionDate", "introductionDate", null, null, null, null);
productSearchContext.entityConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("prodIntroductionDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("prodIntroductionDate", EntityOperator.LESS_THAN_EQUAL_TO, productSearchContext.nowTimestamp)));
@@ -1718,10 +1755,12 @@ public class ProductSearch {
productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", "")));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
return UtilProperties.getMessage(resource, "ProductFilterByAvailabilityDates", locale);
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof AvailabilityDateConstraint) {
@@ -1744,6 +1783,7 @@ public class ProductSearch {
this.include = include;
}
@Override
public void addConstraint(ProductSearchContext productSearchContext) {
if (UtilValidate.isNotEmpty(goodIdentificationTypeId) ||
UtilValidate.isNotEmpty(goodIdentificationValue) ||
@@ -1780,6 +1820,7 @@ public class ProductSearch {
}
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
if (UtilValidate.isEmpty(goodIdentificationTypeId) &&
UtilValidate.isEmpty(goodIdentificationValue) &&
@@ -1812,6 +1853,7 @@ public class ProductSearch {
return msgBuf.toString();
}
@Override
public boolean equals(Object obj) {
ProductSearchConstraint psc = (ProductSearchConstraint) obj;
if (psc instanceof GoodIdentificationConstraint) {
@@ -1840,6 +1882,7 @@ public class ProductSearch {
public SortKeywordRelevancy() {
}
@Override
public void setSortOrder(ProductSearchContext productSearchContext) {
if (productSearchContext.includedKeywordSearch) {
// we have to check this in order to be sure that there is a totalRelevancy to sort by...
@@ -1848,14 +1891,17 @@ public class ProductSearch {
}
}
@Override
public String getOrderName() {
return "KeywordRelevancy";
}
@Override
public String prettyPrintSortOrder(boolean detailed, Locale locale) {
return UtilProperties.getMessage(resource, "ProductKeywordRelevancy", locale);
}
@Override
public boolean isAscending() {
return false;
}
@@ -1877,6 +1923,7 @@ public class ProductSearch {
this.ascending = ascending;
}
@Override
public void setSortOrder(ProductSearchContext productSearchContext) {
if (productSearchContext.getDelegator().getModelEntity("Product").isField(fieldName)) {
productSearchContext.dynamicViewEntity.addAlias("PROD", fieldName);
@@ -1891,10 +1938,12 @@ public class ProductSearch {
productSearchContext.fieldsToSelect.add(fieldName);
}
@Override
public String getOrderName() {
return "ProductField:" + this.fieldName;
}
@Override
public String prettyPrintSortOrder(boolean detailed, Locale locale) {
if ("productName".equals(this.fieldName)) {
return UtilProperties.getMessage(resource, "ProductProductName", locale);
@@ -1908,6 +1957,7 @@ public class ProductSearch {
return this.fieldName;
}
@Override
public boolean isAscending() {
return this.ascending;
}
@@ -1931,6 +1981,7 @@ public class ProductSearch {
this.ascending = ascending;
}
@Override
public void setSortOrder(ProductSearchContext productSearchContext) {
if (this.currencyUomId == null) {
this.currencyUomId = UtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD");
@@ -1965,10 +2016,12 @@ public class ProductSearch {
productSearchContext.fieldsToSelect.add("sortPrice");
}
@Override
public String getOrderName() {
return "ProductPrice:" + productPriceTypeId;
}
@Override
public String prettyPrintSortOrder(boolean detailed, Locale locale) {
String priceTypeName = null;
if ("LIST_PRICE".equals(this.productPriceTypeId)) {
@@ -1990,6 +2043,7 @@ public class ProductSearch {
return priceTypeName;
}
@Override
public boolean isAscending() {
return this.ascending;
}
@@ -964,10 +964,9 @@ public class ProductServices {
/* scale Image in different sizes */
String viewNumber = String.valueOf(productContentTypeId.charAt(productContentTypeId.length() - 1));
ScaleImage imageTransform = new ScaleImage();
Map<String, Object> resultResize = FastMap.newInstance();
try {
resultResize.putAll(imageTransform.scaleImageInAllSize(context, filenameToUse, "additional", viewNumber));
resultResize.putAll(ScaleImage.scaleImageInAllSize(context, filenameToUse, "additional", viewNumber));
} catch (IOException e) {
String errMsg = "Scale additional image in all different sizes is impossible : " + e.toString();
Debug.logError(e, errMsg, module);
@@ -60,6 +60,7 @@ public class ProductWorker {
public static final MathContext generalRounding = new MathContext(10);
/** @deprecated */
@Deprecated
public static void getProduct(PageContext pageContext, String attributeName) {
getProduct(pageContext, attributeName, null);
}
@@ -150,6 +151,7 @@ public class ProductWorker {
}
/** @deprecated */
@Deprecated
public static void getProduct(PageContext pageContext, String attributeName, String productId) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
ServletRequest request = pageContext.getRequest();
@@ -291,6 +293,7 @@ public class ProductWorker {
}
/** @deprecated */
@Deprecated
public static void getAssociatedProducts(PageContext pageContext, String productAttributeName, String assocPrefix) {
GenericValue product = (GenericValue) pageContext.getAttribute(productAttributeName);
@@ -119,7 +119,8 @@ public class SubscriptionServices {
calendar.add(times[0], (useTime.intValue() * times[1]));
} else {
Debug.logWarning("Don't know anything about useTimeUomId [" + useTimeUomId + "], defaulting to month", module);
calendar.add(Calendar.MONTH, (useTime.intValue() * times[1]));
// FIXME: times[] can only be null here
//calendar.add(Calendar.MONTH, (useTime.intValue() * times[1]));
}
thruDate = new Timestamp(calendar.getTimeInMillis());
@@ -39,10 +39,12 @@ public class InventoryItemTransferTest extends OFBizTestCase {
super(name);
}
@Override
protected void setUp() throws Exception {
userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
}
@Override
protected void tearDown() throws Exception {
}
@@ -41,10 +41,12 @@ public class StockMovesTest extends OFBizTestCase {
super(name);
}
@Override
protected void setUp() throws Exception {
userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
}
@Override
protected void tearDown() throws Exception {
}
@@ -1006,10 +1006,12 @@ public class PackingSession implements java.io.Serializable {
return quantity;
}
@Override
public Set entrySet() {
return null;
}
@Override
public Object get(Object name) {
if ("orderItem".equals(name.toString())) {
return orderItem;
@@ -1021,6 +1023,7 @@ public class PackingSession implements java.io.Serializable {
return null;
}
@Override
public boolean equals(Object o) {
if (o instanceof ItemDisplay) {
ItemDisplay d = (ItemDisplay) o;
@@ -31,13 +31,12 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.base.util.Debug;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
@@ -54,14 +53,17 @@ public class UspsMockApiServlet extends HttpServlet {
super();
}
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// we're only testing the Rate API right now
@@ -123,16 +125,9 @@ public class UspsMockApiServlet extends HttpServlet {
OutputStream os = new ByteArrayOutputStream();
OutputFormat format = new OutputFormat(responseDocument);
format.setOmitDocumentType(true);
format.setOmitXMLDeclaration(false);
format.setIndenting(false);
XMLSerializer serializer = new XMLSerializer(os, format);
try {
serializer.asDOMSerializer();
serializer.serialize(responseDocument.getDocumentElement());
} catch (IOException e) {
UtilXml.writeXmlDocument(responseDocument, os, "UTF-8", true, false, 0);
} catch (TransformerException e) {
Debug.log(e, module);
return;
}
@@ -144,6 +139,7 @@ public class UspsMockApiServlet extends HttpServlet {
}
}
@Override
public void destroy() {
super.destroy();
}
@@ -33,13 +33,12 @@ import java.util.Locale;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import javolution.util.FastList;
import javolution.util.FastMap;
import org.apache.commons.lang.StringUtils;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.ofbiz.base.util.Base64;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
@@ -1329,16 +1328,9 @@ public class UspsServices {
OutputStream os = new ByteArrayOutputStream();
OutputFormat format = new OutputFormat(requestDocument);
format.setOmitDocumentType(true);
format.setOmitXMLDeclaration(true);
format.setIndenting(false);
XMLSerializer serializer = new XMLSerializer(os, format);
try {
serializer.asDOMSerializer();
serializer.serialize(requestDocument.getDocumentElement());
} catch (IOException e) {
UtilXml.writeXmlDocument(requestDocument, os, "UTF-8", true, false, 0);
} catch (TransformerException e) {
throw new UspsRequestException("Error serializing requestDocument: " + e.getMessage());
}
@@ -48,9 +48,11 @@ public class UspsServicesTests extends OFBizTestCase {
super(name);
}
@Override
protected void setUp() throws Exception {
}
@Override
protected void tearDown() throws Exception {
}
@@ -43,6 +43,7 @@ public class ProjectWorker {
public static final String module = ProjectWorker.class.getName();
/** @deprecated */
@Deprecated
public static void getAssignedProjects(PageContext pageContext, String projectsAttrName) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
GenericValue userLogin = (GenericValue) pageContext.getSession().getAttribute("userLogin");
@@ -71,6 +72,7 @@ public class ProjectWorker {
}
/** @deprecated */
@Deprecated
public static void getAllAssignedProjects(PageContext pageContext, String projectsAttrName) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
GenericValue userLogin = (GenericValue) pageContext.getSession().getAttribute("userLogin");
@@ -96,6 +98,7 @@ public class ProjectWorker {
}
/** @deprecated */
@Deprecated
public static void getAllProjectPhases(PageContext pageContext, String phasesAttrName) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
GenericValue userLogin = (GenericValue) pageContext.getSession().getAttribute("userLogin");
@@ -144,6 +147,7 @@ public class ProjectWorker {
}
/** @deprecated */
@Deprecated
public static void getAllPhaseTasks(PageContext pageContext, String tasksAttrName) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
GenericValue userLogin = (GenericValue) pageContext.getSession().getAttribute("userLogin");
@@ -191,6 +195,7 @@ public class ProjectWorker {
}
/** @deprecated */
@Deprecated
public static void getTaskNotes(PageContext pageContext, String notesAttrName) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
GenericValue userLogin = (GenericValue) pageContext.getSession().getAttribute("userLogin");
@@ -273,7 +273,6 @@ public class ICalWorker {
return true;
}
@SuppressWarnings("unchecked")
protected static void logInUser(HttpServletRequest request, HttpServletResponse response) throws GenericServiceException, GenericEntityException {
Map<String, Object> serviceMap = (Map<String, Object>) WebDavUtil.getCredentialsFromRequest(request);
if (serviceMap == null) {
@@ -506,6 +506,7 @@ public class WorkEffortSearch {
this.includeSubWorkEfforts = includeSubWorkEfforts;
}
@Override
public void addConstraint(WorkEffortSearchContext workEffortSearchContext) {
Set<String> workEffortIdSet = FastSet.newInstance();
if (includeSubWorkEfforts) {
@@ -573,6 +574,7 @@ public class WorkEffortSearch {
/** pretty print for log messages and even UI stuff */
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
GenericValue workEffort = null;
GenericValue workEffortAssocType = null;
@@ -609,6 +611,7 @@ public class WorkEffortSearch {
return ppBuf.toString();
}
@Override
public boolean equals(Object obj) {
WorkEffortSearchConstraint psc = (WorkEffortSearchConstraint) obj;
if (psc instanceof WorkEffortAssocConstraint) {
@@ -648,6 +651,7 @@ public class WorkEffortSearch {
this.reviewTextString = reviewTextString;
}
@Override
public void addConstraint(WorkEffortSearchContext workEffortSearchContext) {
String entityAlias = "WFR" + workEffortSearchContext.index;
String prefix = "wfr" + workEffortSearchContext.index;
@@ -663,6 +667,7 @@ public class WorkEffortSearch {
/** pretty print for log messages and even UI stuff */
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder ppBuf = new StringBuilder();
ppBuf.append(UtilProperties.getMessage(resource, "WorkEffortReviews", locale) + ": \"");
@@ -670,6 +675,7 @@ public class WorkEffortSearch {
return ppBuf.toString();
}
@Override
public boolean equals(Object obj) {
WorkEffortSearchConstraint psc = (WorkEffortSearchConstraint) obj;
if (psc instanceof WorkEffortReviewConstraint) {
@@ -700,6 +706,7 @@ public class WorkEffortSearch {
this.roleTypeId = roleTypeId;
}
@Override
public void addConstraint(WorkEffortSearchContext workEffortSearchContext) {
// make index based values and increment
String entityAlias = "WEPA" + workEffortSearchContext.index;
@@ -724,6 +731,7 @@ public class WorkEffortSearch {
workEffortSearchContext.workEffortSearchConstraintList.add(workEffortSearchContext.getDelegator().makeValue("WorkEffortSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.partyId + "," + this.roleTypeId)));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
GenericValue partyNameView = null;
GenericValue roleType = null;
@@ -768,6 +776,7 @@ public class WorkEffortSearch {
return ppBuf.toString();
}
@Override
public boolean equals(Object obj) {
WorkEffortSearchConstraint psc = (WorkEffortSearchConstraint) obj;
if (psc instanceof PartyAssignmentConstraint) {
@@ -805,6 +814,7 @@ public class WorkEffortSearch {
this.productIdSet = UtilMisc.makeSetWritable(productIdSet);
}
@Override
public void addConstraint(WorkEffortSearchContext workEffortSearchContext) {
// make index based values and increment
String entityAlias = "WEGS" + workEffortSearchContext.index;
@@ -835,6 +845,7 @@ public class WorkEffortSearch {
workEffortSearchContext.workEffortSearchConstraintList.add(workEffortSearchContext.getDelegator().makeValue("WorkEffortSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", productIdInfo.toString())));
}
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder infoOut = new StringBuilder();
try {
@@ -861,6 +872,7 @@ public class WorkEffortSearch {
return infoOut.toString();
}
@Override
public boolean equals(Object obj) {
WorkEffortSearchConstraint psc = (WorkEffortSearchConstraint) obj;
if (psc instanceof ProductSetConstraint) {
@@ -918,6 +930,7 @@ public class WorkEffortSearch {
return fullKeywordSet;
}
@Override
public void addConstraint(WorkEffortSearchContext workEffortSearchContext) {
// just make the fixed keyword lists and put them in the context
if (isAnd) {
@@ -958,6 +971,7 @@ public class WorkEffortSearch {
}
/** pretty print for log messages and even UI stuff */
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder ppBuf = new StringBuilder();
ppBuf.append(UtilProperties.getMessage(resource, "WorkEffortKeywords", locale)).append(": \"");
@@ -966,6 +980,7 @@ public class WorkEffortSearch {
return ppBuf.toString();
}
@Override
public boolean equals(Object obj) {
WorkEffortSearchConstraint psc = (WorkEffortSearchConstraint) obj;
if (psc instanceof KeywordConstraint) {
@@ -1008,6 +1023,7 @@ public class WorkEffortSearch {
this.thruDate = thruDate;
}
@Override
public void addConstraint(WorkEffortSearchContext workEffortSearchContext) {
workEffortSearchContext.dynamicViewEntity.addAlias("WEFF", "lastModifiedDate", "lastModifiedDate", null, null, null, null);
@@ -1042,6 +1058,7 @@ public class WorkEffortSearch {
}
/** pretty print for log messages and even UI stuff */
@Override
public String prettyPrintConstraint(GenericDelegator delegator, boolean detailed, Locale locale) {
StringBuilder ppBuf = new StringBuilder();
ppBuf.append(UtilProperties.getMessage(resource, "WorkEffortLastModified", locale)).append(": \"");
@@ -1050,6 +1067,7 @@ public class WorkEffortSearch {
}
@Override
public boolean equals(Object obj) {
WorkEffortSearchConstraint psc = (WorkEffortSearchConstraint) obj;
if (psc instanceof LastUpdatedRangeConstraint) {
@@ -1097,6 +1115,7 @@ public class WorkEffortSearch {
public SortKeywordRelevancy() {
}
@Override
public void setSortOrder(WorkEffortSearchContext workEffortSearchContext) {
if (workEffortSearchContext.includedKeywordSearch) {
// we have to check this in order to be sure that there is a totalRelevancy to sort by...
@@ -1105,14 +1124,17 @@ public class WorkEffortSearch {
}
}
@Override
public String getOrderName() {
return "KeywordRelevancy";
}
@Override
public String prettyPrintSortOrder(boolean detailed, Locale locale) {
return UtilProperties.getMessage(resource, "WorkEffortKeywordRelevancy", locale);
}
@Override
public boolean isAscending() {
return false;
}
@@ -1134,6 +1156,7 @@ public class WorkEffortSearch {
this.ascending = ascending;
}
@Override
public void setSortOrder(WorkEffortSearchContext workEffortSearchContext) {
if (workEffortSearchContext.getDelegator().getModelEntity("WorkEffort").isField(fieldName)) {
workEffortSearchContext.dynamicViewEntity.addAlias("WEFF", fieldName);
@@ -1146,10 +1169,12 @@ public class WorkEffortSearch {
workEffortSearchContext.fieldsToSelect.add(fieldName);
}
@Override
public String getOrderName() {
return "WorkEffortField:" + this.fieldName;
}
@Override
public String prettyPrintSortOrder(boolean detailed, Locale locale) {
if ("workEffortName".equals(this.fieldName)) {
return UtilProperties.getMessage(resource, "WorkEffortName", locale);
@@ -1163,6 +1188,7 @@ public class WorkEffortSearch {
return this.fieldName;
}
@Override
public boolean isAscending() {
return this.ascending;
}
@@ -50,6 +50,7 @@ public class WorkEffortWorker {
public static final String module = WorkEffortWorker.class.getName();
/** @deprecated */
@Deprecated
public static void getWorkEffort(PageContext pageContext, String workEffortIdAttrName, String workEffortAttrName, String partyAssignsAttrName,
String canViewAttrName, String tryEntityAttrName, String currentStatusAttrName) {
GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
@@ -134,14 +135,17 @@ public class WorkEffortWorker {
}
/** @deprecated */
@Deprecated
public static void getMonthWorkEffortEvents(PageContext pageContext, String attributeName) {}
/** @deprecated */
@Deprecated
public static void getActivityContext(PageContext pageContext, String workEffortId) {
getActivityContext(pageContext, workEffortId, "activityContext");
}
/** @deprecated */
@Deprecated
public static void getActivityContext(PageContext pageContext, String workEffortId, String attribute) {
LocalDispatcher dispatcher = (LocalDispatcher) pageContext.getRequest().getAttribute("dispatcher");
GenericValue userLogin = (GenericValue) pageContext.getSession().getAttribute("userLogin");
@@ -77,7 +77,7 @@ public class GenerateContainer implements Container {
*/
public void init(String[] args, String configFile) {
ofbizHome = System.getProperty("ofbiz.home");
configFile = configFile;
this.configFile = configFile;
this.args = args;
isGeronimo = args[0].toLowerCase().contains("geronimo") || args[0].toLowerCase().contains("wasce");
if (isGeronimo) {
@@ -89,6 +89,7 @@ public class ComponentResourceHandler implements ResourceHandler {
return ComponentConfig.getFullLocation(componentName, loaderName, location);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ComponentResourceHandler) {
ComponentResourceHandler other = (ComponentResourceHandler) obj;
@@ -102,11 +103,13 @@ public class ComponentResourceHandler implements ResourceHandler {
return false;
}
@Override
public int hashCode() {
// the hashCode will weight by a combination componentName and the combination of loaderName and location
return (this.componentName.hashCode() + ((this.loaderName.hashCode() + this.location.hashCode()) >> 1)) >> 1;
}
@Override
public String toString() {
return "ComponentResourceHandler from XML file [" + this.componentName + "] with loaderName [" + loaderName + "] and location [" + location + "]";
}
@@ -28,6 +28,7 @@ import org.ofbiz.base.util.*;
*/
public class ClasspathLoader extends ResourceLoader implements java.io.Serializable {
@Override
public URL getURL(String location) throws GenericConfigException {
String fullLocation = fullLocation(location);
URL url = UtilURL.fromResource(fullLocation);
@@ -37,6 +38,7 @@ public class ClasspathLoader extends ResourceLoader implements java.io.Serializa
return url;
}
@Override
public InputStream loadResource(String location) throws GenericConfigException {
URL url = getURL(location);
try {
@@ -28,6 +28,7 @@ import org.ofbiz.base.util.*;
*/
public class FileLoader extends ResourceLoader implements java.io.Serializable {
@Override
public URL getURL(String location) throws GenericConfigException {
String fullLocation = fullLocation(location);
URL fileUrl = null;
@@ -39,6 +40,7 @@ public class FileLoader extends ResourceLoader implements java.io.Serializable {
return fileUrl;
}
@Override
public InputStream loadResource(String location) throws GenericConfigException {
URL fileUrl = getURL(location);
try {
@@ -95,6 +95,7 @@ public final class MainResourceHandler implements ResourceHandler {
return loader.fullLocation(location);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof MainResourceHandler) {
MainResourceHandler other = (MainResourceHandler) obj;
@@ -108,11 +109,13 @@ public final class MainResourceHandler implements ResourceHandler {
return false;
}
@Override
public int hashCode() {
// the hashCode will weight by a combination xmlFilename and the combination of loaderName and location
return (this.xmlFilename.hashCode() + ((this.loaderName.hashCode() + this.location.hashCode()) >> 1)) >> 1;
}
@Override
public String toString() {
return "ResourceHandler from XML file [" + this.xmlFilename + "] with loaderName [" + loaderName + "] and location [" + location + "]";
}
@@ -27,6 +27,7 @@ import java.io.*;
*/
public class UrlLoader extends ResourceLoader implements java.io.Serializable {
@Override
public URL getURL(String location) throws GenericConfigException {
String fullLocation = fullLocation(location);
@@ -44,6 +45,7 @@ public class UrlLoader extends ResourceLoader implements java.io.Serializable {
return url;
}
@Override
public InputStream loadResource(String location) throws GenericConfigException {
URL url = getURL(location);
@@ -87,6 +87,7 @@ public final class SplashScreen extends Frame {
setVisible(true);
}
@Override
public void paint(Graphics graphics) {
if (fImage != null) {
graphics.drawImage(fImage, 0, 0, this);
@@ -150,14 +150,17 @@ public class CachedClassLoader extends URLClassLoader {
this(url, parent, "__globalContext");
}
@Override
public String toString() {
return "org.ofbiz.base.util.CachedClassLoader(" + contextName + ") / " + getParent().toString();
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
return loadClass(name, false);
}
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
//check glocal common classes, ie for all instances
Class<?> theClass = globalClassNameClassMap.get(name);
@@ -202,6 +205,7 @@ public class CachedClassLoader extends URLClassLoader {
return theClass;
}
@Override
public URL getResource(String name) {
//check glocal common resources, ie for all instances
URL theResource = globalResourceMap.get(name);
@@ -60,10 +60,12 @@ public class DateRange implements Serializable {
}
}
@Override
public boolean equals(Object obj) {
return obj instanceof DateRange && ((DateRange)obj).start.equals(this.start) && ((DateRange)obj).end.equals(this.end);
}
@Override
public String toString() {
return this.start + " - " + this.end;
}
@@ -110,6 +110,7 @@ public class GeneralException extends Exception {
}
/** Returns the detail message, including the message from the nested exception if there is one. */
@Override
public String getMessage() {
Throwable nested = getCause();
if (nested != null) {
@@ -142,16 +143,19 @@ public class GeneralException extends Exception {
}
/** Prints the composite message to System.err. */
@Override
public void printStackTrace() {
super.printStackTrace();
}
/** Prints the composite message and the embedded stack trace to the specified stream ps. */
@Override
public void printStackTrace(PrintStream ps) {
super.printStackTrace(ps);
}
/** Prints the composite message and the embedded stack trace to the specified print writer pw. */
@Override
public void printStackTrace(PrintWriter pw) {
super.printStackTrace(pw);
}
@@ -63,6 +63,7 @@ public class GeneralRuntimeException extends RuntimeException {
}
/** Returns the detail message, including the message from the nested exception if there is one. */
@Override
public String getMessage() {
if (nested != null)
return super.getMessage() + " (" + nested.getMessage() + ")";
@@ -81,18 +82,21 @@ public class GeneralRuntimeException extends RuntimeException {
}
/** Prints the composite message to System.err. */
@Override
public void printStackTrace() {
super.printStackTrace();
if (nested != null) nested.printStackTrace();
}
/** Prints the composite message and the embedded stack trace to the specified stream ps. */
@Override
public void printStackTrace(PrintStream ps) {
super.printStackTrace(ps);
if (nested != null) nested.printStackTrace(ps);
}
/** Prints the composite message and the embedded stack trace to the specified print writer pw. */
@Override
public void printStackTrace(PrintWriter pw) {
super.printStackTrace(pw);
if (nested != null) nested.printStackTrace(pw);
@@ -52,6 +52,7 @@ public class Log4jLoggerWriter extends PrintWriter {
this.priority = priority;
}
@Override
public void write(char[] cbuf, int off, int len) throws IOException {
if (closed) {
throw new IOException("Writer is closed");
@@ -68,12 +69,14 @@ public class Log4jLoggerWriter extends PrintWriter {
}
}
@Override
public void flush() throws IOException {
if (closed) {
throw new IOException("Writer is closed");
}
}
@Override
public void close() {
closed = true;
}
@@ -247,6 +247,7 @@ public class MessageString implements Serializable {
this.isError = isError;
}
@Override
public String toString() {
return this.message;
}
@@ -39,6 +39,7 @@ public class ObjectInputStream extends java.io.ObjectInputStream {
/**
* @see java.io.ObjectInputStream#resolveClass(java.io.ObjectStreamClass)
*/
@Override
protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
return ObjectType.loadClass(classDesc.getName(), classloader);
}
@@ -46,6 +47,7 @@ public class ObjectInputStream extends java.io.ObjectInputStream {
/**
* @see java.io.ObjectInputStream#resolveProxyClass(java.lang.String[])
*/
@Override
protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
Class[] cinterfaces = new Class[interfaces.length];
for (int i = 0; i < interfaces.length; i++)
@@ -1239,10 +1239,12 @@ public class ObjectType {
public static final class NullObject {
public NullObject() { }
@Override
public String toString() {
return "ObjectType.NullObject";
}
@Override
public boolean equals(Object other) {
if (other instanceof NullObject) {
// should do equality of object? don't think so, just same type
@@ -63,6 +63,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
public static UtilCache<String, Interpreter.ParsedScript> parsedScripts = new UtilCache<String, Interpreter.ParsedScript>("script.BshBsfParsedCache", 0, 0, false);
@Override
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException {
super.initialize(mgr, lang, declaredBeans);
@@ -135,6 +136,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
* It exectutes the funcBody text in an "anonymous" method call with
* arguments.
*/
@Override
public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector namesVec, Vector argsVec) throws BSFException {
if (namesVec.size() != argsVec.size()) throw new BSFException("number of params/names mismatch");
if (!(funcBody instanceof String)) throw new BSFException("apply: function body must be a string");
@@ -199,6 +201,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
}
@Override
public void exec(String source, int lineNo, int columnNo, Object script) throws BSFException {
eval(source, lineNo, columnNo, script);
}
@@ -216,6 +219,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
Object script, CodeBuffer cb) throws BSFException;
*/
@Override
public void declareBean(BSFDeclaredBean bean) throws BSFException {
try {
interpreter.set(bean.name, bean.bean);
@@ -224,6 +228,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
}
}
@Override
public void undeclareBean(BSFDeclaredBean bean) throws BSFException {
try {
interpreter.unset(bean.name);
@@ -232,6 +237,7 @@ public class OfbizBshBsfEngine extends BSFEngineImpl {
}
}
@Override
public void terminate() { }
private String sourceInfo(String source, int lineNo, int columnNo) {
@@ -23,11 +23,13 @@ import java.io.OutputStream;
/** @deprecated */
@Deprecated
public class OutputStreamByteCount extends OutputStream {
protected long byteCount = 0;
/** @deprecated */
@Deprecated
public OutputStreamByteCount() {
super();
}
@@ -35,14 +37,17 @@ public class OutputStreamByteCount extends OutputStream {
/**
* @see java.io.OutputStream#write(int)
*/
@Override
public void write(int arg0) throws IOException {
byteCount++;
}
@Override
public void write(byte[] b) throws IOException {
byteCount += b.length;
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
byteCount += len;
}
@@ -600,6 +600,7 @@ public class StringUtil {
*
* @deprecated Use StringUtil.htmlEncoder instead.
*/
@Deprecated
public static String htmlSpecialChars(String html, boolean doubleQuotes, boolean singleQuotes, boolean insertBR) {
html = StringUtil.replaceString(html, "&", "&amp;");
html = StringUtil.replaceString(html, "<", "&lt;");
@@ -698,6 +699,7 @@ public class StringUtil {
/**
* @return The String this object wraps.
*/
@Override
public String toString() {
return this.theString;
}
@@ -709,6 +711,7 @@ public class StringUtil {
*/
public static class HtmlEncodingMapWrapper<K> implements Map<K, Object>, Reusable {
protected static final ObjectFactory<HtmlEncodingMapWrapper<?>> mapStackFactory = new ObjectFactory<HtmlEncodingMapWrapper<?>>() {
@Override
protected HtmlEncodingMapWrapper<?> create() {
return new HtmlEncodingMapWrapper();
}
@@ -758,6 +761,7 @@ public class StringUtil {
public Set<K> keySet() { return this.internalMap.keySet(); }
public Collection<Object> values() { return this.internalMap.values(); }
public Set<Map.Entry<K, Object>> entrySet() { return this.internalMap.entrySet(); }
@Override
public String toString() { return this.internalMap.toString(); }
}
}
@@ -67,6 +67,7 @@ public class TimeDuration implements Serializable {
this.set(cal1, cal2);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -80,6 +81,7 @@ public class TimeDuration implements Serializable {
return false;
}
@Override
public String toString() {
return this.years + ":" + this.months + ":" + this.days + ":" + this.hours + ":" + this.minutes + ":" + this.seconds + ":" + this.millis;
}
@@ -282,6 +284,7 @@ public class TimeDuration implements Serializable {
protected static class NullDuration extends TimeDuration {
protected NullDuration() {}
@Override
public Calendar addToCalendar(Calendar cal) {
return cal;
}
@@ -911,6 +911,7 @@ public class UtilMisc {
}
}
@Override
public String toString() {
if (realMapIfNeeded != null) {
return realMapIfNeeded.toString();
@@ -929,6 +930,7 @@ public class UtilMisc {
}
}
@Override
public int hashCode() {
if (realMapIfNeeded != null) {
return realMapIfNeeded.hashCode();
@@ -944,6 +946,7 @@ public class UtilMisc {
}
}
@Override
public boolean equals(Object obj) {
if (realMapIfNeeded != null) {
return realMapIfNeeded.equals(obj);
@@ -21,9 +21,11 @@ package org.ofbiz.base.util;
import java.math.BigDecimal;
/** @deprecated */
@Deprecated
public class UtilParse {
/** @deprecated */
@Deprecated
public static BigDecimal parseBigDecimalForEntity(String bigDecimalString) throws NumberFormatException {
if (bigDecimalString == null) {
return null;
@@ -874,22 +874,27 @@ public class UtilProperties implements java.io.Serializable {
return bundle;
}
@Override
public int hashCode() {
return this.hashCode;
}
@Override
public boolean equals(Object obj) {
return obj == null ? false : obj.hashCode() == this.hashCode;
}
@Override
public Locale getLocale() {
return this.locale;
}
@Override
protected Object handleGetObject(String key) {
return properties.get(key);
}
@Override
public Enumeration<String> getKeys() {
return new Enumeration<String>() {
Iterator i = properties.keySet().iterator();
@@ -924,6 +929,7 @@ public class UtilProperties implements java.io.Serializable {
}
in.close();
}
@Override
public void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException {
xmlToProperties(in, null, this);
in.close();
@@ -278,7 +278,7 @@ public class UtilXml {
/**
* @deprecated Use <a href="#writeXmlDocument(org.w3c.dom.Node,%20java.io.OutputStream,%20java.lang.String,%20boolean,%20boolean,%20int)">writeXmlDocument(Node node, OutputStream os, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount)</a>
*/
@SuppressWarnings("deprecation")
@Deprecated
public static void writeXmlDocument(OutputStream os, Element element, OutputFormat format) throws java.io.IOException {
if (element == null) {
Debug.logWarning("[UtilXml.writeXmlDocument] Element was null, doing nothing", module);
@@ -353,6 +353,7 @@ public class UtilXml {
/**
* @deprecated
*/
@Deprecated
public static Document readXmlDocument(InputStream is)
throws SAXException, ParserConfigurationException, java.io.IOException {
return readXmlDocument(is, true, null);
@@ -468,41 +469,49 @@ public class UtilXml {
}
}
@Override
public void startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException {
super.startGeneralEntity(name, identifier, encoding, augs);
setLineColumn();
}
@Override
public void comment(XMLString text, Augmentations augs) throws XNIException {
super.comment(text, augs);
setLastChildLineColumn();
}
@Override
public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException {
super.processingInstruction(target, data, augs);
setLastChildLineColumn();
}
@Override
public void startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs) throws XNIException {
super.startDocument(locator, encoding, namespaceContext, augs);
this.locator = locator;
setLineColumn();
}
@Override
public void doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs) throws XNIException {
super.doctypeDecl(rootElement, publicId, systemId, augs);
}
@Override
public void startElement(QName elementQName, XMLAttributes attrList, Augmentations augs) throws XNIException {
super.startElement(elementQName, attrList, augs);
setLineColumn();
}
@Override
public void characters(XMLString text, Augmentations augs) throws XNIException {
super.characters(text, augs);
setLastChildLineColumn();
}
@Override
public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException {
super.ignorableWhitespace(text, augs);
setLastChildLineColumn();
@@ -36,6 +36,7 @@ public class CacheSoftReference<V> extends SoftReference<V> implements Serializa
super(o, referenceQueue);
}
@Override
public void clear() {
if (Debug.verboseOn()) {
Debug.logVerbose(new Exception("UtilCache.CacheSoftRef.clear()"), "Clearing UtilCache SoftReference - " + get(), module);
@@ -43,6 +44,7 @@ public class CacheSoftReference<V> extends SoftReference<V> implements Serializa
super.clear();
}
@Override
public void finalize() throws Throwable {
if (Debug.verboseOn()) {
Debug.logVerbose(new Exception("UtilCache.CacheSoftRef.finalize()"), "Finalize UtilCache SoftReference - " + get(), module);
@@ -31,10 +31,12 @@ public final class HardRefCacheLine<V> extends CacheLine<V> {
this.value = value;
}
@Override
public V getValue() {
return value;
}
@Override
public boolean isInvalid() {
return value == null;
}
@@ -31,10 +31,12 @@ public final class SoftRefCacheLine<V> extends CacheLine<V> {
this.ref = new CacheSoftReference<V>(value);
}
@Override
public V getValue() {
return ref.get();
}
@Override
public boolean isInvalid() {
return ref.get() == null;
}
@@ -196,6 +196,7 @@ public class FlexibleMapAccessor<T> implements Serializable {
return expression;
}
@Override
public String toString() {
if (this.isEmpty()) {
return super.toString();
@@ -203,6 +204,7 @@ public class FlexibleMapAccessor<T> implements Serializable {
return this.original;
}
@Override
@SuppressWarnings("unchecked")
public boolean equals(Object obj) {
if (this == obj) {
@@ -218,6 +220,7 @@ public class FlexibleMapAccessor<T> implements Serializable {
return false;
}
@Override
public int hashCode() {
return this.original == null ? super.hashCode() : this.original.hashCode();
}
@@ -158,6 +158,7 @@ public class FlexibleServletAccessor<T> implements Serializable {
/** The equals and hashCode methods are imnplemented just case this object is ever accidently used as a Map key *
* @return the hashcode
*/
@Override
public int hashCode() {
return this.name.hashCode();
}
@@ -166,6 +167,7 @@ public class FlexibleServletAccessor<T> implements Serializable {
* @param obj
* @return whether this object is equal to the passed object
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof FlexibleServletAccessor) {
FlexibleServletAccessor flexibleServletAccessor = (FlexibleServletAccessor) obj;
@@ -185,6 +187,7 @@ public class FlexibleServletAccessor<T> implements Serializable {
/** To be used for a string representation of the accessor, returns the original name.
* @return the name of this accessor
*/
@Override
public String toString() {
return this.name;
}
@@ -54,6 +54,7 @@ public class LRUMap<K, V> extends LinkedHashMap<K, V> {
this.maxSize = size;
}
@Override
protected boolean removeEldestEntry(Map.Entry<K, V> entry) {
return size() > maxSize;
}
@@ -63,6 +63,7 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
/**
* @see java.util.Collection#size()
*/
@Override
public int size() {
return backedList.size();
}
@@ -70,6 +71,7 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
/**
* @see java.util.Collection#add(java.lang.Object)
*/
@Override
public boolean add(V obj) {
int index = backedList.indexOf(obj);
@@ -87,6 +89,7 @@ public class LifoSet<V> extends AbstractSet<V> implements Serializable {
/**
* @see java.util.Collection#iterator()
*/
@Override
public Iterator<V> iterator() {
return backedList.iterator();
}
@@ -47,6 +47,7 @@ public class MapComparator implements Comparator<Map<Object, Object>> {
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
return obj.equals(this);
}
@@ -44,6 +44,7 @@ public class MapStack<K> implements Map<K, Object>, Reusable, LocalizedMap<Objec
public static final String module = MapStack.class.getName();
protected static final ObjectFactory<MapStack<?>> mapStackFactory = new ObjectFactory<MapStack<?>>() {
@Override
protected MapStack<?> create() {
return new MapStack();
}
@@ -335,6 +336,7 @@ public class MapStack<K> implements Map<K, Object>, Reusable, LocalizedMap<Objec
return Collections.unmodifiableSet(resultEntrySet);
}
@Override
public String toString() {
StringBuilder fullMapString = new StringBuilder();
int curLevel = 0;
@@ -57,6 +57,7 @@ public class JuelConnector {
public ExtendedAstBracket(AstNode base, AstNode property, boolean lvalue, boolean strict) {
super(base, property, lvalue, strict);
}
@Override
public void setValue(Bindings bindings, ELContext context, Object value) throws ELException {
if (!lvalue) {
throw new ELException(LocalMessages.get("error.value.set.rvalue"));
@@ -90,6 +91,7 @@ public class JuelConnector {
public ExtendedAstDot(AstNode base, String property, boolean lvalue) {
super(base, property, lvalue);
}
@Override
public void setValue(Bindings bindings, ELContext context, Object value) throws ELException {
if (!lvalue) {
throw new ELException(LocalMessages.get("error.value.set.rvalue"));
@@ -121,6 +123,7 @@ public class JuelConnector {
public ExtendedParser(Builder context, String input) {
super(context, input);
}
@Override
protected AstEval eval(boolean required, boolean deferred) throws ScanException, ParseException {
AstEval v = null;
Symbol start_eval = deferred ? START_EVAL_DEFERRED : START_EVAL_DYNAMIC;
@@ -146,9 +149,11 @@ public class JuelConnector {
}
return v;
}
@Override
protected AstBracket createAstBracket(AstNode base, AstNode property, boolean lvalue, boolean strict) {
return new ExtendedAstBracket(base, property, lvalue, strict);
}
@Override
protected AstDot createAstDot(AstNode base, String property, boolean lvalue) {
return new ExtendedAstDot(base, property, lvalue);
}
@@ -157,6 +162,7 @@ public class JuelConnector {
/** Custom <code>Builder</code> class needed to implement a custom parser. */
@SuppressWarnings("serial")
protected static class ExtendedBuilder extends Builder {
@Override
public Tree build(String expression) throws ELException {
try {
return new ExtendedParser(this, expression).tree();
@@ -261,6 +261,7 @@ public class UelFunctions {
}
Debug.logVerbose("UelFunctions.Functions loaded " + this.functionMap.size() + " functions", module);
}
@Override
public Method resolveFunction(String prefix, String localName) {
return functionMap.get(prefix + ":" + localName);
}
@@ -109,12 +109,15 @@ public class UelUtil {
public BasicContext(Map<String, ? extends Object> context) {
this.variableMapper = new BasicVariableMapper(context, this);
}
@Override
public ELResolver getELResolver() {
return defaultResolver;
}
@Override
public FunctionMapper getFunctionMapper() {
return UelFunctions.getFunctionMapper();
}
@Override
public VariableMapper getVariableMapper() {
return this.variableMapper;
}
@@ -134,6 +137,7 @@ public class UelUtil {
* @param variable the variable's name
* @return a BasicValueExpression containing the variable's value or null if the variable is unknown
*/
@Override
public ValueExpression resolveVariable(String variable) {
Object obj = null;
String createObjectType = null;
@@ -189,6 +193,7 @@ public class UelUtil {
}
return null;
}
@Override
public ValueExpression setVariable(String variable, ValueExpression expression) {
return new BasicValueExpression(this.variables.put(variable, expression.getValue(this.elContext)));
}
@@ -201,6 +206,7 @@ public class UelUtil {
super();
this.object = object;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -214,30 +220,39 @@ public class UelUtil {
} catch (Exception e) {}
return false;
}
@Override
public int hashCode() {
return this.object == null ? 0 : this.object.hashCode();
}
@Override
public Object getValue(ELContext context) {
return this.object;
}
@Override
public String getExpressionString() {
return null;
}
@Override
public boolean isLiteralText() {
return false;
}
@Override
public Class<?> getType(ELContext context) {
return this.object == null ? null : this.object.getClass();
}
@Override
public boolean isReadOnly(ELContext context) {
return false;
}
@Override
public void setValue(ELContext context, Object value) {
this.object = value;
}
@Override
public String toString() {
return "ValueExpression(" + this.object + ")";
}
@Override
public Class<?> getExpectedType() {
return this.object == null ? null : this.object.getClass();
}
@@ -247,6 +262,7 @@ public class UelUtil {
* auto-vivify.
*/
protected static class ExtendedCompositeResolver extends CompositeELResolver {
@Override
public void setValue(ELContext context, Object base, Object property, Object val) {
super.setValue(context, base, property, val);
if (!context.isPropertyResolved() && base == null) {
@@ -271,6 +287,7 @@ public class UelUtil {
super(isReadOnly);
this.isReadOnly = isReadOnly;
}
@Override
@SuppressWarnings("unchecked")
public void setValue(ELContext context, Object base, Object property, Object val) {
if (context == null) {
@@ -317,6 +334,7 @@ public class UelUtil {
public ExtendedMapResolver(boolean isReadOnly) {
super(isReadOnly);
}
@Override
@SuppressWarnings("unchecked")
public Object getValue(ELContext context, Object base, Object property) {
if (context == null) {
@@ -584,9 +584,11 @@ public class FreeMarkerWorker {
this.templateLocation = templateLocation;
}
@Override
public int hashCode() {
return templateLocation.hashCode();
}
@Override
public boolean equals(Object obj) {
return obj instanceof FlexibleTemplateSource && obj.hashCode() == this.hashCode();
}
@@ -56,10 +56,12 @@ public class OfbizStore extends StoreBase implements Store {
this.delegator = delegator;
}
@Override
public String getInfo() {
return info;
}
@Override
public String getStoreName() {
return storeName;
}
@@ -49,6 +49,7 @@ public class SSLImpl extends JSSEImplementation {
Debug.log("SSLImpl loaded; using custom ServerSocketFactory", module);
}
@Override
public ServerSocketFactory getServerSocketFactory() {
return ssFactory;
}
@@ -88,7 +88,6 @@ public class AuthHelper {
}
}
@SuppressWarnings("unchecked")
private synchronized static void loadAuthenticators_internal(LocalDispatcher dispatcher) {
if (!authenticatorsLoaded) {
Iterator<Authenticator> it = ServiceRegistry.lookupProviders(Authenticator.class, getContextClassLoader());
@@ -1655,6 +1655,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return The GenericValue corresponding to the primaryKey
*@deprecated Use findOne() instead
*/
@Deprecated
public GenericValue findByPrimaryKey(GenericPK primaryKey) throws GenericEntityException {
return findOne(primaryKey.getEntityName(), primaryKey, false);
}
@@ -1665,6 +1666,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return The GenericValue corresponding to the primaryKey
*@deprecated Use findOne() instead
*/
@Deprecated
public GenericValue findByPrimaryKeyCache(GenericPK primaryKey) throws GenericEntityException {
return findOne(primaryKey.getEntityName(), primaryKey, true);
}
@@ -1676,6 +1678,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return The GenericValue corresponding to the primaryKey
*@deprecated Use findOne() instead
*/
@Deprecated
public GenericValue findByPrimaryKey(String entityName, Object... fields) throws GenericEntityException {
return findByPrimaryKey(entityName, UtilMisc.<String, Object>toMap(fields));
}
@@ -1697,6 +1700,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return The GenericValue corresponding to the primaryKey
*@deprecated Use findOne() instead
*/
@Deprecated
public GenericValue findByPrimaryKeySingle(String entityName, Object singlePkValue) throws GenericEntityException {
return findOne(entityName, makePKSingle(entityName, singlePkValue), false);
}
@@ -1728,6 +1732,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return The GenericValue corresponding to the primaryKey
*@deprecated Use findOne() instead
*/
@Deprecated
public GenericValue findByPrimaryKeyCacheSingle(String entityName, Object singlePkValue) throws GenericEntityException {
return findOne(entityName, makePKSingle(entityName, singlePkValue), true);
}
@@ -1739,6 +1744,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return The GenericValue corresponding to the primaryKey
*@deprecated Use findByPrimaryKeyPartial(GenericPK, Set<String>) instead
*/
@Deprecated
public GenericValue findByPrimaryKeyPartial(GenericPK primaryKey, String... keys) throws GenericEntityException {
return findByPrimaryKeyPartial(primaryKey, UtilMisc.makeSetWritable(Arrays.asList(keys)));
}
@@ -1799,6 +1805,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue objects corresponding to the passed primaryKey objects
*@deprecated
*/
@Deprecated
public List<GenericValue> findAllByPrimaryKeys(Collection<GenericPK> primaryKeys) throws GenericEntityException {
boolean beganTransaction = false;
try {
@@ -1861,6 +1868,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue objects corresponding to the passed primaryKey objects
*@deprecated
*/
@Deprecated
public List<GenericValue> findAllByPrimaryKeysCache(Collection<GenericPK> primaryKeys) throws GenericEntityException {
boolean beganTransaction = false;
try {
@@ -1930,6 +1938,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List containing all Generic entities
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findAll(String entityName) throws GenericEntityException {
return this.findList(entityName, null, null, null, null, false);
}
@@ -1941,6 +1950,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List containing all Generic entities
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findAll(String entityName, String... orderBy) throws GenericEntityException {
return findList(entityName, null, null, Arrays.asList(orderBy), null, false);
}
@@ -1952,6 +1962,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List containing all Generic entities
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findAll(String entityName, List<String> orderBy) throws GenericEntityException {
return this.findList(entityName, null, null, orderBy, null, false);
}
@@ -1962,6 +1973,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List containing all Generic entities
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findAllCache(String entityName) throws GenericEntityException {
return this.findList(entityName, null, null, null, null, true);
}
@@ -1973,6 +1985,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List containing all Generic entities
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findAllCache(String entityName, String... orderBy) throws GenericEntityException {
return findList(entityName, null, null, Arrays.asList(orderBy), null, true);
}
@@ -1984,6 +1997,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List containing all Generic entities
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findAllCache(String entityName, List<String> orderBy) throws GenericEntityException {
return this.findList(entityName, null, null, orderBy, null, true);
}
@@ -2016,6 +2030,7 @@ public class GenericDelegator implements DelegatorInterface {
* @return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByOr(String entityName, Object... fields) throws GenericEntityException {
EntityCondition ecl = EntityCondition.makeCondition(EntityOperator.OR, fields);
return this.findList(entityName, ecl, null, null, null, false);
@@ -2028,6 +2043,7 @@ public class GenericDelegator implements DelegatorInterface {
* @return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByOr(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
EntityCondition ecl = EntityCondition.makeCondition(fields, EntityOperator.OR);
return this.findList(entityName, ecl, null, null, null, false);
@@ -2055,6 +2071,7 @@ public class GenericDelegator implements DelegatorInterface {
* @return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByOr(String entityName, Map<String, ? extends Object> fields, List<String> orderBy) throws GenericEntityException {
EntityCondition ecl = EntityCondition.makeCondition(fields, EntityOperator.OR);
return this.findList(entityName, ecl, null, orderBy, null, false);
@@ -2067,6 +2084,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByAndCache(String entityName, Object... fields) throws GenericEntityException {
return this.findByAndCache(entityName, UtilMisc.<String, Object>toMap(fields));
}
@@ -2099,6 +2117,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public <T extends EntityCondition> List<GenericValue> findByAnd(String entityName, T... expressions) throws GenericEntityException {
EntityConditionList<T> ecl = EntityCondition.makeCondition(EntityOperator.AND, expressions);
return this.findList(entityName, ecl, null, null, null, false);
@@ -2111,6 +2130,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public <T extends EntityCondition> List<GenericValue> findByAnd(String entityName, List<T> expressions) throws GenericEntityException {
EntityConditionList<T> ecl = EntityCondition.makeCondition(expressions, EntityOperator.AND);
return this.findList(entityName, ecl, null, null, null, false);
@@ -2124,6 +2144,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public <T extends EntityCondition> List<GenericValue> findByAnd(String entityName, List<T> expressions, List<String> orderBy) throws GenericEntityException {
EntityConditionList<T> ecl = EntityCondition.makeCondition(expressions, EntityOperator.AND);
return this.findList(entityName, ecl, null, orderBy, null, false);
@@ -2136,6 +2157,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public <T extends EntityCondition> List<GenericValue> findByOr(String entityName, T... expressions) throws GenericEntityException {
return this.findList(entityName, EntityCondition.makeCondition(EntityOperator.AND, expressions), null, null, null, false);
}
@@ -2147,6 +2169,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public <T extends EntityCondition> List<GenericValue> findByOr(String entityName, List<T> expressions) throws GenericEntityException {
EntityConditionList<T> ecl = EntityCondition.makeCondition(expressions, EntityOperator.OR);
return this.findList(entityName, ecl, null, null, null, false);
@@ -2160,6 +2183,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue instances that match the query
*@deprecated Use findList() instead
*/
@Deprecated
public <T extends EntityCondition> List<GenericValue> findByOr(String entityName, List<T> expressions, List<String> orderBy) throws GenericEntityException {
EntityConditionList<T> ecl = EntityCondition.makeCondition(expressions, EntityOperator.OR);
return this.findList(entityName, ecl, null, orderBy, null, false);
@@ -2169,6 +2193,7 @@ public class GenericDelegator implements DelegatorInterface {
* NOTE 20080502: 0 references
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByLike(String entityName, Object... fields) throws GenericEntityException {
Map<String, ? extends Object> fieldMap = UtilMisc.<String, Object>toMap(fields);
List<EntityExpr> likeExpressions = FastList.newInstance();
@@ -2185,6 +2210,7 @@ public class GenericDelegator implements DelegatorInterface {
* NOTE 20080502: 1 references; all changed to findList
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByLike(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
List<EntityExpr> likeExpressions = FastList.newInstance();
if (fields != null) {
@@ -2200,6 +2226,7 @@ public class GenericDelegator implements DelegatorInterface {
* NOTE 20080502: 1 references; all changed to findList
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByLike(String entityName, Map<String, ? extends Object> fields, List<String> orderBy) throws GenericEntityException {
List<EntityExpr> likeExpressions = FastList.newInstance();
if (fields != null) {
@@ -2220,6 +2247,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue objects representing the result
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByCondition(String entityName, EntityCondition entityCondition, Collection<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException {
return this.findList(entityName, entityCondition, UtilMisc.toSet(fieldsToSelect), orderBy, null, false);
}
@@ -2235,6 +2263,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue objects representing the result
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByCondition(String entityName, EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions)
throws GenericEntityException {
@@ -2276,6 +2305,7 @@ public class GenericDelegator implements DelegatorInterface {
*@return List of GenericValue objects representing the result
*@deprecated Use findList() instead
*/
@Deprecated
public List<GenericValue> findByConditionCache(String entityName, EntityCondition entityCondition, Collection<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException {
return this.findList(entityName, entityCondition, UtilMisc.collectionToSet(fieldsToSelect), orderBy, null, true);
}
@@ -2290,6 +2320,7 @@ public class GenericDelegator implements DelegatorInterface {
* DONE WITH IT, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION.
*@deprecated Use find() instead
*/
@Deprecated
public EntityListIterator findListIteratorByCondition(String entityName, EntityCondition entityCondition,
Collection<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException {
return this.find(entityName, entityCondition, null, UtilMisc.collectionToSet(fieldsToSelect), orderBy, null);
@@ -2307,6 +2338,7 @@ public class GenericDelegator implements DelegatorInterface {
* DONE WITH IT, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION.
*@deprecated Use find() instead
*/
@Deprecated
public EntityListIterator findListIteratorByCondition(String entityName, EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions)
throws GenericEntityException {
@@ -2462,6 +2494,7 @@ public class GenericDelegator implements DelegatorInterface {
* NOTE 20080502: 3 references; all changed to findCoundByCondition
*@deprecated Use findCountByCondition() instead
*/
@Deprecated
public long findCountByAnd(String entityName) throws GenericEntityException {
return findCountByCondition(entityName, null, null, null);
}
@@ -2470,6 +2503,7 @@ public class GenericDelegator implements DelegatorInterface {
* NOTE 20080502: 1 references; all changed to use findCountByCondition
*@deprecated Use findCountByCondition() instead
*/
@Deprecated
public long findCountByAnd(String entityName, Object... fields) throws GenericEntityException {
return findCountByCondition(entityName, EntityCondition.makeCondition(UtilMisc.<String, Object>toMap(fields), EntityOperator.AND), null, null);
}
@@ -2478,6 +2512,7 @@ public class GenericDelegator implements DelegatorInterface {
* NOTE 20080502: 8 references; all changed to use findCountByCondition
*@deprecated Use findCountByCondition() instead
*/
@Deprecated
public long findCountByAnd(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
return findCountByCondition(entityName, EntityCondition.makeCondition(fields, EntityOperator.AND), null, null);
}
@@ -2486,6 +2521,7 @@ public class GenericDelegator implements DelegatorInterface {
* NOTE 20080502: 17 references; all changed to use remaining findCountByCondition
*@deprecated Use findCountByCondition() instead
*/
@Deprecated
public long findCountByCondition(String entityName, EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition) throws GenericEntityException {
return findCountByCondition(entityName, whereEntityCondition, havingEntityCondition, null);
@@ -2600,6 +2636,7 @@ public class GenericDelegator implements DelegatorInterface {
* @return List of GenericValue instances as specified in the relation definition
*@deprecated Use getMultiRelation() instead
*/
@Deprecated
public List<GenericValue> getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo) throws GenericEntityException {
return getMultiRelation(value, relationNameOne, relationNameTwo, null);
}
@@ -2613,6 +2650,7 @@ public class GenericDelegator implements DelegatorInterface {
* @return List of GenericValue instances as specified in the relation definition
*@deprecated Use getRelated() instead
*/
@Deprecated
public List<GenericValue> getRelated(String relationName, GenericValue value) throws GenericEntityException {
return getRelated(relationName, null, null, value);
}
@@ -2627,6 +2665,7 @@ public class GenericDelegator implements DelegatorInterface {
* @return List of GenericValue instances as specified in the relation definition
*@deprecated Use getRelated() instead
*/
@Deprecated
public List<GenericValue> getRelatedByAnd(String relationName, Map<String, ? extends Object> byAndFields, GenericValue value) throws GenericEntityException {
return this.getRelated(relationName, byAndFields, null, value);
}
@@ -2642,6 +2681,7 @@ public class GenericDelegator implements DelegatorInterface {
* @return List of GenericValue instances as specified in the relation definition
*@deprecated Use getRelated() instead
*/
@Deprecated
public List<GenericValue> getRelatedOrderBy(String relationName, List<String> orderBy, GenericValue value) throws GenericEntityException {
return this.getRelated(relationName, null, orderBy, value);
}
@@ -1156,6 +1156,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
*@param obj The object (GenericEntity) to compare this two
*@return boolean stating if the two objects are equal
*/
@Override
public boolean equals(Object obj) {
if (!(obj instanceof GenericEntity)) return false;
@@ -1170,6 +1171,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
/** Creates a hashCode for the entity, using the default String hashCode and Map hashCode, overrides the default hashCode
*@return Hashcode corresponding to this entity
*/
@Override
public int hashCode() {
// divide both by two (shift to right one bit) to maintain scale and add together
if (generateHashCode) {
@@ -1189,6 +1191,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
*
*@return String corresponding to this entity
*/
@Override
public String toString() {
StringBuilder theString = new StringBuilder();
theString.append("[GenericEntity:");
@@ -1297,6 +1300,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
/** Clones this GenericEntity, this is a shallow clone & uses the default shallow HashMap clone
*@return Object that is a clone of this GenericEntity
*/
@Override
public Object clone() {
GenericEntity newEntity = new GenericEntity();
newEntity.init(this);
@@ -1374,9 +1378,11 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
public static class NullGenericEntity extends GenericEntity implements NULL {
protected NullGenericEntity() { }
@Override
public String getEntityName() {
return "[null-entity]";
}
@Override
public String toString() {
return "[null-entity]";
}
@@ -1385,6 +1391,7 @@ public class GenericEntity extends Observable implements Map<String, Object>, Lo
public static class NullField implements NULL, Comparable<NullField> {
protected NullField() { }
@Override
public String toString() {
return "[null-field]";
}
@@ -31,6 +31,7 @@ import org.ofbiz.entity.model.ModelEntity;
public class GenericPK extends GenericEntity {
protected static final ObjectFactory<GenericPK> genericPKFactory = new ObjectFactory<GenericPK>() {
@Override
protected GenericPK create() {
return new GenericPK();
}
@@ -69,6 +70,7 @@ public class GenericPK extends GenericEntity {
/** Clones this GenericPK, this is a shallow clone & uses the default shallow HashMap clone
*@return Object that is a clone of this GenericPK
*/
@Override
public Object clone() {
GenericPK newEntity = GenericPK.create(this);
newEntity.setDelegator(internalDelegator);
@@ -49,6 +49,7 @@ public class GenericValue extends GenericEntity implements Reusable {
public static final GenericValue NULL_VALUE = new NullGenericValue();
protected static final ObjectFactory<GenericValue> genericValueFactory = new ObjectFactory<GenericValue>() {
@Override
protected GenericValue create() {
return new GenericValue();
}
@@ -103,6 +104,7 @@ public class GenericValue extends GenericEntity implements Reusable {
return newValue;
}
@Override
public void reset() {
// from GenericEntity
super.reset();
@@ -113,6 +115,7 @@ public class GenericValue extends GenericEntity implements Reusable {
this.originalDbValues = null;
}
@Override
public void synchronizedWithDatasource() {
super.synchronizedWithDatasource();
this.copyOriginalDbValues();
@@ -490,6 +493,7 @@ public class GenericValue extends GenericEntity implements Reusable {
/** Clones this GenericValue, this is a shallow clone & uses the default shallow HashMap clone
*@return Object that is a clone of this GenericValue
*/
@Override
public Object clone() {
GenericValue newEntity = GenericValue.create(this);
newEntity.setDelegator(internalDelegator);
@@ -497,9 +501,11 @@ public class GenericValue extends GenericEntity implements Reusable {
}
protected static class NullGenericValue extends GenericValue implements NULL {
@Override
public String getEntityName() {
return "[null-entity-value]";
}
@Override
public String toString() {
return "[null-entity-value]";
}
@@ -40,6 +40,7 @@ import freemarker.template.TemplateModelException;
@SuppressWarnings("serial")
public class GenericValueHtmlWrapper extends GenericValue {
protected static final ObjectFactory<GenericValueHtmlWrapper> genericValueHtmlWrapperFactory = new ObjectFactory<GenericValueHtmlWrapper>() {
@Override
protected GenericValueHtmlWrapper create() {
return new GenericValueHtmlWrapper();
}
@@ -68,6 +69,7 @@ public class GenericValueHtmlWrapper extends GenericValue {
}
}*/
@Override
public Object get(Object name) {
Object value = super.get(name);
if (value instanceof String) {
@@ -83,6 +85,7 @@ public class GenericValueHtmlWrapper extends GenericValue {
super(gv, wrapper);
}
@Override
public TemplateModel get(String key) {
TemplateModel tm = null;
try {
@@ -29,14 +29,17 @@ public class EntityObjectCache extends AbstractEntityConditionCache<String, Obje
super(delegatorName, "object-list");
}
@Override
public Object get(String entityName, EntityCondition condition, String name) {
return super.get(entityName, condition, name);
}
@Override
public Object put(String entityName, EntityCondition condition, String name, Object value) {
return super.put(entityName, getFrozenConditionKey(condition), name, value);
}
@Override
public Object remove(String entityName, EntityCondition condition, String name) {
return super.remove(entityName, condition, name);
}
@@ -128,6 +128,7 @@ public class EntityClause {
return secondModelEntity;
}
@Override
public String toString() {
StringBuilder outputBuffer = new StringBuilder();
@@ -31,7 +31,6 @@ import org.apache.oro.text.regex.PatternMatcher;
import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericModelException;
@@ -68,6 +67,7 @@ public class EntityComparisonOperator extends EntityOperator<Boolean> {
return null;
}
@Override
public void validateSql(ModelEntity entity, Object lhs, Object rhs) throws GenericModelException {
if (lhs instanceof EntityConditionValue) {
EntityConditionValue ecv = (EntityConditionValue) lhs;
@@ -79,11 +79,13 @@ public class EntityComparisonOperator extends EntityOperator<Boolean> {
}
}
@Override
public void visit(EntityConditionVisitor visitor, Object lhs, Object rhs) {
visitor.accept(lhs);
visitor.accept(rhs);
}
@Override
public void addSqlValue(StringBuilder sql, ModelEntity entity, List<EntityConditionParam> entityConditionParams, boolean compat, Object lhs, Object rhs, DatasourceInfo datasourceInfo) {
//Debug.logInfo("EntityComparisonOperator.addSqlValue field=" + lhs + ", value=" + rhs + ", value type=" + (rhs == null ? "null object" : rhs.getClass().getName()), module);
@@ -135,6 +137,7 @@ public class EntityComparisonOperator extends EntityOperator<Boolean> {
return Boolean.valueOf(mapMatches(delegator, map, lhs, rhs));
}
@Override
@SuppressWarnings("unchecked")
public boolean mapMatches(GenericDelegator delegator, Map<String, ? extends Object> map, Object lhs, Object rhs) {
Object leftValue;
@@ -158,6 +161,7 @@ public class EntityComparisonOperator extends EntityOperator<Boolean> {
return compare((Comparable) leftValue, rightValue);
}
@Override
public EntityCondition freeze(Object lhs, Object rhs) {
return EntityCondition.makeCondition(freeze(lhs), this, freeze(rhs));
}

Some files were not shown because too many files have changed in this diff Show More