}
int iDominId = 0;
int iRetVal;
Interpreter oInterpreter = new Interpreter();
oInterpreter.set ("DomainNm", sDomainNm);
oInterpreter.set ("DefaultConnection", oConn);
oInterpreter.set ("AlternativeConnection", oConn);
if (DebugFile.trace) DebugFile.writeln("Interpreter.eval(getResourceAsString(scripts/domain_create.js,"+sEncoding);
oInterpreter.eval(getResourceAsString("scripts/domain_create.js", sEncoding));
Object obj = oInterpreter.get("ErrorCode");
Integer oCodError = (Integer) oInterpreter.get("ErrorCode");
if (oCodError.intValue()!=0) {
sErrMsg = (String) oInterpreter.get("ErrorMessage");
iErrors++;
if (null!=oStrLog) oStrLog.append("EvalError: " + sErrMsg + "\n");
if (DebugFile.trace) {
DebugFile.writeln("SQLException "+sErrMsg);
DebugFile.decIdent();
}
throw new SQLException(sErrMsg);
} // fi ()
obj = oInterpreter.get("ReturnValue");
if ( null != obj ) {
iDominId = ( (Integer) obj).intValue();
Statement oStmt = oConn.createStatement();
if (DebugFile.trace) DebugFile.writeln("Statement.executeUpdate(UPDATE k_workareas SET nm_workarea='" + sDomainNm.toLowerCase() + "_default' WHERE id_domain=" + String.valueOf(iDominId) + " AND nm_workarea='model_default')");
oStmt.executeUpdate("UPDATE k_workareas SET nm_workarea='" + sDomainNm.toLowerCase() + "_default' WHERE id_domain=" + String.valueOf(iDominId) + " AND nm_workarea='model_default'");
oStmt.close();
if (null!=oStrLog) oStrLog.append("New Domain " + oInterpreter.get("ReturnValue") + " created successfully\n");
iRetVal = iDominId;
}
else {
if (null!=oStrLog) oStrLog.append( oInterpreter.get("ErrorMessage") + ": Domain not created.");
iRetVal = 0;
}
if (DebugFile.trace) {
DebugFile.decIdent();