Class DefaultTicketUpdateStrategy
- java.lang.Object
-
- de.hybris.platform.ticket.strategies.impl.DefaultTicketUpdateStrategy
-
- All Implemented Interfaces:
TicketUpdateStrategy
public class DefaultTicketUpdateStrategy extends java.lang.Object implements TicketUpdateStrategy
-
-
Constructor Summary
Constructors Constructor Description DefaultTicketUpdateStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CsTicketEventModelassignTicketToAgent(CsTicketModel ticket, EmployeeModel agent)Assign the ticket to a new agent, or null to make the ticket unassigned.CsTicketEventModelassignTicketToGroup(CsTicketModel ticket, CsAgentGroupModel group)Assign the ticket to a new group, or null to make the ticket unassigned.protected CsTicketEventModelcreateAssignTicketEvent(CsTicketModel ticket, java.util.Set<CsTicketChangeEventEntryModel> changedValues)protected CsTicketEventModelcreateChangeEvent(CsTicketModel ticket, java.util.Set<CsTicketChangeEventEntryModel> changedValues)protected CsTicketEventModelcreateChangeEvent(CsTicketModel ticket, java.util.Set<CsTicketChangeEventEntryModel> changedValues, java.lang.String note)protected ItemModelContextImplgetContext(AbstractItemModel model)protected ModelServicegetModelService()java.lang.StringgetTicketAssigndEventType()java.util.List<CsTicketState>getTicketNextStates(CsTicketState currentState)Get a list of legal states that a ticket can move into.protected booleanisValidStateTransition(CsTicketState oldState, CsTicketState newState)protected voidpreChangeTicketAssignment(CsTicketModel ticket, EmployeeModel agent)protected voidpreChangeTicketGroup(CsTicketModel ticket, CsAgentGroupModel group)protected voidpreSetTicketState(CsTicketModel ticket, CsTicketState newState)voidsetAvailableNextStates(java.util.Map<CsTicketState,java.util.List<CsTicketState>> availableNextStates)voidsetModelService(ModelService modelService)voidsetTicketAssigndEventType(java.lang.String ticketAssigndEventType)voidsetTicketAttributeChangeEventStrategy(TicketAttributeChangeEventStrategy ticketAttributeChangeEventStrategy)voidsetTicketChangeEventType(java.lang.String ticketChangeEventType)voidsetTicketEventFactory(TicketEventFactory ticketEventFactory)voidsetTicketState(CsTicketModel ticket, CsTicketState newState)Set the state of the ticket.voidsetTicketState(CsTicketModel ticket, CsTicketState newState, java.lang.String note)Set the state of the ticket.CsTicketModelupdateTicket(CsTicketModel ticket)Store all updated attributes on a ticket.CsTicketModelupdateTicket(CsTicketModel ticket, java.lang.String note)Store all updated attributes on a ticket.
-
-
-
Method Detail
-
updateTicket
public CsTicketModel updateTicket(CsTicketModel ticket) throws TicketException
Description copied from interface:TicketUpdateStrategyStore 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.- Specified by:
updateTicketin interfaceTicketUpdateStrategy- Parameters:
ticket- The ticket to be updated- Returns:
- The updated ticket
- Throws:
TicketException- If the update is not permitted
-
updateTicket
public CsTicketModel updateTicket(CsTicketModel ticket, java.lang.String note) throws TicketException
Description copied from interface:TicketUpdateStrategyStore 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.- Specified by:
updateTicketin interfaceTicketUpdateStrategy- Parameters:
ticket- The ticket to be updatednote- The text of the note to add along with the update- Returns:
- The updated ticket
- Throws:
TicketException- If the update is not permitted
-
setTicketState
public void setTicketState(CsTicketModel ticket, CsTicketState newState) throws TicketException
Description copied from interface:TicketUpdateStrategySet 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.- Specified by:
setTicketStatein interfaceTicketUpdateStrategy- Parameters:
ticket- The ticket to update the state ofnewState- 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
public void setTicketState(CsTicketModel ticket, CsTicketState newState, java.lang.String note) throws TicketException
Description copied from interface:TicketUpdateStrategySet 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.- Specified by:
setTicketStatein interfaceTicketUpdateStrategy- Parameters:
ticket- The ticket to update the state ofnewState- The state to set the ticket tonote- 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
-
getTicketNextStates
public java.util.List<CsTicketState> getTicketNextStates(CsTicketState currentState)
Description copied from interface:TicketUpdateStrategyGet a list of legal states that a ticket can move into.- Specified by:
getTicketNextStatesin interfaceTicketUpdateStrategy- Parameters:
currentState- The starting state- Returns:
- a list of states that the ticket can move to next.
-
isValidStateTransition
protected boolean isValidStateTransition(CsTicketState oldState, CsTicketState newState)
-
preSetTicketState
protected void preSetTicketState(CsTicketModel ticket, CsTicketState newState) throws TicketException
- Throws:
TicketException
-
assignTicketToAgent
public CsTicketEventModel assignTicketToAgent(CsTicketModel ticket, EmployeeModel agent) throws TicketException
Description copied from interface:TicketUpdateStrategyAssign 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.- Specified by:
assignTicketToAgentin interfaceTicketUpdateStrategy- Parameters:
ticket- The ticket to update the state ofagent- 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
-
preChangeTicketAssignment
protected void preChangeTicketAssignment(CsTicketModel ticket, EmployeeModel agent) throws TicketException
- Throws:
TicketException
-
assignTicketToGroup
public CsTicketEventModel assignTicketToGroup(CsTicketModel ticket, CsAgentGroupModel group) throws TicketException
Description copied from interface:TicketUpdateStrategyAssign 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.- Specified by:
assignTicketToGroupin interfaceTicketUpdateStrategy- Parameters:
ticket- The ticket to update the state ofgroup- 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
-
preChangeTicketGroup
protected void preChangeTicketGroup(CsTicketModel ticket, CsAgentGroupModel group) throws TicketException
- Throws:
TicketException
-
createAssignTicketEvent
protected CsTicketEventModel createAssignTicketEvent(CsTicketModel ticket, java.util.Set<CsTicketChangeEventEntryModel> changedValues)
-
createChangeEvent
protected CsTicketEventModel createChangeEvent(CsTicketModel ticket, java.util.Set<CsTicketChangeEventEntryModel> changedValues)
-
createChangeEvent
protected CsTicketEventModel createChangeEvent(CsTicketModel ticket, java.util.Set<CsTicketChangeEventEntryModel> changedValues, java.lang.String note)
-
setTicketAttributeChangeEventStrategy
public void setTicketAttributeChangeEventStrategy(TicketAttributeChangeEventStrategy ticketAttributeChangeEventStrategy)
-
setAvailableNextStates
public void setAvailableNextStates(java.util.Map<CsTicketState,java.util.List<CsTicketState>> availableNextStates)
-
setTicketEventFactory
public void setTicketEventFactory(TicketEventFactory ticketEventFactory)
-
setTicketChangeEventType
public void setTicketChangeEventType(java.lang.String ticketChangeEventType)
-
getContext
protected ItemModelContextImpl getContext(AbstractItemModel model)
-
getTicketAssigndEventType
public java.lang.String getTicketAssigndEventType()
-
setTicketAssigndEventType
public void setTicketAssigndEventType(java.lang.String ticketAssigndEventType)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
-