diff --git a/base/src/org/compiere/model/MResource.java b/base/src/org/compiere/model/MResource.java
index 8ded37a6c4..e90b061e2f 100644
--- a/base/src/org/compiere/model/MResource.java
+++ b/base/src/org/compiere/model/MResource.java
@@ -16,8 +16,10 @@
*****************************************************************************/
package org.compiere.model;
-import java.sql.*;
-import java.util.*;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import org.compiere.util.CCache;
/**
@@ -25,9 +27,34 @@ import java.util.*;
*
* @author Jorg Janke
* @version $Id: MResource.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $
+ *
+ * @author Teo Sarca, www.arhipac.ro
+ *
FR [ 2051056 ] MResource[Type] should be cached
*/
public class MResource extends X_S_Resource
{
+ /** Cache */
+ private static CCache s_cache = new CCache(Table_Name, 20);
+
+ /**
+ * Get from Cache
+ * @param ctx
+ * @param S_Resource_ID
+ * @return MResource
+ */
+ public static MResource get(Properties ctx, int S_Resource_ID)
+ {
+ if (S_Resource_ID <= 0)
+ return null;
+ MResource r = s_cache.get(S_Resource_ID);
+ if (r == null) {
+ r = new MResource(ctx, S_Resource_ID, null);
+ if (r.get_ID() == S_Resource_ID) {
+ s_cache.put(S_Resource_ID, r);
+ }
+ }
+ return r;
+ }
/**
* Standard Constructor
@@ -62,8 +89,13 @@ public class MResource extends X_S_Resource
*/
public MResourceType getResourceType()
{
- if (m_resourceType == null && getS_ResourceType_ID() != 0)
+ // Use cache if we are outside transaction:
+ if (get_TrxName() == null && getS_ResourceType_ID() > 0)
+ return MResourceType.get(getCtx(), getS_ResourceType_ID());
+ //
+ if (m_resourceType == null && getS_ResourceType_ID() != 0) {
m_resourceType = new MResourceType (getCtx(), getS_ResourceType_ID(), get_TrxName());
+ }
return m_resourceType;
} // getResourceType
@@ -94,7 +126,7 @@ public class MResource extends X_S_Resource
if (getValue() == null || getValue().length() == 0)
setValue(getName());
m_product = new MProduct(this, getResourceType());
- return m_product.save(get_TrxName());
+ m_product.saveEx(get_TrxName());
}
return true;
} // beforeSave
@@ -112,7 +144,7 @@ public class MResource extends X_S_Resource
MProduct prod = getProduct();
if (prod.setResource(this))
- prod.save(get_TrxName());
+ prod.saveEx(get_TrxName());
return success;
} // afterSave
diff --git a/base/src/org/compiere/model/MResourceType.java b/base/src/org/compiere/model/MResourceType.java
index 846a0ff9d8..5c0b127521 100644
--- a/base/src/org/compiere/model/MResourceType.java
+++ b/base/src/org/compiere/model/MResourceType.java
@@ -16,8 +16,10 @@
*****************************************************************************/
package org.compiere.model;
-import java.sql.*;
-import java.util.*;
+import java.sql.ResultSet;
+import java.util.Properties;
+
+import org.compiere.util.CCache;
/**
@@ -25,9 +27,36 @@ import java.util.*;
*
* @author Jorg Janke
* @version $Id: MResourceType.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $
+ *
+ * @author Teo Sarca, www.arhipac.ro
+ * FR [ 2051056 ] MResource[Type] should be cached
*/
public class MResourceType extends X_S_ResourceType
{
+ /** Cache */
+ private static CCache s_cache = new CCache(Table_Name, 20);
+
+ /**
+ * Get from Cache
+ * @param ctx
+ * @param S_ResourceType_ID
+ * @return MResourceType
+ */
+ public static MResourceType get(Properties ctx, int S_ResourceType_ID)
+ {
+ if (S_ResourceType_ID <= 0)
+ return null;
+
+ MResourceType type = s_cache.get(S_ResourceType_ID);
+ if (type == null) {
+ type = new MResourceType(ctx, S_ResourceType_ID, null);
+ if (type.get_ID() == S_ResourceType_ID) {
+ s_cache.put(S_ResourceType_ID, type);
+ }
+ }
+ return type;
+ }
+
/**
* Standard Constructor
* @param ctx context
@@ -70,7 +99,7 @@ public class MResourceType extends X_S_ResourceType
{
MProduct product = products[i];
if (product.setResource(this))
- product.save(get_TrxName());
+ product.saveEx(get_TrxName());
}
}
diff --git a/base/src/org/eevolution/model/MPPMRP.java b/base/src/org/eevolution/model/MPPMRP.java
index 9858044f12..694b3286bf 100644
--- a/base/src/org/eevolution/model/MPPMRP.java
+++ b/base/src/org/eevolution/model/MPPMRP.java
@@ -840,8 +840,8 @@ public class MPPMRP extends X_PP_MRP
if (S_Resource_ID == 0)
return Env.ZERO;
- MResource S_Resource = new MResource(Env.getCtx(),S_Resource_ID,null);
- MResourceType S_ResourceType = new MResourceType(Env.getCtx(),S_Resource.getS_ResourceType_ID(),null);
+ MResource S_Resource = MResource.get(Env.getCtx(),S_Resource_ID);
+ MResourceType S_ResourceType = MResourceType.get(Env.getCtx(),S_Resource.getS_ResourceType_ID());
BigDecimal AvailableDayTime = Env.ZERO;
int AvailableDays = 0;
diff --git a/base/src/org/eevolution/model/reasoner/CRPReasoner.java b/base/src/org/eevolution/model/reasoner/CRPReasoner.java
index 35a0a18bc9..d201ac5e68 100644
--- a/base/src/org/eevolution/model/reasoner/CRPReasoner.java
+++ b/base/src/org/eevolution/model/reasoner/CRPReasoner.java
@@ -103,8 +103,7 @@ public class CRPReasoner {
public Timestamp getBorderDayMin(Timestamp dateTime, MResource r) {
- MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
- Timestamp dMin = null;
+ MResourceType t = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
return (t.isTimeSlot()) ?
DateTimeUtil.getDayBorder(dateTime, t.getTimeSlotStart(), false) :
DateTimeUtil.getDayBorder(dateTime, null, false);
@@ -112,8 +111,7 @@ public class CRPReasoner {
public Timestamp getBorderDayMax(Timestamp dateTime, MResource r) {
- MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
- Timestamp dMin = null;
+ MResourceType t = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
return (t.isTimeSlot()) ?
DateTimeUtil.getDayBorder(dateTime, t.getTimeSlotEnd(), true) :
DateTimeUtil.getDayBorder(dateTime, null, true);
@@ -121,8 +119,7 @@ public class CRPReasoner {
public boolean isResourceAvailable(Timestamp dateTime, MResource r) {
- MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
-
+ MResourceType t = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
return ( checkResourceAvailability(dateTime, r) && checkResourceTypeAvailability(dateTime, t) );
}
diff --git a/base/src/org/eevolution/process/CRP.java b/base/src/org/eevolution/process/CRP.java
index 1428116f07..a0d14803ef 100644
--- a/base/src/org/eevolution/process/CRP.java
+++ b/base/src/org/eevolution/process/CRP.java
@@ -109,7 +109,7 @@ public class CRP extends SvrProcess {
long nodeMillis = 0;
int nodeId = -1;
- resource = new MResource(Env.getCtx(), p_S_Resource_ID, null);
+ resource = MResource.get(getCtx(), p_S_Resource_ID);
MPPOrder[] orders = reasoner.getPPOrdersNotCompleted(resource);
log.log(Level.INFO,"MPP_Order[] : " + orders.length);
for(int i = 0; i < orders.length; i++) {
@@ -127,17 +127,17 @@ public class CRP extends SvrProcess {
log.log(Level.FINE,"MPP_Order Workflow:" + owf.getName());
date = orders[i].getDateStartSchedule();
nodeId = owf.getPP_Order_Node_ID();
+
while(nodeId != 0) {
node = new MPPOrderNode(getCtx(),nodeId , get_TrxName());
log.log(Level.FINE,"MPP_Order Node:" + node.getName() + " Description:" + node.getDescription());
- resource = new MResource(Env.getCtx(), node.getS_Resource_ID(), null);
- resourceType = new MResourceType(Env.getCtx(), resource.getS_ResourceType_ID(), null);
+ resource = MResource.get(getCtx(), node.getS_Resource_ID());
+ resourceType = MResourceType.get(getCtx(), resource.getS_ResourceType_ID());
// Checks, whether the resource type is principal available on one day a week.
// If not, process breaks with a Info message about.
if(!reasoner.checkResourceTypeAvailability(resourceType)) {
-
return Msg.getMsg(Env.getCtx(), "ResourceNotInSlotDay");
}
@@ -164,16 +164,14 @@ public class CRP extends SvrProcess {
nodeId = owf.getLast(0, getAD_Client_ID());
while(nodeId != 0) {
-
node = new MPPOrderNode(getCtx(),nodeId , get_TrxName());
log.log(Level.FINE,"MPP_Order Node:" + node.getName() + " Description:" + node.getDescription());
- resource = new MResource(Env.getCtx(), node.getS_Resource_ID(), null);
- resourceType = new MResourceType(Env.getCtx(), resource.getS_ResourceType_ID(), null);
+ resource = MResource.get(getCtx(), node.getS_Resource_ID());
+ resourceType = MResourceType.get(getCtx(), resource.getS_ResourceType_ID());
// Checks, whether the resource type is principal available on one day a week.
// If not, process breaks with a Info message about.
if(!reasoner.checkResourceTypeAvailability(resourceType)) {
-
return Msg.getMsg(Env.getCtx(), "ResourceNotInSlotDay");
}
diff --git a/base/src/org/eevolution/process/CRPSummary.java b/base/src/org/eevolution/process/CRPSummary.java
index a6c28b6277..7aec8457eb 100644
--- a/base/src/org/eevolution/process/CRPSummary.java
+++ b/base/src/org/eevolution/process/CRPSummary.java
@@ -148,11 +148,11 @@ public class CRPSummary extends SvrProcess
// Calculate Total seconds for Node
seconds = (n.getQueuingTime() + n.getSetupTime() + QtyOpen.multiply(new BigDecimal(n.getDuration())).longValue() + n.getMovingTime() + n.getWaitingTime()) * owf.getDurationBaseSec();
// Calculate Factor Day
- MResource r = new MResource(getCtx(),n.getS_Resource_ID(),null);
+ MResource r = MResource.get(getCtx(),n.getS_Resource_ID());
if (r == null)
continue;
- MResourceType type = new MResourceType(Env.getCtx(),r.getS_ResourceType_ID(),null);
+ MResourceType type = MResourceType.get(Env.getCtx(),r.getS_ResourceType_ID());
long hours = 0 ;
if (type.isTimeSlot())
@@ -186,11 +186,11 @@ public class CRPSummary extends SvrProcess
// Calculate Total seconds for Node
seconds = (n.getQueuingTime() + n.getSetupTime() + QtyOpen.multiply(new BigDecimal(n.getDuration())).longValue() + n.getMovingTime() + n.getWaitingTime()) * owf.getDurationBaseSec();
// Calculate Factor Day
- MResource r = new MResource(getCtx(),n.getS_Resource_ID(),null);
+ MResource r = MResource.get(getCtx(),n.getS_Resource_ID());
if (r == null)
continue;
- MResourceType type = new MResourceType(Env.getCtx(),r.getS_ResourceType_ID(),null);
+ MResourceType type = MResourceType.get(Env.getCtx(),r.getS_ResourceType_ID());
long hours = 0 ;
if (type.isTimeSlot())
@@ -360,7 +360,7 @@ public class CRPSummary extends SvrProcess
gc2.clear(Calendar.MINUTE);
gc2.clear(Calendar.HOUR_OF_DAY);
- MResourceType t = new MResourceType(Env.getCtx(),r.getS_ResourceType_ID(),null);
+ MResourceType t = MResourceType.get(Env.getCtx(),r.getS_ResourceType_ID());
long hours = 0;
if (t.isTimeSlot())
@@ -434,7 +434,7 @@ public class CRPSummary extends SvrProcess
Long Hours = new Long(hours);
cols.setCapacity(Hours.intValue());
int C_UOM_ID = DB.getSQLValue(null,"SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? " , r.getS_Resource_ID());
- MUOM oum = new MUOM(getCtx(),C_UOM_ID,null);
+ MUOM oum = MUOM.get(getCtx(),C_UOM_ID);
if (oum.isHour())
{
Timestamp date = new Timestamp(gc1.getTimeInMillis());
diff --git a/base/src/org/eevolution/process/MRP.java b/base/src/org/eevolution/process/MRP.java
index 0844c9fbb1..821933f83c 100644
--- a/base/src/org/eevolution/process/MRP.java
+++ b/base/src/org/eevolution/process/MRP.java
@@ -111,7 +111,7 @@ public class MRP extends SvrProcess
else if (name.equals("S_Resource_ID"))
{
p_S_Resource_ID = ((BigDecimal)para[i].getParameter()).intValue();
- MResource r = new MResource(getCtx(),p_S_Resource_ID, get_TrxName());
+ MResource r = MResource.get(getCtx(),p_S_Resource_ID);
Date_Planning_Horizon = TimeUtil.addDays(Today, r.getPlanningHorizon());
}
else if (name.equals("M_Warehouse_ID"))
diff --git a/base/src/org/eevolution/process/RollupWorkflow.java b/base/src/org/eevolution/process/RollupWorkflow.java
index 0312b5b7cd..cae7846291 100644
--- a/base/src/org/eevolution/process/RollupWorkflow.java
+++ b/base/src/org/eevolution/process/RollupWorkflow.java
@@ -176,8 +176,8 @@ public class RollupWorkflow extends SvrProcess
String sql = "SELECT CASE WHEN ow.DurationUnit = 's' THEN 1 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration ) WHEN ow.DurationUnit = 'm' THEN 60 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration) WHEN ow.DurationUnit = 'h' THEN 3600 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration) WHEN ow.DurationUnit = 'Y' THEN 31536000 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration) WHEN ow.DurationUnit = 'M' THEN 2592000 * ( (onode.SetupTime/ow.QtyBatchSize) + onode.Duration ) WHEN ow.DurationUnit = 'D' THEN 86400 * ((onode.SetupTime/ow.QtyBatchSize) + onode.Duration) END AS load FROM AD_WF_Node onode INNER JOIN AD_Workflow ow ON (ow.AD_Workflow_ID = onode.AD_Workflow_ID) WHERE onode.AD_WF_Node_ID = ? AND onode.AD_Client_ID = ?" ;
int seconds = DB.getSQLValue(get_TrxName(),sql,node.getAD_WF_Node_ID(),node.getAD_Client_ID());
int C_UOM_ID = DB.getSQLValue(get_TrxName(),"SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? " , node.getS_Resource_ID());
- MUOM oum = new MUOM(getCtx(),C_UOM_ID,get_TrxName());
- if (oum.isHour())
+ MUOM uom = MUOM.get(getCtx(), C_UOM_ID);
+ if (uom.isHour())
{
BigDecimal time = new BigDecimal(seconds);
diff --git a/client/src/org/eevolution/form/CCRP.java b/client/src/org/eevolution/form/CCRP.java
index 76667d56cf..48a107aab3 100644
--- a/client/src/org/eevolution/form/CCRP.java
+++ b/client/src/org/eevolution/form/CCRP.java
@@ -338,34 +338,24 @@ public class CCRP extends CAbstractForm {
}
public MUOM getSourceUOM() {
-
MResource r = getResource();
int uom_id = r.getResourceType().getC_UOM_ID();
-
- return (uom_id > 0) ? new MUOM(Env.getCtx(),uom_id, null) : null;
+ return (uom_id > 0) ? MUOM.get(Env.getCtx(),uom_id) : null;
}
public MResource getResource() {
-
MResource r = null;
-
if(resource.getValue() != null) {
-
- r = new MResource(Env.getCtx(), ((Integer)resource.getValue()).intValue(), null);
+ r = MResource.get(Env.getCtx(), ((Integer)resource.getValue()).intValue());
}
-
return r;
}
public MUOM getTargetUOM() {
-
MUOM u = null;
-
if(resource.getValue() != null) {
-
- u = new MUOM(Env.getCtx(), ((Integer)resource.getValue()).intValue(), null);
+ u = MUOM.get(Env.getCtx(), ((Integer)resource.getValue()).intValue());
}
-
return u;
}
diff --git a/client/src/org/eevolution/form/VCRP.java b/client/src/org/eevolution/form/VCRP.java
index 70992c9888..c7987f0aa3 100644
--- a/client/src/org/eevolution/form/VCRP.java
+++ b/client/src/org/eevolution/form/VCRP.java
@@ -205,10 +205,10 @@ implements FormPanel, ActionListener
if (date != null && S_Resource_ID != 0)
{
System.out.println("Call createDataset(date,S_Resource_ID)");
- MResource r = new MResource (Env.getCtx(), S_Resource_ID, null);
+ MResource r = MResource.get(Env.getCtx(), S_Resource_ID);
// Ge�ndert Anfang 04.08.2005
int uom_id = r.getResourceType().getC_UOM_ID();
- MUOM uom = new MUOM(Env.getCtx(),uom_id,null);
+ MUOM uom = MUOM.get(Env.getCtx(),uom_id);
CategoryDataset dataset = null;
if(uom.isHour()) {
@@ -361,7 +361,7 @@ implements FormPanel, ActionListener
String namesummary = Msg.translate(Env.getCtx(), "Summary");
String namepossiblecapacity = "Possible Capacity";
- MResourceType t = new MResourceType(Env.getCtx(),r.getS_ResourceType_ID(),null);
+ MResourceType t = MResourceType.get(Env.getCtx(),r.getS_ResourceType_ID());
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
@@ -533,7 +533,7 @@ implements FormPanel, ActionListener
System.out.println("\n Nameload :"+nameload);
String namesummary = Msg.translate(Env.getCtx(), "Summary");
System.out.println("\n Namesummary :"+namesummary);
- MResourceType t = new MResourceType(Env.getCtx(),r.getS_ResourceType_ID(),null);
+ MResourceType t = MResourceType.get(Env.getCtx(),r.getS_ResourceType_ID());
System.out.println("\n Resourcetype "+t);
int days = 1;
long hours = 0;
@@ -547,7 +547,7 @@ implements FormPanel, ActionListener
// Long Hours = new Long(hours);
int C_UOM_ID = DB.getSQLValue(null,"SELECT C_UOM_ID FROM M_Product WHERE S_Resource_ID = ? " , r.getS_Resource_ID());
- MUOM uom = new MUOM(Env.getCtx(),C_UOM_ID,null);
+ MUOM uom = MUOM.get(Env.getCtx(),C_UOM_ID);
System.out.println("\n uom1 "+uom+"\n");
//System.out.println("um.isHour()"+ uom.isHour() );
if (!uom.isHour())
diff --git a/client/src/org/eevolution/form/VMRPDetailed.java b/client/src/org/eevolution/form/VMRPDetailed.java
index 348fa11bfa..c3ac68c0b1 100644
--- a/client/src/org/eevolution/form/VMRPDetailed.java
+++ b/client/src/org/eevolution/form/VMRPDetailed.java
@@ -983,7 +983,7 @@ public class VMRPDetailed extends CPanel implements FormPanel, ActionListener, V
if (rs.next())
{
UOM = rs.getInt(1);
- MUOM um = new MUOM(Env.getCtx(),UOM, null);
+ MUOM um = MUOM.get(Env.getCtx(),UOM);
KeyNamePair kum = new KeyNamePair(um.getC_UOM_ID(),um.getName());
fUOM.setText(kum.toString());
diff --git a/client/src/org/eevolution/form/bom/BOMTreeFactory.java b/client/src/org/eevolution/form/bom/BOMTreeFactory.java
index 32b2e07e09..b12c76c2c5 100644
--- a/client/src/org/eevolution/form/bom/BOMTreeFactory.java
+++ b/client/src/org/eevolution/form/bom/BOMTreeFactory.java
@@ -174,7 +174,7 @@ public abstract class BOMTreeFactory implements BOMTreeModel {
if(node.getUserObject() instanceof MPPOrder) {
MPPOrder o = (MPPOrder)node.getUserObject();
- MResource r = new MResource(Env.getCtx(), o.getS_Resource_ID(), null);
+ MResource r = MResource.get(Env.getCtx(), o.getS_Resource_ID());
name = o.getDocumentNo()+" ("+r.getName()+")";
}
diff --git a/client/src/org/eevolution/form/bom/action/CreateRfQAction.java b/client/src/org/eevolution/form/bom/action/CreateRfQAction.java
index 5c9987b77b..c8ed7363bb 100644
--- a/client/src/org/eevolution/form/bom/action/CreateRfQAction.java
+++ b/client/src/org/eevolution/form/bom/action/CreateRfQAction.java
@@ -105,7 +105,7 @@ public class CreateRfQAction extends ProcessPopupAction {
BOMWrapper bom = (BOMWrapper)node.getUserObject();
MPPOrder mo = new MPPOrder(Env.getCtx(), bom.getPP_Order_ID(), null);
- MResource r = new MResource(Env.getCtx(), mo.getS_Resource_ID(), null);
+ MResource r = MResource.get(Env.getCtx(), mo.getS_Resource_ID());
Calendar cal = Calendar.getInstance();
diff --git a/client/src/org/eevolution/form/crp/CRPDatasetFactory.java b/client/src/org/eevolution/form/crp/CRPDatasetFactory.java
index 5a270981c5..74b40b03f4 100644
--- a/client/src/org/eevolution/form/crp/CRPDatasetFactory.java
+++ b/client/src/org/eevolution/form/crp/CRPDatasetFactory.java
@@ -55,11 +55,11 @@ public abstract class CRPDatasetFactory extends CRPReasoner implements CRPModel
public static CRPModel get(Timestamp start, Timestamp end, MResource r) {
- MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
- // Hardcoded UOM ID - 'Minutes' is base unit
- final MUOM uom1 = new MUOM(Env.getCtx(), 103, null);
+ MResourceType t = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
+ // UOM ID - 'Minutes' is base unit
+ final MUOM uom1 = MUOM.get(Env.getCtx(), MUOM.getMinute_UOM_ID(Env.getCtx()));
// Target UOM is the resource type's UOM
- final MUOM uom2 = new MUOM(Env.getCtx(), t.getC_UOM_ID(), null);
+ final MUOM uom2 = MUOM.get(Env.getCtx(), t.getC_UOM_ID());
CRPDatasetFactory factory = new CRPDatasetFactory() {
@@ -83,7 +83,7 @@ public abstract class CRPDatasetFactory extends CRPReasoner implements CRPModel
String labelActCap = Msg.translate(Env.getCtx(), "DailyCapacity");
String labelLoadAct = Msg.translate(Env.getCtx(), "ActualLoad");
- MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
+ MResourceType t = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
BigDecimal utilization = r.getPercentUtilization();
BigDecimal dailyCapacity = null;
@@ -127,9 +127,9 @@ public abstract class CRPDatasetFactory extends CRPReasoner implements CRPModel
public BigDecimal calculateLoad(Timestamp dateTime, MResource r, String docStatus) {
- MResourceType t = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
+ MResourceType t = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
MPPOrderNode[] nodes = getPPOrderNodes(dateTime, r);
- MUOM uom = new MUOM(Env.getCtx(), t.getC_UOM_ID(), null);
+ MUOM uom = MUOM.get(Env.getCtx(), t.getC_UOM_ID());
MPPOrder o = null;
BigDecimal qtyOpen;
@@ -258,7 +258,7 @@ public abstract class CRPDatasetFactory extends CRPReasoner implements CRPModel
MPPOrderNode on = (MPPOrderNode)node.getUserObject();
MPPOrderWorkflow owf = new MPPOrderWorkflow(Env.getCtx(), on.getPP_Order_Workflow_ID(), null);
- MResourceType rt = new MResourceType(Env.getCtx(), r.getS_ResourceType_ID(), null);
+ MResourceType rt = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
// no function
//Env.getLanguage(Env.getCtx()).getTimeFormat();