Scripting - change underscore by dollar sign -> _ by $

This commit is contained in:
Carlos Ruiz 2008-01-26 18:13:19 +00:00
parent 609f2e8f0e
commit bc911ef263
5 changed files with 32 additions and 32 deletions

View File

@ -161,16 +161,16 @@ public final class ProcessUtil {
MRule.setContext(engine, ctx, 0); // no window
// now add the process parameters to the engine
// Parameter context are ___
engine.put("___Ctx", ctx);
engine.put("$$$Ctx", ctx);
if (trx == null)
trx = Trx.get(pi.getTitle()+"_"+pi.getAD_PInstance_ID(), true);
engine.put("___Trx", trx);
engine.put("___TrxName", trx.getTrxName());
engine.put("___Record_ID", pi.getRecord_ID());
engine.put("___AD_Client_ID", pi.getAD_Client_ID());
engine.put("___AD_User_ID", pi.getAD_User_ID());
engine.put("___AD_PInstance_ID", pi.getAD_PInstance_ID());
engine.put("___Table_ID", pi.getTable_ID());
engine.put("$$$Trx", trx);
engine.put("$$$TrxName", trx.getTrxName());
engine.put("$$$Record_ID", pi.getRecord_ID());
engine.put("$$$AD_Client_ID", pi.getAD_Client_ID());
engine.put("$$$AD_User_ID", pi.getAD_User_ID());
engine.put("$$$AD_PInstance_ID", pi.getAD_PInstance_ID());
engine.put("$$$Table_ID", pi.getTable_ID());
// Add process parameters
ProcessInfoParameter[] para = pi.getParameter();
if (para == null) {
@ -178,31 +178,31 @@ public final class ProcessUtil {
para = pi.getParameter();
}
if (para != null) {
engine.put("___Parameter", pi.getParameter());
engine.put("$$$Parameter", pi.getParameter());
for (int i = 0; i < para.length; i++)
{
String name = para[i].getParameterName();
if (para[i].getParameter_To() == null) {
Object value = para[i].getParameter();
if (name.endsWith("_ID") && (value instanceof BigDecimal))
engine.put("___" + name, ((BigDecimal)value).intValue());
engine.put("$$$" + name, ((BigDecimal)value).intValue());
else
engine.put("___" + name, value);
engine.put("$$$" + name, value);
} else {
Object value1 = para[i].getParameter();
Object value2 = para[i].getParameter_To();
if (name.endsWith("_ID") && (value1 instanceof BigDecimal))
engine.put("___" + name + "1", ((BigDecimal)value1).intValue());
engine.put("$$$" + name + "1", ((BigDecimal)value1).intValue());
else
engine.put("___" + name + "1", value1);
engine.put("$$$" + name + "1", value1);
if (name.endsWith("_ID") && (value2 instanceof BigDecimal))
engine.put("___" + name + "2", ((BigDecimal)value2).intValue());
engine.put("$$$" + name + "2", ((BigDecimal)value2).intValue());
else
engine.put("___" + name + "2", value2);
engine.put("$$$" + name + "2", value2);
}
}
}
engine.put("___ProcessInfo", pi);
engine.put("$$$ProcessInfo", pi);
msg = engine.eval(rule.getScript()).toString();
//transaction should rollback if there are error in process

View File

@ -2471,11 +2471,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
MRule.setContext(engine, m_vo.ctx, m_vo.WindowNo);
// now add the callout parameters windowNo, tab, field, value, oldValue to the engine
// Parameter context are ___
engine.put("___WindowNo", m_vo.WindowNo);
engine.put("___Tab", this);
engine.put("___Field", field);
engine.put("___Value", value);
engine.put("___OldValue", oldValue);
engine.put("$$$WindowNo", m_vo.WindowNo);
engine.put("$$$Tab", this);
engine.put("$$$Field", field);
engine.put("$$$Value", value);
engine.put("$$$OldValue", oldValue);
try
{

View File

@ -283,13 +283,13 @@ public class MRule extends X_AD_Rule
String k = m_windowNo + "|";
if (key.startsWith(k))
{
String retValue = "_" + key.substring(k.length());
retValue = Util.replace(retValue, "|", "_");
String retValue = "$" + key.substring(k.length());
retValue = Util.replace(retValue, "|", "$");
return retValue;
}
else
{
String retValue = Util.replace(key, "#", "__");
String retValue = Util.replace(key, "#", "$$");
return retValue;
}
} // convertKey

View File

@ -213,11 +213,11 @@ public class ModelValidationEngine
MRule.setContext(engine, Env.getCtx(), 0); // no window
// now add the process parameters to the engine
// Parameter context are ___
engine.put("___Ctx", Env.getCtx());
engine.put("___AD_Client_ID", AD_Client_ID);
engine.put("___AD_Org_ID", AD_Org_ID);
engine.put("___AD_Role_ID", AD_Role_ID);
engine.put("___AD_User_ID", AD_User_ID);
engine.put("$$$Ctx", Env.getCtx());
engine.put("$$$AD_Client_ID", AD_Client_ID);
engine.put("$$$AD_Org_ID", AD_Org_ID);
engine.put("$$$AD_Role_ID", AD_Role_ID);
engine.put("$$$AD_User_ID", AD_User_ID);
error = engine.eval(loginRule.getScript()).toString();
} catch (Exception e) {

View File

@ -349,13 +349,13 @@ public class Scriptlet
String k = m_windowNo + "|";
if (key.startsWith(k))
{
String retValue = "_" + key.substring(k.length());
retValue = Util.replace(retValue, "|", "_");
String retValue = "$" + key.substring(k.length());
retValue = Util.replace(retValue, "|", "$");
return retValue;
}
else
{
String retValue = Util.replace(key, "#", "__");
String retValue = Util.replace(key, "#", "$$");
return retValue;
}
} // convertKey