psdi.app.contract.common

Class CommonContractStatusHandler

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void approve(java.lang.String desiredStatus, java.util.Date date)
      Validates certain conditions before approving the contract.
      void canApprove(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change is legal.
      void canCancel(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change to Cancel is legal.
      void cancel(java.lang.String desiredStatus, java.util.Date date)
      Sets the status of the contract to cancel.
      void canChangeStatus(java.lang.String currentStatus, java.lang.String desiredStatus, long accessModifier)
      Defines which status changes are legal.
      void canClose(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change to close is legal.
      void canDraft(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change is legal.
      void canExpire(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change to Expire is legal.
      void canPndRev(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change to Pending Revision is legal.
      void canRevise(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change to Revised is legal.
      void canSuspnd(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change to Suspend is legal.
      void canUnapprove(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change to Unapproved is legal.
      void canWStart(java.lang.String currentMaxStatus)
      Contains conditions to check if the status change to Waiting to Start is legal.
      void changeStatus(java.lang.String currentStatus, java.lang.String desiredStatus, java.util.Date date, java.lang.String memo)
      Change the status from the current state to a desired state.
      protected void checkApprovalLimit() 
      void checkStatusChangeAuthorization(java.lang.String desiredExternalStatus)
      Is a certain status change allowable? This test determines whether a status change is possible by only checking security.
      void close(java.lang.String desiredStatus, java.util.Date date)
      When the status of the Contract is set to CLOSE, the linestatus of all the ContractLines will also be set to CLOSE with the exception of Canceled lines.
      void doesContractReferenceExistOnPO()
      Returns true if the contract reference exists on any PO Header or POLine, false otherwise
      void draft(java.lang.String desiredStatus, java.util.Date date)
      Sets the status of the contract to Draft.
      void expire(java.lang.String desiredStatus, java.util.Date date)
      Sets the status of the Contract to expire.
      MboRemote getNextRevision()
      Returns the next revision reference if a next reference exists.
      static java.lang.String getOptionName(java.lang.String status)
      Given a PR Status, return the optionName Note the status passed in is the INTERNAL status code.
      void possibleStatusChange(java.lang.String currentMaxStatus, java.lang.String desiredMaxStatus)
      Determine if a change of status is legal using the statusChangeMatrix.
      void postStatusChange(java.lang.String currentStatus, java.lang.String status, java.util.Date asOfDate, java.lang.String memo)
      Object can over override this method to process post status change logic.
      void revise(java.lang.String desiredStatus, java.util.Date date)
      Sets the status of the Contract to Revised.
      void setLineStatus(java.lang.String externalStatus)
      Sets the status of the LINESTATUS to whatever status that is passed into this method.
      void suspnd(java.lang.String desiredStatus, java.util.Date date)
      When the status of the Contract is set to SUSPND, the linestatus of all the ContractLines will also be set to SUSPND with the exception of Canceled lines.
      void unapprove(java.lang.String desiredStatus, java.util.Date date)
      Sets the status of the contract to Waiting for Approval.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • WAPPR

        protected java.lang.String WAPPR
        String object that holds the string "WAPPR"
      • APPROVE

        protected java.lang.String APPROVE
        String object that holds the string "APPR"
      • DRAFT

        protected java.lang.String DRAFT
        String object that holds the string "DRAFT"
      • CLOSE

        protected java.lang.String CLOSE
        String object that holds the string "CLOSE"
      • CANCEL

        protected java.lang.String CANCEL
        String object that holds the string "CAN"
      • WSTART

        protected java.lang.String WSTART
        String object that holds the string "WSTART"
      • PNDREV

        protected java.lang.String PNDREV
        String object that holds the string "PNDREV"
      • REVISE

        protected java.lang.String REVISE
        String object that holds the string "REVISE"
      • SUSPND

        protected java.lang.String SUSPND
        String object that holds the string "SUSPND"
      • EXPIRE

        protected java.lang.String EXPIRE
        String object that holds the string "EXPIRE"
      • Draft

        protected static final int Draft
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • Wappr

        protected static final int Wappr
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • Appr

        protected static final int Appr
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • Close

        protected static final int Close
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • Can

        protected static final int Can
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • PndRev

        protected static final int PndRev
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • Revise

        protected static final int Revise
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • WStart

        protected static final int WStart
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • Expire

        protected static final int Expire
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • Suspnd

        protected static final int Suspnd
        A static integer used to access the rows of the statusChangeMatrix.
        See Also:
        Constant Field Values
      • statusChangeMatrix

        public static boolean[][] statusChangeMatrix
        A statusChangeMatrix for the legal status changes that can be made.

        Status   DRAFT   WAPPR   APPR  CLOSE  CANCEL  PNDREV  REVISE  WSTART  EXPIRE  SUSPND 
        DRAFT false true true true true false false false false false
        WAPPR true false true true true false false false false false
        APPRfalse falsefalse true true false true false true true
        CLOSE false false false falsefalse false false falsefalse false
        CANCEL false false false falsefalse false false false false false
        PNDREV true true true false true false false false false false
        REVISE false false false false false false false false false false
        WSTART false false true true true false true false falsetrue
        EXPIRE false false false true false false false false false false
        SUSPND true true true true true false false false false false
        s. The above table must be read from right to left only.
        For example , if you want to change the status from CLOSE to WAPPR , look at the left for the CLOSE row and look at the intersecting WAPPR column. The value is false. This means that this status change is not allowed.
    • Constructor Detail

      • CommonContractStatusHandler

        public CommonContractStatusHandler(StatefulMbo sm)
        Parameters:
        sm -
    • Method Detail

      • possibleStatusChange

        public void possibleStatusChange(java.lang.String currentMaxStatus,
                                         java.lang.String desiredMaxStatus)
                                  throws MXException,
                                         java.rmi.RemoteException
        Determine if a change of status is legal using the statusChangeMatrix. This method is called while building the list for possible status changes.
        Throws:
        MXApplicationException(contract, - invalidstatuschange) is thrown when a status change is illegal.
        MXException
        java.rmi.RemoteException
        See Also:
        statusChangeMatrix#matrix
      • canChangeStatus

        public void canChangeStatus(java.lang.String currentStatus,
                                    java.lang.String desiredStatus,
                                    long accessModifier)
                             throws MXException,
                                    java.rmi.RemoteException
        Defines which status changes are legal. If a status change is not legal, an MXApplicationException is thrown.
        Overrides:
        canChangeStatus in class StatusHandler
        Parameters:
        currentStatus - The current external status of the Purchase Contract
        desiredStatus - The desired external status of the Purchase Contract
        accessModifier -
        Throws:
        MXApplicationException("contract", - "invalidstatus")
        MXException
        java.rmi.RemoteException
        See Also:
        possibleStatusChange, statusChangeMatrix#matrix
      • checkApprovalLimit

        protected void checkApprovalLimit()
                                   throws MXException,
                                          java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • getOptionName

        public static java.lang.String getOptionName(java.lang.String status)
        Given a PR Status, return the optionName Note the status passed in is the INTERNAL status code.
        The SigOption Option Name doesn't always match the status name.
        Parameters:
        status - The status to return the optionName of.
        Returns:
        optionName The Option Name.
      • canClose

        public void canClose(java.lang.String currentMaxStatus)
                      throws MXException,
                             java.rmi.RemoteException
        Contains conditions to check if the status change to close is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canExpire

        public void canExpire(java.lang.String currentMaxStatus)
                       throws MXException,
                              java.rmi.RemoteException
        Contains conditions to check if the status change to Expire is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canSuspnd

        public void canSuspnd(java.lang.String currentMaxStatus)
                       throws MXException,
                              java.rmi.RemoteException
        Contains conditions to check if the status change to Suspend is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canPndRev

        public void canPndRev(java.lang.String currentMaxStatus)
                       throws MXException,
                              java.rmi.RemoteException
        Contains conditions to check if the status change to Pending Revision is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canRevise

        public void canRevise(java.lang.String currentMaxStatus)
                       throws MXException,
                              java.rmi.RemoteException
        Contains conditions to check if the status change to Revised is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canWStart

        public void canWStart(java.lang.String currentMaxStatus)
                       throws MXException,
                              java.rmi.RemoteException
        Contains conditions to check if the status change to Waiting to Start is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canApprove

        public void canApprove(java.lang.String currentMaxStatus)
                        throws MXException,
                               java.rmi.RemoteException
        Contains conditions to check if the status change is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canDraft

        public void canDraft(java.lang.String currentMaxStatus)
                      throws MXException,
                             java.rmi.RemoteException
        Contains conditions to check if the status change is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canUnapprove

        public void canUnapprove(java.lang.String currentMaxStatus)
                          throws MXException,
                                 java.rmi.RemoteException
        Contains conditions to check if the status change to Unapproved is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • canCancel

        public void canCancel(java.lang.String currentMaxStatus)
                       throws MXException,
                              java.rmi.RemoteException
        Contains conditions to check if the status change to Cancel is legal. Currently has no implementation.
        Parameters:
        currentMaxStatus -
        Throws:
        MXException
        java.rmi.RemoteException
      • changeStatus

        public void changeStatus(java.lang.String currentStatus,
                                 java.lang.String desiredStatus,
                                 java.util.Date date,
                                 java.lang.String memo)
                          throws MXException,
                                 java.rmi.RemoteException
        Change the status from the current state to a desired state. Call the appropriate status change methods based on the target status.
        Overrides:
        changeStatus in class StatusHandler
        Parameters:
        currentStatus - The Purchase Contract's status now.
        desiredStatus - The status to change to.
        date - The date as of the status change is to be made.
        memo - Memo text.
        Throws:
        MXException
        java.rmi.RemoteException
      • revise

        public void revise(java.lang.String desiredStatus,
                           java.util.Date date)
                    throws MXException,
                           java.rmi.RemoteException
        Sets the status of the Contract to Revised. Revised contracts become history records. Also, the line statuses are changed to revised with the exception of canceled lines.
        Throws:
        MXException
        java.rmi.RemoteException
      • expire

        public void expire(java.lang.String desiredStatus,
                           java.util.Date date)
                    throws MXException,
                           java.rmi.RemoteException
        Sets the status of the Contract to expire. Also, the line statuses are changed to expired with the exception of canceled lines.
        Throws:
        MXException
        java.rmi.RemoteException
      • unapprove

        public void unapprove(java.lang.String desiredStatus,
                              java.util.Date date)
                       throws MXException,
                              java.rmi.RemoteException
        Sets the status of the contract to Waiting for Approval. When the status of the Contract is set to Waiting for Approval, the linestatus of all the ContractLines will also be set to Waiting for Approval with the exception of Cancelled lines.
        Parameters:
        approveDate -
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        setLineStatus
      • doesContractReferenceExistOnPO

        public void doesContractReferenceExistOnPO()
                                            throws MXException,
                                                   java.rmi.RemoteException
        Returns true if the contract reference exists on any PO Header or POLine, false otherwise
        Throws:
        MXException
        java.rmi.RemoteException
      • cancel

        public void cancel(java.lang.String desiredStatus,
                           java.util.Date date)
                    throws MXException,
                           java.rmi.RemoteException
        Sets the status of the contract to cancel. When the status of the Contract is set to cancel, the linestatus of all the ContractLines will also be set to Cancel. Canceling a contract also cancels the next or previous revision. Also cancel any invoices that have been created for this contract and are in the status SCHED.
        Parameters:
        approveDate -
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        setLineStatus
      • getNextRevision

        public MboRemote getNextRevision()
                                  throws MXException,
                                         java.rmi.RemoteException
        Returns the next revision reference if a next reference exists. If no next revision exists, this method will return null.
        Returns:
        MboRemote - next revision reference.
        Throws:
        MXException
        java.rmi.RemoteException
      • draft

        public void draft(java.lang.String desiredStatus,
                          java.util.Date date)
                   throws MXException,
                          java.rmi.RemoteException
        Sets the status of the contract to Draft. When the status of the Contract is set to Draft, the linestatus of all the ContractLines will also be set to Draft with the exception of Canceled lines.
        Parameters:
        approveDate -
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        setLineStatus
      • close

        public void close(java.lang.String desiredStatus,
                          java.util.Date date)
                   throws MXException,
                          java.rmi.RemoteException
        When the status of the Contract is set to CLOSE, the linestatus of all the ContractLines will also be set to CLOSE with the exception of Canceled lines. The historyflag is also turned on. Also cancel any invoices that have been created for this contract and are in the status SCHED.
        Parameters:
        approveDate -
        Throws:
        MXException
        java.rmi.RemoteException
      • suspnd

        public void suspnd(java.lang.String desiredStatus,
                           java.util.Date date)
                    throws MXException,
                           java.rmi.RemoteException
        When the status of the Contract is set to SUSPND, the linestatus of all the ContractLines will also be set to SUSPND with the exception of Canceled lines.
        Parameters:
        date -
        Throws:
        MXException
        java.rmi.RemoteException
      • approve

        public void approve(java.lang.String desiredStatus,
                            java.util.Date date)
                     throws MXException,
                            java.rmi.RemoteException
        Validates certain conditions before approving the contract.
        • Check to see if the current date falls within the valid dates for the contract.
        • Check the approval limit of the person approving the contract. If it is more that the specified approval limit an error is thrown.
        • If the status of the current contract is Pending revision, locate the previous revision of this contract and set the status of the previous revision of this contract to revised.
        Parameters:
        approveDate -
        Throws:
        MXException
        java.rmi.RemoteException
      • setLineStatus

        public void setLineStatus(java.lang.String externalStatus)
                           throws MXException,
                                  java.rmi.RemoteException
        Sets the status of the LINESTATUS to whatever status that is passed into this method. The status of canceled lines remain as canceled.
        Throws:
        MXException
        java.rmi.RemoteException
      • postStatusChange

        public void postStatusChange(java.lang.String currentStatus,
                                     java.lang.String status,
                                     java.util.Date asOfDate,
                                     java.lang.String memo)
                              throws MXException,
                                     java.rmi.RemoteException
        Object can over override this method to process post status change logic. called by statefulmbo.
        Overrides:
        postStatusChange in class StatusHandler
        Throws:
        MXException
        java.rmi.RemoteException