Files
Dynamic-Form-Tools/DevResources/full-examples/bdgt04/exec/bdgt04-actions.jsp
skidus 431e51079c feat: comprehensive cross-file support and performance optimization (v3.3.0)
- Implemented cross-file completion, references, and validation for .frml files.
- Optimized resource discovery using IntelliJ indexing (ReferencesSearch) to fix IDE freeze.
- Refactored shared search logic into DynFormPathUtils.
- Excluded <ROW> tags from field definition requirements.
- Updated plugin version to 3.3.0.
2026-05-14 18:27:57 +07:00

101 lines
3.0 KiB
Plaintext
Executable File

<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ page import="java.lang.reflect.*" %>
<%@ page import="sdk.json.*" %>
<%@ page import="sdk.utils.*" %>
<%@ page import="sdk.api.client.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.apps.SystemFactory" %>
<%@ page import="sdk.db.connector.*" %>
<%@ page import="com.bgt.model.bean.*" %>
<%!
SDKLogger logger = new SDKLogger("Operate-actions");
public boolean flowAdd(SystemFactory factory, JSONObject jsData) {
if (!jsData.getString("-- some important field --").isBlank()) {
DBConnector dbConn = factory.appDatabase.getXConnector();
try {
{
REFER_CODE dsRefcode = new REFER_CODE(dbConn);
dsRefcode.append();
dsRefcode.setRFG_GRP("STG-ITEMS");
dsRefcode.setRFC_CODE(jsData.getString(REFER_CODE.RFC_CODE));
dsRefcode.setRFC_DESC(jsData.getString(REFER_CODE.RFC_DESC));
dsRefcode.setRFC_FLAG(jsData.getString(REFER_CODE.RFC_FLAG));
dsRefcode.execute();
}
{
REFER_GROUP dsRefGroup = new REFER_GROUP(dbConn);
dsRefGroup.insert();
dsRefGroup.setRFG_CODE(jsData.getString(REFER_CODE.RFC_CODE));
dsRefGroup.setRFG_NAME(jsData.getString(REFER_CODE.RFC_DESC));
dsRefGroup.setRFG_FLAG(jsData.getString(REFER_CODE.RFC_FLAG));
dsRefGroup.setRFG_EDITOR("STG");
dsRefGroup.execute();
}
factory.setRestCode("OK");
dbConn.close();
} catch (Exception ex) {
factory.setRestCode("ERROR");
factory.setRestMsg(ex.getMessage());
dbConn.close();
return false;
}
}
return true;
}
public boolean flowUpdate(SystemFactory factory, JSONObject jsData) {
return true;
}
public boolean flowDelete(SystemFactory factory, JSONObject jsData) {
return true;
}
public boolean _action_skeleton(SystemFactory factory, JSONObject jsData) {
if (!jsData.getString("-- some important field --").isBlank()) {
DBConnector dbConn = factory.appDatabase.getXConnector();
try {
factory.setRestCode("OK");
dbConn.close();
} catch (Exception ex) {
factory.setRestCode("ERROR");
factory.setRestMsg(ex.getMessage());
dbConn.close();
return false;
}
}
return true;
}
private boolean execute(String action, SystemFactory factory) {
try {
Class<?> thisClass = getClass();
Method mtAction = thisClass.getMethod(action, SystemFactory.class, JSONObject.class);
String data = factory.rqsCtx.getParameter("data", "{}");
JSONObject jsData = new JSONObject(data);
boolean result = (boolean) mtAction.invoke(this, factory, jsData);
return result;
} catch (Exception e) {
factory.setRestCode("ERROR");
factory.setRestMsg(e+"\n"+JUtils.stackToString(e,10));
logger.error(e);
return false;
}
}
%>
<%
SystemFactory factory = SystemFactory.getInstance(request);
String action = factory.rqsCtx.getParameter("action", "");
if (factory.isValidJaxVF()) {
action = action.replaceAll("-", "_").replaceAll(" ", "_");
this.execute(action, factory);
} else {
factory.setRestCode("ERROR");
factory.setRestMsg("TK-Controller mismatch.");
}
%>