use of org.adempiere.pipo.PackOut in project adempiere by adempiere.
the class WindowElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
int AD_Window_ID = Env.getContextAsInt(ctx, "AD_Window_ID");
PackOut packOut = (PackOut) ctx.get("PackOutProcess");
X_AD_Window m_Window = new X_AD_Window(ctx, AD_Window_ID, null);
AttributesImpl atts = new AttributesImpl();
createWindowBinding(atts, m_Window);
document.startElement("", "", "window", atts);
// Tab Tag
String sql = "SELECT * FROM AD_TAB WHERE AD_WINDOW_ID = " + AD_Window_ID + " ORDER BY " + X_AD_Tab.COLUMNNAME_SeqNo + "," + X_AD_Tab.COLUMNNAME_AD_Tab_ID;
PreparedStatement pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
packOut.createTable(rs.getInt("AD_Table_ID"), document);
createTab(ctx, document, rs.getInt("AD_Tab_ID"));
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
if (e instanceof SAXException)
throw (SAXException) e;
else if (e instanceof SQLException)
throw new DatabaseAccessException("Failed to export window.", e);
else if (e instanceof RuntimeException)
throw (RuntimeException) e;
else
throw new RuntimeException("Failed to export window.", e);
} finally {
try {
if (pstmt != null)
pstmt.close();
} catch (Exception e) {
}
pstmt = null;
}
//TODO: export of ad_image and ad_color use
// Loop tags.
document.endElement("", "", "window");
// Preference Tag
sql = "SELECT * FROM AD_PREFERENCE WHERE AD_WINDOW_ID = " + AD_Window_ID + " ORDER BY " + X_AD_Preference.COLUMNNAME_AD_Preference_ID;
pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
createPreference(ctx, document, rs.getInt("AD_Preference_ID"));
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
if (e instanceof SAXException)
throw (SAXException) e;
else if (e instanceof SQLException)
throw new DatabaseAccessException("Failed to export window preference.", e);
else if (e instanceof RuntimeException)
throw (RuntimeException) e;
else
throw new RuntimeException("Failed to export window preference.", e);
} finally {
try {
if (pstmt != null)
pstmt.close();
} catch (Exception e) {
}
pstmt = null;
}
}
use of org.adempiere.pipo.PackOut in project adempiere by adempiere.
the class ViewDefinitionElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
PackOut packOut = (PackOut) ctx.get("PackOutProcess");
int AD_View_Definition_ID = Env.getContextAsInt(ctx, X_AD_View_Definition.COLUMNNAME_AD_View_Definition_ID);
MViewDefinition m_View_Definition = new MViewDefinition(ctx, AD_View_Definition_ID, getTrxName(ctx));
AttributesImpl atts = new AttributesImpl();
createViewDefinitionBinding(atts, m_View_Definition);
document.startElement("", "", "viewdefinition", atts);
// View Columns tags.
StringBuilder whereClause = new StringBuilder(I_AD_View_Definition.COLUMNNAME_AD_View_Definition_ID).append("=?");
List<MViewColumn> viewColumns = new Query(ctx, I_AD_View_Column.Table_Name, whereClause.toString(), getTrxName(ctx)).setParameters(m_View_Definition.get_ID()).list();
for (MViewColumn vc : viewColumns) {
createViewColumn(ctx, document, vc.getAD_View_Column_ID());
}
document.endElement("", "", "viewdefinition");
}
use of org.adempiere.pipo.PackOut in project adempiere by adempiere.
the class BrowseFieldElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
int AD_Browse_Field_ID = Env.getContextAsInt(ctx, X_AD_Browse_Field.COLUMNNAME_AD_Browse_Field_ID);
MBrowseField m_BrowseField = new MBrowseField(ctx, AD_Browse_Field_ID, null);
AttributesImpl atts = new AttributesImpl();
createBrowseFieldBinding(atts, m_BrowseField);
PackOut packOut = (PackOut) ctx.get("PackOutProcess");
if (m_BrowseField.getAD_Reference_ID() > 0) {
packOut.createReference(m_BrowseField.getAD_Reference_ID(), document);
}
if (m_BrowseField.getAD_Reference_Value_ID() > 0) {
packOut.createReference(m_BrowseField.getAD_Reference_Value_ID(), document);
}
if (m_BrowseField.getAD_Val_Rule_ID() > 0) {
packOut.createDynamicRuleValidation(m_BrowseField.getAD_Val_Rule_ID(), document);
}
document.startElement("", "", "browsefield", atts);
document.endElement("", "", "browsefield");
}
use of org.adempiere.pipo.PackOut in project adempiere by adempiere.
the class MenuElementHandler method createModule.
public void createModule(Properties ctx, TransformerHandler document, int menu_id) throws SAXException {
PackOut packOut = (PackOut) ctx.get("PackOutProcess");
String sql = null;
sql = "SELECT A.Node_ID, B.AD_Menu_ID, B.Name, B.AD_WINDOW_ID, B.AD_WORKFLOW_ID, B.AD_TASK_ID, " + "B.AD_PROCESS_ID, B.AD_FORM_ID, B.AD_BROWSE_ID, B.AD_WORKBENCH_ID " + "FROM AD_TreeNoDemm A, AD_Menu B " + "WHERE A.Parent_ID = " + menu_id + " AND A.Node_ID = B.AD_Menu_ID";
AttributesImpl atts = new AttributesImpl();
PreparedStatement pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
// Menu tag Start.
X_AD_Menu m_Menu = new X_AD_Menu(ctx, rs.getInt("AD_Menu_ID"), null);
atts = createMenuBinding(atts, m_Menu);
document.startElement("", "", "menu", atts);
if (rs.getInt("AD_WINDOW_ID") > 0 || rs.getInt("AD_WORKFLOW_ID") > 0 || rs.getInt("AD_TASK_ID") > 0 || rs.getInt("AD_PROCESS_ID") > 0 || rs.getInt("AD_FORM_ID") > 0 || rs.getInt("AD_BROWSE_ID") > 0 || rs.getInt("AD_WORKBENCH_ID") > 0) {
// Call CreateWindow.
if (rs.getInt("AD_WINDOW_ID") > 0) {
packOut.createWindow(rs.getInt("AD_WINDOW_ID"), document);
} else // Call CreateProcess.
if (rs.getInt("AD_PROCESS_ID") > 0) {
packOut.createProcess(rs.getInt("AD_PROCESS_ID"), document);
} else // Call CreateTask.
if (rs.getInt("AD_TASK_ID") > 0) {
packOut.createTask(rs.getInt("AD_TASK_ID"), document);
} else // Call CreateForm.
if (rs.getInt("AD_FORM_ID") > 0) {
packOut.createForm(rs.getInt("AD_FORM_ID"), document);
} else // Call Browse.
if (rs.getInt("AD_Browse_ID") > 0) {
packOut.createBrowse(rs.getInt("AD_Browse_ID"), document);
} else // Call CreateWorkflow
if (rs.getInt("AD_Workflow_ID") > 0) {
packOut.createWorkflow(rs.getInt("AD_Workflow_ID"), document);
}
// Call CreateModule because entry is a summary menu
} else {
createModule(ctx, document, rs.getInt("Node_ID"));
}
document.endElement("", "", "menu");
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, "getWindows", e);
} finally {
try {
if (pstmt != null)
pstmt.close();
} catch (Exception e) {
}
pstmt = null;
}
}
use of org.adempiere.pipo.PackOut in project adempiere by adempiere.
the class FieldGroupElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
int fieldGroup_id = Env.getContextAsInt(ctx, X_AD_FieldGroup.COLUMNNAME_AD_FieldGroup_ID);
if (processedFieldGroups.contains(fieldGroup_id))
return;
processedFieldGroups.add(fieldGroup_id);
X_AD_FieldGroup fieldGroup = new X_AD_FieldGroup(ctx, fieldGroup_id, null);
AttributesImpl atts = new AttributesImpl();
createFieldGroupBinding(atts, fieldGroup);
document.startElement("", "", "fieldgroup", atts);
PackOut packOut = (PackOut) ctx.get("PackOutProcess");
packOut.createTranslations(X_AD_FieldGroup.Table_Name, fieldGroup.get_ID(), document);
document.endElement("", "", "fieldgroup");
}
Aggregations