com.ibm.commerce.ubf

Class BusinessFlowInstance

  • java.lang.Object
    • com.ibm.commerce.ubf.BusinessFlowInstance


  • public class BusinessFlowInstance
    extends java.lang.Object
    BusinessFlowInstance acts as a facade for BusinessFlowEventListener. All data related to a business flow Instance are retrieved, created, and updated through this class.
    • Constructor Detail

      • BusinessFlowInstance

        public BusinessFlowInstance(java.lang.Long aFlowId,
                                    java.lang.Long aResourceId,
                                    java.lang.String aResourceClassName)
                             throws com.ibm.commerce.exception.ECSystemException
        Construct a BusinessFlowInstance object. This is used when a new business flow instance is created.
        Parameters:
        aFlowId - The BusinessFlow Id this object represents.
        aResourceId - The resource Id for access control checking.
        aResourceClassName - The resource class name for access control checking.
        Throws:
        com.ibm.commerce.exception.ECSystemException - If the entity data bean class can not be found, the entity data bean class can not be accessed, or the entity data bean class can not be instantiated.
      • BusinessFlowInstance

        public BusinessFlowInstance(java.lang.String aFlowTypeIdentifier,
                                    BusinessFlowEntityBean anEntity)
        Construct a BusinessFlowInstance object.
        Parameters:
        aFlowTypeIdentifier - The business flow type identifier this business flow instance belongs to.
        anEntity - The object of the business entity.
      • BusinessFlowInstance

        public BusinessFlowInstance(java.lang.String aFlowTypeIdentifier,
                                    java.lang.Long anEntityId)
                             throws com.ibm.commerce.exception.ECSystemException
        Construct a BusinessFlowInstance object.
        Parameters:
        aFlowTypeIdentifier - The business flow type identifier this business flow instance belongs to.
        anEntityId - The id of the business entity.
        Throws:
        com.ibm.commerce.exception.ECSystemException - If the entity data bean class can not be found, the entity data bean class can not be accessed, or the entity data bean class can not be instantiated.
    • Method Detail

      • anyAutomaticTransition

        public boolean anyAutomaticTransition(java.lang.String eventIdentifierFromEntryAction,
                                              java.lang.String approvalEventIdentifier)
        Check if we have automatic transitions from the new state after we have finished the current transition. The eventIdentifier from entryAction will the highest priority, then NULL event has the second highest priority, that from ApprovalSetUpCmd has the lowest priority.
        Parameters:
        eventIdentifierFromEntryAction - The event identifier from the entryAction.
        approvalEventIdentifier - The event identifier from the approval code.
        Returns:
        true if there is any automatic transition.
      • createInstanceBean

        public void createInstanceBean(java.lang.Long anEntityId,
                                       java.lang.Integer aStateIdentifier,
                                       java.lang.String aFlowStages,
                                       java.lang.Integer aCurrentFlowStageIndex,
                                       java.lang.String aFlowContext)
        Create a record in the FLINSTANCE table for the new business flow instance related to a newly created entity object.
        Parameters:
        anEntityId - The entity object Id which has been just created.
        aStateIdentifier - The Identifier the current state which the entity is in.
        aFlowStages - The flow stage string which represents the sequence of a composite flow.
        aCurrentFlowStageIndex - The index of the current flow stage.
        aFlowContext - The name-value pair string which is related to the business flow instance.
      • generateActionName

        public java.lang.String generateActionName(BusinessFlowTransition aMatchTransition)
        Generate an action name for Policy Manager by cancatenating flowTypeIdentifier, flowIdentifier, eventIdentifier, sourceStateName,and targetStateName.
        Parameters:
        aMatchTransition - The current transition.
        Returns:
        The action name of a transition.
      • generateFlowStageString

        public java.lang.String generateFlowStageString(BusinessFlow[] subFlows)
        Generate a string by cancatenating flow Id's hyphenating by "-".
        Parameters:
        subFlows - The array of flow Id's.
        Returns:
        The string which representing a sequence of flows a composite will follow.
      • getBusinessFlowEntityBean

        public BusinessFlowEntityBean getBusinessFlowEntityBean()
        Get the business flow entity bean this flow instance is controlling.
        Returns:
        The business flow entity bean.
      • getBusinessFlowEntityId

        public java.lang.Long getBusinessFlowEntityId()
        Get the Id of the business flow entity this flow instance is controlling.
        Returns:
        The Id of the business flow entity.
      • getBusinessFlowManager

        public BusinessFlowManager getBusinessFlowManager()
        Get the business flow manager which is managing the state machine cache.
        Returns:
        The business flow manager.
      • getCurrentFlowStageIndex

        public java.lang.Integer getCurrentFlowStageIndex()
        Get the index of the current flow stage the business flow instance is in.
        Returns:
        The index of the current flow stage.
      • getCurrentFlowStateRelBean

        public BusinessFlowStateRelation getCurrentFlowStateRelBean()
        Get the business flow state relation bean this flow instance is currently using.
        Returns:
        The business flow state relation bean.
      • getCurrentState

        public BusinessFlowState getCurrentState()
        Get the business flow state bean this flow instance is currently in.
        Returns:
        The business flow state bean.
      • getEventIdentifier

        public java.lang.String getEventIdentifier()
        Get an eventIdentifier.
        Returns:
        The eventIdentifier
      • getFlowBean

        public BusinessFlow getFlowBean()
        Get the bean of the business flow this flow instance is currently following.
        Returns:
        The business flow bean.
      • getFlowInstance

        public com.ibm.commerce.ubf.objects.FlowInstanceAccessBean getFlowInstance()
        Get the business flow instance access bean.
        Returns:
        The business flow instance access bean.
      • getFlowStages

        public java.lang.String getFlowStages()
        Get the flow stage string.
        Returns:
        The flow stage string.
      • getFlowType

        public BusinessFlowType getFlowType()
        Get the bean of the business flow type this flow instance belongs to.
        Returns:
        The business flow type bean.
      • getTargetFlowStateRelBean

        public BusinessFlowStateRelation getTargetFlowStateRelBean()
        Get the business flow state relation bean this flow instance will be using next.
        Returns:
        The business flow state relation bean.
      • getTargetState

        public BusinessFlowState getTargetState()
        Get the business flow state bean this flow instance will in next.
        Returns:
        The business flow state bean.
      • getTransitions

        public BusinessFlowTransition[] getTransitions()
        Get an array of transitions the business flow instance has from the current state.
        Returns:
        The array of transitions.
      • isIsAprvAutoTranstn

        public boolean isIsAprvAutoTranstn()
        Check if it is an automatic transition for approval.
        Returns:
        true if it is an automatic transition for approval
      • isIsCreate

        public boolean isIsCreate()
        Check if it is a new business flow instance.
        Returns:
        true if it is a new business flow instance
      • nullEventTransitionsExist

        public boolean nullEventTransitionsExist()
        Check if we have null event transitions.
        Returns:
        true if there is any null event transition.
      • retrieveAprvStatusRecord

        public com.ibm.commerce.approval.objects.ApprovalStatusAccessBean retrieveAprvStatusRecord(BusinessFlowEventData data)
        Retrieve an ApprovalStatusAccessBean object which is the approval record in the APRVSTATUS table for the approver.
        Parameters:
        data - The BusinessFlowEventData which contains information related to the request.
        Returns:
        an ApprovalStatusAccessBean object.
      • retrieveEntityDataBean

        public void retrieveEntityDataBean(java.lang.Long anEntityId)
                                    throws com.ibm.commerce.exception.ECSystemException
        Retrieve an entity data bean based on the bean class name in the FLOWTYPE table. If the bean class name in the FLOWTYPE table is not set up, the bean will not be retrieved.
        Parameters:
        anEntityId - The id of the entity data bean.
        Throws:
        com.ibm.commerce.exception.ECSystemException - If the user does fails for the , the entity data bean class can not be accessed, or the entity data bean class can not be instantiated.
      • retrieveEntityDataBean

        public void retrieveEntityDataBean(java.lang.Long anEntityId,
                                           java.lang.String aFlowTypeIdentifier)
                                    throws com.ibm.commerce.exception.ECSystemException
        Retrieve an entity data bean based on the bean class name in the FLOWTYPE table. If the bean class name in the FLOWTYPE table is not set up, the bean will not be retrieved.
        Parameters:
        anEntityId - The id of the entity data bean.
        aFlowTypeIdentifier - The identifier of the flow type.
        Throws:
        com.ibm.commerce.exception.ECSystemException - If the user does fails for the , the entity data bean class can not be accessed, or the entity data bean class can not be instantiated.
      • retrieveResourceDataBean

        public BusinessFlowEntityBean retrieveResourceDataBean(java.lang.Long aResourceId,
                                                               java.lang.String aResourceClassName)
                                                        throws com.ibm.commerce.exception.ECSystemException
        Retrieve a resource data bean based on the bean class name and its Id.
        Parameters:
        aResourceId - The id of the resource data bean.
        aResourceClassName - The resource class name.
        Returns:
        aBusinessFlowEntityBean The retrieved business flow entity object.
        Throws:
        com.ibm.commerce.exception.ECSystemException - If the user does fails for the , the entity data bean class can not be accessed, or the entity data bean class can not be instantiated.
      • retrieveTransitions

        public BusinessFlowTransition[] retrieveTransitions(java.lang.String anEventIdentifier)
        Retrieve an array of business flow transitions based on the event identifier.
        Parameters:
        anEventIdentifier - The identifier of the event.
        Returns:
        an array of business flow transitions
      • setBusinessFlowEntityBean

        public void setBusinessFlowEntityBean(BusinessFlowEntityBean newBusinessFlowEntityBean)
        Set the business flow entity bean this flow instance is controlling..
        Parameters:
        newBusinessFlowEntityBean - The business flow entity bean.
      • setBusinessFlowEntityId

        public void setBusinessFlowEntityId(java.lang.Long newBusinessFlowEntityId)
        Set the id of the business flow entity bean this flow instance is controlling..
        Parameters:
        newBusinessFlowEntityId - The id of the business flow entity bean.
      • setBusinessFlowManager

        public void setBusinessFlowManager(BusinessFlowManager newBusinessFlowManager)
        Set the business flow manager which is managing the state machine cache.
        Parameters:
        newBusinessFlowManager - The business flow manager.
      • setCurrentFlowStageIndex

        public void setCurrentFlowStageIndex(java.lang.Integer newCurrentFlowStageIndex)
        Set the index of the current flow stage the business flow instance is in.
        Parameters:
        newCurrentFlowStageIndex - The index of the current flow stage.
      • setCurrentFlowStateRelBean

        public void setCurrentFlowStateRelBean(BusinessFlowStateRelation newCurrentFlowStateRelBean)
        Set the business flow state relation bean this flow instance is currently using.
        Parameters:
        newCurrentFlowStateRelBean - The business flow state relation bean.
      • setCurrentState

        public void setCurrentState(BusinessFlowState newCurrentState)
        Set the business flow state bean this flow instance is currently in.
        Parameters:
        newCurrentState - The business flow state bean.
      • setEventIdentifier

        public void setEventIdentifier(java.lang.String newEventIdentifier)
        Set an eventIdentifier.
        Parameters:
        newEventIdentifier - The event identifier
      • setFlowBean

        public void setFlowBean(BusinessFlow newFlowBean)
        Set the bean of the business flow this flow instance is following.
        Parameters:
        newFlowBean - The business flow bean.
      • setFlowInstance

        public void setFlowInstance(com.ibm.commerce.ubf.objects.FlowInstanceAccessBean newFlowInstance)
        Set the business flow instance access bean.
        Parameters:
        newFlowInstance - The business flow instance access bean.
      • setFlowStages

        public void setFlowStages(java.lang.String newFlowStages)
        Set the flow stage string.
        Parameters:
        newFlowStages - The flow stage string.
      • setFlowType

        public void setFlowType(BusinessFlowType newFlowType)
        Set the bean of the business flow type this flow instance belongs to.
        Parameters:
        newFlowType - The business flow type bean.
      • setIsAprvAutoTranstn

        public void setIsAprvAutoTranstn(boolean newIsAprvAutoTranstn)
        Set the flag to indicate if it is an automatic transition for approval.
        Parameters:
        newIsAprvAutoTranstn - The flag to indicate if it is an automatic transition for approval.
      • setIsCreate

        public void setIsCreate(boolean newIsCreate)
        Set the flag to indicate if it is a new business flow instance.
        Parameters:
        newIsCreate - The flag to indicate if it is a new business flow instance.
      • setTargetFlowStateRelBean

        public void setTargetFlowStateRelBean(BusinessFlowStateRelation newTargetFlowStateRelBean)
        Set the target business flow state relation bean this flow instance will be using next.
        Parameters:
        newTargetFlowStateRelBean - The target business flow state relation bean.
      • setTargetState

        public void setTargetState(BusinessFlowState newTargetState)
        Set the business flow state bean this flow instance will in next.
        Parameters:
        newTargetState - The business flow state.
      • setTransitions

        public void setTransitions(BusinessFlowTransition[] newTransitions)
        Set an array of transitions the business flow instance has from the current state.
        Parameters:
        newTransitions - The array of transitions.
      • updateFlowInstance

        public void updateFlowInstance(java.lang.String flowContext)
        Update the record in the FLINSTANCE table for the business flow instance related to the entity object, including its current state identifier, stage index, timestamp.
        Parameters:
        flowContext - The flow context from an action command which needs to be persisted.