Interface TicketUpdateStrategy

  • All Known Implementing Classes:
    DefaultTicketUpdateStrategy

    public interface TicketUpdateStrategy
    Interface to support the strategies to be considered when changing a ticket. This strategy should implement any business rules to be used changing a ticket.
    • Method Detail

      • updateTicket

        CsTicketModel updateTicket​(CsTicketModel ticket)
                            throws TicketException
        Store all updated attributes on a ticket. This method should run business rules to confirm that the changes made are legal. If the update is not permitted an exception is thrown.
        Parameters:
        ticket - The ticket to be updated
        Returns:
        The updated ticket
        Throws:
        TicketException - If the update is not permitted
      • updateTicket

        CsTicketModel updateTicket​(CsTicketModel ticket,
                                   java.lang.String note)
                            throws TicketException
        Store all updated attributes on a ticket. This method also allows a note to be added to the ticket with the update. This method should run business rules to confirm that the changes made are legal. If the update is not permitted an exception is thrown.
        Parameters:
        ticket - The ticket to be updated
        note - The text of the note to add along with the update
        Returns:
        The updated ticket
        Throws:
        TicketException - If the update is not permitted
      • setTicketState

        void setTicketState​(CsTicketModel ticket,
                            CsTicketState newState)
                     throws TicketException
        Set the state of the ticket. This method should run any business rules associated with state change. This method should also guarantee that it won't have the side effect of storing any other changes to the ticket and should throw an exception if the ticket has been otherwise updated.
        Parameters:
        ticket - The ticket to update the state of
        newState - The state to set the ticket to
        Throws:
        TicketException - If the ticket has been modified or the state transition is illegal
        See Also:
        getTicketNextStates to get list of possible state transitions
      • setTicketState

        void setTicketState​(CsTicketModel ticket,
                            CsTicketState newState,
                            java.lang.String note)
                     throws TicketException
        Set the state of the ticket. This method should run any business rules associated with state change. This method should also guarantee that it won't have the side effect of storing any other changes to the ticket and should throw an exception if the ticket has been otherwise updated.
        Parameters:
        ticket - The ticket to update the state of
        newState - The state to set the ticket to
        note - The text of the note to add along with the state change
        Throws:
        TicketException - If the ticket has been modified or the state transition is illegal
        See Also:
        getTicketNextStates to get list of possible state transitions
      • assignTicketToAgent

        CsTicketEventModel assignTicketToAgent​(CsTicketModel ticket,
                                               EmployeeModel agent)
                                        throws TicketException
        Assign the ticket to a new agent, or null to make the ticket unassigned. This method should run any business rules associated with the assignment change. This method should also guarantee that it won't have the side effect of storing any other changes to the ticket and should throw an exception if the ticket has been otherwise updated.
        Parameters:
        ticket - The ticket to update the state of
        agent - The agent to assign the ticket to or null to mark the ticket as unassigned.
        Returns:
        CsTicketEventModel
        Throws:
        TicketException - If the ticket has been modified or the assignment is illegal
      • assignTicketToGroup

        CsTicketEventModel assignTicketToGroup​(CsTicketModel ticket,
                                               CsAgentGroupModel group)
                                        throws TicketException
        Assign the ticket to a new group, or null to make the ticket unassigned. This method should run any business rules associated with the assignment change. This method should also guarantee that it won't have the side effect of storing any other changes to the ticket and should throw an exception if the ticket has been otherwise updated.
        Parameters:
        ticket - The ticket to update the state of
        group - The agent group to assign the ticket to or null to mark the ticket as unassigned.
        Returns:
        CsTicketEventModel
        Throws:
        TicketException - If the ticket has been modified or the assignment is illegal
      • getTicketNextStates

        java.util.List<CsTicketState> getTicketNextStates​(CsTicketState currentState)
        Get a list of legal states that a ticket can move into.
        Parameters:
        currentState - The starting state
        Returns:
        a list of states that the ticket can move to next.