use of org.xml.sax.helpers.AttributesImpl in project adempiere by adempiere.
the class ModelValidatorElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
final int AD_ModelValidator_ID = Env.getContextAsInt(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_AD_ModelValidator_ID);
if (validators.contains(AD_ModelValidator_ID))
return;
validators.add(AD_ModelValidator_ID);
final X_AD_ModelValidator validator = new X_AD_ModelValidator(ctx, AD_ModelValidator_ID, null);
AttributesImpl atts = new AttributesImpl();
createMessageBinding(atts, validator);
document.startElement("", "", TAG_Name, atts);
document.endElement("", "", TAG_Name);
}
use of org.xml.sax.helpers.AttributesImpl in project adempiere by adempiere.
the class PreferenceElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
int AD_Preference_ID = Env.getContextAsInt(ctx, X_AD_Preference.COLUMNNAME_AD_Preference_ID);
X_AD_Preference m_Preference = new X_AD_Preference(ctx, AD_Preference_ID, getTrxName(ctx));
AttributesImpl atts = new AttributesImpl();
createPreferenceBinding(atts, m_Preference);
document.startElement("", "", "preference", atts);
document.endElement("", "", "preference");
}
use of org.xml.sax.helpers.AttributesImpl in project adempiere by adempiere.
the class RoleElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
int Role_id = Env.getContextAsInt(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_AD_Role_ID);
if (roles.contains(Role_id))
return;
roles.add(Role_id);
X_AD_Role m_Role = new X_AD_Role(ctx, Role_id, null);
AttributesImpl atts = new AttributesImpl();
createRoleBinding(atts, m_Role);
document.startElement("", "", "role", atts);
// Process org access
String sql = "SELECT * FROM AD_Role_OrgAccess WHERE AD_Role_ID= " + Role_id;
PreparedStatement pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
createOrgAccess(ctx, document, rs.getInt("AD_Org_ID"), rs.getInt("AD_Role_ID"));
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, "AD_Role_OrgAccess", e);
throw new DatabaseAccessException("Failed to export organization role access.");
}
// Process user assignment access
sql = "SELECT * FROM AD_User_Roles WHERE AD_Role_ID= " + Role_id;
pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
createUserRole(ctx, document, rs.getInt("AD_User_ID"), rs.getInt("AD_Role_ID"), rs.getInt("AD_Org_ID"));
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, "AD_User_Roles", e);
throw new DatabaseAccessException("Failed to export user role assignment.");
}
// Process AD_Window_Access Values
sql = "SELECT * FROM AD_Window_Access WHERE AD_Role_ID= " + Role_id;
pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
createWindowAccess(ctx, document, rs.getInt("AD_Window_ID"), rs.getInt("AD_Role_ID"));
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, "AD_Window_Access", e);
throw new DatabaseAccessException("Failed to export window access.");
}
// Process AD_Process_Access Values
sql = "SELECT * FROM AD_Process_Access WHERE AD_Role_ID= " + Role_id;
pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
createProcessAccess(ctx, document, rs.getInt("AD_Process_ID"), rs.getInt("AD_Role_ID"));
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, "AD_Process_Access", e);
throw new DatabaseAccessException("Failed to export process access.");
}
// Process AD_Form_Access Values
sql = "SELECT * FROM AD_Form_Access WHERE AD_Role_ID= " + Role_id;
pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
createFormAccess(ctx, document, rs.getInt("AD_Form_ID"), rs.getInt("AD_Role_ID"));
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, "AD_Form_Access", e);
throw new DatabaseAccessException("Failed to export form access.");
}
// Process AD_Browse_Access
String whereClause = I_AD_Browse_Access.COLUMNNAME_AD_Role_ID + "=?";
List<X_AD_Browse_Access> browseaccess = new Query(ctx, I_AD_Browse_Access.Table_Name, whereClause, getTrxName(ctx)).setParameters(Role_id).list();
for (X_AD_Browse_Access ba : browseaccess) {
createBrowseAccess(ctx, document, ba.getAD_Browse_ID(), ba.getAD_Role_ID());
}
// Process AD_Workflow_Access Values
sql = "SELECT * FROM AD_Workflow_Access WHERE AD_Role_ID= " + Role_id;
pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
createWorkflowAccess(ctx, document, rs.getInt("AD_Workflow_ID"), rs.getInt("AD_Role_ID"));
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, "AD_Workflow_Access", e);
throw new DatabaseAccessException("Failed to export workflow access.");
}
// Process AD_Task_Access Values
sql = "SELECT * FROM AD_Task_Access WHERE AD_Role_ID= " + Role_id;
pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
createTaskAccess(ctx, document, rs.getInt("AD_Task_ID"), rs.getInt("AD_Role_ID"));
}
rs.close();
pstmt.close();
pstmt = null;
} catch (Exception e) {
log.log(Level.SEVERE, "AD_Task_Access", e);
throw new DatabaseAccessException("Failed to export task access.");
} finally {
try {
if (pstmt != null)
pstmt.close();
} catch (Exception e) {
}
pstmt = null;
}
document.endElement("", "", "role");
}
use of org.xml.sax.helpers.AttributesImpl in project adempiere by adempiere.
the class WorkflowNodeNextElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
int ad_wf_nodenext_id = Env.getContextAsInt(ctx, X_AD_WF_NodeNext.COLUMNNAME_AD_WF_NodeNext_ID);
X_AD_WF_NodeNext m_WF_NodeNext = new X_AD_WF_NodeNext(ctx, ad_wf_nodenext_id, null);
AttributesImpl atts = new AttributesImpl();
createWorkflowNodeNextBinding(atts, m_WF_NodeNext);
document.startElement("", "", "workflowNodeNext", atts);
document.endElement("", "", "workflowNodeNext");
}
use of org.xml.sax.helpers.AttributesImpl in project adempiere by adempiere.
the class WorkflowElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
int AD_Workflow_ID = Env.getContextAsInt(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID);
if (workflows.contains(AD_Workflow_ID))
return;
workflows.add(AD_Workflow_ID);
String sql = "SELECT Name FROM AD_Workflow WHERE AD_Workflow_ID= " + AD_Workflow_ID;
int ad_wf_nodenext_id = 0;
int ad_wf_nodenextcondition_id = 0;
AttributesImpl atts = new AttributesImpl();
PreparedStatement pstmt = null;
ResultSet rs = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
rs = pstmt.executeQuery();
while (rs.next()) {
X_AD_Workflow m_Workflow = new X_AD_Workflow(ctx, AD_Workflow_ID, null);
createWorkflowBinding(atts, m_Workflow);
document.startElement("", "", "workflow", atts);
String sql1 = "SELECT AD_WF_Node_ID FROM AD_WF_Node WHERE AD_Workflow_ID = " + AD_Workflow_ID + " ORDER BY " + X_AD_WF_Node.COLUMNNAME_AD_WF_Node_ID;
PreparedStatement pstmt1 = null;
ResultSet rs1 = null;
try {
pstmt1 = DB.prepareStatement(sql1, getTrxName(ctx));
// Generated workflowNodeNext(s) and
// workflowNodeNextCondition(s)
rs1 = pstmt1.executeQuery();
while (rs1.next()) {
int nodeId = rs1.getInt("AD_WF_Node_ID");
createNode(ctx, document, nodeId);
ad_wf_nodenext_id = 0;
String sqlnn = "SELECT AD_WF_NodeNext_ID FROM AD_WF_NodeNext WHERE AD_WF_Node_ID = ?" + " ORDER BY " + X_AD_WF_NodeNext.COLUMNNAME_AD_WF_NodeNext_ID;
PreparedStatement pstmtnn = null;
ResultSet rsnn = null;
try {
pstmtnn = DB.prepareStatement(sqlnn, getTrxName(ctx));
pstmtnn.setInt(1, nodeId);
rsnn = pstmtnn.executeQuery();
while (rsnn.next()) {
ad_wf_nodenext_id = rsnn.getInt("AD_WF_NodeNext_ID");
if (ad_wf_nodenext_id > 0) {
createNodeNext(ctx, document, ad_wf_nodenext_id);
ad_wf_nodenextcondition_id = 0;
String sqlnnc = "SELECT AD_WF_NextCondition_ID FROM AD_WF_NextCondition WHERE AD_WF_NodeNext_ID = ?" + " ORDER BY " + X_AD_WF_NextCondition.COLUMNNAME_AD_WF_NextCondition_ID;
PreparedStatement pstmtnnc = null;
ResultSet rsnnc = null;
try {
pstmtnnc = DB.prepareStatement(sqlnnc, getTrxName(ctx));
pstmtnnc.setInt(1, ad_wf_nodenext_id);
rsnnc = pstmtnnc.executeQuery();
while (rsnnc.next()) {
ad_wf_nodenextcondition_id = rsnnc.getInt("AD_WF_NextCondition_ID");
log.info("ad_wf_nodenextcondition_id: " + String.valueOf(ad_wf_nodenextcondition_id));
if (ad_wf_nodenextcondition_id > 0) {
createNodeNextCondition(ctx, document, ad_wf_nodenextcondition_id);
}
}
} finally {
DB.close(rsnnc, pstmtnnc);
rsnnc = null;
pstmtnnc = null;
}
}
}
} finally {
DB.close(rsnn, pstmtnn);
rsnn = null;
pstmtnn = null;
}
}
} finally {
DB.close(rs1, pstmt1);
rs1 = null;
pstmt1 = null;
document.endElement("", "", "workflow");
}
}
} catch (Exception e) {
log.log(Level.SEVERE, "Workflow", e);
if (e instanceof SAXException)
throw (SAXException) e;
else if (e instanceof SQLException)
throw new DatabaseAccessException("Failed to export workflow.", e);
else
throw new RuntimeException("Failed to export workflow.", e);
} finally {
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
}
Aggregations