diff --git a/base/src/org/adempiere/pipo/PackInHandler.java b/base/src/org/adempiere/pipo/PackInHandler.java index 42beeb7aef..de4bfa9448 100644 --- a/base/src/org/adempiere/pipo/PackInHandler.java +++ b/base/src/org/adempiere/pipo/PackInHandler.java @@ -10,10 +10,10 @@ * You should have received a copy of the GNU General Public License along * * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * - * Copyright (C) 2004 Marco LOMBARDO. lombardo@mayking.com - * Contributor(s): Robert KLEIN. robeklein@hotmail.com - *_____________________________________________ + * * + * Copyright (C) 2004 Marco LOMBARDO. lombardo@mayking.com * + * Contributor: Robert KLEIN. robeklein@hotmail.com * + * Contributor: Tim Heath * *****************************************************************************/ package org.adempiere.pipo; @@ -80,6 +80,7 @@ public class PackInHandler extends DefaultHandler { private X_AD_Process_Para m_Process_para = null; private MTask m_Task = null; private MForm m_Form = null; + private MMessage m_Message = null; private X_AD_Workbench m_Workbench = null; private X_AD_WorkbenchWindow m_Workbenchwindow = null; private X_AD_Reference m_Reference = null; @@ -771,12 +772,40 @@ public class PackInHandler extends DefaultHandler { } } } + else if (elementValue.equals("message")) { + log.info(elementValue+" "+atts.getValue("Value")); + String entitytype = atts.getValue("EntityType"); + if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { + String value = atts.getValue("Value"); + int id = get_IDWithColumn("AD_Message", "value", value); + + m_Message = new MMessage(m_ctx, id, m_trxName); + if (id > 0){ + AD_Backup_ID = copyRecord("AD_Message",m_Message); + Object_Status = "Update"; + } + else{ + Object_Status = "New"; + AD_Backup_ID =0; + } + m_Message.setMsgText(atts.getValue("MsgText").replaceAll("'","''").replaceAll(",","")); + m_Message.setMsgTip(atts.getValue("MsgTip").replaceAll("'","''").replaceAll(",","")); + m_Message.setEntityType(atts.getValue("EntityType")); + m_Message.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue():true); + m_Message.setValue(value); + m_Message.setMsgType(atts.getValue("MsgType")); + if (m_Message.save(m_trxName) == true){ + record_log (1, m_Message.getValue(),"Message", m_Message.get_ID(),AD_Backup_ID, Object_Status,"AD_Message",get_IDWithColumn("AD_Message", "value", "AD_Message")); + } + else{ + record_log (0, m_Message.getValue(),"Message", m_Message.get_ID(),AD_Backup_ID, Object_Status,"AD_Message",get_IDWithColumn("AD_Message", "value", "AD_Message")); + } + } + } else if (elementValue.equals("dynvalrule")) { log.info(elementValue+" "+atts.getValue("Name")); String entitytype = atts.getValue("EntityType"); - //FIXME: understand how to change m_UpdateMode to true - //if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { - if (entitytype.equals("U") || entitytype.equals("D")) { + if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { String name = atts.getValue("Name"); int id = get_IDWithColumn("AD_Val_Rule", "name", name); @@ -810,15 +839,13 @@ public class PackInHandler extends DefaultHandler { String entitytype = atts.getValue("EntityType"); log.info("entitytype "+atts.getValue("EntityType")); - //FIXME: understand how to change m_UpdateMode to true - //if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { - if (entitytype.equals("U") || entitytype.equals("D")) { - log.info("entitytype is a U or D"); - + if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { + log.info("entitytype is a U or D"); + String workflowName = atts.getValue("Name"); - + int id = get_IDWithColumn("AD_Workflow", "name", workflowName); - + m_Workflow = new MWorkflow(m_ctx, id, m_trxName); if (id > 0){ AD_Backup_ID = copyRecord("AD_Workflow",m_Workflow); @@ -838,13 +865,13 @@ public class PackInHandler extends DefaultHandler { String Name = atts.getValue("ADTableNameID"); id = get_IDWithColumn("AD_Table", "TableName", Name); m_Workflow.setAD_Table_ID(id); - + } if (atts.getValue("ADWorkflowProcessorNameID")!= null){ String Name = atts.getValue("ADWorkflowProcessorNameID"); id = get_IDWithColumn("AD_WorkflowProcessor", "Name", Name); m_Workflow.setAD_WorkflowProcessor_ID(id); - + } m_Workflow.setName(workflowName); m_Workflow.setAccessLevel (atts.getValue("AccessLevel")); @@ -867,19 +894,19 @@ public class PackInHandler extends DefaultHandler { m_Workflow.setAD_WF_Node_ID(-1); // log.info("in3"); attsOut.clear(); - log.info("about to execute m_Workflow.save"); + log.info("about to execute m_Workflow.save"); if (m_Workflow.save(m_trxName) == true){ - log.info("m_Workflow save success"); + log.info("m_Workflow save success"); record_log (1, m_Workflow.getName(),"Workflow", m_Workflow.get_ID(),AD_Backup_ID, Object_Status,"AD_Workflow",get_IDWithColumn("AD_Workflow", "Name", "AD_Workflow")); } else{ - log.info("m_Workflow save failure"); + log.info("m_Workflow save failure"); record_log (0, m_Workflow.getName(),"Workflow", m_Workflow.get_ID(),AD_Backup_ID, Object_Status,"AD_Workflow",get_IDWithColumn("AD_Workflow", "Name", "AD_Workflow")); } } else { - log.info("entitytype is not a U or D"); - - } + log.info("entitytype is not a U or D"); + + } } // workflowNode element. else if (elementValue.equals("workflowNode")) { @@ -888,21 +915,19 @@ public class PackInHandler extends DefaultHandler { String entitytype = atts.getValue("EntityType"); log.info("entitytype "+atts.getValue("EntityType")); - //FIXME: understand how to change m_UpdateMode to true - //if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { - if (entitytype.equals("U") || entitytype.equals("D")) { - log.info("entitytype is a U or D"); + if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { + log.info("entitytype is a U or D"); String workflowName = atts.getValue("ADWorkflowNameID"); - + int workflowId = get_IDWithColumn("AD_Workflow", "name", workflowName); - + String workflowNodeName = atts.getValue("Name"); sqlB = new StringBuffer ("SELECT ad_wf_node_id FROM AD_WF_Node WHERE AD_Workflow_ID=? and Name =?"); - int id = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeName); - + int id = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeName); + m_WFNode = new MWFNode(m_ctx, id, m_trxName); if (id > 0){ AD_Backup_ID = copyRecord("AD_WF_Node",m_WFNode); @@ -933,7 +958,7 @@ public class PackInHandler extends DefaultHandler { id = get_IDWithColumn("AD_WF_Responsible", "Name", name); m_WFNode.setAD_WF_Responsible_ID(id); } - + if (atts.getValue("ADWindowNameID")!= null){ String name = atts.getValue("ADWindowNameID"); id = get_IDWithColumn("AD_Window", "Name", name); @@ -949,13 +974,13 @@ public class PackInHandler extends DefaultHandler { id = get_IDWithColumn("AD_WF_Block", "Name", name); m_WFNode.setAD_WF_Block_ID(id); } - /* FIXME: Do we need TaskName ? + /* FIXME: Do we need TaskName ? if (atts.getValue("ADTaskNameID")!=null){ String name = atts.getValue("ADTaskNameID"); sqlB = new StringBuffer ("SELECT AD_Task_ID FROM AD_Task WHERE Name= ?"); taskid = DB.getSQLValue(m_trxName,sqlB.toString(),name); } - */ + */ m_WFNode.setEntityType(atts.getValue("EntityType")); m_WFNode.setAction(atts.getValue("Action")); m_WFNode.setDocAction(atts.getValue("DocAction")); @@ -982,50 +1007,48 @@ public class PackInHandler extends DefaultHandler { m_WFNode.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue():true); // log.info("in3"); attsOut.clear(); - log.info("about to execute m_WFNode.save"); + log.info("about to execute m_WFNode.save"); if (m_WFNode.save(m_trxName) == true){ - log.info("m_WFNode save success"); + log.info("m_WFNode save success"); record_log (1, m_WFNode.getName(),"WFNode", m_WFNode.get_ID(),AD_Backup_ID, Object_Status,"AD_WF_Node",get_IDWithColumn("AD_WF_Node", "Name", "AD_WF_Node")); } else{ - log.info("m_WFNode save failure"); + log.info("m_WFNode save failure"); record_log (0, m_WFNode.getName(),"WFNode", m_WFNode.get_ID(),AD_Backup_ID, Object_Status,"AD_WF_Node",get_IDWithColumn("AD_WF_Node", "Name", "AD_WF_Node")); } } else { - log.info("entitytype is not a U or D"); - - } + log.info("entitytype is not a U or D"); + + } } // workflowNodeNext element. else if (elementValue.equals("workflowNodeNext")) { log.info("In PackInHandler.java with element workflowNodeNext"); String entitytype = atts.getValue("EntityType"); log.info("entitytype "+atts.getValue("EntityType")); - - //FIXME: understand how to change m_UpdateMode to true - //if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { - if (entitytype.equals("U") || entitytype.equals("D")) { - log.info("entitytype is a U or D"); - + + if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { + log.info("entitytype is a U or D"); + String workflowName = atts.getValue("ADWorkflowNameID"); - + int workflowId = get_IDWithColumn("AD_Workflow", "name", workflowName); - + String workflowNodeName = atts.getValue("ADWorkflowNodeNameID"); String workflowNodeNextName = atts.getValue("ADWorkflowNodeNextNameID"); sqlB = new StringBuffer ("SELECT ad_wf_node_id FROM AD_WF_Node WHERE AD_Workflow_ID=? and Name =?"); - int wfNodeId = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeName); + int wfNodeId = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeName); + + int wfNodeNextId = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeNextName); - int wfNodeNextId = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeNextName); - sqlB = new StringBuffer ("SELECT ad_wf_nodenext_id FROM AD_WF_NodeNext WHERE ad_wf_node_id =? and ad_wf_next_id =?"); //int id = get_IDWithColumn("AD_WF_Node", "name", workflowNodeName); - int id = DB.getSQLValue(m_trxName,sqlB.toString(),wfNodeId,wfNodeNextId); - + int id = DB.getSQLValue(m_trxName,sqlB.toString(),wfNodeId,wfNodeNextId); + m_WFNodeNext = new MWFNodeNext(m_ctx, id, m_trxName); if (id > 0){ AD_Backup_ID = copyRecord("AD_WF_NodeNext",m_WFNodeNext); @@ -1043,51 +1066,49 @@ public class PackInHandler extends DefaultHandler { m_WFNodeNext.setIsStdUserWorkflow(atts.getValue("IsStdUserWorkflow") != null ? Boolean.valueOf(atts.getValue("IsStdUserWorkflow")).booleanValue():true); // log.info("m_WFNodeNext.get_ID: " + String.valueOf(m_WFNodeNext.get_ID)); attsOut.clear(); - log.info("about to execute m_WFNodeNext.save"); + log.info("about to execute m_WFNodeNext.save"); if (m_WFNodeNext.save(m_trxName) == true){ - log.info("m_WFNodeNext save success"); + log.info("m_WFNodeNext save success"); record_log (1, String.valueOf(m_WFNodeNext.get_ID()),"WFNodeNext", m_WFNodeNext.get_ID(),AD_Backup_ID, Object_Status,"AD_WF_NodeNext",get_IDWithColumn("AD_WF_NodeNext", "ad_wf_nodenext_id", "AD_WF_NodeNext")); } else{ - log.info("m_WFNodeNext save failure"); + log.info("m_WFNodeNext save failure"); record_log (0, String.valueOf(m_WFNodeNext.get_ID()),"WFNode", m_WFNodeNext.get_ID(),AD_Backup_ID, Object_Status,"AD_WF_NodeNext",get_IDWithColumn("AD_WF_NodeNext", "ad_wf_nodenext_id", "AD_WF_NodeNext")); } } else { - log.info("entitytype is not a U or D"); - - } + log.info("entitytype is not a U or D"); + + } } // workflowNodeNextCondition element. else if (elementValue.equals("workflowNodeNextCondition")) { log.info("In PackInHandler.java with element workflowNodeNextCondition"); String entitytype = atts.getValue("EntityType"); log.info("entitytype "+atts.getValue("EntityType")); - - //FIXME: understand how to change m_UpdateMode to true - //if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { - if (entitytype.equals("U") || entitytype.equals("D")) { - log.info("entitytype is a U or D"); - + + if (entitytype.equals("U") || entitytype.equals("D") && m_UpdateMode.equals("true")) { + log.info("entitytype is a U or D"); + String workflowName = atts.getValue("ADWorkflowNameID"); - + int workflowId = get_IDWithColumn("AD_Workflow", "name", workflowName); - + String workflowNodeName = atts.getValue("ADWorkflowNodeNameID"); String workflowNodeNextName = atts.getValue("ADWorkflowNodeNextNameID"); sqlB = new StringBuffer ("SELECT ad_wf_node_id FROM AD_WF_Node WHERE AD_Workflow_ID=? and Name =?"); - int wfNodeId = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeName); + int wfNodeId = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeName); + + int wfNodeNextId = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeNextName); - int wfNodeNextId = DB.getSQLValue(m_trxName,sqlB.toString(),workflowId,workflowNodeNextName); - sqlB = new StringBuffer ("SELECT ad_wf_nodenext_id FROM AD_WF_NodeNext WHERE ad_wf_node_id =? and ad_wf_next_id =?"); - int wfNodeNextTablePKId = DB.getSQLValue(m_trxName,sqlB.toString(),wfNodeId,wfNodeNextId); + int wfNodeNextTablePKId = DB.getSQLValue(m_trxName,sqlB.toString(),wfNodeId,wfNodeNextId); sqlB = new StringBuffer ("SELECT ad_wf_nextcondition_id FROM AD_WF_NextCondition WHERE ad_wf_nodenext_id =?"); - int id = DB.getSQLValue(m_trxName,sqlB.toString(),wfNodeNextTablePKId); - + int id = DB.getSQLValue(m_trxName,sqlB.toString(),wfNodeNextTablePKId); + m_WFNodeNextCondition = new MWFNextCondition(m_ctx, id, m_trxName); if (id > 0){ AD_Backup_ID = copyRecord("AD_WF_NextCondition",m_WFNodeNextCondition); @@ -1099,8 +1120,8 @@ public class PackInHandler extends DefaultHandler { } sqlB = new StringBuffer ("SELECT AD_Column.ad_column_id FROM AD_Column, AD_Table WHERE AD_Column.ad_table_id = AD_Table.ad_table_id and AD_Table.name = '" + atts.getValue("ADTableNameID") + "' and AD_Column.name = ?"); - //int columnId = DB.getSQLValue(m_trxName,sqlB.toString(),atts.getValue("ADTableNameID"), atts.getValue("ADColumnNameID")); - int columnId = DB.getSQLValue(m_trxName,sqlB.toString(),atts.getValue("ADColumnNameID")); + //int columnId = DB.getSQLValue(m_trxName,sqlB.toString(),atts.getValue("ADTableNameID"), atts.getValue("ADColumnNameID")); + int columnId = DB.getSQLValue(m_trxName,sqlB.toString(),atts.getValue("ADColumnNameID")); m_WFNodeNextCondition.setAD_Column_ID(columnId); m_WFNodeNextCondition.setAD_WF_NodeNext_ID(wfNodeNextTablePKId); @@ -1113,19 +1134,19 @@ public class PackInHandler extends DefaultHandler { m_WFNodeNextCondition.setValue(atts.getValue("Value")); m_WFNodeNextCondition.setValue2(atts.getValue("Value2")); attsOut.clear(); - log.info("about to execute m_WFNodeNextCondition.save"); + log.info("about to execute m_WFNodeNextCondition.save"); if (m_WFNodeNextCondition.save(m_trxName) == true){ - log.info("m_WFNodeNextCondition save success"); + log.info("m_WFNodeNextCondition save success"); record_log (1, String.valueOf(m_WFNodeNextCondition.get_ID()),"WFNextCondition", m_WFNodeNextCondition.get_ID(),AD_Backup_ID, Object_Status,"AD_WF_NextCondition",get_IDWithColumn("AD_WF_NextCondition", "ad_wf_nextcondition_id", "AD_WF_NextCondition")); } else{ - log.info("m_WFNodeNextCondition save failure"); + log.info("m_WFNodeNextCondition save failure"); record_log (0, String.valueOf(m_WFNodeNextCondition.get_ID()),"WFNextCondition", m_WFNodeNextCondition.get_ID(),AD_Backup_ID, Object_Status,"AD_WF_NextCondition",get_IDWithColumn("AD_WF_NextCondition", "ad_wf_nextcondition_id", "AD_WF_NextCondition")); } } else { - log.info("entitytype is not a U or D"); - - } + log.info("entitytype is not a U or D"); + + } } // table element. else if (elementValue.equals("table")) { diff --git a/base/src/org/adempiere/pipo/PackOut.java b/base/src/org/adempiere/pipo/PackOut.java index 75be1f13c0..b6fdc9d26c 100644 --- a/base/src/org/adempiere/pipo/PackOut.java +++ b/base/src/org/adempiere/pipo/PackOut.java @@ -30,6 +30,8 @@ import javax.xml.transform.stream.StreamResult; import org.adempiere.pipo.CreateZipFile; import org.compiere.model.X_AD_Column; import org.compiere.model.X_AD_Field; +import org.compiere.model.X_AD_Package_Exp; +import org.compiere.model.X_AD_Package_Exp_Detail; import org.compiere.model.X_AD_Process; import org.compiere.model.X_AD_Process_Para; import org.compiere.model.X_AD_Tab; @@ -52,6 +54,7 @@ import org.compiere.model.X_AD_ReportView_Col; import org.compiere.model.X_AD_Role; import org.compiere.model.X_AD_Workflow; import org.compiere.model.X_AD_Val_Rule; +import org.compiere.model.X_AD_Message; import org.compiere.model.X_AD_WF_Node; import org.compiere.model.X_AD_WF_NodeNext; import org.compiere.model.X_AD_WF_NextCondition; @@ -78,6 +81,7 @@ public class PackOut extends SvrProcess private X_AD_Process_Para m_Processpara = null; private X_AD_Table m_Table = null; private X_AD_Workflow m_Workflow = null; + private X_AD_Message m_Message = null; private X_AD_WF_Node m_WF_Node = null; private X_AD_WF_NodeNext m_WF_NodeNext = null; private X_AD_WF_NextCondition m_WF_NodeNextCondition = null; @@ -141,13 +145,13 @@ public class PackOut extends SvrProcess while (rs1.next()){ //Create the package documentation fileSeperator = File.separator; - packagedir = rs1.getString("File_Directory").trim(); + packagedir = rs1.getString(X_AD_Package_Exp.COLUMNNAME_File_Directory).trim(); if (!packagedir.endsWith("/") && !packagedir.endsWith("\\")) packagedir += fileSeperator; - packagename = packagedir + rs1.getString("Name"); - includesdir = rs1.getString("Name") + fileSeperator+"**"; + packagename = packagedir + rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name); + includesdir = rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name) + fileSeperator+"**"; boolean success = (new File(packagename+fileSeperator+"doc"+fileSeperator )).mkdirs(); - String file_document = packagename +fileSeperator+ "doc"+fileSeperator+rs1.getString("Name")+"Doc.xml"; + String file_document = packagename +fileSeperator+ "doc"+fileSeperator+rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name)+"Doc.xml"; fw_document = new FileOutputStream (file_document, false); StreamResult streamResult_document = new StreamResult(fw_document); SAXTransformerFactory tf_document = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); @@ -162,25 +166,25 @@ public class PackOut extends SvrProcess hd_documemt.processingInstruction("xml-stylesheet","type=\"text/css\" href=\"adempiereDocument.css\""); hd_documemt.startElement("","","adempiereDocument",atts); hd_documemt.startElement("","","header",atts); - hd_documemt.characters((rs1.getString("Name")+" Package Description").toCharArray(),0,(rs1.getString("Name")+" Package Description").length()); + hd_documemt.characters((rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name)+" Package Description").toCharArray(),0,(rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name)+" Package Description").length()); hd_documemt.endElement("","","header"); hd_documemt.startElement("","","H1",atts); hd_documemt.characters(("Package Name:" ).toCharArray(),0,("Package Name:" ).length()); hd_documemt.endElement("","","H1"); hd_documemt.startElement("","","packagename",atts); - hd_documemt.characters(rs1.getString("Name").toCharArray(),0,rs1.getString("Name").length()); + hd_documemt.characters(rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name).toCharArray(),0,rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name).length()); hd_documemt.endElement("","","packagename"); hd_documemt.startElement("","","H1",atts); hd_documemt.characters(("Creator:" ).toCharArray(),0,("Creator:").length()); hd_documemt.endElement("","","H1"); hd_documemt.startElement("","","creator",atts); - hd_documemt.characters(rs1.getString("UserName").toCharArray(),0,rs1.getString("UserName").length()); + hd_documemt.characters(rs1.getString(X_AD_Package_Exp.COLUMNNAME_UserName).toCharArray(),0,rs1.getString(X_AD_Package_Exp.COLUMNNAME_UserName).length()); hd_documemt.endElement("","","creator"); hd_documemt.startElement("","","H1",atts); hd_documemt.characters(("Email Address:" ).toCharArray(),0,("Email Address:" ).length()); hd_documemt.endElement("","","H1"); hd_documemt.startElement("","","creatorcontact",atts); - hd_documemt.characters(rs1.getString("Email").toCharArray(),0,rs1.getString("Email").length()); + hd_documemt.characters(rs1.getString(X_AD_Package_Exp.COLUMNNAME_EMail).toCharArray(),0,rs1.getString(X_AD_Package_Exp.COLUMNNAME_EMail).length()); hd_documemt.endElement("","","creatorcontact"); hd_documemt.startElement("","","H1",atts); hd_documemt.characters(("Created:" ).toCharArray(),0,("Created:" ).length()); @@ -198,13 +202,13 @@ public class PackOut extends SvrProcess hd_documemt.characters(("Description:" ).toCharArray(),0,("Description:" ).length()); hd_documemt.endElement("","","H1"); hd_documemt.startElement("","","description",atts); - hd_documemt.characters(rs1.getString("Description").toCharArray(),0,rs1.getString("Description").length()); + hd_documemt.characters(rs1.getString(X_AD_Package_Exp.COLUMNNAME_Description).toCharArray(),0,rs1.getString(X_AD_Package_Exp.COLUMNNAME_Description).length()); hd_documemt.endElement("","","description"); hd_documemt.startElement("","","H1",atts); hd_documemt.characters(("Instructions:" ).toCharArray(),0,("Instructions:" ).length()); hd_documemt.endElement("","","H1"); hd_documemt.startElement("","","instructions",atts); - hd_documemt.characters(rs1.getString("Instructions").toCharArray(),0,rs1.getString("Instructions").length()); + hd_documemt.characters(rs1.getString(X_AD_Package_Exp.COLUMNNAME_Instructions).toCharArray(),0,rs1.getString(X_AD_Package_Exp.COLUMNNAME_Instructions).length()); hd_documemt.endElement("","","instructions"); hd_documemt.startElement("","","H1",atts); hd_documemt.characters(("Files in Package:" ).toCharArray(),0,("Files in Package:" ).length()); @@ -230,13 +234,13 @@ public class PackOut extends SvrProcess hd_menu.setResult(streamResult_menu); hd_menu.startDocument(); atts.clear(); - atts.addAttribute("","","Name","CDATA",rs1.getString("Name")); - atts.addAttribute("","","Version","CDATA",rs1.getString("PK_Version")); - atts.addAttribute("","","CompVer","CDATA",rs1.getString("ReleaseNo")); - atts.addAttribute("","","DataBase","CDATA",rs1.getString("Version")); - atts.addAttribute("","","Description","CDATA",rs1.getString("Description")); - atts.addAttribute("","","creator","CDATA",rs1.getString("UserName")); - atts.addAttribute("","","creatorcontact","CDATA",rs1.getString("Email")); + atts.addAttribute("","","Name","CDATA",rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name)); + atts.addAttribute("","","Version","CDATA",rs1.getString(X_AD_Package_Exp.COLUMNNAME_PK_Version)); + atts.addAttribute("","","CompVer","CDATA",rs1.getString(X_AD_Package_Exp.COLUMNNAME_ReleaseNo)); + atts.addAttribute("","","DataBase","CDATA",rs1.getString(X_AD_Package_Exp.COLUMNNAME_Version)); + atts.addAttribute("","","Description","CDATA",rs1.getString(X_AD_Package_Exp.COLUMNNAME_Description)); + atts.addAttribute("","","creator","CDATA",rs1.getString(X_AD_Package_Exp.COLUMNNAME_UserName)); + atts.addAttribute("","","creatorcontact","CDATA",rs1.getString(X_AD_Package_Exp.COLUMNNAME_EMail)); atts.addAttribute("","","createddate","CDATA",rs1.getString("Created")); atts.addAttribute("","","updateddate","CDATA",rs1.getString("Updated")); atts.addAttribute("","","PackOutVer","CDATA",PackOutVer); @@ -251,51 +255,58 @@ public class PackOut extends SvrProcess try { ResultSet rs = pstmt.executeQuery(); while (rs.next()){ - String Type = rs.getString("Type"); - log.info(rs.getString("Line")); + String Type = rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Type); + log.info(rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Line)); if (Type.compareTo("M") == 0){ - m_Menu = new X_AD_Menu (getCtx(), rs.getInt("AD_Menu_ID"), null); + m_Menu = new X_AD_Menu (getCtx(), rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Menu_ID), null); if (m_Menu.isSummary() == false) { - CreateApplication (atts, hd_menu, rs.getInt("AD_Menu_ID")); + CreateApplication (atts, hd_menu, rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Menu_ID)); } else { atts = createmenuBinding(atts,m_Menu); hd_menu.startElement("","","menu",atts); - CreateModule (atts, hd_menu, rs.getInt("AD_Menu_ID")); + CreateModule (atts, hd_menu, rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Menu_ID)); hd_menu.endElement("","","menu"); } } else if (Type.compareTo("P") == 0) - CreateProcess ( rs.getInt("AD_Process_ID"), atts, hd_menu ); + CreateProcess ( rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID), atts, hd_menu ); else if (Type.compareTo("R") == 0) - CreateReportview ( rs.getInt("AD_ReportView_ID"), atts, hd_menu ); + CreateReportview ( rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ReportView_ID), atts, hd_menu ); else if (Type.compareTo("D") == 0) - CreateData ( rs.getInt("AD_Table_ID"), rs.getString("SQLStatement"), atts, hd_menu ); + CreateData ( rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID), rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement), atts, hd_menu ); else if (Type.compareTo("T") == 0) - CreateTable (rs.getInt("AD_Table_ID"), atts, hd_menu); + CreateTable (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID), atts, hd_menu); else if (Type.compareTo("X") == 0) - CreateForm (rs.getInt("AD_Form_ID"), atts, hd_menu); + CreateForm (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID), atts, hd_menu); else if (Type.compareTo("W") == 0) - CreateWindow (rs.getInt("AD_Window_ID"), atts, hd_menu); + CreateWindow (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID), atts, hd_menu); else if (Type.compareTo("B") == 0) - CreateWorkbench (rs.getInt("AD_Workbench_ID"), atts, hd_menu); + CreateWorkbench (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workbench_ID), atts, hd_menu); else if (Type.compareTo("S") == 0) - CreateRoles (rs.getInt("AD_Role_ID"), atts, hd_menu); + CreateRoles (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Role_ID), atts, hd_menu); else if (Type.compareTo("SQL") == 0) - CreateSQL (rs.getString("SQLStatement"), rs.getString("DBType"), atts, hd_menu); + CreateSQL (rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement), rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_DBType), atts, hd_menu); else if (Type.compareTo("IMP") == 0) - CreateImp (rs.getInt("AD_ImpFormat_ID"), atts, hd_menu); + CreateImp (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID), atts, hd_menu); else if (Type.compareTo("SNI") == 0) - CreateSnipit (rs.getString("Destination_Directory"),rs.getString("Destination_FileName"),rs.getString("AD_Package_Code_Old"), - rs.getString("AD_Package_Code_New"), rs.getString("ReleaseNo"), atts, hd_menu); + CreateSnipit( + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory), + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_FileName), + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_Old), + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_New), + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo), + atts, hd_menu); else if (Type.compareTo("F") == 0) - CreateWorkflow (rs.getInt("AD_Workflow_ID"), atts, hd_menu); + CreateWorkflow (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID), atts, hd_menu); else if (Type.compareTo("V") == 0) - CreateDynamicRuleValidation(rs.getInt("AD_Val_Rule_ID"), atts, hd_menu); + CreateDynamicRuleValidation(rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID), atts, hd_menu); + else if (Type.compareTo("MSG") == 0) + CreateMessage(rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Message_ID), atts, hd_menu); else if (Type.compareTo("C") == 0){ log.log(Level.SEVERE,"In PackOut.java handling Code or Other 2pack module creation"); - String fullDirectory = rs1.getString("File_Directory") + rs1.getString("Name")+rs.getString("Target_Directory"); + String fullDirectory = rs1.getString(X_AD_Package_Exp.COLUMNNAME_File_Directory) + rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name)+rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory); log.log(Level.SEVERE,"fullDirectory" + fullDirectory); String targetDirectoryModified=null; char fileseperator1 = '/'; @@ -309,7 +320,7 @@ public class PackOut extends SvrProcess String target_File = (targetDirectoryModified); success = (new File(target_File).mkdirs()); - fullDirectory = rs.getString("File_Directory"); + fullDirectory = rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_File_Directory); targetDirectoryModified=null; //Correct package for proper file seperator if (fileSeperator.equals("/")){ @@ -318,13 +329,15 @@ public class PackOut extends SvrProcess else targetDirectoryModified = fullDirectory.replace(fileseperator2,fileseperator1); - CopyCode (targetDirectoryModified+rs.getString("FileName"),target_File+rs.getString("FileName")); + CopyCode( + targetDirectoryModified + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName), + target_File + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName)); atts.clear(); - if(rs.getString("Destination_Directory") != null){ + if(rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory) != null){ - fullDirectory = rs.getString("Destination_Directory"); + fullDirectory = rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory); String destinationDirectoryModified=null; //Correct package for proper file seperator @@ -334,21 +347,32 @@ public class PackOut extends SvrProcess else destinationDirectoryModified = fullDirectory.replace(fileseperator2,fileseperator1); - DistributeFile( rs.getString("FileName"), rs.getString("Target_Directory"), rs.getString("ReleaseNo"),destinationDirectoryModified, atts, hd_menu); + DistributeFile( + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName), + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory), + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo), + destinationDirectoryModified, atts, + hd_menu); } - if(rs.getString("FileName") != null){ + if(rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName) != null){ hd_documemt.startElement("","","file",atts); - hd_documemt.characters(("File: "+rs.getString("FileName")).toCharArray(),0,("File: "+rs.getString("FileName")).length()); + hd_documemt.characters(("File: "+rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName)).toCharArray(),0,("File: "+rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_FileName)).length()); hd_documemt.endElement("","","file"); - } + } hd_documemt.startElement("","","filedirectory",atts); - hd_documemt.characters(("Directory: "+rs.getString("TARGET_DIRECTORY")).toCharArray(),0,("Directory: "+rs.getString("TARGET_DIRECTORY")).length()); + hd_documemt.characters( + ("Directory: " + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory)).toCharArray(), + 0, + ("Directory: " + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory)).length()); hd_documemt.endElement("","","filedirectory"); hd_documemt.startElement("","","filenotes",atts); - hd_documemt.characters(("Notes: "+rs.getString("Description")).toCharArray(),0,(("Notes: " + rs.getString("Description")).length())); + hd_documemt.characters( + ("Notes: " + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Description)).toCharArray(), + 0, + (("Notes: " + rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Description)).length())); hd_documemt.endElement("","","filenotes"); } } @@ -591,6 +615,44 @@ public class PackOut extends SvrProcess { CopyFile (sourceName, copyName ); } + + public void CreateMessage (int AD_Message_ID, AttributesImpl atts, TransformerHandler hd_menu) throws SAXException + { + log.info(""); + + String sql = "SELECT value FROM AD_Message WHERE AD_Message_ID= " + AD_Message_ID; + + PreparedStatement pstmt = null; + pstmt = DB.prepareStatement (sql, get_TrxName()); + + try { + + ResultSet rs = pstmt.executeQuery(); + + while (rs.next()) + { + m_Message = new X_AD_Message (getCtx(), AD_Message_ID, null); + atts = createmessageBinding(atts,m_Message); + hd_menu.startElement("","","message",atts); + hd_menu.endElement("","","message"); + } + rs.close(); + pstmt.close(); + pstmt = null; + } + + catch (Exception e){ + log.log(Level.SEVERE,"getProcess", e); + } + finally{ + try { + if (pstmt != null) + pstmt.close (); + } + catch (Exception e){} + pstmt = null; + } + } public void CreateDynamicRuleValidation (int AD_Val_Rule_ID, AttributesImpl atts, TransformerHandler hd_menu) throws SAXException { @@ -2110,6 +2172,20 @@ public class PackOut extends SvrProcess return atts; } + public static AttributesImpl createmessageBinding( AttributesImpl atts, X_AD_Message m_Message) + { + atts.clear(); + //FIXME: may not need this I guess + //atts.addAttribute("","","AccessLevel","CDATA",(m_Message.getAccessLevel () != null ? m_Message.getAccessLevel ():"")); + atts.addAttribute("","","MsgText","CDATA",(m_Message.getMsgText() != null ? m_Message.getMsgText():"")); + atts.addAttribute("","","MsgType","CDATA",(m_Message.getMsgType() != null ? m_Message.getMsgType ():"")); + atts.addAttribute("","","MsgTip","CDATA",(m_Message.getMsgTip() != null ? m_Message.getMsgTip ():"")); + atts.addAttribute("","","Value","CDATA",(m_Message.getValue() != null ? m_Message.getValue ():"")); + atts.addAttribute("","","EntityType","CDATA",(m_Message.getEntityType () != null ? m_Message.getEntityType ():"")); + atts.addAttribute("","","isActive","CDATA",(m_Message.isActive()== true ? "true":"false")); + return atts; + } + public static AttributesImpl createdynamicvalidationruleBinding( AttributesImpl atts, X_AD_Val_Rule m_ValRule) { atts.clear(); diff --git a/base/src/org/compiere/model/X_AD_Package_Exp_Detail.java b/base/src/org/compiere/model/X_AD_Package_Exp_Detail.java index 2e0bb72670..14dfb10e43 100644 --- a/base/src/org/compiere/model/X_AD_Package_Exp_Detail.java +++ b/base/src/org/compiere/model/X_AD_Package_Exp_Detail.java @@ -56,13 +56,13 @@ public X_AD_Package_Exp_Detail (Properties ctx, ResultSet rs, String trxName) { super (ctx, rs, trxName); } -/** AD_Table_ID=50006 */ -public static final int Table_ID=MTable.getTable_ID("AD_Package_Exp_Detail"); - /** TableName=AD_Package_Exp_Detail */ public static final String Table_Name="AD_Package_Exp_Detail"; -protected static KeyNamePair Model = new KeyNamePair(Table_ID,"AD_Package_Exp_Detail"); +/** AD_Table_ID=50006 */ +public static final int Table_ID=MTable.getTable_ID(Table_Name); + +protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); protected BigDecimal accessLevel = BigDecimal.valueOf(4); /** AccessLevel @@ -146,6 +146,24 @@ return ii.intValue(); } /** Column name AD_Menu_ID */ public static final String COLUMNNAME_AD_Menu_ID = "AD_Menu_ID"; +/** Set Message. +@param AD_Message_ID System Message */ +public void setAD_Message_ID (int AD_Message_ID) +{ +if (AD_Message_ID <= 0) set_Value ("AD_Message_ID", null); + else +set_Value ("AD_Message_ID", Integer.valueOf(AD_Message_ID)); +} +/** Get Message. +@return System Message */ +public int getAD_Message_ID() +{ +Integer ii = (Integer)get_Value("AD_Message_ID"); +if (ii == null) return 0; +return ii.intValue(); +} +/** Column name AD_Message_ID */ +public static final String COLUMNNAME_AD_Message_ID = "AD_Message_ID"; /** Set AD_Package_Code_New. @param AD_Package_Code_New AD_Package_Code_New */ public void setAD_Package_Code_New (String AD_Package_Code_New) @@ -672,6 +690,8 @@ public static final String TYPE_Workflow = "F"; public static final String TYPE_ImportFormat = "IMP"; /** Application or Module = M */ public static final String TYPE_ApplicationOrModule = "M"; +/** Message = MSG */ +public static final String TYPE_Message = "MSG"; /** Process/Report = P */ public static final String TYPE_ProcessReport = "P"; /** ReportView = R */ @@ -695,8 +715,8 @@ public static final String TYPE_Form = "X"; public void setType (String Type) { if (Type == null) throw new IllegalArgumentException ("Type is mandatory"); -if (Type.equals("B") || Type.equals("C") || Type.equals("D") || Type.equals("F") || Type.equals("IMP") || Type.equals("M") || Type.equals("P") || Type.equals("R") || Type.equals("S") || Type.equals("SNI") || Type.equals("SQL") || Type.equals("T") || Type.equals("V") || Type.equals("W") || Type.equals("X")); - else throw new IllegalArgumentException ("Type Invalid value - " + Type + " - Reference_ID=50004 - B - C - D - F - IMP - M - P - R - S - SNI - SQL - T - V - W - X"); +if (Type.equals("B") || Type.equals("C") || Type.equals("D") || Type.equals("F") || Type.equals("IMP") || Type.equals("M") || Type.equals("MSG") || Type.equals("P") || Type.equals("R") || Type.equals("S") || Type.equals("SNI") || Type.equals("SQL") || Type.equals("T") || Type.equals("V") || Type.equals("W") || Type.equals("X")); + else throw new IllegalArgumentException ("Type Invalid value - " + Type + " - Reference_ID=50004 - B - C - D - F - IMP - M - MSG - P - R - S - SNI - SQL - T - V - W - X"); if (Type.length() > 10) { log.warning("Length > 10 - truncated"); diff --git a/migration/320-trunk/005_2pack_enhancements_message.sql b/migration/320-trunk/005_2pack_enhancements_message.sql new file mode 100644 index 0000000000..e726ddfa3c --- /dev/null +++ b/migration/320-trunk/005_2pack_enhancements_message.sql @@ -0,0 +1,75 @@ +ALTER TABLE AD_PACKAGE_EXP_DETAIL ADD ad_message_id NUMBER(10); + +INSERT INTO AD_COLUMN + (ad_column_id, ad_client_id, ad_org_id, isactive, + created, + updated, createdby, + updatedby, NAME, description, + HELP, VERSION, entitytype, columnname, + ad_table_id, ad_reference_id, fieldlength, iskey, isparent, + ismandatory, isupdateable, isidentifier, seqno, istranslated, + isencrypted, isselectioncolumn, ad_element_id, issyncdatabase, + isalwaysupdateable + ) + VALUES (50213, 0, 0, 'Y', + TO_DATE ('05/14/2007 19:48:41', 'MM/DD/YYYY HH24:MI:SS'), + TO_DATE ('05/14/2007 19:48:41', 'MM/DD/YYYY HH24:MI:SS'), 100, + 100, 'Message', 'System Message', + 'Information and Error messages', 0, 'D', 'AD_Message_ID', + 50006, 19, 22, 'N', 'N', + 'N', 'Y', 'N', 0, 'N', + 'N', 'N', 1752, 'N', + 'N' + ); + +INSERT INTO AD_FIELD + (ad_field_id, ad_client_id, ad_org_id, isactive, + created, createdby, + updated, updatedby, + NAME, description, HELP, + iscentrallymaintained, ad_tab_id, ad_column_id, isdisplayed, + displaylogic, displaylength, isreadonly, seqno, issameline, + isheading, isfieldonly, isencrypted, entitytype + ) + VALUES (50183, 0, 0, 'Y', + TO_DATE ('05/14/2007 19:51:35', 'MM/DD/YYYY HH24:MI:SS'), 100, + TO_DATE ('05/14/2007 19:52:28', 'MM/DD/YYYY HH24:MI:SS'), 100, + 'Message', 'System Message', 'Information and Error messages', + 'Y', 50006, 50213, 'Y', + '@Type@=''MSG''', 22, 'N', 246, 'N', + 'N', 'N', 'N', 'D' + ); + +INSERT INTO AD_REF_LIST + (ad_ref_list_id, ad_client_id, ad_org_id, isactive, + created, createdby, + updated, updatedby, + VALUE, NAME, ad_reference_id, entitytype + ) + VALUES (50043, 0, 0, 'Y', + TO_DATE ('05/14/2007 19:54:20', 'MM/DD/YYYY HH24:MI:SS'), 100, + TO_DATE ('05/14/2007 19:54:20', 'MM/DD/YYYY HH24:MI:SS'), 100, + 'MSG', 'Message', 50004, 'D' + ); + +COMMIT ; + +UPDATE AD_SEQUENCE + SET currentnextsys = (SELECT MAX (ad_column_id) + 1 + FROM AD_COLUMN + WHERE ad_column_id < 1000000) + WHERE NAME = 'AD_Column'; + +UPDATE AD_SEQUENCE + SET currentnextsys = (SELECT MAX (ad_field_id) + 1 + FROM AD_FIELD + WHERE ad_field_id < 1000000) + WHERE NAME = 'AD_Field'; + +UPDATE AD_SEQUENCE + SET currentnextsys = (SELECT MAX (ad_ref_list_id) + 1 + FROM AD_REF_LIST + WHERE ad_ref_list_id < 1000000) + WHERE NAME = 'AD_Ref_List'; + +COMMIT ; \ No newline at end of file