Search in sources :

Example 41 with AttributesImpl

use of org.xml.sax.helpers.AttributesImpl 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;
    }
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) X_AD_Menu(org.compiere.model.X_AD_Menu) PackOut(org.adempiere.pipo.PackOut) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement) SAXException(org.xml.sax.SAXException)

Example 42 with AttributesImpl

use of org.xml.sax.helpers.AttributesImpl in project adempiere by adempiere.

the class EntityTypeElementHandler method create.

public void create(Properties ctx, TransformerHandler document) throws SAXException {
    // TODO
    final int AD_EntityType_ID = Env.getContextAsInt(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_AD_EntityType_ID);
    if (entityTypes.contains(AD_EntityType_ID))
        return;
    entityTypes.add(AD_EntityType_ID);
    final MEntityType entity = new MEntityType(ctx, AD_EntityType_ID, null);
    AttributesImpl atts = new AttributesImpl();
    createMessageBinding(atts, entity);
    document.startElement("", "", TAG_Name, atts);
    document.endElement("", "", TAG_Name);
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) MEntityType(org.compiere.model.MEntityType)

Example 43 with AttributesImpl

use of org.xml.sax.helpers.AttributesImpl 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");
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) X_AD_FieldGroup(org.compiere.model.X_AD_FieldGroup) PackOut(org.adempiere.pipo.PackOut)

Example 44 with AttributesImpl

use of org.xml.sax.helpers.AttributesImpl in project adempiere by adempiere.

the class ReferenceTableElementHandler method create.

public void create(Properties ctx, TransformerHandler document) throws SAXException {
    int Reference_id = Env.getContextAsInt(ctx, X_AD_Ref_Table.COLUMNNAME_AD_Reference_ID);
    AttributesImpl atts = new AttributesImpl();
    createReferenceTableBinding(ctx, atts, Reference_id);
    document.startElement("", "", "referencetable", atts);
    document.endElement("", "", "referencetable");
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl)

Example 45 with AttributesImpl

use of org.xml.sax.helpers.AttributesImpl in project adempiere by adempiere.

the class ReportViewColElementHandler method create.

public void create(Properties ctx, TransformerHandler document) throws SAXException {
    int AD_ReportView_Col_ID = Env.getContextAsInt(ctx, X_AD_ReportView_Col.COLUMNNAME_AD_ReportView_Col_ID);
    X_AD_ReportView_Col m_Reportview_Col = new X_AD_ReportView_Col(ctx, AD_ReportView_Col_ID, getTrxName(ctx));
    AttributesImpl atts = new AttributesImpl();
    createReportViewColBinding(atts, m_Reportview_Col);
    document.startElement("", "", "reportviewcol", atts);
    document.endElement("", "", "reportviewcol");
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) X_AD_ReportView_Col(org.compiere.model.X_AD_ReportView_Col)

Aggregations

AttributesImpl (org.xml.sax.helpers.AttributesImpl)310 SAXException (org.xml.sax.SAXException)53 Test (org.junit.Test)34 DiskWriteAttributesImpl (org.apache.geode.internal.cache.DiskWriteAttributesImpl)23 PartitionAttributesImpl (org.apache.geode.internal.cache.PartitionAttributesImpl)23 ContentHandler (org.xml.sax.ContentHandler)21 Attributes (org.xml.sax.Attributes)17 PreparedStatement (java.sql.PreparedStatement)16 ResultSet (java.sql.ResultSet)16 Map (java.util.Map)16 PackOut (org.adempiere.pipo.PackOut)16 IOException (java.io.IOException)15 POSaveFailedException (org.adempiere.pipo.exception.POSaveFailedException)12 Iterator (java.util.Iterator)11 TransformerHandler (javax.xml.transform.sax.TransformerHandler)11 StreamResult (javax.xml.transform.stream.StreamResult)11 Metadata (org.apache.tika.metadata.Metadata)11 File (java.io.File)9 SAXTransformerFactory (javax.xml.transform.sax.SAXTransformerFactory)9 DatabaseAccessException (org.adempiere.pipo.exception.DatabaseAccessException)9