ECO Process primaryBusinessObject cibComments auditComments submitDate approvalDate fastTrack ammendComments inInitialPhase ecoNumber ecoName ecoContainer ecoDescription Rework_Comments isRework Set State Implementation primaryBusinessObject aState Set State Implementation primaryBusinessObject aState ECO Complete Notification subject message primaryBusinessObject Set State Implementation primaryBusinessObject aState Set State Under Review primaryBusinessObject aState Set State Pending Approval primaryBusinessObject aState ECO Rejected by CC subject message primaryBusinessObject Set State Cancelled primaryBusinessObject aState ECO Submitted subject message primaryBusinessObject Set State Closed primaryBusinessObject aState ECP Rejected by Govt subject message primaryBusinessObject Set State Cancelled primaryBusinessObject aState Set ECO Resolution Date primaryBusinessObject cibComments auditComments submitDate approvalDate fastTrack ammendComments inInitialPhase ecoNumber ecoName ecoContainer ecoDescription Rework_Comments isRework _ROBOT_EXPRESSION_ com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setECNResolutionDate((wt.change2.WTChangeOrder2)primaryBusinessObject); Set Submit Date, etc. primaryBusinessObject cibComments auditComments submitDate approvalDate fastTrack ammendComments inInitialPhase ecoNumber ecoName ecoContainer ecoDescription Rework_Comments isRework _ROBOT_EXPRESSION_ submitDate=new Timestamp(System.currentTimeMillis()); ecoName = ((wt.change2.WTChangeOrder2)primaryBusinessObject).getName(); ecoNumber = ((wt.change2.WTChangeOrder2)primaryBusinessObject).getNumber(); ecoDescription = ((wt.change2.WTChangeOrder2)primaryBusinessObject).getDescription(); ecoContainer = ((wt.change2.WTChangeOrder2)primaryBusinessObject).getContainerName(); java.lang.String role="wt.project.role.CHANGE ADMINISTRATOR I"; com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject, role); role="wt.project.role.ECR AUTHOR"; com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject, role); Synch on CA Complete primaryBusinessObject cibComments auditComments submitDate approvalDate fastTrack ammendComments inInitialPhase ecoNumber ecoName ecoContainer ecoDescription Rework_Comments isRework _SYNCH_EXPRESSION_ // This code returns COMPLETED if at least one Change Activity is in state // "Completed" and the rest are in state "Completed" or "Cancelled". // It returns CANCELLED if all Change Activities are in state "Cancelled" or // NOT_FINISHED if at least one Change Activity is pending // (i.e. has not reached either state "Completed" or "Cancelled"). wt.fc.QueryResult qResult = wt.change2.ChangeHelper2.service.getChangeActivities( (wt.change2.ChangeOrder2) primaryBusinessObject ); String result_value = "NO_SUBORDINATES"; while( qResult.hasMoreElements() ) { wt.fc.Persistable persistable = (wt.fc.Persistable) qResult.nextElement(); if( persistable instanceof wt.lifecycle.LifeCycleManaged ) { wt.lifecycle.LifeCycleManaged life_cycle_managed = (wt.lifecycle.LifeCycleManaged) persistable; if( life_cycle_managed.getLifeCycleState().equals(wt.lifecycle.State.toState("COMPLETED")) ) { result_value = "COMPLETED"; } else if( life_cycle_managed.getLifeCycleState().equals(wt.lifecycle.State.toState("CANCELLED")) ) { if( result_value == "NO_SUBORDINATES" || !result_value.equals("COMPLETED") ) result_value = "CANCELLED"; } else { result_value = "NOT_FINISHED"; } } } if( (result_value.equals("COMPLETED") || result_value.equals("NO_SUBORDINATES")) && !isRework ) result = "Complete"; else if( result_value.equals("CANCELLED") ) result = "Cancelled"; else if( result_value.equals("NOT_FINISHED") ) result = null; _INITIAL_SYNCH_EXPRESSION_ // This code returns COMPLETED if at least one Change Activity is in state // "Completed" and the rest are in state "Completed" or "Cancelled". // It returns CANCELLED if all Change Activities are in state "Cancelled" or // NOT_FINISHED if at least one Change Activity is pending // (i.e. has not reached either state "Completed" or "Cancelled"). wt.fc.QueryResult qResult = wt.change2.ChangeHelper2.service.getChangeActivities( (wt.change2.ChangeOrder2) primaryBusinessObject ); String result_value = "NO_SUBORDINATES"; while( qResult.hasMoreElements() ) { wt.fc.Persistable persistable = (wt.fc.Persistable) qResult.nextElement(); if( persistable instanceof wt.lifecycle.LifeCycleManaged ) { wt.lifecycle.LifeCycleManaged life_cycle_managed = (wt.lifecycle.LifeCycleManaged) persistable; if( life_cycle_managed.getLifeCycleState().equals(wt.lifecycle.State.toState("COMPLETED")) ) { result_value = "COMPLETED"; } else if( life_cycle_managed.getLifeCycleState().equals(wt.lifecycle.State.toState("CANCELLED")) ) { if( result_value == "NO_SUBORDINATES" || !result_value.equals("COMPLETED") ) result_value = "CANCELLED"; } else { result_value = "NOT_FINISHED"; } } } if( (result_value.equals("COMPLETED") || result_value.equals("NO_SUBORDINATES")) && !isRework ) result = "Complete"; else if( result_value.equals("CANCELLED") ) result = "Cancelled"; else if( result_value.equals("NOT_FINISHED") ) result = null; Synch on CA Complete primaryBusinessObject cibComments auditComments submitDate approvalDate fastTrack ammendComments inInitialPhase ecoNumber ecoName ecoContainer ecoDescription Rework_Comments isRework _SYNCH_EXPRESSION_ // This code returns COMPLETED if at least one Change Activity is in state // "Completed" and the rest are in state "Completed" or "Cancelled". // It returns CANCELLED if all Change Activities are in state "Cancelled" or // NOT_FINISHED if at least one Change Activity is pending // (i.e. has not reached either state "Completed" or "Cancelled"). wt.fc.QueryResult qResult = wt.change2.ChangeHelper2.service.getChangeActivities( (wt.change2.ChangeOrder2) primaryBusinessObject ); String result_value = "NO_SUBORDINATES"; while( qResult.hasMoreElements() ) { wt.fc.Persistable persistable = (wt.fc.Persistable) qResult.nextElement(); if( persistable instanceof wt.lifecycle.LifeCycleManaged ) { wt.lifecycle.LifeCycleManaged life_cycle_managed = (wt.lifecycle.LifeCycleManaged) persistable; if( life_cycle_managed.getLifeCycleState().equals(wt.lifecycle.State.toState("COMPLETED")) ) { result_value = "COMPLETED"; } else if( life_cycle_managed.getLifeCycleState().equals(wt.lifecycle.State.toState("CANCELLED")) ) { if( result_value == "NO_SUBORDINATES" || !result_value.equals("COMPLETED") ) result_value = "CANCELLED"; } else { result_value = "NOT_FINISHED"; } } } if( (result_value.equals("COMPLETED") || result_value.equals("NO_SUBORDINATES")) && !isRework ) result = "Complete"; else if( result_value.equals("CANCELLED") ) result = "Cancelled"; else if( result_value.equals("NOT_FINISHED") ) result = null; _INITIAL_SYNCH_EXPRESSION_ // This code returns COMPLETED if at least one Change Activity is in state // "Completed" and the rest are in state "Completed" or "Cancelled". // It returns CANCELLED if all Change Activities are in state "Cancelled" or // NOT_FINISHED if at least one Change Activity is pending // (i.e. has not reached either state "Completed" or "Cancelled"). wt.fc.QueryResult qResult = wt.change2.ChangeHelper2.service.getChangeActivities( (wt.change2.ChangeOrder2) primaryBusinessObject ); String result_value = "NO_SUBORDINATES"; while( qResult.hasMoreElements() ) { wt.fc.Persistable persistable = (wt.fc.Persistable) qResult.nextElement(); if( persistable instanceof wt.lifecycle.LifeCycleManaged ) { wt.lifecycle.LifeCycleManaged life_cycle_managed = (wt.lifecycle.LifeCycleManaged) persistable; if( life_cycle_managed.getLifeCycleState().equals(wt.lifecycle.State.toState("COMPLETED")) ) { result_value = "COMPLETED"; } else if( life_cycle_managed.getLifeCycleState().equals(wt.lifecycle.State.toState("CANCELLED")) ) { if( result_value == "NO_SUBORDINATES" || !result_value.equals("COMPLETED") ) result_value = "CANCELLED"; } else { result_value = "NOT_FINISHED"; } } } if( (result_value.equals("COMPLETED") || result_value.equals("NO_SUBORDINATES")) && !isRework ) result = "Complete"; else if( result_value.equals("CANCELLED") ) result = "Cancelled"; else if( result_value.equals("NOT_FINISHED") ) result = null; Submit Now primaryBusinessObject cibComments auditComments submitDate approvalDate fastTrack ammendComments inInitialPhase ecoNumber ecoName ecoContainer ecoDescription Rework_Comments isRework _SYNCH_EXPRESSION_ // Continue if the primaryBusinessObject has progressed past the initial state // If the ECO is in state UNDERREVIEW, set to IMPLEMENTATION (Workaround for incedibly stupid OOTB implementation of AbstractUpdateChange2Delegate) wt.lifecycle.LifeCycleManaged lifecyclemanaged = (wt.lifecycle.LifeCycleManaged) primaryBusinessObject; inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase( lifecyclemanaged ) ; if( inInitialPhase != true ) { if( lifecyclemanaged.getLifeCycleState() == wt.lifecycle.State.toState("UNDERREVIEW") ) { wt.session.SessionContext sessioncontext = wt.session.SessionContext.getContext(); try { wt.session.SessionHelper.manager.setAdministrator(); primaryBusinessObject = (wt.fc.WTObject) wt.lifecycle.LifeCycleHelper.service.setLifeCycleState( lifecyclemanaged, wt.lifecycle.State.toState("IMPLEMENTATION") ); } finally { wt.session.SessionContext.setContext( sessioncontext ); } } result = "Go"; } else { result = null; } _INITIAL_SYNCH_EXPRESSION_ // Continue if the primaryBusinessObject has progressed past the initial state // If the ECO is in state UNDERREVIEW, set to IMPLEMENTATION (Workaround for incedibly stupid OOTB implementation of AbstractUpdateChange2Delegate) wt.lifecycle.LifeCycleManaged lifecyclemanaged = (wt.lifecycle.LifeCycleManaged) primaryBusinessObject; System.out.println("DEBUG, ECO Process, Submit Now; LifeCycleState = " + lifecyclemanaged.getLifeCycleState()); inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase( lifecyclemanaged ) ; if( inInitialPhase != true ) { if( lifecyclemanaged.getLifeCycleState() == wt.lifecycle.State.toState("UNDERREVIEW") ) { wt.session.SessionContext sessioncontext = wt.session.SessionContext.getContext(); try { wt.session.SessionHelper.manager.setAdministrator(); primaryBusinessObject = (wt.fc.WTObject) wt.lifecycle.LifeCycleHelper.service.setLifeCycleState( lifecyclemanaged, wt.lifecycle.State.toState("IMPLEMENTATION") ); } finally { wt.session.SessionContext.setContext( sessioncontext ); } } result = "Go"; } else { result = null; } Update XXI primaryBusinessObject Government Review primaryBusinessObject Comments approval_date Rework_Comments Approve approval_date=new Timestamp(System.currentTimeMillis()); Rework ECO primaryBusinessObject Comments Rework_Instructions isRework START isRework=true; COMPLETE isRework=false; Rework ECO primaryBusinessObject Comments Rework_Instructions isRework START isRework=true; COMPLETE isRework=false; Submit ECO primaryBusinessObject inInitialPhase START result = inInitialPhase; Verify ECO & Create ECN primaryBusinessObject Comments approval_date Rework_Comments Approve approval_date=new Timestamp(System.currentTimeMillis());