Implementing cache for Network Distribution
This commit is contained in:
parent
c794877516
commit
4027198f74
|
@ -22,7 +22,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.MWarehouse;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.util.CCache;
|
||||
|
||||
/**
|
||||
* Network Distribution
|
||||
|
@ -32,6 +34,7 @@ import org.compiere.model.Query;
|
|||
public class MDDNetworkDistribution extends X_DD_NetworkDistribution
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static CCache<Integer,MDDNetworkDistribution> s_cache = new CCache<Integer,MDDNetworkDistribution>(MDDNetworkDistribution.Table_Name, 50);
|
||||
|
||||
/** Standard Constructor */
|
||||
public MDDNetworkDistribution (Properties ctx, int DD_NetworkDistribution_ID, String trxName)
|
||||
|
@ -50,6 +53,25 @@ public class MDDNetworkDistribution extends X_DD_NetworkDistribution
|
|||
|
||||
/** Network Lines */
|
||||
private MDDNetworkDistributionLine[] m_lines = null;
|
||||
|
||||
/**
|
||||
* Get from Cache
|
||||
* @param ctx context
|
||||
* @param M_Warehouse_ID id
|
||||
* @return warehouse
|
||||
*/
|
||||
public static MDDNetworkDistribution get (Properties ctx, int DD_NetworkDistribution_ID)
|
||||
{
|
||||
Integer key = new Integer(DD_NetworkDistribution_ID);
|
||||
MDDNetworkDistribution retValue = (MDDNetworkDistribution)s_cache.get(DD_NetworkDistribution_ID);
|
||||
if (retValue != null)
|
||||
return retValue;
|
||||
//
|
||||
retValue = new MDDNetworkDistribution (ctx,DD_NetworkDistribution_ID, null);
|
||||
retValue.getLines();
|
||||
s_cache.put (key, retValue);
|
||||
return retValue;
|
||||
} // get
|
||||
|
||||
/**
|
||||
* Get Lines
|
||||
|
|
Loading…
Reference in New Issue