@@@@@@@@@@@@@@@@@
Change_Activity_Workflow:
@@@@@@@@@@@@@@@@@

// Initialize the parentChangeRequest variable
parentChangeOrder=com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.findChangeOrder( (wt.change2.WTChangeActivity2) primaryBusinessObject);
==============
// 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;
==============
// 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;
==============

@@@@@@@@@@@@@@@@@
Change_Notice_Workflow:
@@@@@@@@@@@@@@@@@

String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
==============
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);
==============
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);
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.promoteChangeables((wt.change2.WTChangeOrder2)primaryBusinessObject);
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setECNResolutionDate((wt.change2.WTChangeOrder2)primaryBusinessObject);
==============
String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
==============
submitDate=new Timestamp(System.currentTimeMillis());
==============
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 = "<b>-   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 += "</b>";
}
==============
// 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;
==============
// 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;
==============
// "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;
==============
// "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;
==============
result = inInitialPhase;
==============
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 = "<b>-   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 += "</b>";
}
==============
approval_date=new Timestamp(System.currentTimeMillis());
==============

@@@@@@@@@@@@@@@@@
Change_Request_Workflow:
@@@@@@@@@@@@@@@@@

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.forcePRsToResolved((wt.change2.WTChangeRequest2)primaryBusinessObject);
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
// 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;
==============
// 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;
==============
// 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;
==============
// 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;
==============
Analysis="";
==============
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);
==============
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);
==============
Comment="";Clarify_Comments="";
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject,"COMPLEX");
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
==============
result = inInitialPhase;
==============
Review="";
==============

@@@@@@@@@@@@@@@@@
CMII_CA_Workflow:
@@@@@@@@@@@@@@@@@

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setPRResolutionDate((wt.change2.WTChangeIssue)primaryBusinessObject);
==============
// 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;
==============
// 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;
==============
result = inInitialPhase;
==============
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());
==============
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());
==============
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());
==============
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());
==============
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());
==============
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:
@@@@@@@@@@@@@@@@@

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);
==============
submitDate=new Timestamp(System.currentTimeMillis());
==============
String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.promoteChangeables((wt.change2.WTChangeOrder2)primaryBusinessObject);
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setECNResolutionDate((wt.change2.WTChangeOrder2)primaryBusinessObject);
==============
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);
==============
String role=new String("wt.project.role.ECR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECN((wt.change2.WTChangeOrder2)primaryBusinessObject,role);
==============
// 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;
==============
// 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;
==============
// "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;
==============
// "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;
==============
approval_date=new Timestamp(System.currentTimeMillis());
==============
result = inInitialPhase;
==============

@@@@@@@@@@@@@@@@@
CMII_ECR_Workflow:
@@@@@@@@@@@@@@@@@

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.forcePRsToResolved((wt.change2.WTChangeRequest2)primaryBusinessObject);
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
// 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;
==============
// 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;
==============
// 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;
==============
// 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;
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject,"COMPLEX");
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setTrack((wt.change2.WTChangeRequest2)primaryBusinessObject, "SIMPLE");
==============
result = inInitialPhase;
==============
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);
==============
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_PR_Workflow:
@@@@@@@@@@@@@@@@@

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setPRResolutionDate((wt.change2.WTChangeIssue)primaryBusinessObject);
==============
// 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;
==============
// 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;
==============
result = inInitialPhase;
==============
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());
==============
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());
==============
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());
==============
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());
==============
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());
==============
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());
==============

@@@@@@@@@@@@@@@@@
fnm_eco_process:
@@@@@@@@@@@@@@@@@

com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setECNResolutionDate((wt.change2.WTChangeOrder2)primaryBusinessObject);
==============
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);
==============
// 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;
==============
// 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;
==============
// 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;
==============
// 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;
==============
// 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;
}
==============
// 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, FN 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;
}
==============
approval_date=new Timestamp(System.currentTimeMillis());
==============
isRework=true;
==============
isRework=false;
==============
isRework=true;
==============
isRework=false;
==============
result = inInitialPhase;
==============
approval_date=new Timestamp(System.currentTimeMillis());
==============

@@@@@@@@@@@@@@@@@
fnm_eco_task_process:
@@@@@@@@@@@@@@@@@

// Initialize the parentChangeRequest variable
parentChangeOrder=com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.findChangeOrder( (wt.change2.WTChangeActivity2) primaryBusinessObject);

==============
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();
}
==============
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();
}
==============
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();
}
==============
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();
}
==============
// 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;
==============
// 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;
==============
// 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;
==============
// 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;
==============

@@@@@@@@@@@@@@@@@
fnm_ecr_process:
@@@@@@@@@@@@@@@@@

String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
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();
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.forcePRsToResolved((wt.change2.WTChangeRequest2)primaryBusinessObject);
==============
String role=new String("wt.project.role.PR AUTHOR");
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setRoleToECR((wt.change2.WTChangeRequest2)primaryBusinessObject,role);
==============
// 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;
==============
System.out.println("DEBUG: FN ECO Process; Sync on ECO Completion, Initial 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;
==============
// 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;
==============
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 );
==============
result = inInitialPhase;
==============
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 );
==============
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 );
==============
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 );
==============
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:
@@@@@@@@@@@@@@@@@

submitDate=new java.sql.Timestamp(System.currentTimeMillis());
==============
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper.setPRResolutionDate((wt.change2.WTChangeIssue)primaryBusinessObject);
==============
// 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;
==============
// 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;
==============
result = inInitialPhase;
==============
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());
==============
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());
==============
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());
==============
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());
==============
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());
==============
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:
@@@@@@@@@@@@@@@@@

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();     
}
==============

Promotion_Request_Review_Process:
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();     
}
==============

@@@@@@@@@@@@@@@@@
ReplicationPublish:
@@@@@@@@@@@@@@@@@

sharedCabinet=true;
==============
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";
==============
System.out.println("+++Workflow ReplicationUnit. got pre_export event on " + primaryBusinessObject);
result="started";
==============
wt.folder.FolderEntry fe = (wt.folder.FolderEntry) primaryBusinessObject;
boolean priv = wt.folder.FolderHelper.inPersonalCabinet(fe);
if(priv)
   result="personal";
else
   result="shared";
==============
System.out.println("+++Received EXPORT_SCHEDULED event for " + primaryBusinessObject);
result="success";
==============
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";
==============
if(sharedCabinet)
   result="shared";
else {
    try {
       Thread.sleep(1000);
    } catch(InterruptedException e) {}
    result="private";
}
==============

@@@@@@@@@@@@@@@@@
ReplicationReceive:
@@@@@@@@@@@@@@@@@

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";
}
==============
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";
==============
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";
==============
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";
==============
System.out.println("+++Receive operation scheduled on "+primaryBusinessObject);
result="success";
==============
System.out.println("+++Workflow ReplicationReceive. got pre_import event on " + primaryBusinessObject);
result="success";
==============
System.out.println("+++Got PRE_RECEIVE event for object " + primaryBusinessObject);
result="success";
==============
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:
@@@@@@@@@@@@@@@@@

wt.replication.sender.UnitSendRecord rec = (wt.replication.sender.UnitSendRecord) primaryBusinessObject;
result = wt.replication.sender.StandardSenderService.enableScheduleItem(rec);
==============
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";
==============
