PortaleOrdiniGruppo/PostIn/postin_operationR.java
2025-03-24 15:28:26 +01:00

293 lines
10 KiB
Java

// * --- Area Manuale = BO - Header
// * --- Fine Area Manuale
public class postin_operationR implements CallerWithObjs {
// gestori associati a particolari eventi ('Routine start')
public static volatile java.util.Map<String,java.util.List<com.zucchetti.sitepainter.EventHandler>> specificEventsHandlers;
// gestori associati a tutti gli eventi
public static volatile java.util.List<com.zucchetti.sitepainter.EventHandler> allEventsHandlers;
// indica se si sta gestendo un evento scatenato da questa routine per restituire il valore corretto di i_EntityName ed i_EntityType
static boolean m_bEventRunning;
public String m_cLastMsgError;
public boolean m_bError;
// Variabile di collegamento con il database: passata nel costruttore
public CPSql m_Sql;
// Variabile di contesto (variabili globali): passata nel costruttore
public CPContext m_Ctx;
// Variabile di caller (variabili di caller): passata nel costruttore
public CallerWithObjs m_Caller;
public String k;
public String op;
public String testo_postit;
public org.json.JSONArray ja;
// * --- Area Manuale = BO - Properties
// * --- Fine Area Manuale
public postin_operationR (CPContext p_ContextObject, Caller caller) {
if (caller == null)
m_Caller = CallerWithObjsImpl.EMPTY;
else if (caller instanceof CallerWithObjs)
m_Caller = (CallerWithObjs)caller;
else
m_Caller = new CallerWithObjsImpl(caller);
m_Ctx=p_ContextObject;
// Assegnazione della variabile di collegamento con il database
m_Sql=m_Ctx.GetSql();
/* Impostazione dell'ambiente globale: il businness object si collega
all'oggetto globale (unico per più istanze di una stessa applicazione)
per recuperare informazioni sul:
1) nome fisico della tabella di gestione;
2) nome fisico delle tabelle collegate nei link;
3) stringa di connessione.
L'azienda è contenuta nel global object.
*/
p_ContextObject = p_ContextObject.DisabledDataFilteringVersion();
CPSecurity.RoutineCallableByProgram("postin_operation",m_Caller);
Blank();
}
public double GetNumber(String p_cVarName,String p_cType,int len,int dec) {
return 0;
}
public String GetString(String p_cVarName,String p_cType,int len,int dec) {
if (CPLib.eqr("m_cVQRList",p_cVarName)) {
return m_cVQRList;
} else if (CPLib.eqr("i_InvokedRoutines",p_cVarName)) {
return i_InvokedRoutines;
} else if (m_bEventRunning && CPLib.eqr("i_EntityName",p_cVarName)) {
return "postin_operation";
} else if (m_bEventRunning && CPLib.eqr("i_EntityType",p_cVarName)) {
return "function";
}
if (CPLib.eqr("k",p_cVarName)) {
return k;
}
if (CPLib.eqr("op",p_cVarName)) {
return op;
}
if (CPLib.eqr("testo_postit",p_cVarName)) {
return testo_postit;
}
return "";
}
public java.sql.Date GetDate(String p_cVarName,String p_cType,int len,int dec) {
return CPLib.NullDate();
}
public java.sql.Timestamp GetDateTime(String p_cVarName,String p_cType,int len,int dec) {
return CPLib.NullDateTime();
}
public boolean GetLogic(String p_cVarName,String p_cType,int len,int dec) {
return false;
}
public CPMemoryCursor GetMemoryCursor(String p_cVarName,String p_cType,int len,int dec) {
return null;
}
public CPMemoryCursorRow GetMemoryCursorRow(String p_cVarName,String p_cType,int len,int dec) {
return null;
}
public com.zucchetti.sitepainter.datatypes.CPJSONStruct GetJSON(String p_cVarName,String p_cType,int len,int dec) {
return com.zucchetti.sitepainter.datatypes.CPJSONStruct.EmptyStruct();
}
public void SetNumber(String p_cVarName,String p_cType,int len,int dec,double value) {
}
public void SetString(String p_cVarName,String p_cType,int len,int dec,String value) {
if (CPLib.eqr("k",p_cVarName)) {
k = value;
return;
}
if (CPLib.eqr("op",p_cVarName)) {
op = value;
return;
}
if (CPLib.eqr("testo_postit",p_cVarName)) {
testo_postit = value;
return;
}
}
public void SetDate(String p_cVarName,String p_cType,int len,int dec,java.sql.Date value) {
}
public void SetDateTime(String p_cVarName,String p_cType,int len,int dec,java.sql.Timestamp value) {
}
public void SetLogic(String p_cVarName,String p_cType,int len,int dec,boolean value) {
}
public void SetMemoryCursorRow(String p_cVarName,String p_cType,int len,int dec,CPMemoryCursorRow value) {
}
public void SetMemoryCursor(String p_cVarName,String p_cType,int len,int dec,CPMemoryCursor value) {
}
public void SetJSON(String p_cVarName,String p_cType,int len,int dec,com.zucchetti.sitepainter.datatypes.CPJSONStruct value) {
}
public void CalledBatchEnd() {
}
void Page_1() throws Exception {
/* o Object(postin_userBO) */
postin_userBO o;
o = null;
/* k Char(50) */
/* op Char(2) */
/* testo_postit Memo */
/* color Char(10) */
String color;
color = CPLib.Space(10);
/* o := new postin_userBO() */
o = new postin_userBO(m_Ctx);
/* Case op="D" */
if (CPLib.eqr(op,"D")) {
/* If o.Delete(k) */
if (o.Delete(k)) {
/* Return 'OK' */
throw new Stop("OK");
} else { // Else
/* Return '' */
throw new Stop("");
} // End If
/* Case op="N" */
} else if (CPLib.eqr(op,"N")) {
/* If m_Ctx.GetAuthority().HasWarns(k) */
if (m_Ctx.GetAuthority().HasWarns(k)) {
/* o.Initialize() */
o.Initialize();
/* color := o.w_color */
color = o.w_color;
/* o.w_code := k */
o.w_code = k;
postin_addwarnR.Make(m_Ctx,o).Run();
/* o.Load(o.w_code) */
o.Load(o.w_code);
/* o.w_color := color */
o.w_color = color;
/* o.Set_textualpostit(testo_postit) */
o.Set_textualpostit(testo_postit);
/* If o.Save() */
if (o.Save()) {
/* Return o.w_code */
throw new Stop(o.w_code);
} else { // Else
/* Return '' */
throw new Stop("");
} // End If
} else { // Else
/* Return '' */
throw new Stop("");
} // End If
/* Case op="Q" */
} else if (CPLib.eqr(op,"Q")) {
/* If o.Load(k) */
if (o.Load(k)) {
/* Return o.w_textualpostit */
throw new Stop(o.w_textualpostit);
} else { // Else
/* Return '' */
throw new Stop("");
} // End If
/* Case op="U" */
} else if (CPLib.eqr(op,"U")) {
/* o.Load(k) */
o.Load(k);
/* o.Set_textualpostit(testo_postit) */
o.Set_textualpostit(testo_postit);
/* If o.Save() */
if (o.Save()) {
/* Return "OK" */
throw new Stop("OK");
} else { // Else
/* Return '' */
throw new Stop("");
} // End If
/* Case op="GW" */
} else if (CPLib.eqr(op,"GW")) {
/* ja Object(org.json.JSONArray) */
/* ja := new org.json.JSONArray(m_Ctx.GetAuthority().GetWarns(k)) */
ja = new org.json.JSONArray(m_Ctx.GetAuthority().GetWarns(k));
/* Return ja.toString() */
throw new Stop(ja.toString());
} // End Case
}
void _init_() {
}
public String RunAsync(String p_k,String p_op,String p_testo_postit) {
k = p_k;
op = p_op;
testo_postit = p_testo_postit;
return CPAsyncRoutine.CreateAsyncAndStart(
new CPAsyncRoutine.AsyncRunnable() {
public void Compute(CPAsyncRoutine.AsyncResult p_oResult) {
try {
p_oResult.m_oResult=new Stop(Run());
} finally {
//evito di tenere nell'heap della virtual machine riferimenti non piu' usati
m_Caller = null;
m_Sql = null;
m_Ctx = null;
}
}
}
);
}
public String Run(String p_k,String p_op,String p_testo_postit) {
k = p_k;
op = p_op;
testo_postit = p_testo_postit;
return Run();
}
public String Run() {
String l_result;
l_result = "";
m_Ctx = m_Ctx.DisabledDataFilteringVersion();
try {
try {
try {
try {
m_bEventRunning = true;
com.zucchetti.sitepainter.EventHandler.notifyEvent("Run start",this,m_Ctx,specificEventsHandlers,allEventsHandlers);
} finally {
m_bEventRunning = false;
}
Page_1();
} finally {
try {
m_bEventRunning = true;
com.zucchetti.sitepainter.EventHandler.notifyEvent(com.zucchetti.sitepainter.EventHandler.RUN_END,this,m_Ctx,specificEventsHandlers,allEventsHandlers);
} finally {
m_bEventRunning = false;
}
}
} catch(Stop stop_value) {
l_result = stop_value.GetString();
} catch(RoutineException l_transactionRaise) {
//non va segnalato come errore
} catch(Exception fault) {
l_result = "";
CPStdCounter.Error(fault);
CallerExImpl l_oTraceSink;
l_oTraceSink = new CallerExImpl(m_Caller,"");
if (l_oTraceSink.HasWorkingVar("m_cFaultTrace")) {
if ( ! (CPLib.IsAdministrator(m_Ctx)) && m_Ctx.HasAdministeredUsers()) {
l_oTraceSink.SetString("m_cFaultTrace","C",0,0,"MSG_ADMIN_REQUIRED");
} else {
l_oTraceSink.SetString("m_cFaultTrace","C",0,0,CPLib.DumpException(fault));
}
}
}
} finally {
m_Ctx.EnableDataFiltering();
}
return l_result;
}
public static postin_operationR Make(CPContext p_Ctx, Caller p_Caller) {
return new postin_operationR(p_Ctx, p_Caller);
}
public static postin_operationR Make(CPContext p_Ctx) {
return new postin_operationR(p_Ctx, CPSecurity.EXECUTE_ALL_ROUTINES);
}
public void Blank() {
k = CPLib.Space(50);
op = CPLib.Space(2);
testo_postit = "";
ja = null;
}
// * --- Area Manuale = BO - Methods
// * --- Fine Area Manuale
// ENTITY_VQR:
public static final String m_cVQRList = "";
// ENTITY_BATCHES: ,postin_operation,
public static final String i_InvokedRoutines = ",postin_operation,";
public static String[] m_cRunParameterNames={"k","op","testo_postit"};
}