Class WorkflowProcessHelper

java.lang.Object
com.ptc.windchill.pdmlink.change.server.impl.WorkflowProcessHelper

public class WorkflowProcessHelper extends Object
This class contains static methods to support the PDMLink Workflow processes These methods are intended to be called by routing expressions and synchronization robot expressions.

Supported API: true

Extendable: true
  • Field Details

  • Method Details

    • processConfirmation

      public static void processConfirmation(WTChangeIssue changeIssue, ConfirmationCategory a_ConfirmationCategory) throws WTPropertyVetoException, WTException
      This method processes the confirmation of a Problem Report: - Persist the ConfirmationCategory on the Problem Report - Persist the ConfirmationAudit on the Problem Report

      Supported API: true
      Parameters:
      changeIssue -
      a_ConfirmationCategory -
      Throws:
      WTException
      WTPropertyVetoException
      See Also:
    • setECNResolutionDate

      @Deprecated public static void setECNResolutionDate(ChangeOrder2 changeOrder, String changeTaskState) throws WTException
      Deprecated.
      use WorkflowProcessHelper.closeChangeChildren(changeItem) instead.
      This method sets the resolution date of a Change Notice and sets the state of the associated Change Tasks.

      Supported API: true
      Parameters:
      changeOrder - the change order to set the resolution date on and whose related change tasks state will be set
      changeTaskState - the state the change tasks related to the change order will be set to
      Throws:
      WTException
      See Also:
    • setECNResolutionDate

      @Deprecated public static void setECNResolutionDate(ChangeOrder2 changeOrder) throws WTException
      Deprecated.
      use WorkflowProcessHelper.closeChangeChildren(changeItem) instead.
      This method sets the resolution date of a Change Notice. This method also sets the state of the associated Change Tasks to the CA_RESOLVED_STATE

      Supported API: true
      Parameters:
      changeOrder -
      Throws:
      WTException
      See Also:
    • setECNActualStartDate

      public static void setECNActualStartDate(ChangeOrder2 changeOrder) throws WTException, WTPropertyVetoException
      This method sets the actual start date of a Change Notice
      Supported API: true
      Parameters:
      changeOrder -
      Throws:
      WTException
      WTPropertyVetoException
      See Also:
    • isStateValidForLifeCycleTemplate

      public static boolean isStateValidForLifeCycleTemplate(LifeCycleManaged object, State state) throws WTException
      Verify that the passed state is valid for the LifeCycleTemplate of the passed LifeCycleManaged object.

      Supported API: true
      Parameters:
      object - The LifeCycleManaged object
      state - The state to verify.
      Returns:
      boolean
      Throws:
      WTException
    • getECNPendingImplementationState

      public static State getECNPendingImplementationState(ChangeOrder2 changeOrder) throws WTException
      Will return the LifeCycleState value from the "Pending Implementation State" property on Change Notice type. Will only support WTChangeOrder2 object. Will return null for other objects.

      Supported API: true
      Parameters:
      changeItem - - A Change Notice object. Only WTChangeOrder2 object is handled.
      Returns:
      Throws:
      WTException
    • setResolutionDate

      public static void setResolutionDate(Object changeItem) throws WTException
      This method sets the resolution date of a Change Item. It returns the new version.

      Supported API: true
      Parameters:
      changeItem -
      Throws:
      WTException
    • setPRResolutionDate

      @Deprecated public static void setPRResolutionDate(ChangeIssue changeIssue) throws WTException
      Deprecated.
      - Use WorkflowProcessHelper.setResolutionDate(changeItem)


      Supported API: true This method sets the resolution date of a Problem Report.
      Parameters:
      changeIssue -
      Throws:
      WTException
      See Also:
    • setCRResolutionDate

      @Deprecated public static void setCRResolutionDate(ChangeRequest2 changeRequest) throws WTException
      Deprecated.
      - Use WorkflowProcessHelper.setResolutionDate(changeItem)
      This method sets the resolutionDate field of a ChangeRequest and saves it in the database. The resolutionDate is calculated via System.currentTimeMillis(); This method is intended to be executed inside a workflow. This method does not update any other Change objects.

      Supported API: true
      Parameters:
      changeRequest -
      Throws:
      WTException
    • getUnpromotableChangeables

      @Deprecated public static WTCollection getUnpromotableChangeables(ChangeOrder2 cOrder) throws WTException
      Deprecated.
      This method hardcodes unpromotable check to Change transition. But we dont limit customers to check for CHANGE Transition. They can validate for any transition and hence this method is deprecated and will be removed in future releases.
      Return the changeable2 objects associated through the ChangeRecord2 link that have no CHANGE transition.

      Supported API: true
      Parameters:
      cOrder -
      Returns:
      WTCollection
      Throws:
      WTException
      See Also:
    • promoteChangeables

      @Deprecated public static void promoteChangeables(ChangeOrder2 cOrder) throws WTException
      Deprecated.
      All the changeables of a ChangeOrder are automatically promoted to state defined by the CHANGE transition. In Addition, If any of the changeables have a live workflow, it is terminated. Deprecation notice - this should no longer be called from the workflow! Instead, you should be calling the api: releaseChangeables(versionableChangeItem).

      Supported API: true
      Parameters:
      cOrder -
      Throws:
      WTException
    • promoteChangeables

      @Deprecated public static void promoteChangeables(ChangeActivity2 ca) throws WTException
      Deprecated.
      All the changeables of a ChangeActivity are automatically promoted to the state defined by the CHANGE transition. If any of the changeables have a running workflow, it is terminated prior to the transition occuring. Deprecation notice - this should no longer be called from the workflow! Instead, you should be calling the api: releaseChangeables(versionableChangeItem).

      Supported API: true
      Parameters:
      ca - The change activity for which the change records will be promoted.
      Throws:
      WTException
    • releaseChangeables

      public static void releaseChangeables(VersionableChangeItem object) throws WTException
      Given the versionableChangeItem, this method will release the changeables based on the persisted TargetTransition on the ChangeRecord2. This method also calls sync API to update the Affected objects to latest released in eligible Change Tasks and also triggers the sync for open and eligible Redlines.

      Supported API: true
      Parameters:
      changeOrder -
      Throws:
      WTException
    • processBusinessDecision

      public static void processBusinessDecision(WTChangeRequest2 changeRequest, BusinessDecisionCategory a_BusinessDecision, String track, String comments) throws WTPropertyVetoException, WTException
      This method processes the business decision of a Change Request: - Persist the BusinessDecisionSummary on the Change Request - Persist the BusinessDecisionAudit on the Change Request

      Supported API: true
      Parameters:
      changeRequest -
      a_BusinessDecision -
      track -
      comments -
      Throws:
      WTException
      WTPropertyVetoException
      See Also:
    • processBusinessDecision

      public static void processBusinessDecision(ChangeRequest2 changeRequest, BusinessDecisionCategory a_BusinessDecision, String comments) throws WTPropertyVetoException, WTException
      This method processes the business decision of a Change Request: - Persist the BusinessDecisionSummary on the Change Request - Persist the BusinessDecisionAudit on the Change Request

      Supported API: true
      Parameters:
      changeRequest -
      a_BusinessDecision -
      comments -
      Throws:
      WTException
      WTPropertyVetoException
      See Also:
    • processBusinessDecisionImpl

      protected static void processBusinessDecisionImpl(ChangeRequest2 changeRequest, BusinessDecisionCategory a_BusinessDecision, String comments) throws WTPropertyVetoException, WTException
      This method processes the business decision of a Change Request: - Persist the BusinessDecisionSummary on the Change Request - Persist the BusinessDecisionAudit on the Change Request

      Supported API: true
      Parameters:
      changeRequest -
      a_BusinessDecision -
      comments -
      Throws:
      WTException
      WTPropertyVetoException
      See Also:
    • setTrack

      public static void setTrack(WTChangeRequest2 changeRequest, String track) throws WTPropertyVetoException, WTException
      This method sets the complexity (track) of a change request

      Supported API: true
      Parameters:
      changeRequest -
      track -
      Throws:
      WTException
      WTPropertyVetoException
      See Also:
    • checkOrdersFinished

      public static String checkOrdersFinished(ChangeRequest2 cRequest) throws WTException
      This method checks if the state of all of the associated ECNs of the cRequest: - If at least on of the ECNs are in the LCM_RESOLVED_STATE and the rest are either in the LCM_RESOLVED_STATE or the LCM_CANCELLED_STATE then return RESOLVED. - If all of the ECNs are in the LCM_CANCELLED_STATE then return CANCELLED. - If there are no associated Change Notices then return NO_SUBORDINATES. - If any are in some other state then return NOT_FINISHED.

      Supported API: true
      Parameters:
      cRequest -
      Returns:
      String
      Throws:
      WTException
    • checkActivitiesFinished

      public static String checkActivitiesFinished(ChangeOrder2 changeOrder) throws WTException
      This method checks if the state of all of the associated Change Tasks of the change order: - If there are associated Change Tasks and at least one of the Change Tasks are in the LCM_RESOLVED_STATE and the rest are either in the LCM_RESOLVED_STATE or the LCM_CANCELLED_STATE then return RESOLVED. - If all of the Change Tasks are in the LCM_CANCELLED_STATE then return CANCELLED. - If any Change Tasks are in some other state then return NOT_FINISHED.

      Supported API: true
      Parameters:
      changeOrder -
      Returns:
      String
      Throws:
      WTException
      ChangeException2
    • rescheduleChangeItem

      public static void rescheduleChangeItem(VersionableChangeItem changeItem)
      Reschedule a change plan activity for a change item. Has no effect if the change item has no change plan activity.

      Supported API: true
      Parameters:
      changeItem - Change item that owns a change plan activity.
    • checkImplementation

      @Deprecated public static String checkImplementation(WTChangeOrder2 cOrder)
      Deprecated.
      - Use cOrder.getState().toString()


      Supported API: true Return the State of the Change Order.
      Parameters:
      cOrder -
      Returns:
      String
    • findChangeOrder

      public static WTChangeOrder2 findChangeOrder(WTChangeActivity2 ca) throws ChangeException2, WTException


      Supported API: true This finds the associated Change Order for a Change Activity.
      Parameters:
      ca -
      Returns:
      WTChangeOrder2
      Throws:
      WTException
      ChangeException2
    • setRolesToECN

      public static void setRolesToECN(ChangeOrder2 changeOrder, String... roles) throws WTException


      Supported API: true Obtains the principles assigned to the given roles on all parent Change Requests and copies those principles to the same role on the passed Change Order.
      Parameters:
      changeOrder -
      roles -
      Throws:
      WTException
    • setRoleToECN

      public static void setRoleToECN(ChangeOrder2 changeOrder, String sRole) throws WTException
      Obtains the principles assigned to the given role on all parent Change Requests and copies those principles to the same role on the passed Change Order.

      Supported API: true
      Parameters:
      changeOrder -
      sRole -
      Throws:
      WTException
    • setRoleToECR

      public static void setRoleToECR(ChangeRequest2 request, String sRole) throws WTException
      Obtains the principles assigned to the given role on all associated Change Issues and copies those principles to the same role on the passed Change Request.

      Supported API: true
      Parameters:
      request -
      sRole -
      Throws:
      WTException
    • getComplexity

      public static ChangeNoticeComplexity getComplexity(WTChangeOrder2 changeOrder)


      Supported API: true This method returns the complexity of an ECN, as opposed to the complexity of an associated ECR.
      Parameters:
      changeOrder - The change order (ECN) whose complexity will be evaluated.
      Returns:
      Complexity The complexity of the passed change order (ECN).
      See Also:
    • isComplex

      public static Boolean isComplex(WTChangeOrder2 changeOrder)
      This method returns true if the complexity of any Change Request associated to the changeOrder is COMPLEX.

      Supported API: true
      Parameters:
      changeOrder -
      Returns:
      Boolean
      See Also:
    • setVarianceAuthorRole

      public static void setVarianceAuthorRole(WTVariance variance, String sRole) throws WTException
      setVarianceAuthorRole

      Supported API: true Sets the variance owner principal to the Variance Author role.
      Parameters:
      variance -
      sRole -
      Throws:
      WTException
    • setSubmitterRole

      public static void setSubmitterRole(VersionableChangeItem chg, String sRole) throws WTException
      Assigns the original creator of the change item to the specified role

      Supported API: true
      Parameters:
      chg -
      sRole -
      Throws:
      WTException
    • applyPendingEffectivities

      public static void applyPendingEffectivities(ChangeOrderIfc changeNotice) throws WTException
      Processes pending effectivities on a change notice, creating active product effectivities. This method directly defers to the effectivity service for processing.



      Supported API: true

      Parameters:
      changeNotice - change notice participating in workflow
      Throws:
      WTException - surfaced from call to effectivity service method
    • approveHangingChanges

      public static void approveHangingChanges(WTChangeOrder2 cOrder) throws WTException
      Set the UnIncorporatedChange status to APPROVED or INCORPORATED depending on the current state of the unincorporated changes.

      Supported API: true
      Parameters:
      cOrder - change notice participating in workflow
      Throws:
      WTException - Caused by an issue in processing the unincorporated changes.
    • rejectUnincorporatedChanges

      public static void rejectUnincorporatedChanges(WTChangeOrder2 cOrder) throws WTException, WTPropertyVetoException
      Reject the unincorporated changes for the change notice that is being rejected by the CIB review. For unincorporated changes for the rejected change notice; Will delete all unincorporated changes of status PENDING_HANGING. Will set any unincorporated changes of status PENDING_INCORPORATION to status APPROVED_HANGING. Will set any unincorporated changes of status PENDING_INCORPORATION to incorpChange of null.

      invalid input: '<'Supported API: true
      Parameters:
      cOrder - The change notice that is being rejected.
      Throws:
      WTException - Thrown if an error occurs processing the hanging change links.
      WTPropertyVetoException - If setting the incorpStatus or incorpChange is not allowed a veto exception is thrown and no work is done for the reject.
    • performChangeWorkflowValidation

      @Deprecated public static UIValidationResultSet performChangeWorkflowValidation(VersionableChangeItem changeItem, String selector) throws WTException
      Deprecated.
      - Replace the caller procedure to use wt.businessRules.BusinessRulesHelper.engine.execute(String ruleSetKey, RuleValidationCriteria criteria)
      See com.ptc.core.businessRules.engine.BusinessRulesEngine# execute
      Calls the registered validator for the given selector to validate that the change object can move to the phase in the work flow process. The performFullPreValidation is invoked and a validation result set is return with a validation result with the status set to PERMITTED or DENIED. A localized feed back message may be used to communicate why the status was set to DENIED.

      Supported API: true
      Parameters:
      changeItem - The primary business object in the change object work flow.
      selector - Key for validation
      Returns:
      validation result set with the status as PERMITTED or DENIED.
      Throws:
      WTException
    • syncChangeActivityState

      public static void syncChangeActivityState(ChangeOrder2 co) throws WTException
      Changes the state of a ChangeOrder2's associated ChangeActivity2's to be the same state as the ChangeOrder2.

      Supported API: true
      Parameters:
      co -
      Throws:
      WTException
    • implementChange

      public static void implementChange(ChangeOrder2 co) throws WTException
      Emits the CHANGE IMPLEMENTATION event for all the associated Change Activities for the given Change Order.

      Supported API: true
      Parameters:
      co - - Change Order
      Throws:
      WTException
    • isChangeActivityReady

      public static boolean isChangeActivityReady(ChangeActivity2 ca)
      Checks if the given Change Activity is ready to execute the work flow or not.

      Supported API: true
      Parameters:
      ca - - Change Activity
      Returns:
      boolean - if the given Change Activity is ready or not to execute the workflow.
    • getActivityParticipants

      public static Map<Role,WTSet> getActivityParticipants(VersionableChangeItem changeItem, String activityName) throws WTException
      Get participants of a completed work activity for a change item. If the work activity was executed multiple times (e.g., a rework activity was run several times), then only the participants from the latest completed execution are returned.

      Supported API: true
      Parameters:
      changeItem - Work flow primary business object.
      activityName - Work flow activity name.
      Returns:
      Map of activity roles to the participants for that role, or null if an activity with the specified name has not been executed for the change item.
      Throws:
      WTException
    • getChangeItemParticipants

      public static Map<Role,WTSet> getChangeItemParticipants(VersionableChangeItem changeItem) throws WTException
      Get all participants of a change item team.

      Supported API: true
      Parameters:
      changeItem - Change item object.
      Returns:
      Map of change item roles to the participants for that role.
      Throws:
      WTException
    • setChangeItemParticipants

      public static void setChangeItemParticipants(VersionableChangeItem changeItem, Role role, WTCollection participants) throws WTException
      Set the participants for a role of a change item team. The old participants of the role, if any, will be replaced with the new participants.

      Supported API: true
      Parameters:
      changeItem - Work flow primary business object.
      role - Change item team role to be set.
      participants - Collection of new participants for the role. Pass an empty set to remove all participants from the role. Pass null to remove the entire role.
      Throws:
      WTException
    • isRelatedParentsInStates

      public static boolean isRelatedParentsInStates(Object changeItem, String[] states) throws WTException
      Given a ChangeItem and an array of states, look up the related parent objects and determine if each one is in one of the given states. If each parent object is in one of the given states, then this will return true. Otherwise, it will return false. If there are no parent objects found, then it will also return false.

      Supported API: true
      Parameters:
      changeItem -
      states -
      Throws:
      WTException
    • isRelatedParentsInStates

      public static boolean isRelatedParentsInStates(Object changeItem, String[] states, String[] filterByChangeTypeIds) throws WTException
      Given a ChangeItem and an array of states, look up the related parent objects that match specified change filter types and determine if each one is in one of the given states. If each parent object is in one of the given states, then this will return true. Otherwise, it will return false. If there are no parent objects found, then it will also return false.

      Supported API: true
      Parameters:
      changeItem -
      states -
      filterByChangeTypeIds - Change type identifiers to filter by
      Throws:
      WTException
    • isRelatedChildrenInStates

      public static boolean isRelatedChildrenInStates(Object changeItem, String[] states) throws WTException
      Given a ChangeItem and an array of states, look up the related child objects and determine if each one is in one of the given states. If each child object is in one of the given states, then this will return true. Otherwise, it will return false. If there are no child objects found, then it will also return false.

      Supported API: true
      Parameters:
      changeItem -
      states -
      Throws:
      WTException
    • isRelatedChildrenInStates

      public static boolean isRelatedChildrenInStates(Object changeItem, String[] states, String[] filterByChangeTypeIds) throws WTException
      Given a ChangeItem and an array of states, look up the related child objects that match specified change filter types and determine if each one is in one of the given states. If each child object is in one of the given states, then this will return true. Otherwise, it will return false. If there are no child objects found, then it will also return false.

      Supported API: true
      Parameters:
      changeItem -
      states -
      filterByChangeTypeIds - Change type identifiers to filter by
      Throws:
      WTException
    • closeChangeChildren

      public static void closeChangeChildren(Object changeItem, Map<Class,State> stateMap) throws WTException
      Given a change item, and a map of class types to states, this API will look up the children of the given change item and will close the children with the given states. This method supports both legacy or flexible change objects. For legacy change items, the objects will close according to the traditional child role. For flexible change items, the child members of the ChangeProcessLink will be closed. When a change item is closed, the following changes occur to the object:
      1. The resolution date is set
      2. The state is set
      3. The workflow is terminated
      Note: this does not close the passed in change item.

      Supported API: true
      Parameters:
      changeItem - the change object forcing its children to close
      stateMap - map a change class to a particular state to resolve to
      Throws:
      WTException
    • closeChangeParents

      public static void closeChangeParents(Object changeItem, Map<Class,State> stateMap) throws WTException
      Given a change item, and a map of class types to states, this API will look up the parents of the given change item and will close the parents with the given states. This method supports both legacy or flexible change objects. For legacy change items, the objects will close according to the traditional parent role. For flexible change items, the parent members of the ChangeProcessLink will be closed. When a change item is closed, the following changes occur to the object:
      1. The resolution date is set
      2. The state is set
      3. The workflow is terminated
      Note: this does not close the passed in change item.

      Supported API: true
      Parameters:
      changeItem - the change object forcing its parents to close
      stateMap - map a change class to a particular state to resolve to
      Throws:
      WTException
    • changeNoticeExists

      public static boolean changeNoticeExists(Object changeItem) throws WTException
      Return true if a change notice exists for the given change request. This supports flexible or legacy change requests. If input parameter is not instanceOf FlexibleChangeItem this returns false.

      Supported API: true
      Parameters:
      changeItem -
      Throws:
      WTException
      ChangeException2
    • applyImpacts

      public static boolean applyImpacts(VersionableChangeItem changeItem) throws WTException
      Apply the impact of a change activity, and all the change activities of a change order, on associated Impacted objects.

      Supported API: true
      Parameters:
      changeItem - ChangeActivity2 or ChangeOrder2 object, other types ignored.
      Returns:
      True if an associated Impacted object was updated. False if none were updated or none are associated.
      Throws:
      WTException
    • applyImpacts

      public static boolean applyImpacts(WTCollection changeItems) throws WTException
      Apply the impact of change activities, and all the change activities of change orders, on associated Impacted objects.

      Supported API: true
      Parameters:
      changeItems - Collection of ChangeActivity2 or ChangeOrder2 objects, other types ignored.
      Returns:
      True if an associated Impacted object was updated. False if none were updated or none are associated.
      Throws:
      WTException
    • setChangeRedlineState

      public static void setChangeRedlineState(WTChangeOrder2 changeNotice, State changeVersionState, ChangeVersionState changeVersionLinkStateToUpdate, Set<ChangeVersionState> changeVersionLinkStates, boolean undoCheckoutRedlines) throws WTException, WTPropertyVetoException
      Set the state for all change versions in the passed change notice.

      Supported API: true
      Parameters:
      changeNotice -
      changeVersionState - - The state to set for change version(BOM Redline).
      changeVersionLinkStateToUpdate - - If not null then will set the state for ChangeVersionLink.
      changeVersionLinkStates - - If null then will fetch Open ChangeVersionLinks only to set Change version or ChangeVersionLink state. If not null then will fetch ChangeVersionLinks of all passed states and will set Change version or ChangeVersionLink state.
      undoCheckoutRedlines - - If true then undo checkout change version(BOM Redline) before setting state.
      Throws:
      WTException
      WTPropertyVetoException