@@@@@@@@@@@@@@@@@
Change Activity Workflow
@@@@@@@@@@@@@@@@@

ca_START

// Initialize the parentChangeRequest variable
parentChangeOrder=com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.findChangeOrder( (wt.change2.WTChangeActivity2) primaryBusinessObject);
=================
Set State Implementation
Set State Resolved
Set State Implementation
Set State Under Review
Synch on Change Notice Implementation

ca__SYNCH_EXPRESSION_

// Determine the state of the parent change request and branch accordingly
String state = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkImplementation(parentChangeOrder);
if (state.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.IMPLEMENTATION))
   result = "Go";
else
  result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Determine the state of the parent change request and branch accordingly
String state = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkImplementation(parentChangeOrder);
if (state.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.IMPLEMENTATION))
   result = "Go";
else
   result = null;
=================
Rework Change Notice Task
Complete Change Notice Task
Review Change Notice Task

@@@@@@@@@@@@@@@@@
Change Notice Workflow
@@@@@@@@@@@@@@@@@

Set State Implementation
Set State Under Review
Change Notice Submitted
Set State Released
Set State Resolved
Change Notice Rejected
Change Notice Complete Notification
Set State Cancelled
Change Notice Approved
Set ECRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
=================
Set ECRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
=================
Set CAI and CAII

_ROBOT_EXPRESSION_

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.CHANGE ADMINISTRATOR II";
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject, role);
=================
Set Changeables to Released

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.promoteChangeables((wt.change2.WTChangeOrder2)primaryBusinessObject);
=================
Set Change Notice Resolution Date

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setECNResolutionDate((wt.change2.WTChangeOrder2)primaryBusinessObject);
=================
Set ECRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
=================
Set Submit Date

_ROBOT_EXPRESSION_

submitDate=new Timestamp(System.currentTimeMillis());
=================
Set Unpromotable

_ROBOT_EXPRESSION_

wt.fc.collections.WTHashSet unpromChanges = (wt.fc.collections.WTHashSet) com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.getUnpromotableChangeables((wt.change2.WTChangeOrder2)primaryBusinessObject);
java.util.Iterator i = unpromChanges.persistableIterator();
wt.enterprise.RevisionControlled p = null;
String unpromotables = "";
if (i.hasNext()){
   p = (wt.enterprise.RevisionControlled)i.next();
   unpromotables = unpromotables +  p.getDisplayIdentity();
}
while (i.hasNext()){
   p = (wt.enterprise.RevisionControlled)i.next();
   unpromotables = unpromotables + "; " + p.getDisplayIdentity();
}
if (unpromotables.length()!=0){
   unpromotable = "&lt;b&gt;-   The following Resulting Data will not be promoted because there is no change transition defined: \n";
   java.util.StringTokenizer s = new java.util.StringTokenizer( unpromotables, ";" );
   while (s.hasMoreTokens()){
        unpromotable += "-                             -   "  + s.nextToken() + "\n";
   }
   unpromotable += "\n There are two ways to resolve the issue: \n 1. If you did not intend to promote the resulting data, then simply complete the task. \n 2. If you did intend to promote the resulting data, there may be a problem with the configuration of lifecycle templates. Select the Rework option and enter comments for Change Administrator II.";
   unpromotable += "&lt;/b&gt;";
}
=================
Submit Now

_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================
Synch on CA Complete

_SYNCH_EXPRESSION_

// "Complete" and the rest are in state "Complete" or "Cancel." 
// It returns ProcessHelper.CANCELLED if all Change Orders are in state "Cancelled" or
// ProcessHelper.NOT_FINISHED if at least one Change Order is pending 
// (i.e. has not reached either state "Complete" or "Cancelled"). 
String checkActivitiesFinished = null;
checkActivitiesFinished = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkActivitiesFinished((wt.change2.WTChangeOrder2)primaryBusinessObject);
if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.RESOLVED))
   result = "Resolved";
else if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.CANCELLED))
   result = "Cancelled";
else if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.NOT_FINISHED))
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// "Complete" and the rest are in state "Complete" or "Cancel." 
// It returns ProcessHelper.CANCELLED if all Change Orders are in state "Cancelled" or
// ProcessHelper.NOT_FINISHED if at least one Change Order is pending 
// (i.e. has not reached either state "Complete" or "Cancelled"). 
String checkActivitiesFinished = null;
checkActivitiesFinished = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkActivitiesFinished((wt.change2.WTChangeOrder2)primaryBusinessObject);
if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.RESOLVED))
   result = "Resolved";
else if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.CANCELLED))
   result = "Cancelled";
else if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.NOT_FINISHED))
   result = null;
=================
Submit Change Notice
START

result = inInitialPhase;
=================
Audit Change Notice
Unpromotables
Rework Change Notice Task
unpromotable2
COMPLETE

wt.fc.collections.WTHashSet unpromChanges = (wt.fc.collections.WTHashSet) com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.getUnpromotableChangeables((wt.change2.WTChangeOrder2)primaryBusinessObject);
java.util.Iterator i = unpromChanges.persistableIterator();
wt.enterprise.RevisionControlled p = null;
String unpromotable1="";
if (i.hasNext()){
   p = (wt.enterprise.RevisionControlled)i.next();
   unpromotable1 = unpromotable1 + p.getName();
}
while (i.hasNext()){
   p = (wt.enterprise.RevisionControlled)i.next();
   unpromotable1 = unpromotable1 + "; " + p.getName();
}
if (unpromotable1.length()!=0){
   unpromotable2 = "&lt;b&gt;-   The following Resulting Data will not be promoted because there is no change transition defined: \n";
   java.util.StringTokenizer s = new java.util.StringTokenizer( unpromotable1, ";" );
   while (s.hasMoreTokens()){
        unpromotable2 += "-                             -   "  + s.nextToken() + "\n";
   }
   unpromotable2 += "\n There are two ways to resolve the issue: \n 1. If you did not intend to promote the resulting data, then simply complete the task. \n 2. If you did intend to promote the resulting data, there may be a problem with the configuration of lifecycle templates. Select the Rework option and enter comments for Change Administrator II.";
   unpromotable2 += "&lt;/b&gt;";
}
=================
Amend Change Notice Plan
Schedule CIB Review
Approve

approval_date=new Timestamp(System.currentTimeMillis());
=================

@@@@@@@@@@@@@@@@@
Change Request Workflow
@@@@@@@@@@@@@@@@@

Set State Implementation
Change Request Rejected by Change Admin I
Change Request Reassigned
Set State Under Review
Change Request Rejected by CRB
Change Request Resolved
Set State Resolved
Change Request Cancelled
Set State
Change Request - Fast Track
Change Request Approved
Set Submit Date

_ROBOT_EXPRESSION_

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Force PRs to Completion

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.forcePRsToResolved((wt.change2.WTChangeRequest2)primaryBusinessObject);
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Submit Now

_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================
Synch on Change Notice Completion

_SYNCH_EXPRESSION_

// The method ProcessHelper.checkOrdersFinished
// returns ProcessHelper.COMPLETE if at least one Change Order is in state 
// "Complete" and the rest are in state "Complete" or "Cancel." 
// It returns ProcessHelper.CANCELLED if all Change Orders are in state "Cancelled" or
// ProcessHelper.NOT_FINISHED if at least one Change Order is pending 
// (i.e. has not reached either state "Complete" or "Cancelled"). 
String checkOrdersFinished = null;
checkOrdersFinished = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkOrdersFinished((wt.change2.ChangeRequest2)primaryBusinessObject);
if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.RESOLVED))
   result = "Resolved";
else if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.CANCELLED))
   result = "Cancelled";
else if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.NOT_FINISHED))
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// The method ProcessHelper.checkOrdersFinished
// returns ProcessHelper.COMPLETE if at least one Change Order is in state 
// "Complete" and the rest are in state "Complete" or "Cancel." 
// It returns ProcessHelper.CANCELLED if all Change Orders are in state "Cancelled" or
// ProcessHelper.NOT_FINISHED if at least one Change Order is pending 
// (i.e. has not reached either state "Complete" or "Cancelled"). 
String checkOrdersFinished = null;
checkOrdersFinished = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkOrdersFinished((wt.change2.ChangeRequest2)primaryBusinessObject);
if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.RESOLVED))
   result = "Resolved";
else if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.CANCELLED))
   result = "Cancelled";
else if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.NOT_FINISHED))
   result = null;
=================
Clarify
Analysis
Clarification
COMPLETE

Analysis="";
=================
Schedule CRB Review
Clarification
Approve

approval_date=new Timestamp(System.currentTimeMillis());
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processBusinessDecision((wt.change2.WTChangeRequest2)primaryBusinessObject,wt.change2.BusinessDecisionCategory.APPROVED, "COMPLEX", Comments);
=================
Reject

approval_date=new Timestamp(System.currentTimeMillis());
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processBusinessDecision((wt.change2.WTChangeRequest2)primaryBusinessObject,wt.change2.BusinessDecisionCategory.REJECTED, "COMPLEX", Comments);
=================
Modify Roles
Comment
Clarify_COMPLETE

Comment="";Clarify_Comments="";
=================
Analyze Change Request
Clarification
Comment
Fast_Track

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
=================
Full_Track

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject,"COMPLEX");
=================
Reject

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
=================
Create Change Notice
Submit Change Request
approvalDate
START

result = inInitialPhase;
=================
Clarify
Review
Clarification
COMPLETE

Review="";
=================

@@@@@@@@@@@@@@@@@
CMII PR Workflow
@@@@@@@@@@@@@@@@@

Problem Report Rejected
Set State Resolved
Problem Report Confirmed
Set State Under Review
Set State Accepted
Set Submit Date

_ROBOT_EXPRESSION_

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
=================
Set Resolution Date

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setPRResolutionDate((wt.change2.WTChangeIssue)primaryBusinessObject);
=================
Submit Now

_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================
Submit Problem Report
START

result = inInitialPhase;
=================
Analyze Problem Report
Confirmed

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.CONFIRMED);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Not_Verified

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.NOTVERIFIED);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Unreproducable

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.UNREPRODUCABLE);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Will_Not_Resolve

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.WONTRESOLVE);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Duplicate

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.DUPLICATE);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Clarification

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.CLARIFICATION);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================

@@@@@@@@@@@@@@@@@
CMII ECN Workflow
@@@@@@@@@@@@@@@@@

ECN Rejected
ECN Complete Notification
Set State Cancelled
ECN Approved
ECN Submitted
Set State Resolved
Set State Released
Set State Implementation
Set State Under Review
Set ECRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
=================
Set Submit Date

_ROBOT_EXPRESSION_

submitDate=new Timestamp(System.currentTimeMillis());
=================
Set ECRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
=================
Set Changeables to Released

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.promoteChangeables((wt.change2.WTChangeOrder2)primaryBusinessObject);
=================
Set ECN Resolution Date

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setECNResolutionDate((wt.change2.WTChangeOrder2)primaryBusinessObject);
=================
Set CAI and CAII

_ROBOT_EXPRESSION_

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.CHANGE ADMINISTRATOR II";
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject, role);
=================
Set ECRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
=================
Submit Now

_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================
Synch on CA Complete

_SYNCH_EXPRESSION_

// "Complete" and the rest are in state "Complete" or "Cancel." 
// It returns ProcessHelper.CANCELLED if all Change Orders are in state "Cancelled" or
// ProcessHelper.NOT_FINISHED if at least one Change Order is pending 
// (i.e. has not reached either state "Complete" or "Cancelled"). 
String checkActivitiesFinished = null;
checkActivitiesFinished = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkActivitiesFinished((wt.change2.WTChangeOrder2)primaryBusinessObject);
if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.RESOLVED))
   result = "Resolved";
else if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.CANCELLED))
   result = "Cancelled";
else if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.NOT_FINISHED))
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// "Complete" and the rest are in state "Complete" or "Cancel." 
// It returns ProcessHelper.CANCELLED if all Change Orders are in state "Cancelled" or
// ProcessHelper.NOT_FINISHED if at least one Change Order is pending 
// (i.e. has not reached either state "Complete" or "Cancelled"). 
String checkActivitiesFinished = null;
checkActivitiesFinished = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkActivitiesFinished((wt.change2.WTChangeOrder2)primaryBusinessObject);
if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.RESOLVED))
   result = "Resolved";
else if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.CANCELLED))
   result = "Cancelled";
else if (checkActivitiesFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.NOT_FINISHED))
   result = null;
=================
Audit ECN
Ammend ECN Plan
Schedule CIB Review
Approve

approval_date=new Timestamp(System.currentTimeMillis());
=================
Rework ECN Task
Submit ECN
START

result = inInitialPhase;
=================

@@@@@@@@@@@@@@@@@
CMII ECR Workflow
@@@@@@@@@@@@@@@@@

Set State Resolved
ECR Rejected by Change Admin I
ECR Rejected by CRB
ECR Resolved
Set State Under Review
Set State Implementation
ECR Approved
ECR - Fast Track
ECR Cancelled
Set State
ECR Reassigned
Set Submit Date

_ROBOT_EXPRESSION_

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Force PRs to Completion

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.forcePRsToResolved((wt.change2.WTChangeRequest2)primaryBusinessObject);
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Submit Now

_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================
Synch on ECN Completion

_SYNCH_EXPRESSION_

// The method ProcessHelper.checkOrdersFinished
// returns ProcessHelper.COMPLETE if at least one Change Order is in state 
// "Complete" and the rest are in state "Complete" or "Cancel." 
// It returns ProcessHelper.CANCELLED if all Change Orders are in state "Cancelled" or
// ProcessHelper.NOT_FINISHED if at least one Change Order is pending 
// (i.e. has not reached either state "Complete" or "Cancelled"). 
String checkOrdersFinished = null;
checkOrdersFinished = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkOrdersFinished((wt.change2.ChangeRequest2)primaryBusinessObject);
if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.RESOLVED))
   result = "Resolved";
else if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.CANCELLED))
   result = "Cancelled";
else if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.NOT_FINISHED))
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// The method ProcessHelper.checkOrdersFinished
// returns ProcessHelper.COMPLETE if at least one Change Order is in state 
// "Complete" and the rest are in state "Complete" or "Cancel." 
// It returns ProcessHelper.CANCELLED if all Change Orders are in state "Cancelled" or
// ProcessHelper.NOT_FINISHED if at least one Change Order is pending 
// (i.e. has not reached either state "Complete" or "Cancelled"). 
String checkOrdersFinished = null;
checkOrdersFinished = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkOrdersFinished((wt.change2.ChangeRequest2)primaryBusinessObject);
if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.RESOLVED))
   result = "Resolved";
else if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.CANCELLED))
   result = "Cancelled";
else if (checkOrdersFinished.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.NOT_FINISHED))
   result = null;
=================
Modify Roles
Clarify
Analyze ECR
Fast_Track

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
=================
Full_Track

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject,"COMPLEX");
=================
Reject

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
=================
Create ECN
Submit ECR
approvalDate
START

result = inInitialPhase;
=================
Clarify
Schedule CRB Review
Approve

approval_date=new Timestamp(System.currentTimeMillis());
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processBusinessDecision((wt.change2.WTChangeRequest2)primaryBusinessObject,wt.change2.BusinessDecisionCategory.APPROVED, "COMPLEX", Comments);
=================
Reject

approval_date=new Timestamp(System.currentTimeMillis());
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processBusinessDecision((wt.change2.WTChangeRequest2)primaryBusinessObject,wt.change2.BusinessDecisionCategory.REJECTED, "COMPLEX", Comments);
=================

@@@@@@@@@@@@@@@@@
CMII CA Workflow
@@@@@@@@@@@@@@@@@

Problem Report Rejected
Set State Resolved
Problem Report Confirmed
Set State Under Review
Set State Accepted
Set Submit Date

_ROBOT_EXPRESSION_

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
=================
Set Resolution Date

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setPRResolutionDate((wt.change2.WTChangeIssue)primaryBusinessObject);
=================
Submit Now

_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
  result = null;

_INITIAL_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
  result = null;
=================
Submit Problem Report

START

result = inInitialPhase;
=================
Analyze Problem Report

Confirmed

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.CONFIRMED);
review_date=new java.sql.Timestamp(System.currentTimeMillis());

Not_Verified

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.NOTVERIFIED);
review_date=new java.sql.Timestamp(System.currentTimeMillis());

Unreproducable

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.UNREPRODUCABLE);
review_date=new java.sql.Timestamp(System.currentTimeMillis());

Will_Not_Resolve

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.WONTRESOLVE);
review_date=new java.sql.Timestamp(System.currentTimeMillis());

Duplicate

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.DUPLICATE);
review_date=new java.sql.Timestamp(System.currentTimeMillis());

Clarification

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.CLARIFICATION);
review_date=new java.sql.Timestamp(System.currentTimeMillis());

@@@@@@@@@@@@@@@@@
ECO Process
@@@@@@@@@@@@@@@@@

Set State Implementation
Set State Implementation
ECO Complete Notification
Set State Implementation
Set State Under Review
Set State Pending Approval
ECO Rejected by CC
Set State Cancelled
ECO Submitted
Set State Closed
ECP Rejected by Govt
Set State Cancelled
Set ECO Resolution Date

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setECNResolutionDate((wt.change2.WTChangeOrder2)primaryBusinessObject);
=================
Set Submit Date, etc.

_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

_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")) &amp;&amp; !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")) &amp;&amp; !isRework )
   result = "Complete";
else if( result_value.equals("CANCELLED") )
   result = "Cancelled";
else if( result_value.equals("NOT_FINISHED") )
   result = null;
=================
Synch on CA Complete

_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")) &amp;&amp; !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")) &amp;&amp; !isRework )
   result = "Complete";
else if( result_value.equals("CANCELLED") )
   result = "Cancelled";
else if( result_value.equals("NOT_FINISHED") )
   result = null;
=================
Submit Now

_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
Government Review
Rework_Approve

approval_date=new Timestamp(System.currentTimeMillis());
=================
Rework ECO
Rework_Instructions
isRework
START

isRework=true;
=================
COMPLETE

isRework=false;
=================
Rework ECO
Rework_Instructions
isRework
START

isRework=true;
=================
COMPLETE

isRework=false;
=================
Submit ECO
START

result = inInitialPhase;
=================
Verify ECO &amp; Create ECN
Rework_Approve

approval_date=new Timestamp(System.currentTimeMillis());
=================

@@@@@@@@@@@@@@@@@
ECO Task Process
@@@@@@@@@@@@@@@@@

START

// Initialize the parentChangeRequest variable
parentChangeOrder=com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.findChangeOrder( (wt.change2.WTChangeActivity2) primaryBusinessObject);
=================
Set State Completed
Set State Implementation
Set State Under Review
Set State Implementation
Set State Implementation
Set Resulting Items Under Review

_ROBOT_EXPRESSION_

wt.fc.QueryResult qResult = wt.change2.ChangeHelper2.service.getChangeablesAfter( (wt.change2.ChangeActivity2)primaryBusinessObject );
wt.pom.Transaction trx = new wt.pom.Transaction();
trx.start();
try {
	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;
			wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(life_cycle_managed, wt.lifecycle.State.toState("UNDERREVIEW") );
		}
	}
	trx.commit();
} catch( Exception e ) {
	if(trx != null)
		trx.rollback();
}
=================
Set Resulting Items Cancelled

_ROBOT_EXPRESSION_

wt.fc.QueryResult qResult = wt.change2.ChangeHelper2.service.getChangeablesAfter( (wt.change2.ChangeActivity2)primaryBusinessObject );
wt.pom.Transaction trx = new wt.pom.Transaction();
trx.start();
try {
	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;
			wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(life_cycle_managed, wt.lifecycle.State.toState("CANCELLED") );
		}
	}
	trx.commit();
} catch( Exception e ) {
	if(trx != null)
		trx.rollback();
}
=================
Set Resulting Items Released

_ROBOT_EXPRESSION_

wt.fc.QueryResult qResult = wt.change2.ChangeHelper2.service.getChangeablesAfter( (wt.change2.ChangeActivity2)primaryBusinessObject );
wt.pom.Transaction trx = new wt.pom.Transaction();
trx.start();
try {
	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;
			wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(life_cycle_managed, wt.lifecycle.State.toState("RELEASED") );
		}
	}
	trx.commit();
} catch( Exception e ) {
	if(trx != null)
		trx.rollback();
}
=================
Set Resulting Items In Work

_ROBOT_EXPRESSION_

wt.fc.QueryResult qResult = wt.change2.ChangeHelper2.service.getChangeablesAfter( (wt.change2.ChangeActivity2)primaryBusinessObject );
wt.pom.Transaction trx = new wt.pom.Transaction();
trx.start();
try {
	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;
			wt.lifecycle.LifeCycleHelper.service.setLifeCycleState(life_cycle_managed, wt.lifecycle.State.toState("INWORK") );
		}
	}
	trx.commit();
} catch( Exception e ) {
	if(trx != null)
		trx.rollback();
}
=================
Sync on ECO

_SYNCH_EXPRESSION_

// Determine the state of the parent change request and branch accordingly
String state = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkImplementation(parentChangeOrder);
if( state.equals("CLOSED") )
   result = "Closed";
else
if( state.equals("CANCELLED") )
   result = "Cancelled";
else
if( state.equals("IMPLEMENTATION") )
   result = "Implementation";
else
  result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Determine the state of the parent change request and branch accordingly
String state = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkImplementation(parentChangeOrder);
if( state.equals("CLOSED") )
   result = "Closed";
else
if( state.equals("CANCELLED") )
   result = "Cancelled";
else
  result = null;
=================
Synch on ECO Implementation

_SYNCH_EXPRESSION_

// Determine the state of the parent change request and branch accordingly
String state = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkImplementation(parentChangeOrder);
if (state.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.IMPLEMENTATION))
   result = "Go";
else
  result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Determine the state of the parent change request and branch accordingly
String state = com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.checkImplementation(parentChangeOrder);
if (state.equals(com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.IMPLEMENTATION))
   result = "Go";
else
  result = null;
=================
Submit Task for Rework
Finalize ECO Review Task
Rework ECO Task
Complete ECO Task
Review ECO Task

@@@@@@@@@@@@@@@@@
ECR Process
@@@@@@@@@@@@@@@@@

Set State Cancelled
Set State Closed
ECR Canceled
Set State Under Review
Set State In Work
ECR Rejected by Change Coordinator
ECR Closed
Set State Approved
ECR Approved
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Set Submit Date, etc.

_ROBOT_EXPRESSION_

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
ecrName = ((wt.change2.WTChangeRequest2)primaryBusinessObject).getName();
ecrNumber = ((wt.change2.WTChangeRequest2)primaryBusinessObject).getNumber();
ecrDescription = ((wt.change2.WTChangeRequest2)primaryBusinessObject).getDescription();
ecrContainer = ((wt.change2.WTChangeRequest2)primaryBusinessObject).getContainerName();
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Force PRs to Completion

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.forcePRsToResolved((wt.change2.WTChangeRequest2)primaryBusinessObject);
=================
Set PRAuthors

_ROBOT_EXPRESSION_

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
=================
Synch on ECO Completion

_SYNCH_EXPRESSION_

// This code returns CLOSED if at least one Change Order is in state 
// "Closed" and the rest are in state "Closed" or "Cancelled". 
// It returns CANCELLED if all Change Orders are in state "Cancelled" or
// NOT_FINISHED if at least one Change Order is pending 
// (i.e. has not reached either state "Closed" or "Cancelled").
wt.fc.QueryResult qResult = wt.change2.ChangeHelper2.service.getChangeOrders( (wt.change2.ChangeRequest2) 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("CLOSED")) ) {
			result_value = "CLOSED";
		} else
		if( life_cycle_managed.getLifeCycleState().equals(wt.lifecycle.State.toState("CANCELLED")) ) {
			if( result_value == "NO_SUBORDINATES" || !result_value.equals("CLOSED") )
				result_value = "CANCELLED";
		} else {
			result_value = "NOT_FINISHED";
		}
	}
}

if( result_value.equals("CLOSED") )
   result = "Closed";
else if( result_value.equals("CANCELLED") )
   result = "Cancelled";
else if( result_value.equals("NOT_FINISHED") )
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

System.out.println("DEBUG: ECO Process; Sync on ECO Completion, Initial expression");
=================
Submit Now

_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
  result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
  result = null;
=================
CRB Review

Comments
Clarification_Comments
Change_Coordinator_Comments
Approve

approval_date=new Timestamp(System.currentTimeMillis());
wt.session.SessionServerHelper.manager.setAccessEnforced( false );
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processBusinessDecision((wt.change2.WTChangeRequest2)primaryBusinessObject,wt.change2.BusinessDecisionCategory.APPROVED, "COMPLEX", Comments);
wt.session.SessionServerHelper.manager.setAccessEnforced( true );
=================
Submit ECR

START

result = inInitialPhase;
=================
Clarify

Create ECO
Fast_Track

wt.session.SessionServerHelper.manager.setAccessEnforced( false );
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
wt.session.SessionServerHelper.manager.setAccessEnforced( true );
=================
Full_Track

wt.session.SessionServerHelper.manager.setAccessEnforced( false );
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "COMPLEX");
wt.session.SessionServerHelper.manager.setAccessEnforced( true );
=================
Reject

wt.session.SessionServerHelper.manager.setAccessEnforced( false );
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
wt.session.SessionServerHelper.manager.setAccessEnforced( true );
=================
Verify ECR

Reject

wt.session.SessionServerHelper.manager.setAccessEnforced( false );
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
wt.session.SessionServerHelper.manager.setAccessEnforced( true );
=================

@@@@@@@@@@@@@@@@@
Problem Report Workflow
@@@@@@@@@@@@@@@@@

Problem Report Confirmed
Set State Under Review
Set State Accepted
Problem Report Rejected
Set State Resolved
Set Submit Date

_ROBOT_EXPRESSION_

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
=================
Set Resolution Date

_ROBOT_EXPRESSION_

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setPRResolutionDate((wt.change2.WTChangeIssue)primaryBusinessObject);
=================
Submit Now

_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================

_INITIAL_SYNCH_EXPRESSION_

// Continue if the primaryBusinessObject has progressed past the initial state
inInitialPhase =wt.lifecycle.LifeCycleHelper.service.isInInitialPhase((wt.lifecycle.LifeCycleManaged)primaryBusinessObject) ;
if (inInitialPhase != true)
   result = "Go";
else
   result = null;
=================
Submit Problem Report
START

result = inInitialPhase;
=================
Analyze Problem Report
Confirmed

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.CONFIRMED);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Not_Verified

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.NOTVERIFIED);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Unreproducable

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.UNREPRODUCABLE);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Will_Not_Resolve

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.WONTRESOLVE);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Duplicate

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.DUPLICATE);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================
Clarification

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.processConfirmation((wt.change2.WTChangeIssue)primaryBusinessObject,wt.change2.ConfirmationCategory.CLARIFICATION);
review_date=new java.sql.Timestamp(System.currentTimeMillis());
=================

@@@@@@@@@@@@@@@@@
Promotion Request Approval Process
@@@@@@@@@@@@@@@@@

VERBOSE
Promotion Request Targets Locking Error
Promotion Request Validation Error
Set State Rejected
Set State Approved
Promotion Request Approval
Set State Under Review
Promotion Request Rejected By Approvers
Unlock Targets
VERBOSE

_ROBOT_EXPRESSION_

wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice)primaryBusinessObject;
try
{
wt.util.WTProperties props = wt.util.WTProperties.getLocalProperties();
VERBOSE = props.getProperty("wt.maturity.verbose",VERBOSE);
}
catch( Throwable t ){}
try{
     wt.maturity.MaturityServerHelper.service.unlockTargets (pn);
} catch (wt.maturity.MaturityException me){
     if ( VERBOSE )
      	me.printStackTrace();     
}
=================

Approve Promotion Request
Review Promotion Request

@@@@@@@@@@@@@@@@@
Promotion Request Review Process
@@@@@@@@@@@@@@@@@

VERBOSE
Set State Approved
Promotion Request Validation Error
Promotion Request Targets Locking Error
Set State Rejected
Promotion Request Approval
Unlock Targets
VERBOSE

_ROBOT_EXPRESSION_

wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice)primaryBusinessObject;
try
{
wt.util.WTProperties props = wt.util.WTProperties.getLocalProperties();
VERBOSE = props.getProperty("wt.maturity.verbose",VERBOSE);
}
catch( Throwable t ){ }
try{
     wt.maturity.MaturityServerHelper.service.unlockTargets (pn);
} catch (wt.maturity.MaturityException me){
     if ( VERBOSE )
      	me.printStackTrace();     
}
=================
Review Promotion Request

@@@@@@@@@@@@@@@@@
ReplicationPublish
@@@@@@@@@@@@@@@@@

Export Failed
Schedule Error
Exporting
Ready To Send
Populated
Set Shared

_ROBOT_EXPRESSION_

sharedCabinet=true;
=================
Listen For Export Complete

_SYNCH_EXPRESSION_

System.out.println("+++Workflow ReplicationUnit. got post_export event on " + primaryBusinessObject);
wt.replication.unit.WTUnit unit = (wt.replication.unit.WTUnit) primaryBusinessObject;
wt.replication.unit.UnitReplicationStatus stat = unit.getExportStatus();
if(stat == wt.replication.unit.UnitReplicationStatus.COMPLETE) {
   sendURL = wt.replication.unit.htmlGeneration.URLOperationHelper.getSendURL(unit);
   result="success";
}
else
   result="failure";
=================
Listen for Export Start

_SYNCH_EXPRESSION_

System.out.println("+++Workflow ReplicationUnit. got pre_export event on " +
                                    primaryBusinessObject);
result="started";
=================
Check Cabinet

_SYNCH_EXPRESSION_

wt.folder.FolderEntry fe = (wt.folder.FolderEntry) primaryBusinessObject;
boolean priv = wt.folder.FolderHelper.inPersonalCabinet(fe);
if(priv)
   result="personal";
else
   result="shared";
=================
Listen for Export Scheduled

_SYNCH_EXPRESSION_

System.out.println("+++Received EXPORT_SCHEDULED event for " + primaryBusinessObject);
result="success";
=================
Enable Export

_SYNCH_EXPRESSION_

wt.replication.unit.WTUnit unit = (wt.replication.unit.WTUnit) primaryBusinessObject;
wt.replication.export.UnitExportRecord exportRecord= wt.replication.export.StandardExportService.enableScheduleItem(unit);
if(exportRecord != null) {
   exporterUser = (wt.org.WTUser) exportRecord.getCreator().getPrincipal();
   result="success";
}
else
   result="failure";
=================
Check Shared

_SYNCH_EXPRESSION_

if(sharedCabinet)
   result="shared";
else {
    try {
       Thread.sleep(1000);
    }
    catch(InterruptedException e) {}
    result="private";
}
=================
Folder Activity

@@@@@@@@@@@@@@@@@
ReplicationReceive
@@@@@@@@@@@@@@@@@

Import Schedule Failure
Import Failure
Importing
Complete
Receive Schedule Failure
Ready To Import
Receiving
Completed Notification
Populated
Error in receive operation
Listen for import complete

_SYNCH_EXPRESSION_

System.out.println("+++Workflow ReplicationReceive. got post_import event on " + primaryBusinessObject);
wt.replication.unit.WTUnit unit = (wt.replication.unit.WTUnit) primaryBusinessObject;
wt.replication.unit.UnitReplicationStatus stat = unit.getImportStatus();
if(stat == wt.replication.unit.UnitReplicationStatus.COMPLETE) {
   result="success";
}
else {
   result="failure";
}
=================
Listen for Recieve Complete

_SYNCH_EXPRESSION_

System.out.println("+++Workflow ReplicationUnit. got post_receive event on " + primaryBusinessObject);
wt.replication.unit.WTUnit unit = (wt.replication.unit.WTUnit) primaryBusinessObject;
wt.replication.unit.UnitReplicationStatus stat = unit.getReceiverStatus();
if(stat == wt.replication.unit.UnitReplicationStatus.COMPLETE) {
   importURL=wt.replication.unit.htmlGeneration.URLOperationHelper.getImportURL(unit);
   result="success";
}
else
   result="failure";
=================
Enable Scheduled Receive

_SYNCH_EXPRESSION_

System.out.println("+++Receive operation scheduled on "+primaryBusinessObject);
wt.replication.unit.WTUnit unit = (wt.replication.unit.WTUnit) primaryBusinessObject;
wt.replication.receiver.UnitReceiveRecord receiveRecord = wt.replication.receiver.StandardReplicationRecvService.enableScheduleItem(unit);
if(receiveRecord != null) {
   receiverUser= (wt.org.WTUser) receiveRecord.getCreator().getPrincipal();
   result="success";
}
else
   result="failure";
=================
Enable

_SYNCH_EXPRESSION_

System.out.println("+++Import operation enabled on "+primaryBusinessObject);
wt.replication.unit.WTUnit unit = (wt.replication.unit.WTUnit) primaryBusinessObject;
wt.replication.imp.UnitImportRecord importRecord=wt.replication.imp.StandardImportService.enableScheduleItem(unit);
if(importRecord != null) {
   result="success";
}
else
   result="failure";
=================
Listen for Receive Scheduled

_SYNCH_EXPRESSION_

System.out.println("+++Receive operation scheduled on "+primaryBusinessObject);
result="success";
=================
Listen for import started

_SYNCH_EXPRESSION_

System.out.println("+++Workflow ReplicationReceive. got pre_import event on " +
                                    primaryBusinessObject);
result="success";
=================
Listen for Receive Start

_SYNCH_EXPRESSION_

System.out.println("+++Got PRE_RECEIVE event for object " +
                                      primaryBusinessObject);
result="success";
=================
Listen for Import Scheduled

_SYNCH_EXPRESSION_

System.out.println("+++Import operation scheduled on "+primaryBusinessObject);
wt.replication.unit.WTUnit unit = (wt.replication.unit.WTUnit) primaryBusinessObject;
wt.replication.imp.UnitImportRecord importRecord =  (wt.replication.imp.UnitImportRecord) wt.replication.unit.WTUnitHelper.service.getLatestOperationRecord(unit,wt.replication.imp.UnitImportRecord.class);
if(importRecord != null) {
   importerUser=(wt.org.WTUser) importRecord.getCreator().getPrincipal();
   result="success";
}
else
   result="failure";
=================

@@@@@@@@@@@@@@@@@
ReplicationSender
@@@@@@@@@@@@@@@@@

sitePrincipal
siteName
senderUser
Failure
Schedule error
Sent
Sending
Success
Enable operation
sitePrincipal
siteName
senderUser

_SYNCH_EXPRESSION_

wt.replication.sender.UnitSendRecord rec = (wt.replication.sender.UnitSendRecord) primaryBusinessObject;
result = wt.replication.sender.StandardSenderService.enableScheduleItem(rec);
=================
Listen for Sending Complete
sitePrincipal
siteName
senderUser

_SYNCH_EXPRESSION_

System.out.println("+++Workflow ReplicationSender. completed send operation on " + primaryBusinessObject);
wt.replication.sender.UnitSendRecord link = (wt.replication.sender.UnitSendRecord) primaryBusinessObject;
sitePrincipal= (WTUser) link.getSite().getPrincipal();
siteName=link.getSite().getName();
wt.replication.unit.UnitReplicationStatus ss = link.getStatus();
if(ss == wt.replication.unit.UnitReplicationStatus.COMPLETE)
   result="success";
else
   result="failure";
=================

@@@@@@@@@@@@@@@@@
Review
@@@@@@@@@@@@@@@@@

Review
Observe
Promote

@@@@@@@@@@@@@@@@@
Submit
@@@@@@@@@@@@@@@@@

Submit
