Author: deepak
Date: Mon Oct 16 09:07:36 2017 New Revision: 1812260 URL: http://svn.apache.org/viewvc?rev=1812260&view=rev Log: Inconsistent String Comparisons, Applied patch for Application party and workeffort classes. Thanks Devanshu Vyas for your contribution (OFBIZ-9254) Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearchSession.java ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java?rev=1812260&r1=1812259&r2=1812260&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java Mon Oct 16 09:07:36 2017 @@ -166,7 +166,7 @@ public class BOMNode { } } } - if (ruleSatisfied && ruleOperator.equals("OR")) { + if (ruleSatisfied && "OR".equals(ruleOperator)) { BOMNode tmpNode = oneChildNode; if (newPart == null || newPart.equals("")) { oneChildNode = null; @@ -664,7 +664,7 @@ public class BOMNode { } public boolean isVirtual() { - return (product.get("isVirtual") != null? product.get("isVirtual").equals("Y"): false); + return (product.get("isVirtual") != null? "Y".equals(product.get("isVirtual")): false); } public void isConfigured(List<BOMNode> arr) { Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1812260&r1=1812259&r2=1812260&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Mon Oct 16 09:07:36 2017 @@ -103,14 +103,14 @@ public class ProductionRunServices { String currentStatusId = productionRun.getGenericValue().getString("currentStatusId"); // PRUN_CREATED, PRUN_DOC_PRINTED --> PRUN_CANCELLED - if (currentStatusId.equals("PRUN_CREATED") || currentStatusId.equals("PRUN_DOC_PRINTED") || currentStatusId.equals("PRUN_SCHEDULED")) { + if ("PRUN_CREATED".equals(currentStatusId) || "PRUN_DOC_PRINTED".equals(currentStatusId) || "PRUN_SCHEDULED".equals(currentStatusId)) { try { // First of all, make sure that there aren't production runs that depend on this one. List<ProductionRun> mandatoryWorkEfforts = new LinkedList<ProductionRun>(); ProductionRunHelper.getLinkedProductionRuns(delegator, dispatcher, productionRunId, mandatoryWorkEfforts); for (int i = 1; i < mandatoryWorkEfforts.size(); i++) { GenericValue mandatoryWorkEffort = (mandatoryWorkEfforts.get(i)).getGenericValue(); - if (!(mandatoryWorkEffort.getString("currentStatusId").equals("PRUN_CANCELLED"))) { + if (!("PRUN_CANCELLED".equals(mandatoryWorkEffort.getString("currentStatusId")))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChangedMandatoryProductionRunFound", locale)); } } @@ -614,7 +614,7 @@ public class ProductionRunServices { } // PRUN_CREATED or PRUN_SCHEDULED --> PRUN_DOC_PRINTED - if ((currentStatusId.equals("PRUN_CREATED") || currentStatusId.equals("PRUN_SCHEDULED")) && (statusId == null || statusId.equals("PRUN_DOC_PRINTED"))) { + if (("PRUN_CREATED".equals(currentStatusId) || "PRUN_SCHEDULED".equals(currentStatusId)) && (statusId == null || "PRUN_DOC_PRINTED".equals(statusId))) { // change only the production run (header) status to PRUN_DOC_PRINTED Map<String, Object> serviceContext = new HashMap<String, Object>(); serviceContext.clear(); @@ -647,7 +647,7 @@ public class ProductionRunServices { // PRUN_DOC_PRINTED --> PRUN_RUNNING // this should be called only when the first task is started - if (currentStatusId.equals("PRUN_DOC_PRINTED") && (statusId == null || statusId.equals("PRUN_RUNNING"))) { + if ("PRUN_DOC_PRINTED".equals(currentStatusId) && (statusId == null || "PRUN_RUNNING".equals(statusId))) { // change only the production run (header) status to PRUN_RUNNING // First check if there are production runs with precedence not still completed try { @@ -658,9 +658,9 @@ public class ProductionRunServices { for (int i = 0; i < mandatoryWorkEfforts.size(); i++) { GenericValue mandatoryWorkEffortAssoc = mandatoryWorkEfforts.get(i); GenericValue mandatoryWorkEffort = mandatoryWorkEffortAssoc.getRelatedOne("FromWorkEffort", false); - if (!(mandatoryWorkEffort.getString("currentStatusId").equals("PRUN_COMPLETED") || - mandatoryWorkEffort.getString("currentStatusId").equals("PRUN_RUNNING") || - mandatoryWorkEffort.getString("currentStatusId").equals("PRUN_CLOSED"))) { + if (!("PRUN_COMPLETED".equals(mandatoryWorkEffort.getString("currentStatusId")) || + "PRUN_RUNNING".equals(mandatoryWorkEffort.getString("currentStatusId")) || + "PRUN_CLOSED".equals(mandatoryWorkEffort.getString("currentStatusId")))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChangedMandatoryProductionRunNotCompleted", locale)); } } @@ -687,7 +687,7 @@ public class ProductionRunServices { // PRUN_RUNNING --> PRUN_COMPLETED // this should be called only when the last task is completed - if (currentStatusId.equals("PRUN_RUNNING") && (statusId == null || statusId.equals("PRUN_COMPLETED"))) { + if ("PRUN_RUNNING".equals(currentStatusId) && (statusId == null || "PRUN_COMPLETED".equals(statusId))) { // change only the production run (header) status to PRUN_COMPLETED Map<String, Object> serviceContext = new HashMap<String, Object>(); serviceContext.clear(); @@ -707,7 +707,7 @@ public class ProductionRunServices { } // PRUN_COMPLETED --> PRUN_CLOSED - if (currentStatusId.equals("PRUN_COMPLETED") && (statusId == null || statusId.equals("PRUN_CLOSED"))) { + if ("PRUN_COMPLETED".equals(currentStatusId) && (statusId == null || "PRUN_CLOSED".equals(statusId))) { // change the production run status to PRUN_CLOSED Map<String, Object> serviceContext = new HashMap<String, Object>(); serviceContext.clear(); @@ -770,10 +770,10 @@ public class ProductionRunServices { if (oneTask.getString("workEffortId").equals(taskId)) { theTask = oneTask; } else { - if (theTask == null && allPrecTaskCompletedOrRunning && (!oneTask.getString("currentStatusId").equals("PRUN_COMPLETED") && !oneTask.getString("currentStatusId").equals("PRUN_RUNNING"))) { + if (theTask == null && allPrecTaskCompletedOrRunning && (!"PRUN_COMPLETED".equals(oneTask.getString("currentStatusId")) && !"PRUN_RUNNING".equals(oneTask.getString("currentStatusId")))) { allPrecTaskCompletedOrRunning = false; } - if (allTaskCompleted && !oneTask.getString("currentStatusId").equals("PRUN_COMPLETED")) { + if (allTaskCompleted && !"PRUN_COMPLETED".equals(oneTask.getString("currentStatusId"))) { allTaskCompleted = false; } } @@ -794,13 +794,13 @@ public class ProductionRunServices { // PRUN_CREATED or PRUN_SCHEDULED or PRUN_DOC_PRINTED --> PRUN_RUNNING // this should be called only when the first task is started - if ((currentStatusId.equals("PRUN_CREATED") || currentStatusId.equals("PRUN_SCHEDULED") || currentStatusId.equals("PRUN_DOC_PRINTED")) && (statusId == null || statusId.equals("PRUN_RUNNING"))) { + if (("PRUN_CREATED".equals(currentStatusId) || "PRUN_SCHEDULED".equals(currentStatusId) || "PRUN_DOC_PRINTED".equals(currentStatusId)) && (statusId == null || "PRUN_RUNNING".equals(statusId))) { // change the production run task status to PRUN_RUNNING // if necessary change the production run (header) status to PRUN_RUNNING if (!allPrecTaskCompletedOrRunning) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskCannotStartPrevTasksNotCompleted", locale)); } - if (productionRun.getGenericValue().getString("currentStatusId").equals("PRUN_CREATED")) { + if ("PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskCannotStartDocsNotPrinted", locale)); } Map<String, Object> serviceContext = new HashMap<String, Object>(); @@ -815,7 +815,7 @@ public class ProductionRunServices { Debug.logError(e, "Problem calling the updateWorkEffort service", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); } - if (!productionRun.getGenericValue().getString("currentStatusId").equals("PRUN_RUNNING")) { + if (!"PRUN_RUNNING".equals(productionRun.getGenericValue().getString("currentStatusId"))) { serviceContext.clear(); serviceContext.put("productionRunId", productionRunId); serviceContext.put("statusId", "PRUN_RUNNING"); @@ -835,7 +835,7 @@ public class ProductionRunServices { // PRUN_RUNNING --> PRUN_COMPLETED // this should be called only when the last task is completed - if (currentStatusId.equals("PRUN_RUNNING") && (statusId == null || statusId.equals("PRUN_COMPLETED"))) { + if ("PRUN_RUNNING".equals(currentStatusId) && (statusId == null || "PRUN_COMPLETED".equals(statusId))) { Map<String, Object> serviceContext = new HashMap<String, Object>(); if (issueAllComponents.booleanValue()) { // Issue all the components, if this task needs components and they still need to be issued @@ -2159,7 +2159,7 @@ public class ProductionRunServices { String currentStatusId = theTask.getString("currentStatusId"); - if (!currentStatusId.equals("PRUN_RUNNING")) { + if (!"PRUN_RUNNING".equals(currentStatusId)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotRunning", locale)); } @@ -2934,29 +2934,29 @@ public class ProductionRunServices { Map<String, Object> serviceContext = new HashMap<String, Object>(); // Change the task status to running - if (statusId.equals("PRUN_DOC_PRINTED") || - statusId.equals("PRUN_RUNNING") || - statusId.equals("PRUN_COMPLETED") || - statusId.equals("PRUN_CLOSED")) { + if ("PRUN_DOC_PRINTED".equals(statusId) || + "PRUN_RUNNING".equals(statusId) || + "PRUN_COMPLETED".equals(statusId) || + "PRUN_CLOSED".equals(statusId)) { serviceContext.put("productionRunId", productionRunId); serviceContext.put("statusId", "PRUN_DOC_PRINTED"); serviceContext.put("userLogin", userLogin); dispatcher.runSync("changeProductionRunStatus", serviceContext); } - if (statusId.equals("PRUN_RUNNING") && "Y".equals(startAllTasks)) { + if ("PRUN_RUNNING".equals(statusId) && "Y".equals(startAllTasks)) { serviceContext.clear(); serviceContext.put("productionRunId", productionRunId); serviceContext.put("userLogin", userLogin); dispatcher.runSync("quickStartAllProductionRunTasks", serviceContext); } - if (statusId.equals("PRUN_COMPLETED") || - statusId.equals("PRUN_CLOSED")) { + if ("PRUN_COMPLETED".equals(statusId) || + "PRUN_CLOSED".equals(statusId)) { serviceContext.clear(); serviceContext.put("productionRunId", productionRunId); serviceContext.put("userLogin", userLogin); dispatcher.runSync("quickRunAllProductionRunTasks", serviceContext); } - if (statusId.equals("PRUN_CLOSED")) { + if ("PRUN_CLOSED".equals(statusId)) { // Put in warehouse the products manufactured serviceContext.clear(); serviceContext.put("workEffortId", productionRunId); Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java?rev=1812260&r1=1812259&r2=1812260&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java Mon Oct 16 09:07:36 2017 @@ -121,7 +121,7 @@ public class TechDataServices { Timestamp thruDate = (Timestamp) context.get("thruDate"); String create = (String) context.get("create"); - boolean createProcess = (create !=null && create.equals("Y")) ? true : false; + boolean createProcess = (create !=null && "Y".equals(create)) ? true : false; List<GenericValue> listRoutingTaskAssoc = null; try { Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java?rev=1812260&r1=1812259&r2=1812260&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java Mon Oct 16 09:07:36 2017 @@ -100,7 +100,7 @@ public class CommunicationEventServices // make sure the from contact mech is an email if it is specified if ((communicationEvent.getRelatedOne("FromContactMech", false) == null) || - (!(communicationEvent.getRelatedOne("FromContactMech", false).getString("contactMechTypeId").equals("EMAIL_ADDRESS")) || + (!("EMAIL_ADDRESS".equals(communicationEvent.getRelatedOne("FromContactMech", false).getString("contactMechTypeId"))) || (communicationEvent.getRelatedOne("FromContactMech", false).getString("infoString") == null))) { String errMsg = UtilProperties.getMessage(resource,"commeventservices.communication_event_from_contact_mech_must_be_email", locale); return ServiceUtil.returnError(errMsg + " " + communicationEventId); @@ -359,7 +359,7 @@ public class CommunicationEventServices newContactListCommStatusRecordMap.put("statusId", "COM_IN_PROGRESS"); newContactListCommStatusRecordMap.put("partyId", partyId); contactListCommStatusRecord = delegator.create("ContactListCommStatus", newContactListCommStatusRecordMap); - } else if (contactListCommStatusRecord.get("statusId") != null && contactListCommStatusRecord.getString("statusId").equals("COM_COMPLETE")) { + } else if (contactListCommStatusRecord.get("statusId") != null && "COM_COMPLETE".equals(contactListCommStatusRecord.getString("statusId"))) { // There was a successful earlier attempt, so skip this address continue; @@ -687,7 +687,7 @@ public class CommunicationEventServices int idx = contentTypeRaw.indexOf(";"); if (idx == -1) idx = contentTypeRaw.length(); contentType = contentTypeRaw.substring(0, idx); - if (contentType == null || contentType.equals("")) contentType = "text/html"; + if (contentType == null || "".equals(contentType)) contentType = "text/html"; contentType = contentType.toLowerCase(); Address[] addressesFrom = wrapper.getFrom(); Address[] addressesTo = wrapper.getTo(); @@ -705,7 +705,7 @@ public class CommunicationEventServices String spamHeaderName = EntityUtilProperties.getPropertyValue("general", "mail.spam.name", "N", delegator); String configHeaderValue = EntityUtilProperties.getPropertyValue("general", "mail.spam.value", delegator); // only execute when config file has been set && header variable found - if (!spamHeaderName.equals("N") && wrapper.getHeader(spamHeaderName) != null && wrapper.getHeader(spamHeaderName).length > 0) { + if (!"N".equals(spamHeaderName) && wrapper.getHeader(spamHeaderName) != null && wrapper.getHeader(spamHeaderName).length > 0) { String msgHeaderValue = wrapper.getHeader(spamHeaderName)[0]; if (msgHeaderValue != null && msgHeaderValue.startsWith(configHeaderValue)) { Debug.logInfo("Incoming Email message ignored, was detected by external spam checker", module); Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java?rev=1812260&r1=1812259&r2=1812260&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java Mon Oct 16 09:07:36 2017 @@ -94,7 +94,7 @@ public class ContactMechServices { GenericValue tempContactMech = delegator.makeValue("ContactMech", UtilMisc.toMap("contactMechId", newCmId, "contactMechTypeId", contactMechTypeId)); toBeStored.add(tempContactMech); - if (!partyId.equals("_NA_")) { + if (!"_NA_".equals(partyId)) { toBeStored.add(delegator.makeValue("PartyContactMech", UtilMisc.toMap("partyId", partyId, "contactMechId", newCmId, "fromDate", now, "roleTypeId", context.get("roleTypeId"), "allowSolicitation", context.get("allowSolicitation"), "extension", context.get("extension")))); } @@ -164,7 +164,7 @@ public class ContactMechServices { contactMech = null; } - if (!partyId.equals("_NA_")) { + if (!"_NA_".equals(partyId)) { // try to find a PartyContactMech with a valid date range try { partyContactMech = EntityQuery.use(delegator).from("PartyContactMech") @@ -350,7 +350,7 @@ public class ContactMechServices { toBeStored.add(tempContactMech); // don't create a PartyContactMech if there is no party; we define no party as sending _NA_ as partyId - if (!partyId.equals("_NA_")) { + if (!"_NA_".equals(partyId)) { toBeStored.add(delegator.makeValue("PartyContactMech", UtilMisc.toMap("partyId", partyId, "contactMechId", newCmId, "fromDate", now, "roleTypeId", context.get("roleTypeId"), "allowSolicitation", @@ -429,7 +429,7 @@ public class ContactMechServices { contactMech = null; } - if (!partyId.equals("_NA_")) { + if (!"_NA_".equals(partyId)) { // try to find a PartyContactMech with a valid date range try { partyContactMech = EntityQuery.use(delegator).from("PartyContactMech") Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearchSession.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearchSession.java?rev=1812260&r1=1812259&r2=1812260&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearchSession.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearchSession.java Mon Oct 16 09:07:36 2017 @@ -246,7 +246,7 @@ public class WorkEffortSearchSession { String sortAscending = (String) parameters.get("sortAscending"); boolean ascending = !"N".equals(sortAscending); if (sortOrder != null) { - if (sortOrder.equals("SortKeywordRelevancy")) { + if ("SortKeywordRelevancy".equals(sortOrder)) { searchSetSortOrder(new WorkEffortSearch.SortKeywordRelevancy(), session); } else if (sortOrder.startsWith("SortWorkEffortField:")) { String fieldName = sortOrder.substring("SortWorkEffortField:".length()); Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1812260&r1=1812259&r2=1812260&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java Mon Oct 16 09:07:36 2017 @@ -772,7 +772,7 @@ public class WorkEffortServices { List<GenericValue> incomingProductionRuns = EntityQuery.use(delegator).from("WorkEffortAndGoods").where(findIncomingProductionRunsConds).orderBy("-estimatedCompletionDate").queryList(); for (GenericValue incomingProductionRun: incomingProductionRuns) { double producedQtyTot = 0.0; - if (incomingProductionRun.getString("currentStatusId").equals("PRUN_COMPLETED")) { + if ("PRUN_COMPLETED".equals(incomingProductionRun.getString("currentStatusId"))) { List<GenericValue> inventoryItems = EntityQuery.use(delegator).from("WorkEffortAndInventoryProduced").where("productId", productId, "workEffortId", incomingProductionRun.getString("workEffortId")).queryList(); for (GenericValue inventoryItem: inventoryItems) { GenericValue inventoryItemDetail = EntityQuery.use(delegator).from("InventoryItemDetail").where("inventoryItemId", inventoryItem.getString("inventoryItemId")).orderBy("inventoryItemDetailSeqId").queryFirst(); |
Free forum by Nabble | Edit this page |