Author: mrisaliti
Date: Wed Jan 12 22:26:05 2011
New Revision: 1058341
URL: http://svn.apache.org/viewvc?rev=1058341&view=rev
Log:
Remove most of the java compilation warning (generics markup, unused
code/import) (OFBIZ-4102)
Please advice if you see some issues, I have tested but it could be some errors
due to the migration.
Modified:
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
Modified:
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java?rev=1058341&r1=1058340&r2=1058341&view=diff
==============================================================================
---
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java
(original)
+++
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java
Wed Jan 12 22:26:05 2011
@@ -22,10 +22,11 @@ package org.ofbiz.manufacturing.jobshopm
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import javolution.util.FastList;
+
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilValidate;
@@ -33,8 +34,8 @@ import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.manufacturing.techdata.TechDataServices;
+import org.ofbiz.service.LocalDispatcher;
/**
@@ -57,8 +58,8 @@ public class ProductionRun {
protected String productionRunName;
protected String description;
protected GenericValue currentStatus;
- protected List productionRunComponents;
- protected List productionRunRoutingTasks;
+ protected List<GenericValue> productionRunComponents;
+ protected List<GenericValue> productionRunRoutingTasks;
protected LocalDispatcher dispatcher;
/**
@@ -135,13 +136,13 @@ public class ProductionRun {
quantityIsUpdated = false;
}
if (productionRunRoutingTasks != null) {
- for (Iterator iter = productionRunRoutingTasks.iterator();
iter.hasNext();) {
+ for (Iterator<GenericValue> iter =
productionRunRoutingTasks.iterator(); iter.hasNext();) {
GenericValue routingTask = (GenericValue) iter.next();
routingTask.store();
}
}
if (productionRunComponents != null) {
- for (Iterator iter = productionRunComponents.iterator();
iter.hasNext();) {
+ for (Iterator<GenericValue> iter =
productionRunComponents.iterator(); iter.hasNext();) {
GenericValue component = (GenericValue) iter.next();
component.store();
}
@@ -164,7 +165,8 @@ public class ProductionRun {
if (exist()) {
if (productProduced == null) {
try {
- List productionRunProducts =
productionRun.getRelated("WorkEffortGoodStandard",
UtilMisc.toMap("workEffortGoodStdTypeId", "PRUN_PROD_DELIV"),null);
+ List<GenericValue> productionRunProducts =
productionRun.getRelated("WorkEffortGoodStandard",
+ UtilMisc.toMap("workEffortGoodStdTypeId",
"PRUN_PROD_DELIV"), null);
this.productionRunProduct =
EntityUtil.getFirst(productionRunProducts);
quantity =
productionRunProduct.getBigDecimal("estimatedQuantity");
productProduced =
productionRunProduct.getRelatedOneCache("Product");
@@ -199,7 +201,7 @@ public class ProductionRun {
this.quantityIsUpdated = true;
this.updateCompletionDate = true;
if (productionRunComponents == null) getProductionRunComponents();
- for (Iterator iter = productionRunComponents.iterator();
iter.hasNext();) {
+ for (Iterator<GenericValue> iter = productionRunComponents.iterator();
iter.hasNext();) {
GenericValue component = (GenericValue) iter.next();
componentQuantity = component.getBigDecimal("estimatedQuantity");
component.set("estimatedQuantity",
componentQuantity.divide(previousQuantity, 10,
BigDecimal.ROUND_HALF_UP).multiply(newQuantity));
@@ -254,7 +256,7 @@ public class ProductionRun {
getProductionRunRoutingTasks();
if (quantity == null) getQuantity();
Timestamp endDate=null;
- for (Iterator iter=productionRunRoutingTasks.iterator();
iter.hasNext();) {
+ for (Iterator<GenericValue> iter =
productionRunRoutingTasks.iterator(); iter.hasNext();) {
GenericValue routingTask = (GenericValue) iter.next();
if (priority.compareTo(routingTask.getLong("priority")) <= 0) {
// Calculate the estimatedCompletionDate
@@ -321,15 +323,15 @@ public class ProductionRun {
* get the list of all the productionRunComponents as a list of
GenericValue.
* @return the productionRunComponents related object
**/
- public List getProductionRunComponents() {
+ public List<GenericValue> getProductionRunComponents() {
if (exist()) {
if (productionRunComponents == null) {
if (productionRunRoutingTasks == null)
this.getProductionRunRoutingTasks();
if (productionRunRoutingTasks != null) {
try {
- productionRunComponents = new LinkedList();
+ productionRunComponents = FastList.newInstance();
GenericValue routingTask;
- for (Iterator
iter=productionRunRoutingTasks.iterator(); iter.hasNext();) {
+ for (Iterator<GenericValue> iter =
productionRunRoutingTasks.iterator(); iter.hasNext();) {
routingTask = (GenericValue)iter.next();
productionRunComponents.addAll(routingTask.getRelated("WorkEffortGoodStandard",
UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"),null));
}
@@ -346,7 +348,7 @@ public class ProductionRun {
* get the list of all the productionRunRoutingTasks as a list of
GenericValue.
* @return the productionRunRoutingTasks related object
**/
- public List getProductionRunRoutingTasks() {
+ public List<GenericValue> getProductionRunRoutingTasks() {
if (exist()) {
if (productionRunRoutingTasks == null) {
try {
@@ -418,10 +420,10 @@ public class ProductionRun {
serviceName = genericService.getString("customMethodName");
// call the service
// and put the value in totalTaskTime
- Map estimateCalcServiceMap = UtilMisc.toMap("workEffort",
task, "quantity", quantity, "productId", productId, "routingId", routingId);
- Map serviceContext = UtilMisc.toMap("arguments",
estimateCalcServiceMap);
+ Map<String, Object> estimateCalcServiceMap =
UtilMisc.<String, Object>toMap("workEffort", task, "quantity", quantity,
"productId", productId, "routingId", routingId);
+ Map<String, Object> serviceContext = UtilMisc.<String,
Object>toMap("arguments", estimateCalcServiceMap);
// serviceContext.put("userLogin", userLogin);
- Map resultService = dispatcher.runSync(serviceName,
serviceContext);
+ Map<String, Object> resultService =
dispatcher.runSync(serviceName, serviceContext);
totalTaskTime =
((Double)resultService.get("totalTime")).doubleValue();
}
} catch (Exception exc) {
Modified:
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java?rev=1058341&r1=1058340&r2=1058341&view=diff
==============================================================================
---
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
(original)
+++
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
Wed Jan 12 22:26:05 2011
@@ -49,7 +49,7 @@ public class ProductionRunEvents {
LocalDispatcher dispatcher = (LocalDispatcher)
request.getAttribute("dispatcher");
GenericValue userLogin = (GenericValue)
session.getAttribute("userLogin");
- Map parameters = UtilHttp.getParameterMap(request);
+ Map<String, Object> parameters = UtilHttp.getParameterMap(request);
BigDecimal quantity = null;
try {
@@ -62,7 +62,7 @@ public class ProductionRunEvents {
}
Collection<Map<String, Object>> componentRows =
UtilHttp.parseMultiFormData(parameters);
- Map componentsLocationMap = FastMap.newInstance();
+ Map<GenericPK, Object> componentsLocationMap = FastMap.newInstance();
for (Map<String, Object>componentRow : componentRows) {
Timestamp fromDate = null;
try {
@@ -73,22 +73,25 @@ public class ProductionRunEvents {
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
- GenericPK key = delegator.makePK("WorkEffortGoodStandard",
UtilMisc.toMap("workEffortId", (String)componentRow.get("productionRunTaskId"),
-
"productId",
(String)componentRow.get("productId"),
-
"fromDate", fromDate,
-
"workEffortGoodStdTypeId",
"PRUNT_PROD_NEEDED"));
- componentsLocationMap.put(key, UtilMisc.toMap("locationSeqId",
(String)componentRow.get("locationSeqId"),
-
"secondaryLocationSeqId", (String)componentRow.get("secondaryLocationSeqId"),
-
"failIfItemsAreNotAvailable",
(String)componentRow.get("failIfItemsAreNotAvailable")));
+ GenericPK key = delegator.makePK("WorkEffortGoodStandard",
+ UtilMisc.<String, Object>toMap("workEffortId",
(String)componentRow.get("productionRunTaskId"),
+ "productId", (String)componentRow.get("productId"),
+ "fromDate", fromDate,
+ "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"));
+ componentsLocationMap.put(key,
+ UtilMisc.<String, Object>toMap("locationSeqId",
(String)componentRow.get("locationSeqId"),
+ "secondaryLocationSeqId",
(String)componentRow.get("secondaryLocationSeqId"),
+ "failIfItemsAreNotAvailable",
(String)componentRow.get("failIfItemsAreNotAvailable")));
}
try {
- Map inputMap = UtilMisc.toMap("workEffortId",
parameters.get("workEffortId"), "inventoryItemTypeId",
parameters.get("inventoryItemTypeId"));
+ Map<String, Object> inputMap = UtilMisc.<String,
Object>toMap("workEffortId", parameters.get("workEffortId"),
+ "inventoryItemTypeId",
parameters.get("inventoryItemTypeId"));
inputMap.put("componentsLocationMap", componentsLocationMap);
inputMap.put("quantity", quantity);
inputMap.put("lotId", parameters.get("lotId"));
inputMap.put("userLogin", userLogin);
- Map result = dispatcher.runSync("productionRunDeclareAndProduce",
inputMap);
+ Map<String, Object> result =
dispatcher.runSync("productionRunDeclareAndProduce", inputMap);
if (ServiceUtil.isError(result)) {
request.setAttribute("_ERROR_MESSAGE_",
ServiceUtil.getErrorMessage(result));
return "error";
Modified:
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java?rev=1058341&r1=1058340&r2=1058341&view=diff
==============================================================================
---
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java
(original)
+++
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java
Wed Jan 12 22:26:05 2011
@@ -18,10 +18,11 @@
*******************************************************************************/
package org.ofbiz.manufacturing.jobshopmgt;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javolution.util.FastMap;
+
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilValidate;
@@ -51,20 +52,22 @@ public class ProductionRunHelper {
* <li> the productionRun
* <li> the productionRunProduct
*/
- public static Map getProductionRun(Delegator delegator, String
productionRunId) {
- Map result = new HashMap();
- // Timestamp now = UtilDateTime.nowTimestamp();
-
+ public static Map<String, Object> getProductionRun(Delegator delegator,
String productionRunId) {
+ Map<String, Object> result = FastMap.newInstance();
+
try {
if (productionRunId != null) {
GenericValue productionRun =
delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId",
productionRunId));
if (productionRun != null) {
- List productionRunProducts =
productionRun.getRelated("WorkEffortGoodStandard",
UtilMisc.toMap("workEffortGoodStdTypeId", "PRUN_PROD_DELIV"),null);
+ List<GenericValue> productionRunProducts =
productionRun.getRelated("WorkEffortGoodStandard",
UtilMisc.toMap("workEffortGoodStdTypeId", "PRUN_PROD_DELIV"),null);
GenericValue productionRunProduct =
EntityUtil.getFirst(productionRunProducts);
GenericValue productProduced =
productionRunProduct.getRelatedOneCache("Product");
- List productionRunComponents =
productionRun.getRelated("WorkEffortGoodStandard",
UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"),null);
- List productionRunRoutingTasks =
productionRun.getRelated("FromWorkEffortAssoc",UtilMisc.toMap("workEffortTypeId","PROD_ORDER_TASK"),null);
-
+ List<GenericValue> productionRunComponents =
productionRun.getRelated("WorkEffortGoodStandard",
UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"),null);
+ List<GenericValue> productionRunRoutingTasks =
productionRun.getRelated("FromWorkEffortAssoc",UtilMisc.toMap("workEffortTypeId","PROD_ORDER_TASK"),null);
+ result.put("productionRunProduct", productionRunProduct);
+ result.put("productProduced", productProduced);
+ result.put("productionRunComponents",
productionRunComponents);
+ result.put("productionRunRoutingTasks",
productionRunRoutingTasks);
}
}
} catch (GenericEntityException e) {
@@ -74,15 +77,17 @@ public class ProductionRunHelper {
}
public static boolean hasTask(Delegator delegator, String taskName, String
workEffortId) throws GenericEntityException {
- List tasks = delegator.findByAnd("WorkEffort",
UtilMisc.toMap("workEffortParentId", workEffortId,
- "workEffortTypeId",
"PROD_ORDER_TASK",
- "workEffortName",
taskName));
+ List<GenericValue> tasks = delegator.findByAnd("WorkEffort",
+ UtilMisc.toMap("workEffortParentId", workEffortId,
+ "workEffortTypeId", "PROD_ORDER_TASK",
+ "workEffortName", taskName));
return (UtilValidate.isNotEmpty(tasks));
}
- public static void getLinkedProductionRuns(Delegator delegator,
LocalDispatcher dispatcher, String productionRunId, List productionRuns)
throws GenericEntityException {
+ public static void getLinkedProductionRuns(Delegator delegator,
LocalDispatcher dispatcher, String productionRunId, List<ProductionRun>
productionRuns) throws GenericEntityException {
productionRuns.add(new ProductionRun(productionRunId, delegator,
dispatcher));
- List linkedWorkEfforts =
EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc",
UtilMisc.toMap("workEffortIdTo", productionRunId, "workEffortAssocTypeId",
"WORK_EFF_PRECEDENCY")));
+ List<GenericValue> linkedWorkEfforts =
EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc",
+ UtilMisc.toMap("workEffortIdTo", productionRunId,
"workEffortAssocTypeId", "WORK_EFF_PRECEDENCY")));
for (int i = 0; i < linkedWorkEfforts.size(); i++) {
GenericValue link = (GenericValue)linkedWorkEfforts.get(i);
getLinkedProductionRuns(delegator, dispatcher,
link.getString("workEffortIdFrom"), productionRuns);
@@ -90,7 +95,7 @@ public class ProductionRunHelper {
}
public static String getRootProductionRun(Delegator delegator, String
productionRunId) throws GenericEntityException {
- List linkedWorkEfforts = delegator.findByAnd("WorkEffortAssoc",
UtilMisc.toMap("workEffortIdFrom", productionRunId, "workEffortAssocTypeId",
"WORK_EFF_PRECEDENCY"));
+ List<GenericValue> linkedWorkEfforts =
delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdFrom",
productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY"));
GenericValue linkedWorkEffort = EntityUtil.getFirst(linkedWorkEfforts);
if (linkedWorkEffort != null) {
productionRunId = getRootProductionRun(delegator,
linkedWorkEffort.getString("workEffortIdTo"));