Class DefaultTicketBusinessService
- java.lang.Object
-
- de.hybris.platform.ticket.service.impl.DefaultTicketBusinessService
-
- All Implemented Interfaces:
TicketBusinessService
public class DefaultTicketBusinessService extends java.lang.Object implements TicketBusinessService
Implementation of TicketBusinessService
-
-
Constructor Summary
Constructors Constructor Description DefaultTicketBusinessService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CsCustomerEventModeladdCustomerEmailToTicket(CsTicketModel ticket, CsEventReason reason, java.lang.String subject, java.lang.String emailBody, java.util.Collection<MediaModel> attachments)Add a customer email to the specified ticket.CsCustomerEventModeladdNoteToTicket(CsTicketModel ticket, CsInterventionType intervention, CsEventReason reason, java.lang.String note, java.util.Collection<MediaModel> attachments)Add a note to the specified ticket.CsTicketModelassignTicketToAgent(CsTicketModel ticket, EmployeeModel agent)Sets the assignedAgent of the Ticket, i.e.CsTicketModelassignTicketToGroup(CsTicketModel ticket, CsAgentGroupModel group)Sets the assignedGroup of the Ticket, i.e.CsTicketModelcreateTicket(CsTicketModel ticket, CsCustomerEventModel creationEvent)Deprecated, for removal: This API element is subject to removal in a future version.since 6.0 usecreateTicket(CsTicketParameter)insteadCsTicketModelcreateTicket(CsTicketParameter ticketParameter)Create a new ticket with the parameters defined inCsTicketParameterprotected CsTicketModelcreateTicketInternal(CsTicketModel ticket, CsCustomerEventModel creationEvent)BaseSiteServicegetBaseSiteService()CsTicketEventModelgetLastEvent(CsTicketModel ticket)Returns the last event on the ticket.protected ModelServicegetModelService()protected TicketAttachmentsServicegetTicketAttachmentsService()TicketEventEmailStrategygetTicketEventEmailStrategy()java.util.List<CsTicketState>getTicketNextStates(CsTicketState state)Get the list of states which can come after the passed onjava.util.List<CsTicketState>getTicketNextStates(CsTicketModel ticket)Returns a list of states that the passed ticket can move to according to configured rules.protected Converter<CsTicketParameter,CsTicketModel>getTicketParameterConverter()protected TimeServicegetTimeService()protected UserServicegetUserService()booleanisTicketClosed(CsTicketModel ticket)Find out whether a ticket is closed.booleanisTicketResolvable(CsTicketModel ticket)Find out whether a ticket is resolvable.protected CsTicketModelpopulateTicketDetails(UserModel customer, AbstractOrderModel abstractOrder, CsTicketCategory category, CsTicketPriority priority, EmployeeModel assignedAgent, CsAgentGroupModel assignedGroup, java.lang.String headline)java.lang.StringrenderTicketEventText(CsTicketEventModel ticketEvent)Get a description of a ticket for rendering on front endsCsTicketResolutionEventModelresolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsResolutionType resolutionType, java.lang.String note)Resolve a ticket and add the associated resolution event.CsTicketResolutionEventModelresolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsResolutionType resolutionType, java.lang.String note, java.util.Collection<MediaModel> attachments)Resolve a ticket and add the associated resolution event.voidsetBaseSiteService(BaseSiteService baseSiteService)voidsetModelService(ModelService modelService)voidsetTicketAttachmentsService(TicketAttachmentsService ticketAttachmentsService)voidsetTicketEventEmailStrategy(TicketEventEmailStrategy ticketEventEmailStrategy)voidsetTicketEventStrategy(TicketEventStrategy ticketEventStrategy)voidsetTicketParameterConverter(Converter<CsTicketParameter,CsTicketModel> ticketParameterConverter)voidsetTicketRenderStrategy(TicketRenderStrategy ticketRenderStrategy)voidsetTicketResolutionStrategy(TicketResolutionStrategy ticketResolutionStrategy)CsTicketModelsetTicketState(CsTicketModel ticket, CsTicketState newState)Set the state of a ticket.CsTicketModelsetTicketState(CsTicketModel ticket, CsTicketState newState, java.lang.String note)Set the state of a ticket.voidsetTicketUpdateStrategy(TicketUpdateStrategy ticketUpdateStrategy)voidsetTimeService(TimeService timeService)voidsetUserService(UserService userService)CsCustomerEventModelunResolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsEventReason reason, java.lang.String note)Reverse the resolution of a ticket and add a note to it.CsCustomerEventModelunResolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsEventReason reason, java.lang.String note, java.util.Collection<MediaModel> attachments)Reverse the resolution of a ticket and add a note to it.CsTicketModelupdateTicket(CsTicketModel ticket)Update the details of a ticket.CsTicketModelupdateTicket(CsTicketModel ticket, java.lang.String note)Update the details of a ticket.
-
-
-
Method Detail
-
createTicket
public CsTicketModel createTicket(CsTicketParameter ticketParameter)
Description copied from interface:TicketBusinessServiceCreate a new ticket with the parameters defined inCsTicketParameter- Specified by:
createTicketin interfaceTicketBusinessService- Parameters:
ticketParameter- Ticker creation parameters- Returns:
- The newly created ticket
-
createTicket
@Deprecated(since="6.0", forRemoval=true) public CsTicketModel createTicket(CsTicketModel ticket, CsCustomerEventModel creationEvent)Deprecated, for removal: This API element is subject to removal in a future version.since 6.0 usecreateTicket(CsTicketParameter)insteadCreate a new ticket with the given ticket model and creation event. The ticket will get validated and assigned a ticket id and stored in the DB. The creation event will get associated with the ticket.- Specified by:
createTicketin interfaceTicketBusinessService- Parameters:
ticket- The new ticketcreationEvent- The creation event to associate with the new ticket- Returns:
- The newly created ticket
-
createTicketInternal
protected CsTicketModel createTicketInternal(CsTicketModel ticket, CsCustomerEventModel creationEvent)
-
populateTicketDetails
protected CsTicketModel populateTicketDetails(UserModel customer, AbstractOrderModel abstractOrder, CsTicketCategory category, CsTicketPriority priority, EmployeeModel assignedAgent, CsAgentGroupModel assignedGroup, java.lang.String headline)
-
updateTicket
public CsTicketModel updateTicket(CsTicketModel ticket) throws TicketException
Description copied from interface:TicketBusinessServiceUpdate the details of a ticket. This will generate an event to capture all changed fields on the ticket and attach it to the ticket. Business rules for changes to specific fields (state, assignment etc.) must also be run by the implementation of this method.- Specified by:
updateTicketin interfaceTicketBusinessService- Parameters:
ticket- The ticket to update the details of- Returns:
- The updated ticket
- Throws:
TicketException- If the ticket is null or the update is not permitted
-
updateTicket
public CsTicketModel updateTicket(CsTicketModel ticket, java.lang.String note) throws TicketException
Description copied from interface:TicketBusinessServiceUpdate the details of a ticket. This will generate an event to capture all changed fields on the ticket and attached to the ticket. A note can also be passed which will be added as a separate event to the ticket. Business rules for changes to specific fields (state, assignment etc.) must also be run by the implementation of this method.- Specified by:
updateTicketin interfaceTicketBusinessService- Parameters:
ticket- The ticket to update the details ofnote- The note to associate with the update- Returns:
- The updated ticket
- Throws:
TicketException- TicketException In case if: 1)the ticket is null 2)the note is null or empty 3)the update is not permitted
-
setTicketState
public CsTicketModel setTicketState(CsTicketModel ticket, CsTicketState newState) throws TicketException
Description copied from interface:TicketBusinessServiceSet the state of a ticket. Note that this is a separate method to updateTicket and will throw an exception if the ticket is in any other way changed.- Specified by:
setTicketStatein interfaceTicketBusinessService- Parameters:
ticket- The ticket to change the state ofnewState- The new state of the ticket- Returns:
- The updated ticket
- Throws:
TicketException- If the ticket has been modified
-
setTicketState
public CsTicketModel setTicketState(CsTicketModel ticket, CsTicketState newState, java.lang.String note) throws TicketException
Description copied from interface:TicketBusinessServiceSet the state of a ticket. Note that this is a separate method to updateTicket and will throw an exception if the ticket is in any other way changed.- Specified by:
setTicketStatein interfaceTicketBusinessService- Parameters:
ticket- The ticket to change the state ofnewState- The new state of the ticketnote- The note to associate with the state change- Returns:
- The updated ticket
- Throws:
TicketException- If the ticket has been modified
-
getTicketNextStates
public java.util.List<CsTicketState> getTicketNextStates(CsTicketModel ticket)
Description copied from interface:TicketBusinessServiceReturns a list of states that the passed ticket can move to according to configured rules.- Specified by:
getTicketNextStatesin interfaceTicketBusinessService- Parameters:
ticket- The current state of the ticket- Returns:
- The list of available states that the ticket can move to
-
getTicketNextStates
public java.util.List<CsTicketState> getTicketNextStates(CsTicketState state)
Description copied from interface:TicketBusinessServiceGet the list of states which can come after the passed on- Specified by:
getTicketNextStatesin interfaceTicketBusinessService- Parameters:
state- The state to get the next states from- Returns:
- A list of states that at ticket in the specified state can move into
-
assignTicketToAgent
public CsTicketModel assignTicketToAgent(CsTicketModel ticket, EmployeeModel agent) throws TicketException
Description copied from interface:TicketBusinessServiceSets the assignedAgent of the Ticket, i.e. assigns the ticket to the specified agent. Note that this is a separate method to updateTicket and will throw an exception if the ticket is in any other way changed.- Specified by:
assignTicketToAgentin interfaceTicketBusinessService- Parameters:
ticket- The Ticket to assignagent- The Agent to assign the ticket to- Returns:
- The updated ticket
- Throws:
TicketException- If the ticket has been modified
-
assignTicketToGroup
public CsTicketModel assignTicketToGroup(CsTicketModel ticket, CsAgentGroupModel group) throws TicketException
Description copied from interface:TicketBusinessServiceSets the assignedGroup of the Ticket, i.e. assigns the ticket to the specified group. Note that this is a separate method to updateTicket and will throw an exception if the ticket is in any other way changed.- Specified by:
assignTicketToGroupin interfaceTicketBusinessService- Parameters:
ticket- The Ticket to assigngroup- The Group to assign the ticket to- Returns:
- The updated ticket
- Throws:
TicketException- If the ticket has been modified
-
addNoteToTicket
public CsCustomerEventModel addNoteToTicket(CsTicketModel ticket, CsInterventionType intervention, CsEventReason reason, java.lang.String note, java.util.Collection<MediaModel> attachments)
Description copied from interface:TicketBusinessServiceAdd a note to the specified ticket. This will initiate all business rules around adding a note to a ticket. Note that any changes to the ticket itself will be ignored and should be saved using updateTicket.- Specified by:
addNoteToTicketin interfaceTicketBusinessService- Parameters:
ticket- The ticket to add the note tointervention- The interventionType of the notereason- The reason for the interventionnote- The note to addattachments- The attachments to add to the note- Returns:
- The note created and attached to the ticket.
-
addCustomerEmailToTicket
public CsCustomerEventModel addCustomerEmailToTicket(CsTicketModel ticket, CsEventReason reason, java.lang.String subject, java.lang.String emailBody, java.util.Collection<MediaModel> attachments)
Description copied from interface:TicketBusinessServiceAdd a customer email to the specified ticket. This will add the email to the ticket and send it via email to the customer using the business rules specified. Note that this is for sending an email to a customer and not for adding an email received from the customer.- Specified by:
addCustomerEmailToTicketin interfaceTicketBusinessService- Parameters:
ticket- The ticket to add the email toreason- The reason for the emailsubject- The subject of the emailemailBody- The body of the emailattachments- The attachments to add to the email- Returns:
- The note created and attached to the ticket.
-
resolveTicket
public CsTicketResolutionEventModel resolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsResolutionType resolutionType, java.lang.String note) throws TicketException
Description copied from interface:TicketBusinessServiceResolve a ticket and add the associated resolution event. The ticket will be validated to check it is in an appropriate state for resolution and will then be resolved if the state check passes- Specified by:
resolveTicketin interfaceTicketBusinessService- Parameters:
ticket- The ticket to be resolvedintervention- Intervention TyperesolutionType- The resolution reason for the ticketnote- message- Returns:
- The resolution event created and attached to the ticket.
- Throws:
TicketException- if the ticket is null or missing arguments required to resolve ticket
-
resolveTicket
public CsTicketResolutionEventModel resolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsResolutionType resolutionType, java.lang.String note, java.util.Collection<MediaModel> attachments) throws TicketException
Description copied from interface:TicketBusinessServiceResolve a ticket and add the associated resolution event. The ticket will be validated to check it is in an appropriate state for resolution and will then be resolved if the state check passes- Specified by:
resolveTicketin interfaceTicketBusinessService- Parameters:
ticket- The ticket to be resolvedintervention- Intervention TyperesolutionType- The resolution reason for the ticketnote- messageattachments- as attachments- Returns:
- The resolution event created and attached to the ticket.
- Throws:
TicketException- if the ticket is null or missing arguments required to resolve ticket
-
unResolveTicket
public CsCustomerEventModel unResolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsEventReason reason, java.lang.String note) throws TicketException
Description copied from interface:TicketBusinessServiceReverse the resolution of a ticket and add a note to it.- Specified by:
unResolveTicketin interfaceTicketBusinessService- Parameters:
ticket- The ticket to 'unresolve'intervention- The interventionType for the eventreason- The reason for the eventnote- The content of the note to add to the ticket- Returns:
- The note created and attached to the ticket.
- Throws:
TicketException- if the ticket is null or missing arguments required to unresolve ticket
-
unResolveTicket
public CsCustomerEventModel unResolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsEventReason reason, java.lang.String note, java.util.Collection<MediaModel> attachments) throws TicketException
Description copied from interface:TicketBusinessServiceReverse the resolution of a ticket and add a note to it.- Specified by:
unResolveTicketin interfaceTicketBusinessService- Parameters:
ticket- The ticket to 'unresolve'intervention- The interventionType for the eventreason- The reason for the eventnote- The content of the note to add to the ticketattachments- as ticket attachments- Returns:
- The note created and attached to the ticket.
- Throws:
TicketException- if the ticket is null or missing arguments required to resolve ticket
-
isTicketClosed
public boolean isTicketClosed(CsTicketModel ticket)
Description copied from interface:TicketBusinessServiceFind out whether a ticket is closed. This is dependent on the business rules of when a ticket is open or closed.- Specified by:
isTicketClosedin interfaceTicketBusinessService- Parameters:
ticket- The ticket to check- Returns:
- true if the ticket is closed, false otherwise
-
isTicketResolvable
public boolean isTicketResolvable(CsTicketModel ticket)
Description copied from interface:TicketBusinessServiceFind out whether a ticket is resolvable. This is dependent on the business rules.- Specified by:
isTicketResolvablein interfaceTicketBusinessService- Parameters:
ticket- The ticket to check- Returns:
- true if the ticket is resolvable, false otherwise
-
getLastEvent
public CsTicketEventModel getLastEvent(CsTicketModel ticket)
Description copied from interface:TicketBusinessServiceReturns the last event on the ticket.- Specified by:
getLastEventin interfaceTicketBusinessService- Parameters:
ticket- The ticket to retrieve the last event for- Returns:
- The last event on the ticket
-
renderTicketEventText
public java.lang.String renderTicketEventText(CsTicketEventModel ticketEvent)
Description copied from interface:TicketBusinessServiceGet a description of a ticket for rendering on front ends- Specified by:
renderTicketEventTextin interfaceTicketBusinessService- Parameters:
ticketEvent- The ticket to get the description of- Returns:
- A string description of the ticket
-
setTicketUpdateStrategy
public void setTicketUpdateStrategy(TicketUpdateStrategy ticketUpdateStrategy)
-
setTicketEventStrategy
public void setTicketEventStrategy(TicketEventStrategy ticketEventStrategy)
-
setTicketEventEmailStrategy
public void setTicketEventEmailStrategy(TicketEventEmailStrategy ticketEventEmailStrategy)
-
setTicketResolutionStrategy
public void setTicketResolutionStrategy(TicketResolutionStrategy ticketResolutionStrategy)
-
setTicketRenderStrategy
public void setTicketRenderStrategy(TicketRenderStrategy ticketRenderStrategy)
-
getTicketEventEmailStrategy
public TicketEventEmailStrategy getTicketEventEmailStrategy()
-
getBaseSiteService
public BaseSiteService getBaseSiteService()
- Returns:
- the baseSiteService
-
setBaseSiteService
public void setBaseSiteService(BaseSiteService baseSiteService)
- Parameters:
baseSiteService- the baseSiteService to set
-
getTicketParameterConverter
protected Converter<CsTicketParameter,CsTicketModel> getTicketParameterConverter()
-
setTicketParameterConverter
public void setTicketParameterConverter(Converter<CsTicketParameter,CsTicketModel> ticketParameterConverter)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getTicketAttachmentsService
protected TicketAttachmentsService getTicketAttachmentsService()
-
setTicketAttachmentsService
public void setTicketAttachmentsService(TicketAttachmentsService ticketAttachmentsService)
-
getTimeService
protected TimeService getTimeService()
-
setTimeService
public void setTimeService(TimeService timeService)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
-