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 CsCustomerEventModel
addCustomerEmailToTicket(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.CsCustomerEventModel
addNoteToTicket(CsTicketModel ticket, CsInterventionType intervention, CsEventReason reason, java.lang.String note, java.util.Collection<MediaModel> attachments)
Add a note to the specified ticket.CsTicketModel
assignTicketToAgent(CsTicketModel ticket, EmployeeModel agent)
Sets the assignedAgent of the Ticket, i.e.CsTicketModel
assignTicketToGroup(CsTicketModel ticket, CsAgentGroupModel group)
Sets the assignedGroup of the Ticket, i.e.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)
insteadCsTicketModel
createTicket(CsTicketParameter ticketParameter)
Create a new ticket with the parameters defined inCsTicketParameter
protected CsTicketModel
createTicketInternal(CsTicketModel ticket, CsCustomerEventModel creationEvent)
BaseSiteService
getBaseSiteService()
CsTicketEventModel
getLastEvent(CsTicketModel ticket)
Returns the last event on the ticket.protected ModelService
getModelService()
protected TicketAttachmentsService
getTicketAttachmentsService()
TicketEventEmailStrategy
getTicketEventEmailStrategy()
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 TimeService
getTimeService()
protected UserService
getUserService()
boolean
isTicketClosed(CsTicketModel ticket)
Find out whether a ticket is closed.boolean
isTicketResolvable(CsTicketModel ticket)
Find out whether a ticket is resolvable.protected CsTicketModel
populateTicketDetails(UserModel customer, AbstractOrderModel abstractOrder, CsTicketCategory category, CsTicketPriority priority, EmployeeModel assignedAgent, CsAgentGroupModel assignedGroup, java.lang.String headline)
java.lang.String
renderTicketEventText(CsTicketEventModel ticketEvent)
Get a description of a ticket for rendering on front endsCsTicketResolutionEventModel
resolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsResolutionType resolutionType, java.lang.String note)
Resolve a ticket and add the associated resolution event.CsTicketResolutionEventModel
resolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsResolutionType resolutionType, java.lang.String note, java.util.Collection<MediaModel> attachments)
Resolve a ticket and add the associated resolution event.void
setBaseSiteService(BaseSiteService baseSiteService)
void
setModelService(ModelService modelService)
void
setTicketAttachmentsService(TicketAttachmentsService ticketAttachmentsService)
void
setTicketEventEmailStrategy(TicketEventEmailStrategy ticketEventEmailStrategy)
void
setTicketEventStrategy(TicketEventStrategy ticketEventStrategy)
void
setTicketParameterConverter(Converter<CsTicketParameter,CsTicketModel> ticketParameterConverter)
void
setTicketRenderStrategy(TicketRenderStrategy ticketRenderStrategy)
void
setTicketResolutionStrategy(TicketResolutionStrategy ticketResolutionStrategy)
CsTicketModel
setTicketState(CsTicketModel ticket, CsTicketState newState)
Set the state of a ticket.CsTicketModel
setTicketState(CsTicketModel ticket, CsTicketState newState, java.lang.String note)
Set the state of a ticket.void
setTicketUpdateStrategy(TicketUpdateStrategy ticketUpdateStrategy)
void
setTimeService(TimeService timeService)
void
setUserService(UserService userService)
CsCustomerEventModel
unResolveTicket(CsTicketModel ticket, CsInterventionType intervention, CsEventReason reason, java.lang.String note)
Reverse the resolution of a ticket and add a note to it.CsCustomerEventModel
unResolveTicket(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.CsTicketModel
updateTicket(CsTicketModel ticket)
Update the details of a ticket.CsTicketModel
updateTicket(CsTicketModel ticket, java.lang.String note)
Update the details of a ticket.
-
-
-
Method Detail
-
createTicket
public CsTicketModel createTicket(CsTicketParameter ticketParameter)
Description copied from interface:TicketBusinessService
Create a new ticket with the parameters defined inCsTicketParameter
- Specified by:
createTicket
in 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:
createTicket
in 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:TicketBusinessService
Update 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:
updateTicket
in 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:TicketBusinessService
Update 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:
updateTicket
in 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:TicketBusinessService
Set 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:
setTicketState
in 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:TicketBusinessService
Set 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:
setTicketState
in 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:TicketBusinessService
Returns a list of states that the passed ticket can move to according to configured rules.- Specified by:
getTicketNextStates
in 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:TicketBusinessService
Get the list of states which can come after the passed on- Specified by:
getTicketNextStates
in 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:TicketBusinessService
Sets 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:
assignTicketToAgent
in 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:TicketBusinessService
Sets 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:
assignTicketToGroup
in 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:TicketBusinessService
Add 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:
addNoteToTicket
in 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:TicketBusinessService
Add 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:
addCustomerEmailToTicket
in 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:TicketBusinessService
Resolve 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:
resolveTicket
in 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:TicketBusinessService
Resolve 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:
resolveTicket
in 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:TicketBusinessService
Reverse the resolution of a ticket and add a note to it.- Specified by:
unResolveTicket
in 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:TicketBusinessService
Reverse the resolution of a ticket and add a note to it.- Specified by:
unResolveTicket
in 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:TicketBusinessService
Find out whether a ticket is closed. This is dependent on the business rules of when a ticket is open or closed.- Specified by:
isTicketClosed
in 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:TicketBusinessService
Find out whether a ticket is resolvable. This is dependent on the business rules.- Specified by:
isTicketResolvable
in 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:TicketBusinessService
Returns the last event on the ticket.- Specified by:
getLastEvent
in 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:TicketBusinessService
Get a description of a ticket for rendering on front ends- Specified by:
renderTicketEventText
in 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)
-
-