IDEMPIERE-1172 Setup Wizard uses randomly languages / found the issue is because of adding object to cache on constructor (found and cleared same issue on MRfQLine and MRfQLineQty)

This commit is contained in:
Carlos Ruiz 2013-07-15 21:08:05 -05:00
parent 6ade4c42ca
commit 2ab9b1554a
4 changed files with 40 additions and 67 deletions

View File

@ -85,8 +85,6 @@ public class MRfQLine extends X_C_RfQLine
public MRfQLine (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
if (get_ID() > 0)
s_cache.put(new Integer(get_ID()), this);
} // MRfQLine
/**

View File

@ -89,8 +89,6 @@ public class MRfQLineQty extends X_C_RfQLineQty
public MRfQLineQty (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
if (get_ID() > 0)
s_cache.put (new Integer (get_ID()), this);
} // MRfQLineQty
/**

View File

@ -27,6 +27,7 @@ import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.DBException;
import org.compiere.model.MColumn;
import org.compiere.model.Query;
@ -104,9 +105,10 @@ public class MWFNode extends X_AD_WF_Node
setXPosition (0);
setYPosition (0);
}
// Save to Cache
if (get_ID() != 0)
s_cache.put (new Integer(getAD_WF_Node_ID()), this);
if (getAD_WF_Node_ID() > 0) {
loadNext();
loadTrl();
}
} // MWFNode
/**
@ -137,7 +139,14 @@ public class MWFNode extends X_AD_WF_Node
loadNext();
loadTrl();
// Save to Cache
s_cache.put (get_ID(), this);
Integer key = null;
try {
key = new Integer (rs.getInt("AD_WF_Node_ID"));
} catch (SQLException e) {
throw new AdempiereException(e);
}
if (key != null && trxName == null && !s_cache.containsKey(key))
s_cache.put (key, this);
} // MWFNode

View File

@ -216,7 +216,7 @@ public class HelpController
}
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Process))
{
MProcess process = new MProcess(Env.getCtx(), recordId, null);
MProcess process = MProcess.get(Env.getCtx(), recordId);
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Process")) {
nameMsg = process.get_Translation("Name");
@ -323,41 +323,24 @@ public class HelpController
}
}
else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Workflow)) {
MWorkflow workflow = new MWorkflow(Env.getCtx(), recordId, null);
MWorkflow workflow = MWorkflow.get(Env.getCtx(), recordId);
if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) {
boolean trl = !Env.getLoginLanguage(Env.getCtx()).isBaseLanguage();
nameMsg = workflow.get_Translation("Name");
nameMsg = workflow.getName(trl);
if (workflow != null && nameMsg != null
&& nameMsg.length() != 0) {
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
if (workflow != null && nameMsg != null
&& nameMsg.length() != 0) {
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
descMsg = workflow.get_Translation("Description");
if (descMsg != null && descMsg.length() != 0)
sb.append("<br><br>\n<i>" + descMsg + "</i>");
descMsg = workflow.getDescription(trl);
if (descMsg != null && descMsg.length() != 0)
sb.append("<br><br>\n<i>" + descMsg + "</i>");
helpMsg = workflow.get_Translation("Help");
if (helpMsg != null && helpMsg.length() != 0)
sb.append("<br><br>\n" + helpMsg);
}
} else {
if (workflow != null && workflow.getName() != null
&& workflow.getName().length() != 0) {
sb.append("<br><br>\n<b>" + workflow.getName() + "</b>");
if (workflow.getDescription() != null
&& workflow.getDescription().length() != 0)
sb.append("<br><br>\n<i>"
+ workflow.getDescription() + "</i>");
if (workflow.getHelp() != null
&& workflow.getHelp().length() != 0)
sb.append("<br><br>\n" + workflow.getHelp());
}
}
helpMsg = workflow.getHelp(trl);
if (helpMsg != null && helpMsg.length() != 0)
sb.append("<br><br>\n" + helpMsg);
}
} else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Task)) {
MTask task = new MTask(Env.getCtx(), recordId, null);
@ -395,40 +378,25 @@ public class HelpController
}
}
} else if (ctxType.equals(X_AD_CtxHelp.CTXTYPE_Node)) {
MWFNode node = new MWFNode(Env.getCtx(), recordId, null);
MWFNode node = MWFNode.get(Env.getCtx(), recordId);
if (!Env.getLoginLanguage(Env.getCtx()).isBaseLanguage()) {
nameMsg = node.get_Translation("Name");
boolean trl = !Env.getLoginLanguage(Env.getCtx()).isBaseLanguage();
if (node != null && nameMsg != null
&& nameMsg.length() != 0) {
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
nameMsg = node.getName(trl);
descMsg = node.get_Translation("Description");
if (descMsg != null && descMsg.length() != 0)
sb.append("<br><br>\n<i>" + descMsg + "</i>");
if (node != null && nameMsg != null
&& nameMsg.length() != 0) {
sb.append("<br><br>\n<b>" + nameMsg + "</b>");
helpMsg = node.get_Translation("Help");
if (helpMsg != null && helpMsg.length() != 0)
sb.append("<br><br>\n" + helpMsg);
}
descMsg = node.getDescription(trl);
if (descMsg != null && descMsg.length() != 0)
sb.append("<br><br>\n<i>" + descMsg + "</i>");
} else {
if (node != null && node.getName() != null
&& node.getName().length() != 0) {
sb.append("<br><br>\n<b>" + node.getName() + "</b>");
if (node.getDescription() != null
&& node.getDescription().length() != 0)
sb.append("<br><br>\n<i>" + node.getDescription()
+ "</i>");
if (node.getHelp() != null
&& node.getHelp().length() != 0)
sb.append("<br><br>\n" + node.getHelp());
}
helpMsg = node.getHelp(trl);
if (helpMsg != null && helpMsg.length() != 0)
sb.append("<br><br>\n" + helpMsg);
}
}
}