IDEMPIERE-5224 Locator Field type Caching Improvement (#1242)
* IDEMPIERE-5224 Locator Field type Caching Improvement - Replace M_Locator.get with MLocator ResultSet constructor - Implement lazy loading for MLocatorLookup * IDEMPIERE-5224 Locator Field type Caching Improvement - Implement lazy loading without new constructor (as suggested by Carlos)
This commit is contained in:
parent
316d488ac5
commit
f15abe6522
|
@ -73,9 +73,6 @@ public final class MLocatorLookup extends Lookup implements Serializable
|
|||
super (DisplayType.TableDir, WindowNo);
|
||||
m_ctx = ctx;
|
||||
m_validationCode = validationCode;
|
||||
//
|
||||
m_loader = new Loader();
|
||||
m_loader.start();
|
||||
} // MLocator
|
||||
|
||||
/** Context */
|
||||
|
@ -183,7 +180,7 @@ public final class MLocatorLookup extends Lookup implements Serializable
|
|||
return new KeyNamePair (loc.getM_Locator_ID(), loc.toString());
|
||||
|
||||
// Not found and waiting for loader
|
||||
if (m_loader.isAlive())
|
||||
if (m_loader != null && m_loader.isAlive())
|
||||
{
|
||||
log.fine("Waiting for Loader");
|
||||
loadComplete();
|
||||
|
@ -372,7 +369,7 @@ public final class MLocatorLookup extends Lookup implements Serializable
|
|||
int local_only_warehouse_id = getOnly_Warehouse_ID(); // [ 1674891 ] MLocatorLookup - weird error
|
||||
int local_only_product_id = getOnly_Product_ID();
|
||||
|
||||
StringBuilder sql = new StringBuilder("SELECT M_Locator.M_Locator_ID FROM M_Locator ")
|
||||
StringBuilder sql = new StringBuilder("SELECT M_Locator.* FROM M_Locator ")
|
||||
.append(" INNER JOIN M_Warehouse wh ON (wh.M_Warehouse_ID=M_Locator.M_Warehouse_ID) ")
|
||||
.append(" WHERE M_Locator.IsActive='Y' ")
|
||||
.append(" AND wh.IsActive='Y'");
|
||||
|
@ -431,8 +428,8 @@ public final class MLocatorLookup extends Lookup implements Serializable
|
|||
//
|
||||
while (rs.next())
|
||||
{
|
||||
int M_Locator_ID = rs.getInt(1);
|
||||
MLocator loc = MLocator.get(m_ctx, M_Locator_ID);
|
||||
MLocator loc = new MLocator(Env.getCtx(), rs, null);
|
||||
int M_Locator_ID = loc.getM_Locator_ID();
|
||||
m_lookup.put(Integer.valueOf(M_Locator_ID), loc);
|
||||
}
|
||||
}
|
||||
|
@ -457,9 +454,13 @@ public final class MLocatorLookup extends Lookup implements Serializable
|
|||
*/
|
||||
public Collection<MLocator> getData ()
|
||||
{
|
||||
if (m_loader.isAlive())
|
||||
if (m_loader == null)
|
||||
{
|
||||
log.fine("Waiting for Loader");
|
||||
refresh();
|
||||
}
|
||||
else if (m_loader.isAlive())
|
||||
{
|
||||
if (log.isLoggable(Level.FINE)) log.fine("Waiting for Loader");
|
||||
try
|
||||
{
|
||||
m_loader.join();
|
||||
|
@ -503,7 +504,7 @@ public final class MLocatorLookup extends Lookup implements Serializable
|
|||
*/
|
||||
public int refresh()
|
||||
{
|
||||
log.fine("start");
|
||||
if (log.isLoggable(Level.FINE)) log.fine("start");
|
||||
m_loader = new Loader();
|
||||
m_loader.start();
|
||||
try
|
||||
|
|
|
@ -138,7 +138,7 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
|
|||
sameWarehouseCb.setSelected(true);
|
||||
sameWarehouseCb.addActionListener(this);
|
||||
// load Locator
|
||||
MLocatorLookup locator = new MLocatorLookup(Env.getCtx(), p_WindowNo);
|
||||
MLocatorLookup locator = new MLocatorLookup(Env.getCtx(), p_WindowNo, (String)null);
|
||||
locatorField = new WLocatorEditor ("M_Locator_ID", true, false, true, locator, p_WindowNo);
|
||||
|
||||
initBPartner(false);
|
||||
|
|
|
@ -231,7 +231,7 @@ public class WTrxMaterial extends TrxMaterial
|
|||
orgField = new WTableDirEditor("AD_Org_ID", false, false, true, orgLookup);
|
||||
// orgField.addVetoableChangeListener(this);
|
||||
// Locator
|
||||
MLocatorLookup locatorLookup = new MLocatorLookup(ctx, m_WindowNo);
|
||||
MLocatorLookup locatorLookup = new MLocatorLookup(ctx, m_WindowNo, null);
|
||||
locatorField = new WLocatorEditor ("M_Locator_ID", false, false, true, locatorLookup, m_WindowNo);
|
||||
// locatorField.addVetoableChangeListener(this);
|
||||
// Product
|
||||
|
|
Loading…
Reference in New Issue