Great contribution from Tim Heath!

FR [ 1659903 ] Export & import WF in 2Pack
Bug [ 1663186 ] 2pack is not exporting Dynamic Validation
Contrib [ 1706928 ] 2Pack Workflow Import Functionality
Contrib [ 1706940 ] 2Pack Workflow Export Functionality
Contrib [ 1707038 ] 2Pack Dynamic Validation Rule Export Functionality
Contrib [ 1707039 ] 2Pack Dynamic Validation Rule Import Functionality
This commit is contained in:
Carlos Ruiz 2007-04-26 08:46:31 +00:00
parent 0c004aaf8e
commit 25cfe5ffc4
4 changed files with 1001 additions and 127 deletions

View File

@ -46,6 +46,7 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
import org.compiere.Adempiere;
import org.compiere.model.*;
import org.compiere.wf.*;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.CLogger;
@ -61,6 +62,7 @@ import org.xml.sax.helpers.DefaultHandler;
* @author Marco LOMBARDO, lombardo@mayking.com
* @author Robert KLEIN, robeklein@hotmail
*
* Contributor: William G. Heath - Import of workflows and dynamic validations
*/
public class PackInHandler extends DefaultHandler {
@ -88,7 +90,12 @@ public class PackInHandler extends DefaultHandler {
private X_AD_ImpFormat_Row m_ImpFormat_row = null;
private X_AD_ReportView m_Reportview = null;
private X_AD_ReportView_Col m_Reportview_Col = null;
private X_AD_Val_Rule m_ValRule = null;
private MTable m_Table = null;
private MWorkflow m_Workflow = null;
private MWFNode m_WFNode = null;
private MWFNodeNext m_WFNodeNext = null;
private MWFNextCondition m_WFNodeNextCondition = null;
private MRole m_Role = null;
private MColumn m_Column = null;
private MTab m_Tab;
@ -752,6 +759,362 @@ public class PackInHandler extends DefaultHandler {
}
}
}
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")) {
String name = atts.getValue("Name");
int id = get_IDWithColumn("AD_Val_Rule", "name", name);
m_ValRule = new X_AD_Val_Rule(m_ctx, id, m_trxName);
if (id > 0){
AD_Backup_ID = copyRecord("AD_Val_Rule",m_ValRule);
Object_Status = "Update";
}
else{
Object_Status = "New";
AD_Backup_ID =0;
}
m_ValRule.setDescription(atts.getValue("Description").replaceAll("'","''").replaceAll(",",""));
m_ValRule.setEntityType(atts.getValue("EntityType"));
m_ValRule.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue():true);
m_ValRule.setName(name);
m_ValRule.setType(atts.getValue("Type"));
m_ValRule.setCode(atts.getValue("Code"));
if (m_ValRule.save(m_trxName) == true){
record_log (1, m_ValRule.getName(),"Task", m_ValRule.get_ID(),AD_Backup_ID, Object_Status,"AD_Val_Rule",get_IDWithColumn("AD_Val_Rule", "Name", "AD_Val_Rule"));
}
else{
record_log (0, m_ValRule.getName(),"Task", m_ValRule.get_ID(),AD_Backup_ID, Object_Status,"AD_Val_Rule",get_IDWithColumn("AD_Val_Rule", "Name", "AD_Val_Rule"));
}
}
}
// workflow element.
else if (elementValue.equals("workflow")) {
log.info("In PackInHandler.java with element workflow");
log.info(elementValue+" "+atts.getValue("Name"));
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");
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);
Object_Status = "Update";
}
else{
Object_Status = "New";
AD_Backup_ID =0;
}
if (atts.getValue("ADWorkflowResponsibleNameID")!= null){
String name = atts.getValue("ADWorkflowResponsibleNameID");
id = get_IDWithColumn("AD_WF_Responsible", "Name", name);
m_Workflow.setAD_WF_Responsible_ID(id);
}
if (atts.getValue("ADTableNameID")!= null){
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"));
m_Workflow.setDescription(atts.getValue("Description").replaceAll("'","''").replaceAll(",",""));
m_Workflow.setHelp(atts.getValue("Help").replaceAll("'","''").replaceAll(",",""));
m_Workflow.setDurationUnit(atts.getValue("DurationUnit"));
m_Workflow.setAuthor(atts.getValue("Author"));
m_Workflow.setVersion(Integer.valueOf(atts.getValue("Version")));
m_Workflow.setPriority(Integer.valueOf(atts.getValue("Priority")));
m_Workflow.setLimit(Integer.valueOf(atts.getValue("Limit")));
m_Workflow.setDuration(Integer.valueOf(atts.getValue("Duration")));
m_Workflow.setCost(Integer.valueOf(atts.getValue("Cost")));
m_Workflow.setWorkingTime(Integer.valueOf(atts.getValue("WorkingTime")));
m_Workflow.setWaitingTime(Integer.valueOf(atts.getValue("WaitingTime")));
m_Workflow.setPublishStatus(atts.getValue("PublishStatus"));
m_Workflow.setWorkflowType(atts.getValue("WorkflowType"));
m_Workflow.setDocValueLogic(atts.getValue("DocValueLogic"));
m_Workflow.setIsValid(atts.getValue("isValid") != null ? Boolean.valueOf(atts.getValue("isValid")).booleanValue():true);
m_Workflow.setEntityType(atts.getValue("EntityType"));
m_Workflow.setAD_WF_Node_ID(-1);
// log.info("in3");
attsOut.clear();
log.info("about to execute m_Workflow.save");
if (m_Workflow.save(m_trxName) == true){
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");
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");
}
}
// workflowNode element.
else if (elementValue.equals("workflowNode")) {
log.info("In PackInHandler.java with element workflowNode");
log.info(elementValue+" "+atts.getValue("Name"));
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");
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);
m_WFNode = new MWFNode(m_ctx, id, m_trxName);
if (id > 0){
AD_Backup_ID = copyRecord("AD_WF_Node",m_WFNode);
Object_Status = "Update";
}
else{
Object_Status = "New";
AD_Backup_ID =0;
}
m_WFNode.setName(workflowNodeName);
String Name = atts.getValue("ADWorkflowNameID");
id = get_IDWithColumn("AD_Workflow", "Name", Name);
m_WFNode.setAD_Workflow_ID(id);
if (atts.getValue("ADProcessNameID")!= null){
Name = atts.getValue("ADProcessNameID");
id = get_IDWithColumn("AD_Process", "Name", Name);
m_WFNode.setAD_Process_ID(id);
}
if (atts.getValue("ADFormNameID")!= null){
String name = atts.getValue("ADFormNameID");
id = get_IDWithColumn("AD_Form", "Name", name);
m_WFNode.setAD_Form_ID(id);
}
if (atts.getValue("ADWorkflowResponsibleNameID")!= null){
String name = atts.getValue("ADWorkflowResponsibleNameID");
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);
m_WFNode.setAD_Window_ID(id);
}
if (atts.getValue("ADImageNameID")!= null){
String name = atts.getValue("ADImageNameID");
id = get_IDWithColumn("AD_Image", "Name", name);
m_WFNode.setAD_Image_ID(id);
}
if (atts.getValue("ADWorkflowBlockNameID")!= null){
String name = atts.getValue("ADWorkflowBlockNameID");
id = get_IDWithColumn("AD_WF_Block", "Name", name);
m_WFNode.setAD_WF_Block_ID(id);
}
/* 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"));
m_WFNode.setDescription(atts.getValue("Description").replaceAll("'","''").replaceAll(",",""));
m_WFNode.setJoinElement(atts.getValue("JoinElement"));
m_WFNode.setSplitElement(atts.getValue("SplitElement"));
m_WFNode.setXPosition(Integer.valueOf(atts.getValue("XPosition")));
m_WFNode.setYPosition(Integer.valueOf(atts.getValue("YPosition")));
m_WFNode.setWaitingTime(Integer.valueOf(atts.getValue("WaitingTime")));
m_WFNode.setWaitTime(Integer.valueOf(atts.getValue("WaitTime")));
m_WFNode.setWorkingTime(Integer.valueOf(atts.getValue("WorkingTime")));
m_WFNode.setCost(new BigDecimal(atts.getValue("Cost")));
m_WFNode.setDuration(Integer.valueOf(atts.getValue("Duration")));
m_WFNode.setPriority(Integer.valueOf(atts.getValue("Priority")));
//FIXME: Failing for some reason on a ""
//m_WFNode.setStartMode(atts.getValue("StartMode"));
//FIXME: Failing for some reason on a ""
//m_WFNode.setSubflowExecution(atts.getValue("SubflowExecution"));
m_WFNode.setIsCentrallyMaintained(Boolean.valueOf(atts.getValue("IsCentrallyMaintained")).booleanValue());
m_WFNode.setDynPriorityChange(new BigDecimal(atts.getValue("DynPriorityChange")));
//m_WFNode.setAccessLevel (atts.getValue("AccessLevel"));
//FIXME: Failing for some reason on a ""
//m_WFNode.setDynPriorityUnit (atts.getValue("DynPriorityUnit"));
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");
if (m_WFNode.save(m_trxName) == true){
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");
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");
}
}
// 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");
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 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);
m_WFNodeNext = new MWFNodeNext(m_ctx, id, m_trxName);
if (id > 0){
AD_Backup_ID = copyRecord("AD_WF_NodeNext",m_WFNodeNext);
Object_Status = "Update";
}
else{
Object_Status = "New";
AD_Backup_ID =0;
}
m_WFNodeNext.setAD_WF_Node_ID(wfNodeId);
m_WFNodeNext.setAD_WF_Next_ID(wfNodeNextId);
m_WFNodeNext.setEntityType(atts.getValue("EntityType"));
m_WFNodeNext.setSeqNo(Integer.valueOf(atts.getValue("SeqNo")));
m_WFNodeNext.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue():true);
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");
if (m_WFNodeNext.save(m_trxName) == true){
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");
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");
}
}
// 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");
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 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);
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);
m_WFNodeNextCondition = new MWFNextCondition(m_ctx, id, m_trxName);
if (id > 0){
AD_Backup_ID = copyRecord("AD_WF_NextCondition",m_WFNodeNextCondition);
Object_Status = "Update";
}
else{
Object_Status = "New";
AD_Backup_ID =0;
}
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"));
m_WFNodeNextCondition.setAD_Column_ID(columnId);
m_WFNodeNextCondition.setAD_WF_NodeNext_ID(wfNodeNextTablePKId);
m_WFNodeNextCondition.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue():true);
m_WFNodeNextCondition.setAD_WF_NodeNext_ID(wfNodeNextTablePKId);
m_WFNodeNextCondition.setSeqNo(Integer.valueOf(atts.getValue("SeqNo")));
m_WFNodeNextCondition.setEntityType(atts.getValue("EntityType"));
m_WFNodeNextCondition.setAndOr(atts.getValue("AndOr"));
m_WFNodeNextCondition.setOperation(atts.getValue("Operation"));
m_WFNodeNextCondition.setValue(atts.getValue("Value"));
m_WFNodeNextCondition.setValue2(atts.getValue("Value2"));
attsOut.clear();
log.info("about to execute m_WFNodeNextCondition.save");
if (m_WFNodeNextCondition.save(m_trxName) == true){
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");
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");
}
}
// table element.
else if (elementValue.equals("table")) {
log.info(elementValue+" "+atts.getValue("ADTableNameID"));

View File

@ -50,13 +50,11 @@ import org.compiere.model.X_AD_Ref_List;
import org.compiere.model.X_AD_ReportView;
import org.compiere.model.X_AD_ReportView_Col;
import org.compiere.model.X_AD_Role;
import org.compiere.model.X_AD_Window_Access;
import org.compiere.model.X_AD_Process_Access;
import org.compiere.model.X_AD_Form_Access;
import org.compiere.model.X_AD_Workflow_Access;
import org.compiere.model.X_AD_Task_Access;
import org.compiere.model.X_AD_Role_OrgAccess;
import org.compiere.model.X_AD_User_Roles;
import org.compiere.model.X_AD_Workflow;
import org.compiere.model.X_AD_Val_Rule;
import org.compiere.model.X_AD_WF_Node;
import org.compiere.model.X_AD_WF_NodeNext;
import org.compiere.model.X_AD_WF_NextCondition;
import org.compiere.util.DB;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
@ -69,6 +67,7 @@ import org.compiere.process.*;
* @author Robert Klein
* @version $Id: PackOut.java,v 1.0
*
* Contributor: William G. Heath - Export of workflows and dynamic validations
*/
public class PackOut extends SvrProcess
@ -78,6 +77,11 @@ public class PackOut extends SvrProcess
private X_AD_Window m_Window = null;
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_WF_Node m_WF_Node = null;
private X_AD_WF_NodeNext m_WF_NodeNext = null;
private X_AD_WF_NextCondition m_WF_NodeNextCondition = null;
private X_AD_Val_Rule m_ValRule = null;
private X_AD_Column m_Column = null;
private X_AD_Tab m_Tab = null;
private X_AD_PrintFormat m_Printformat = null;
@ -96,21 +100,12 @@ public class PackOut extends SvrProcess
private X_AD_Preference m_Preference= null;
private X_AD_ImpFormat m_ImpFormat= null;
private X_AD_ImpFormat_Row m_ImpFormat_Row= null;
private X_AD_Window_Access m_Window_Access = null;
private X_AD_Process_Access m_Process_Access = null;
private X_AD_Form_Access m_Form_Access = null;
private X_AD_Workflow_Access m_Workflow_Access = null;
private X_AD_Task_Access m_Task_Access = null;
private X_AD_Role_OrgAccess m_Role_OrgAccess = null;
private X_AD_User_Roles m_User_Role = null;
private String PackOutVer = "005";
private String packagedir = null;
private String packagename = null;
private String includesdir = null;
private int Table_ID[] = new int [1000];
private int Table_Count = 0;
private int PK_AD_Client_ID = 0;
private int PK_AD_Org_ID = 0;
String fileSeperator=null;
/**
* Prepare - e.g., get Parameters.
@ -294,11 +289,14 @@ public class PackOut extends SvrProcess
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);
else if (Type.compareTo("F") == 0)
//TODO Create Workflow
CreateWorkflow (rs.getInt("AD_Workflow_ID"), atts, hd_menu);
else if (Type.compareTo("V") == 0)
CreateDynamicRuleValidation(rs.getInt("AD_Val_Rule_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");
log.log(Level.SEVERE,"fullDirectory" + fullDirectory);
String targetDirectoryModified=null;
char fileseperator1 = '/';
char fileseperator2 = '\\';
@ -594,10 +592,149 @@ public class PackOut extends SvrProcess
CopyFile (sourceName, copyName );
}
public void CreateDynamicRuleValidation (int AD_Val_Rule_ID, AttributesImpl atts, TransformerHandler hd_menu) throws SAXException
{
log.info("");
String sql = "SELECT Name FROM AD_Val_Rule WHERE AD_Val_Rule_ID= " + AD_Val_Rule_ID;
PreparedStatement pstmt = null;
pstmt = DB.prepareStatement (sql, get_TrxName());
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
m_ValRule = new X_AD_Val_Rule (getCtx(), AD_Val_Rule_ID, null);
atts = createdynamicvalidationruleBinding(atts,m_ValRule);
hd_menu.startElement("","","dynvalrule",atts);
hd_menu.endElement("","","dynvalrule");
}
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 CreateWorkflow (int AD_Workflow_ID, AttributesImpl atts, TransformerHandler hd_menu) throws SAXException
{
//TODO Create workflow
log.info("");
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;
PreparedStatement pstmt = null;
pstmt = DB.prepareStatement (sql, get_TrxName());
try {
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
m_Workflow = new X_AD_Workflow (getCtx(), AD_Workflow_ID, null);
atts = createworkflowBinding(atts,m_Workflow);
hd_menu.startElement("","","workflow",atts);
String sql1 = "SELECT * FROM AD_WF_Node WHERE AD_Workflow_ID = " + AD_Workflow_ID;
PreparedStatement pstmt1 = null;
pstmt1 = DB.prepareStatement (sql1, get_TrxName());
try {
ResultSet rs1 = pstmt1.executeQuery();
while (rs1.next()){
if (rs1.getInt("AD_WF_Node_ID")>0)
m_WF_Node = new X_AD_WF_Node(getCtx(), rs1.getInt("AD_WF_Node_ID"), null);
atts = createwf_nodeBinding(atts,m_WF_Node);
hd_menu.startElement("","","workflowNode",atts);
hd_menu.endElement("","","workflowNode");
}
// Generated workflowNodeNext(s) and workflowNodeNextCondition(s)
ResultSet rs2 = pstmt1.executeQuery();
while (rs2.next()){
if (rs2.getInt("AD_WF_Node_ID")>0)
m_WF_Node = new X_AD_WF_Node(getCtx(), rs2.getInt("AD_WF_Node_ID"), null);
ad_wf_nodenext_id = 0;
sql = "SELECT ad_wf_nodenext_id from ad_wf_nodenext WHERE ad_wf_node_id = ?";
ad_wf_nodenext_id = DB.getSQLValue(null,sql,m_WF_Node.getAD_WF_Node_ID());
if (ad_wf_nodenext_id > 0){
m_WF_NodeNext = new X_AD_WF_NodeNext(getCtx(), ad_wf_nodenext_id, null);
atts = createwf_nodenextBinding(atts,m_WF_NodeNext);
hd_menu.startElement("","","workflowNodeNext",atts);
hd_menu.endElement("","","workflowNodeNext");
ad_wf_nodenextcondition_id = 0;
sql = "SELECT ad_wf_nextcondition_id from ad_wf_nextcondition WHERE ad_wf_nodenext_id = ?";
ad_wf_nodenextcondition_id = DB.getSQLValue(null,sql,m_WF_Node.getAD_WF_Node_ID());
log.info("ad_wf_nodenextcondition_id: " + String.valueOf(ad_wf_nodenextcondition_id));
if (ad_wf_nodenextcondition_id > 0){
m_WF_NodeNextCondition = new X_AD_WF_NextCondition(getCtx(), ad_wf_nodenextcondition_id, null);
atts = createwf_nodenextconditionBinding(atts,m_WF_NodeNextCondition);
hd_menu.startElement("","","workflowNodeNextCondition",atts);
hd_menu.endElement("","","workflowNodeNextCondition");
}
}
}
rs2.close();
rs1.close();
pstmt1.close();
pstmt1 = null;
}
catch (Exception e) {
log.log(Level.SEVERE,"getProcess", e);
}
finally {
try {
if (pstmt1 != null)
pstmt1.close ();
}
catch (Exception e){}
pstmt1 = null;
}
hd_menu.endElement("","","workflow");
}
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 CreateWorkbench (int AD_Workbench_ID, AttributesImpl atts, TransformerHandler hd_menu) throws SAXException
{
@ -1969,6 +2106,80 @@ public class PackOut extends SvrProcess
return atts;
}
public static AttributesImpl createdynamicvalidationruleBinding( AttributesImpl atts, X_AD_Val_Rule m_ValRule)
{
atts.clear();
atts.addAttribute("","","Name","CDATA",(m_ValRule.getName () != null ? m_ValRule.getName ():""));
//FIXME: may not need this I guess
//atts.addAttribute("","","AccessLevel","CDATA",(m_ValRule.getAccessLevel () != null ? m_ValRule.getAccessLevel ():""));
atts.addAttribute("","","Code","CDATA",(m_ValRule.getCode() != null ? m_ValRule.getCode ():""));
atts.addAttribute("","","Description","CDATA",(m_ValRule.getDescription () != null ? m_ValRule.getDescription ():""));
atts.addAttribute("","","EntityType","CDATA",(m_ValRule.getEntityType () != null ? m_ValRule.getEntityType ():""));
atts.addAttribute("","","Type","CDATA",(m_ValRule.getType () != null ? m_ValRule.getType ():""));
atts.addAttribute("","","isActive","CDATA",(m_ValRule.isActive()== true ? "true":"false"));
return atts;
}
public static AttributesImpl createworkflowBinding( AttributesImpl atts, X_AD_Workflow m_Workflow)
{
String sql = null;
String name = null;
atts.clear();
atts.addAttribute("","","Name","CDATA",(m_Workflow.getName () != null ? m_Workflow.getName ():""));
if (m_Workflow.getAD_Table_ID()> 0 ){
sql = "SELECT Name FROM AD_Table WHERE AD_Table_ID=?";
name = DB.getSQLValueString(null,sql,m_Workflow.getAD_Table_ID());
atts.addAttribute("","","ADTableNameID","CDATA",name);
}
else
atts.addAttribute("","","ADTableNameID","CDATA","");
if (m_Workflow.getAD_WF_Node_ID()> 0 ){
sql = "SELECT Name FROM AD_WF_Node WHERE AD_WF_Node_ID=?";
name = DB.getSQLValueString(null,sql,m_Workflow.getAD_WF_Node_ID());
atts.addAttribute("","","ADWorkflowNodeNameID","CDATA",name);
}
else
atts.addAttribute("","","ADWorkflowNodeNameID","CDATA","");
if (m_Workflow.getAD_WF_Responsible_ID()> 0 ){
sql = "SELECT Name FROM AD_WF_Responsible WHERE AD_WF_Responsible_ID=?";
name = DB.getSQLValueString(null,sql,m_Workflow.getAD_WF_Responsible_ID());
atts.addAttribute("","","ADWorkflowResponsibleNameID","CDATA",name);
}
else
atts.addAttribute("","","ADWorkflowResponsibleNameID","CDATA","");
if (m_Workflow.getAD_WorkflowProcessor_ID()> 0 ){
sql = "SELECT Name FROM AD_WorkflowProcessor_ID WHERE AD_WorkflowProcessor_ID=?";
name = DB.getSQLValueString(null,sql,m_Workflow.getAD_WorkflowProcessor_ID());
atts.addAttribute("","","ADWorkflowProcessorNameID","CDATA",name);
}
else
atts.addAttribute("","","ADWorkflowProcessorNameID","CDATA","");
atts.addAttribute("","","AccessLevel","CDATA",(m_Workflow.getAccessLevel () != null ? m_Workflow.getAccessLevel ():""));
atts.addAttribute("","","DurationUnit","CDATA",(m_Workflow.getDurationUnit() != null ? m_Workflow.getDurationUnit ():""));
atts.addAttribute("","","Help","CDATA",(m_Workflow.getHelp() != null ? m_Workflow.getHelp():""));
atts.addAttribute("","","Description","CDATA",(m_Workflow.getDescription () != null ? m_Workflow.getDescription ():""));
atts.addAttribute("","","EntityType","CDATA",(m_Workflow.getEntityType () != null ? m_Workflow.getEntityType ():""));
atts.addAttribute("","","Author","CDATA",(m_Workflow.getAuthor () != null ? m_Workflow.getAuthor ():""));
atts.addAttribute("","","Version","CDATA",(""+m_Workflow.getVersion() != null ? ""+m_Workflow.getVersion ():""));
//FIXME: Handle dates
//atts.addAttribute("","","ValidFrom","CDATA",(m_Workflow.getValidFrom ().toGMTString() != null ? m_Workflow.getValidFrom().toGMTString():""));
//atts.addAttribute("","","ValidTo","CDATA",(m_Workflow.getValidTo ().toGMTString() != null ? m_Workflow.getValidTo().toGMTString():""));
atts.addAttribute("","","Priority","CDATA",(""+m_Workflow.getPriority ()));
atts.addAttribute("","","Limit","CDATA",(""+m_Workflow.getLimit()));
atts.addAttribute("","","Duration","CDATA",(""+m_Workflow.getDuration()));
atts.addAttribute("","","Cost","CDATA",(""+m_Workflow.getCost () ));
atts.addAttribute("","","WorkingTime","CDATA",(""+m_Workflow.getWorkingTime() ));
atts.addAttribute("","","WaitingTime","CDATA",(""+m_Workflow.getWaitingTime() ));
atts.addAttribute("","","PublishStatus","CDATA",(m_Workflow.getPublishStatus() != null ? m_Workflow.getPublishStatus():""));
atts.addAttribute("","","WorkflowType","CDATA",(m_Workflow.getWorkflowType () != null ? m_Workflow.getWorkflowType ():""));
atts.addAttribute("","","DocValueLogic","CDATA",(m_Workflow.getDocValueLogic() != null ? m_Workflow.getDocValueLogic():""));
atts.addAttribute("","","isValid","CDATA",(m_Workflow.isValid()== true ? "true":"false"));
//Doesn't appear to be necessary
//atts.addAttribute("","","SetupTime","CDATA",(""+m_Workflow.getSetupTime() != null ? ""+m_Workflow.getSetupTime():""));
return atts;
}
public static AttributesImpl createtableBinding( AttributesImpl atts, X_AD_Table m_Table)
{
String sql = null;
@ -2020,6 +2231,207 @@ public class PackOut extends SvrProcess
return atts;
}
public static AttributesImpl createwf_nodeBinding( AttributesImpl atts, X_AD_WF_Node m_WF_Node)
{
String sql = null;
String name = null;
atts.clear();
atts.addAttribute("","","Name","CDATA",(m_WF_Node.getName () != null ? m_WF_Node.getName():""));
if (m_WF_Node.getAD_Workflow_ID()> 0 ){
sql = "SELECT Name FROM AD_Workflow WHERE AD_Workflow_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_Node.getAD_Workflow_ID());
atts.addAttribute("","","ADWorkflowNameID","CDATA",name);
}
else
atts.addAttribute("","","ADWorkflowNameID","CDATA","");
if (m_WF_Node.getAD_Window_ID()> 0 ){
sql = "SELECT Name FROM AD_Window WHERE AD_Window_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_Node.getAD_Window_ID());
}
if (name != null )
atts.addAttribute("","","ADWindowNameID","CDATA",name);
else
atts.addAttribute("","","ADWindowNameID","CDATA","");
if (m_WF_Node.getAD_Task_ID()> 0 ){
sql = "SELECT Name FROM AD_Task WHERE AD_Task_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_Node.getAD_Task_ID());
}
if (name != null )
atts.addAttribute("","","ADTaskNameID","CDATA",name);
else
atts.addAttribute("","","ADTaskNameID","CDATA","");
if (m_WF_Node.getAD_Process_ID()> 0 ){
sql = "SELECT Name FROM AD_Process WHERE AD_Process_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_Node.getAD_Process_ID());
atts.addAttribute("","","ADProcessNameID","CDATA",name);
}
else
atts.addAttribute("","","ADProcessNameID","CDATA","");
if (m_WF_Node.getAD_Form_ID()> 0 ){
sql = "SELECT Name FROM AD_Form WHERE AD_Form_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_Node.getAD_Form_ID());
atts.addAttribute("","","ADFormNameID","CDATA",name);
}
else
atts.addAttribute("","","ADFormNameID","CDATA","");
if (m_WF_Node.getAD_WF_Block_ID()> 0 ){
sql = "SELECT Name FROM AD_WF_Block WHERE AD_WF_Block_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_Node.getAD_WF_Block_ID());
atts.addAttribute("","","ADWorkflowBlockNameID","CDATA",name);
}
else
atts.addAttribute("","","ADWorkflowBlockNameID","CDATA","");
if (m_WF_Node.getAD_WF_Responsible_ID()> 0 ){
sql = "SELECT Name FROM AD_WF_Responsible WHERE AD_WF_Responsible_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_Node.getAD_WF_Responsible_ID());
atts.addAttribute("","","ADWorkflowResponsibleNameID","CDATA",name);
}
else
atts.addAttribute("","","ADWorkflowResponsibleNameID","CDATA","");
if (m_WF_Node.getAD_Image_ID()> 0 ){
sql = "SELECT Name FROM AD_Image WHERE AD_Image_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_Node.getAD_Image_ID());
}
if (name != null )
atts.addAttribute("","","ADImageNameID","CDATA",name);
else
atts.addAttribute("","","ADImageNameID","CDATA","");
if (m_WF_Node.getAD_Column_ID()> 0 ){
sql = "SELECT ColumnName FROM AD_Column WHERE AD_Column_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_Node.getAD_Column_ID());
atts.addAttribute("","","ADColumnNameID","CDATA",name);
}
else
atts.addAttribute("","","ADColumnNameID","CDATA","");
atts.addAttribute("","","isActive","CDATA",(m_WF_Node.isActive()== true ? "true":"false"));
atts.addAttribute("","","Description","CDATA",(m_WF_Node.getDescription () != null ? m_WF_Node.getDescription ():""));
atts.addAttribute("","","Help","CDATA",(m_WF_Node.getHelp () != null ? m_WF_Node.getHelp ():""));
atts.addAttribute("","","isCentrallyMaintained","CDATA",(m_WF_Node.isCentrallyMaintained ()== true ? "true":"false"));
atts.addAttribute("","","Action","CDATA",(m_WF_Node.getAction () != null ? m_WF_Node.getAction ():""));
atts.addAttribute("","","EntityType","CDATA",(m_WF_Node.getEntityType () != null ? m_WF_Node.getEntityType ():""));
atts.addAttribute("","","XPosition","CDATA",(""+m_WF_Node.getXPosition ()));
atts.addAttribute("","","YPosition","CDATA",(""+m_WF_Node.getYPosition ()));
atts.addAttribute("","","SubflowExecution","CDATA",(m_WF_Node.getSubflowExecution () != null ? m_WF_Node.getSubflowExecution ():""));
atts.addAttribute("","","StartMode","CDATA",(m_WF_Node.getStartMode () != null ? m_WF_Node.getStartMode ():""));
atts.addAttribute("","","Priority","CDATA",(""+m_WF_Node.getPriority ()));
atts.addAttribute("","","Duration","CDATA",(""+m_WF_Node.getDuration () ));
atts.addAttribute("","","Cost","CDATA",(""+m_WF_Node.getCost () ));
atts.addAttribute("","","WorkingTime","CDATA",(""+m_WF_Node.getWorkingTime() ));
atts.addAttribute("","","WaitingTime","CDATA",(""+m_WF_Node.getWaitingTime() ));
atts.addAttribute("","","JoinElement","CDATA",(m_WF_Node.getJoinElement() != null ? m_WF_Node.getJoinElement():""));
atts.addAttribute("","","SplitElement","CDATA",(m_WF_Node.getSplitElement() != null ? m_WF_Node.getSplitElement():""));
atts.addAttribute("","","WaitTime","CDATA",(""+m_WF_Node.getWaitTime() ));
atts.addAttribute("","","AttributeName","CDATA",(m_WF_Node.getAttributeName() != null ? m_WF_Node.getAttributeName():""));
atts.addAttribute("","","AttributeValue","CDATA",(m_WF_Node.getAttributeValue() != null ? m_WF_Node.getAttributeValue():""));
atts.addAttribute("","","DocAction","CDATA",(m_WF_Node.getDocAction() != null ? m_WF_Node.getDocAction():""));
atts.addAttribute("","","DynPriorityUnit","CDATA",(m_WF_Node.getDynPriorityUnit() != null ? m_WF_Node.getDynPriorityUnit():""));
atts.addAttribute("","","DynPriorityChange","CDATA",(""+m_WF_Node.getDynPriorityChange() ));
return atts;
}
public static AttributesImpl createwf_nodenextBinding( AttributesImpl atts, X_AD_WF_NodeNext m_WF_NodeNext)
//public AttributesImpl createwf_nodenextBinding( AttributesImpl atts, X_AD_WF_NodeNext m_WF_NodeNext, X_AD_WF_Node m_WF_Node)
{
String sql = null;
String name = null;
atts.clear();
//log.log(Level.INFO,"m_WF_NodeNext.getAD_WF_Node_ID: ", m_WF_NodeNext.getAD_WF_Node_ID());
//log.log(Level.INFO,"m_WF_NodeNext.getAD_WF_Next_ID: ", m_WF_NodeNext.getAD_WF_Next_ID());
if (m_WF_NodeNext.getAD_WF_Node_ID() > 0 ){
sql = "SELECT AD_Workflow.Name FROM AD_Workflow, AD_WF_Node WHERE AD_Workflow.AD_Workflow_ID = AD_WF_Node.AD_Workflow_ID and AD_WF_Node.AD_WF_Node_ID =?";
name = DB.getSQLValueString(null,sql,m_WF_NodeNext.getAD_WF_Node_ID());
atts.addAttribute("","","ADWorkflowNameID","CDATA",name);
sql = "SELECT Name FROM AD_WF_Node WHERE AD_WF_Node_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_NodeNext.getAD_WF_Node_ID());
atts.addAttribute("","","ADWorkflowNodeNameID","CDATA",name);
}
if (m_WF_NodeNext.getAD_WF_Next_ID() > 0 ){
sql = "SELECT Name FROM AD_WF_Node WHERE AD_WF_Node_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_NodeNext.getAD_WF_Next_ID());
//log.log(Level.INFO,"node next name: ", name);
atts.addAttribute("","","ADWorkflowNodeNextNameID","CDATA",name);
}
// FIXME: don't know if I need org_id or not
//sql = "SELECT Name FROM AD_Org WHERE AD_Org_ID=?";
//name = DB.getSQLValueString(null,sql,org_id);
//atts.addAttribute("","","orgname","CDATA",name);
atts.addAttribute("","","isActive","CDATA",(m_WF_NodeNext.isActive()== true ? "true":"false"));
atts.addAttribute("","","EntityType","CDATA",(m_WF_NodeNext.getEntityType () != null ? m_WF_NodeNext.getEntityType ():""));
atts.addAttribute("","","Description","CDATA",(m_WF_NodeNext.getDescription () != null ? m_WF_NodeNext.getDescription ():""));
atts.addAttribute("","","SeqNo","CDATA",(String.valueOf(m_WF_NodeNext.getSeqNo ()) != null ? String.valueOf(m_WF_NodeNext.getSeqNo ()):""));
atts.addAttribute("","","IsStdUserWorkflow","CDATA",(String.valueOf(m_WF_NodeNext.isStdUserWorkflow ()) != null ? String.valueOf(m_WF_NodeNext.isStdUserWorkflow ()):""));
return atts;
}
public static AttributesImpl createwf_nodenextconditionBinding( AttributesImpl atts, X_AD_WF_NextCondition m_WF_NodeNextCondition)
{
String sql = null;
String name = null;
atts.clear();
if (m_WF_NodeNextCondition.getAD_WF_NodeNext_ID() > 0 ){
//FIXME: it appears nodes point back to themselves
// so a group by is necessary
sql = "SELECT AD_Workflow.Name FROM AD_Workflow, AD_WF_Node, AD_WF_NodeNext WHERE AD_Workflow.AD_Workflow_ID = AD_WF_Node.AD_Workflow_ID and AD_WF_Node.AD_WF_Node_ID = AD_WF_NodeNext.AD_WF_Node_ID and AD_WF_NodeNext.AD_WF_NodeNext_ID = ? group by AD_Workflow.Name";
name = DB.getSQLValueString(null,sql,m_WF_NodeNextCondition.getAD_WF_NodeNext_ID());
atts.addAttribute("","","ADWorkflowNameID","CDATA",name);
//FIXME: it appears nodes point back to themselves
// so a group by is necessary
sql = "SELECT AD_WF_Node.Name FROM AD_WF_Node, AD_WF_NodeNext WHERE AD_WF_Node.AD_WF_Node_ID = AD_WF_NodeNext.AD_WF_Node_ID and AD_WF_NodeNext.AD_WF_NodeNext_ID = ? group by AD_WF_Node.Name";
name = DB.getSQLValueString(null,sql,m_WF_NodeNextCondition.getAD_WF_NodeNext_ID());
atts.addAttribute("","","ADWorkflowNodeNameID","CDATA",name);
//FIXME: it appears nodes point back to themselves
// so a group by is necessary
sql = "SELECT AD_WF_Node.Name FROM AD_WF_Node, AD_WF_NodeNext, AD_WF_NextCondition WHERE AD_WF_Node.AD_WF_Node_ID = AD_WF_NodeNext.AD_WF_Next_ID and AD_WF_NodeNext.AD_WF_NodeNext_ID = ? group by AD_WF_Node.Name";
name = DB.getSQLValueString(null,sql,m_WF_NodeNextCondition.getAD_WF_NodeNext_ID());
//log.log(Level.INFO,"node next name: ", name);
atts.addAttribute("","","ADWorkflowNodeNextNameID","CDATA",name);
}
if (m_WF_NodeNextCondition.getAD_Column_ID()> 0 ){
sql = "SELECT AD_Table.TableName FROM AD_Table, AD_Column, AD_WF_NextCondition WHERE AD_Column.AD_Table_ID=AD_Table.AD_Table_ID and AD_Column.AD_Column_ID = ?";
name = DB.getSQLValueString(null,sql,m_WF_NodeNextCondition.getAD_Column_ID());
atts.addAttribute("","","ADTableNameID","CDATA",name);
sql = "SELECT ColumnName FROM AD_Column WHERE AD_Column_ID=?";
name = DB.getSQLValueString(null,sql,m_WF_NodeNextCondition.getAD_Column_ID());
atts.addAttribute("","","ADColumnNameID","CDATA",name);
}
else {
atts.addAttribute("","","ADTableNameID","CDATA",name);
atts.addAttribute("","","ADColumnNameID","CDATA","");
}
// FIXME: don't know if I need org_id or not
//sql = "SELECT Name FROM AD_Org WHERE AD_Org_ID=?";
//name = DB.getSQLValueString(null,sql,org_id);
//atts.addAttribute("","","orgname","CDATA",name);
atts.addAttribute("","","isActive","CDATA",(m_WF_NodeNextCondition.isActive()== true ? "true":"false"));
atts.addAttribute("","","EntityType","CDATA",(m_WF_NodeNextCondition.getEntityType () != null ? m_WF_NodeNextCondition.getEntityType ():""));
atts.addAttribute("","","AndOr","CDATA",(m_WF_NodeNextCondition.getAndOr () != null ? m_WF_NodeNextCondition.getAndOr ():""));
atts.addAttribute("","","Operation","CDATA",(m_WF_NodeNextCondition.getOperation () != null ? m_WF_NodeNextCondition.getOperation ():""));
atts.addAttribute("","","Value","CDATA",(m_WF_NodeNextCondition.getValue () != null ? m_WF_NodeNextCondition.getValue ():""));
atts.addAttribute("","","Value2","CDATA",(m_WF_NodeNextCondition.getValue2 () != null ? m_WF_NodeNextCondition.getValue2 ():""));
atts.addAttribute("","","SeqNo","CDATA",(String.valueOf(m_WF_NodeNextCondition.getSeqNo ()) != null ? String.valueOf(m_WF_NodeNextCondition.getSeqNo ()):""));
return atts;
}
public static AttributesImpl createcolumnBinding( AttributesImpl atts, X_AD_Column m_Column)
{
String sql = null;

View File

@ -296,6 +296,24 @@ return ii.intValue();
}
/** Column name AD_Table_ID */
public static final String COLUMNNAME_AD_Table_ID = "AD_Table_ID";
/** Set Dynamic Validation.
@param AD_Val_Rule_ID Dynamic Validation Rule */
public void setAD_Val_Rule_ID (int AD_Val_Rule_ID)
{
if (AD_Val_Rule_ID <= 0) set_Value ("AD_Val_Rule_ID", null);
else
set_Value ("AD_Val_Rule_ID", Integer.valueOf(AD_Val_Rule_ID));
}
/** Get Dynamic Validation.
@return Dynamic Validation Rule */
public int getAD_Val_Rule_ID()
{
Integer ii = (Integer)get_Value("AD_Val_Rule_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Column name AD_Val_Rule_ID */
public static final String COLUMNNAME_AD_Val_Rule_ID = "AD_Val_Rule_ID";
/** Set Window.
@param AD_Window_ID Data entry or display window */
public void setAD_Window_ID (int AD_Window_ID)
@ -666,6 +684,8 @@ public static final String TYPE_CodeSnipit = "SNI";
public static final String TYPE_SQLStatement = "SQL";
/** Table = T */
public static final String TYPE_Table = "T";
/** Dynamic Validation Rule = V */
public static final String TYPE_DynamicValidationRule = "V";
/** Window = W */
public static final String TYPE_Window = "W";
/** Form = X */
@ -675,8 +695,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("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 - W - X");
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.length() > 10)
{
log.warning("Length > 10 - truncated");

View File

@ -0,0 +1,79 @@
ALTER TABLE AD_PACKAGE_EXP_DETAIL ADD ad_val_rule_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 (50212, 0, 0, 'Y',
TO_DATE ('04/26/2007 03:24:26', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE ('04/26/2007 03:24:26', 'MM/DD/YYYY HH24:MI:SS'), 100,
100, 'Dynamic Validation', 'Dynamic Validation Rule',
'These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.',
0, 'D', 'AD_Val_Rule_ID', 50006, 18,
22, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 139, '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 (50182, 0, 0, 'Y',
TO_DATE ('04/26/2007 03:28:08', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('04/26/2007 03:30:25', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Dynamic Validation', 'Dynamic Validation Rule',
'These rules define how an entry is determined to valid. You can use variables for dynamic (context sensitive) validation.',
'Y', 50006, 50212, 'Y',
'@Type@=''V''', 22, 'N', 245, '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 (50041, 0, 0, 'Y',
TO_DATE ('04/26/2007 03:33:05', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('04/26/2007 03:33:05', 'MM/DD/YYYY HH24:MI:SS'), 100,
'V', 'Dynamic Validation Rule', 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 ;