Search in sources :

Example 16 with PackOut

use of org.adempiere.pipo.PackOut in project adempiere by adempiere.

the class FieldElementHandler method create.

public void create(Properties ctx, TransformerHandler document) throws SAXException {
    int AD_Field_ID = Env.getContextAsInt(ctx, X_AD_Field.COLUMNNAME_AD_Field_ID);
    X_AD_Field m_Field = new X_AD_Field(ctx, AD_Field_ID, null);
    AttributesImpl atts = new AttributesImpl();
    createFieldBinding(atts, m_Field);
    PackOut packOut = (PackOut) ctx.get("PackOutProcess");
    if (m_Field.getAD_FieldGroup_ID() > 0) {
        packOut.createFieldGroupElement(m_Field.getAD_FieldGroup_ID(), document);
    }
    if (m_Field.getAD_Reference_ID() > 0) {
        packOut.createReference(m_Field.getAD_Reference_ID(), document);
    }
    if (m_Field.getAD_Reference_Value_ID() > 0) {
        packOut.createReference(m_Field.getAD_Reference_Value_ID(), document);
    }
    if (m_Field.getAD_Val_Rule_ID() > 0) {
        packOut.createDynamicRuleValidation(m_Field.getAD_Val_Rule_ID(), document);
    }
    document.startElement("", "", "field", atts);
    document.endElement("", "", "field");
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) X_AD_Field(org.compiere.model.X_AD_Field) PackOut(org.adempiere.pipo.PackOut)

Example 17 with PackOut

use of org.adempiere.pipo.PackOut in project adempiere by adempiere.

the class PackOutTest method testPackOut.

public void testPackOut() {
    PackOut m_PackOut = new PackOut();
    PackInHandler m_PackInHandler = new PackInHandler();
    Trx m_trx = Trx.get(getTrxName(), true);
    int m_ad_process_id = IDFinder.get_IDWithColumn("ad_process", "Name", "PackOut", getAD_Client_ID(), getTrxName());
    int m_ad_table_id = IDFinder.get_IDWithColumn("ad_table", "Name", "AD_Package_Exp_ID", getAD_Client_ID(), getTrxName());
    //Create 2Pack Export Package
    MPackageExp m_MPackageExp = new MPackageExp(getCtx(), 0, getTrxName());
    m_MPackageExp.setName("testSqlStatement2Pack");
    m_MPackageExp.setIsActive(true);
    m_MPackageExp.setDescription("Test Output Package");
    m_MPackageExp.setEMail("wgheath@gmail.com");
    m_MPackageExp.setUserName("wgheath@gmail.com");
    m_MPackageExp.setFile_Directory("packages/");
    m_MPackageExp.setInstructions("use 2pack to import this package");
    m_MPackageExp.setReleaseNo(X_AD_Package_Exp_Detail.RELEASENO_NoSpecificRelease);
    m_MPackageExp.setVersion("1.0");
    m_MPackageExp.setPK_Version("1.0");
    boolean saveResult = m_MPackageExp.save();
    assertTrue("MPackageExp.save()", saveResult);
    X_AD_Package_Exp_Detail m_PackDetail = new X_AD_Package_Exp_Detail(getCtx(), 0, getTrxName());
    m_PackDetail.setAD_Org_ID(m_MPackageExp.getAD_Org_ID());
    m_PackDetail.setAD_Package_Exp_ID(m_MPackageExp.get_ID());
    m_MPackageExp.setIsActive(true);
    m_PackDetail.setType(X_AD_Package_Exp_Detail.TYPE_SQLStatement);
    m_PackDetail.setDBType("ALL");
    m_PackDetail.setSQLStatement("select * from ad_table");
    m_PackDetail.setDescription("2pack test sql statement");
    /*m_PackDetail.setFileName(rs.getString("FILENAME"));
		m_PackDetail.setAD_Client_ID(m_MPackageExp.getAD_Client_ID());
		m_PackDetail.setDescription(rs.getString("DESCRIPTION"));
		m_PackDetail.setTarget_Directory(rs.getString("TARGET_DIRECTORY"));
		m_PackDetail.setFile_Directory(rs.getString("FILE_DIRECTORY"));
		m_PackDetail.setDestination_Directory(rs.getString("DESTINATION_DIRECTORY"));
		m_PackDetail.setAD_Workflow_ID(rs.getInt("AD_WORKFLOW_ID"));
		m_PackDetail.setAD_Window_ID(rs.getInt("AD_WINDOW_ID"));
		m_PackDetail.setAD_Role_ID(rs.getInt("AD_ROLE_ID"));
		m_PackDetail.setAD_Process_ID(rs.getInt("AD_PROCESS_ID"));
		m_PackDetail.setAD_Menu_ID(rs.getInt("AD_MENU_ID"));
		m_PackDetail.setAD_ImpFormat_ID(rs.getInt("AD_IMPFORMAT_ID"));
		m_PackDetail.setAD_Workbench_ID(rs.getInt("AD_WORKBENCH_ID"));
		m_PackDetail.setAD_Table_ID(rs.getInt("AD_TABLE_ID"));
		m_PackDetail.setAD_Form_ID(rs.getInt("AD_FORM_ID"));
		m_PackDetail.setAD_ReportView_ID(rs.getInt("AD_REPORTVIEW_ID"));
		*/
    m_PackDetail.setLine(10);
    saveResult = m_PackDetail.save();
    assertTrue("X_AD_Package_Exp_Detail.save()", saveResult);
    int m_ad_record_id = IDFinder.get_IDWithColumn("ad_package_exp", "Name", "test2packJunit", getAD_Client_ID(), getTrxName());
    ProcessInfo m_ProcessInfo = new ProcessInfo("PackOut", m_ad_process_id, m_ad_table_id, m_MPackageExp.get_ID());
    m_PackOut.startProcess(getCtx(), m_ProcessInfo, m_trx);
    assertFalse("PackOut", m_ProcessInfo.isError());
    try {
        commit();
    } catch (Exception e) {
        fail(e.getLocalizedMessage());
    }
}
Also used : PackInHandler(org.adempiere.pipo.PackInHandler) X_AD_Package_Exp_Detail(org.compiere.model.X_AD_Package_Exp_Detail) PackOut(org.adempiere.pipo.PackOut) Trx(org.compiere.util.Trx) ProcessInfo(org.compiere.process.ProcessInfo) MPackageExp(org.compiere.model.MPackageExp)

Aggregations

PackOut (org.adempiere.pipo.PackOut)17 AttributesImpl (org.xml.sax.helpers.AttributesImpl)16 PreparedStatement (java.sql.PreparedStatement)8 ResultSet (java.sql.ResultSet)8 SAXException (org.xml.sax.SAXException)8 POSaveFailedException (org.adempiere.pipo.exception.POSaveFailedException)6 DatabaseAccessException (org.adempiere.pipo.exception.DatabaseAccessException)5 SQLException (java.sql.SQLException)4 Query (org.compiere.model.Query)3 MBrowseField (org.adempiere.model.MBrowseField)2 MViewColumn (org.adempiere.model.MViewColumn)2 MViewDefinition (org.adempiere.model.MViewDefinition)2 X_AD_Menu (org.compiere.model.X_AD_Menu)2 MBrowse (org.adempiere.model.MBrowse)1 X_AD_View (org.adempiere.model.X_AD_View)1 PackInHandler (org.adempiere.pipo.PackInHandler)1 MPackageExp (org.compiere.model.MPackageExp)1 X_AD_Element (org.compiere.model.X_AD_Element)1 X_AD_Field (org.compiere.model.X_AD_Field)1 X_AD_FieldGroup (org.compiere.model.X_AD_FieldGroup)1