public static int getIntContextInformation(String OBJECT, String OPERATION, String BO_ID)
{
Vector nodesToDelete = new Vector();
try
{
int resp = BSF.getXMLDocument().createElementNS("IntContext", "", "", "http://schemas.schneiderelectric.com/1.0/canonical/technical", 0);
queryText = "SELECT BI.STATUS STATUS_INT, BI.CORDYS_USER_NAME CORDYS_USER_NAME_INT, BCBM.ID ID_BO, BCBM.STATUS STATUS_BO, BCBM.CORDYS_USER_NAME CORDYS_USER_NAME_BO, BI.ADMIN_EMAIL_ADDRESS ADMIN_EMAIL_ADDRESS_INT, BCBM.ADMIN_EMAIL_ADDRESS ADMIN_EMAIL_ADDRESS_BO, BI.DESCRIPTION, BI.SLA AS SLA_INT, BCBM.SLA AS SLA_BO FROM BFOI_INTCONTEXTS BI LEFT OUTER JOIN BFOI_CONTEXT_BO_MAPPING BCBM ON BI.OBJECT =BCBM.OBJECT AND BI.OPERATION=BCBM.OPERATION AND BCBM.BO_ID =:BO_ID WHERE BI.OBJECT =:OBJECT AND BI.OPERATION=:OPERATION ";
QueryObject query = new QueryObject(queryText);
query.addParameter("OBJECT", "BFOI_INITCONTEXTS.OBJECT", 1, OBJECT);
query.addParameter("OPERATION", "BFOI_INITCONTEXTS.OPERATION", 1, OPERATION);
query.addParameter("BO_ID", "BFOI_CONTEXT_BO_MAPPING.BO_ID", 1, BO_ID);
XqyResultSet rset = query.execute();
int data = rset.getDatasetNode();
int dataRoot = Node.createElement("IntegrationInfo", resp);
Node.appendToChildren(XPath.getFirstMatch("//BFOI_INTCONTEXTS", null, data), dataRoot);
nodesToDelete.add(Integer.valueOf(data));
queryText = "select ID, OBJECT, OPERATION, PARAM_NAME, DESCRIPTION, REQUIRED, DATA_TYPE, LENGTH, FRACT_LENGTH, FORMAT_STR, SEQUENCE_NO, KEY_PARAM from \"BFOI_INTCONTEXT_PARAMS\" where \"OBJECT\" = :OBJECT and \"OPERATION\" = :OPERATION ORDER BY SEQUENCE_NO";
query = new QueryObject(queryText);
query.addParameter("OBJECT", "BFOI_INTCONTEXT_PARAMS.OBJECT", 1, OBJECT);
query.addParameter("OPERATION", "BFOI_INTCONTEXT_PARAMS.OPERATION", 1, OPERATION);
query.setResultClass(BFOI_INTCONTEXT_PARAMS.class);
rset = query.execute();
data = rset.getDatasetNode();
int[] boElements = XPath.getMatchingNodes("//BFOI_INTCONTEXT_PARAMS", null, data);
dataRoot = Node.createElement("IntContextParams", resp);
for (int i = 0; i < boElements.length; i++) {
int node = Node.clone(boElements[i], true);
Node.appendToChildren(node, dataRoot);
}
nodesToDelete.add(Integer.valueOf(data));
queryText = "SELECT ID, BO_ID, OBJECT, OPERATION, MAIN_UI_URL, EMBEDDED_UI_URL, UI_SETTINGS, ADDL_INFO FROM BFOI_INTCONTEXT_UI_MAPPINGS WHERE OBJECT=:OBJECT AND (BO_ID=:BO_ID OR BO_ID='*')";
query = new QueryObject(queryText);
query.addParameter("OBJECT", "BFOI_INTCONTEXT_UI_MAPPINGS.OBJECT", 1, OBJECT);
query.addParameter("BO_ID", "BFOI_INTCONTEXT_UI_MAPPINGS.BO_ID", 1, BO_ID);
query.setResultClass(BFOI_INTCONTEXT_PARAMS.class);
rset = query.execute();
data = rset.getDatasetNode();
String boId = BO_ID;
String operation = OPERATION;
if (XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS", null, data) != 0)
{
dataRoot = Node.createElement("IntContextUIMapping", resp);
int node = XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS[BO_ID='" + BO_ID + "' and OPERATION='" + OPERATION + "']", null, data);
if (node != 0) {
Node.appendToChildren(node, dataRoot);
} else {
operation = "*";
node = XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS[BO_ID='" + BO_ID + "' and OPERATION='*']", null, data);
if (node != 0) {
Node.appendToChildren(node, dataRoot);
} else {
boId = "*";
operation = OPERATION;
node = XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS[BO_ID='*' and OPERATION='" + OPERATION + "']", null, data);
if (node != 0) {
Node.appendToChildren(node, dataRoot);
} else {
operation = "*";
node = XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS[BO_ID='*' and OPERATION='*']", null, data);
if (node != 0)
Node.appendToChildren(node, dataRoot);
}
}
}
}
nodesToDelete.add(Integer.valueOf(data));
queryText = "SELECT ID, BO_ID, OBJECT, OPERATION, KEYWORD1, KEYWORD2, SERVICE_NAME, SERVICE_NS, ADDL_INFO, PROCESS_NAME, COMPONENT_NAME FROM BFOI_CONTEXT_SERV_MAPPINGS WHERE OBJECT=:OBJECT AND BO_ID=:BO_ID AND OPERATION=:OPERATION";
query = new QueryObject(queryText);
query.addParameter("OBJECT", "BFOI_CONTEXT_SERV_MAPPINGS.OBJECT", 1, OBJECT);
query.addParameter("BO_ID", "BFOI_CONTEXT_SERV_MAPPINGS.BO_ID", 1, boId);
query.addParameter("OPERATION", "BFOI_UI_SERVICE_MAPPINGS.OPERATION", 1, operation);
query.setResultClass(BFOI_INTCONTEXT_PARAMS.class);
rset = query.execute();
data = rset.getDatasetNode();
boElements = XPath.getMatchingNodes("//BFOI_CONTEXT_SERV_MAPPINGS", null, data);
dataRoot = Node.createElement("IntContextServiceMappings", resp);
for (int i = 0; i < boElements.length; i++) {
int node = Node.clone(boElements[i], true);
Node.appendToChildren(node, dataRoot);
}
nodesToDelete.add(Integer.valueOf(data));
queryText = "SELECT ID, BO_ID, OBJECT, OPERATION, PARAM_NAME, PARAM_VALUE FROM BFOI_INTCONT_PROC_PARAMS WHERE OBJECT=:OBJECT AND BO_ID=:BO_ID AND OPERATION=:OPERATION";
query = new QueryObject(queryText);
query.addParameter("OBJECT", "BFOI_INTCONT_PROC_PARAMS.OBJECT", 1, OBJECT);
query.addParameter("BO_ID", "BFOI_INTCONT_PROC_PARAMS.BO_ID", 1, boId);
query.addParameter("OPERATION", "BFOI_INTCONT_PROC_PARAMS.OPERATION", 1, operation);
query.setResultClass(BFOI_INTCONT_PROC_PARAMS.class);
rset = query.execute();
data = rset.getDatasetNode();
boElements = XPath.getMatchingNodes("//BFOI_INTCONT_PROC_PARAMS", null, data);
dataRoot = Node.createElement("IntContextProcParams", resp);
for (int i = 0; i < boElements.length; i++) {
int node = Node.clone(boElements[i], true);
Node.appendToChildren(node, dataRoot);
}
nodesToDelete.add(Integer.valueOf(data));
Enumeration it;
return resp;
}
catch (Exception e)
{
String queryText;
Enumeration it;
return 0;
} finally {
Enumeration it = nodesToDelete.elements();
while (it.hasMoreElements())
Node.delete(((Integer)it.nextElement()).intValue());
}
}