Implementing cache for Network Distribution

This commit is contained in:
vpj-cd 2008-09-10 19:50:58 +00:00
parent c794877516
commit 4027198f74
1 changed files with 22 additions and 0 deletions

View File

@ -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