@@@@@@@@@@@@@@@@@ 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 ); =================