Menu

#2479 Script field in AD_Rule should be CLOB

open
nobody
Database (55)
5
2010-07-28
2010-07-28
Hans Baier
No

larger scripts (few hundred lines) are only possible via an ugly "trampoline script" like this:

import javax.script.ScriptContext
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

// This script is a workaround for the limited size of the Script Table field in
// Adempiere

def basedir = "/path/to/the/dir//";

def text = new File("${basedir}/ImportScripts/ImportCOA.groovy").getText();

ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("groovy");

engine.put("A_ProcessInfo", A_ProcessInfo);
engine.put("A_Ctx", A_Ctx);
engine.put("A_TrxName", A_TrxName);
engine.put("A_Trx", A_Trx);
engine.put("P_AD_Org_ID", P_AD_Org_ID);
engine.put("P_C_Currency_ID", P_C_Currency_ID );
engine.put("P_CoAFile", P_CoAFile);
engine.put("A_AD_Client_ID", A_AD_Client_ID);

engine.eval(text);

Discussion


Log in to post a comment.