use of org.compiere.model.X_CM_TemplateTable in project adempiere by adempiere.
the class Generator method generateExternalTables.
private void generateExternalTables(Properties ctx, HttpServletRequest httpRequest) {
HttpSession thisSession = httpRequest.getSession(false);
WebInfo wi = null;
if (thisSession != null)
if (thisSession.getAttribute(WebInfo.NAME) != null)
wi = (WebInfo) thisSession.getAttribute(WebInfo.NAME);
int[] tableKeys = X_CM_TemplateTable.getAllIDs("CM_TemplateTable", "CM_Template_ID=" + thisRequest.getCM_Container().getCM_Template_ID(), "WebCM");
if (tableKeys.length > 0) {
xmlCode.append("<externalTables>\n");
for (int i = 0; i < tableKeys.length; i++) {
X_CM_TemplateTable thisTemplateTable = new X_CM_TemplateTable(ctx, tableKeys[i], "WebCM");
try {
StringBuffer tempXML = new StringBuffer();
tempXML.append("<" + thisTemplateTable.getName() + ">\n");
MTable table = MTable.get(ctx, thisTemplateTable.getAD_Table_ID());
String trxName = null;
int[] ids = PO.getAllIDs(table.getTableName(), replaceSessionElements(wi, thisTemplateTable.getWhereClause()), trxName);
if (ids != null && ids.length > 0) {
for (int j = 0; j < ids.length; j++) {
PO po = null;
po = table.getPO(ids[j], null);
if (po != null) {
tempXML = po.get_xmlString(tempXML);
}
}
}
tempXML.append("\n</" + thisTemplateTable.getName() + ">\n");
xmlCode.append(tempXML);
} catch (Exception e) {
e.printStackTrace();
}
}
xmlCode.append("\n</externalTables>\n");
}
}
Aggregations