Search in sources :

Example 1 with X_AD_Tab

use of org.compiere.model.X_AD_Tab in project adempiere by adempiere.

the class TabElementHandler method create.

public void create(Properties ctx, TransformerHandler document) throws SAXException {
    PackOut packOut = (PackOut) ctx.get("PackOutProcess");
    int AD_Tab_ID = Env.getContextAsInt(ctx, X_AD_Tab.COLUMNNAME_AD_Tab_ID);
    X_AD_Tab m_Tab = new X_AD_Tab(ctx, AD_Tab_ID, getTrxName(ctx));
    AttributesImpl atts = new AttributesImpl();
    createTabBinding(atts, m_Tab);
    document.startElement("", "", "tab", atts);
    //Fields tags.
    String sql = "SELECT * FROM AD_FIELD WHERE AD_TAB_ID = " + AD_Tab_ID + "ORDER BY SEQNO asc, " + X_AD_Field.COLUMNNAME_AD_Field_ID;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        pstmt = DB.prepareStatement(sql, getTrxName(ctx));
        rs = pstmt.executeQuery();
        while (rs.next()) {
            createField(ctx, document, rs.getInt("AD_Field_ID"));
        }
    } catch (Exception e) {
        log.log(Level.SEVERE, e.getLocalizedMessage(), e);
        throw new DatabaseAccessException("Failed to export window tab", e);
    } finally {
        DB.close(rs, pstmt);
        rs = null;
        pstmt = null;
    }
    document.endElement("", "", "tab");
    if (m_Tab.getAD_Process_ID() > 0) {
        packOut.createProcess(m_Tab.getAD_Process_ID(), document);
    }
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) PackOut(org.adempiere.pipo.PackOut) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement) X_AD_Tab(org.compiere.model.X_AD_Tab) POSaveFailedException(org.adempiere.pipo.exception.POSaveFailedException) DatabaseAccessException(org.adempiere.pipo.exception.DatabaseAccessException) SAXException(org.xml.sax.SAXException) DatabaseAccessException(org.adempiere.pipo.exception.DatabaseAccessException)

Aggregations

PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 PackOut (org.adempiere.pipo.PackOut)1 DatabaseAccessException (org.adempiere.pipo.exception.DatabaseAccessException)1 POSaveFailedException (org.adempiere.pipo.exception.POSaveFailedException)1 X_AD_Tab (org.compiere.model.X_AD_Tab)1 SAXException (org.xml.sax.SAXException)1 AttributesImpl (org.xml.sax.helpers.AttributesImpl)1