Class BTAppointmentPropose
java.lang.Object
overit.geocall.bl.BusinessTask<AppointmentProposeEvent>
overit.geocallapp.wfm.core.bl.common.validexecution.ValidExecutionBusinessTask<AppointmentProposeEvent>
overit.geocallapp.wfm.core.bl.common.validexecution.ValidPermissionBusinessTask<AppointmentProposeEvent>
overit.geocallapp.wfm.booking.bl.task.BTBookingManagement<AppointmentProposeEvent>
overit.geocallapp.wfm.booking.bl.appointment.task.BTAppointmentPropose
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(AppointmentProposeEvent.class)
public class BTAppointmentPropose
extends BTBookingManagement<AppointmentProposeEvent>
Business task in order to to find a list of
When the
The task is structured by these steps:
BOAppointment proposal to perform a given activity. When the
AppointmentProposeEvent is launched
the BT notices the call and searches for the BOAppointment proposals basing on the event's input. The task is structured by these steps:
- data validation
- starting from the given activity (work order type), external code and external system, it verifies whether a
WorkOrderalready exists - if no such order was found, we create a new work order for the required activity by calling the
WorkOrderCreateFromWorkCycleEvent - it calls the booking module to obtain the list of slots during which the activity can be performed
- if the list of slots is not empty, it creates a temporary appointment and the related agenda
- Since:
- 15.0
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckBookingWorkOrder(WorkOrder workOrder, PoolKit poolKit) Checks that the givenWorkOrderhas a not cancelled booking work order.protected WorkOrdercreateWorkOrder(BOWorkOrderHeader workOrderHeader, TechnicalObject technicalObject, PoolKit poolKit) Creates theWorkOrderstarting from the given data.protected voidexecute(AppointmentProposeEvent event, PoolKit poolKit) Proposes a list of possible appointments slots for the given activity.protected LonggetActivityCost(BOOperationActivity operationActivity, BOWorkOrderOperation woOperation, PoolKit poolKit) protected voidinsertAgenda(Long appointmentId, PoolKit poolKit) protected LonginsertAppointment(WorkOrder workOrder, BOWorkOrderOperation woOperation, ExternalTeamTimeSlot firstSlot, PoolKit poolKit) booleanChecks if the execution is valid.protected List<ExternalTeamTimeSlot> loadAvailableSlots(WorkOrder workOrder, PoolKit poolKit) protected BOAppointmentloadExistingTemporaryAppointment(Long id, PoolKit poolKit) protected BOOperationActivityloadOperationActivity(Long id, PoolKit poolKit) protected WorkOrderloadWorkOrder(Long id, PoolKit poolKit) Loads theWorkOrderfrom the given id.protected WorkOrdersearchWorkOrder(BOWorkOrderHeader workOrderHeader, PoolKit poolKit) Searches for a work order with the given characteristics.protected voidValidates the input data.Methods inherited from class overit.geocallapp.wfm.booking.bl.task.BTBookingManagement
checkValidExecutionMethods inherited from class overit.geocallapp.wfm.core.bl.common.validexecution.ValidPermissionBusinessTask
getException, throwExceptionIfInvalidMethods inherited from class overit.geocallapp.wfm.core.bl.common.validexecution.ValidExecutionBusinessTask
body, getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTAppointmentPropose
public BTAppointmentPropose()
-
-
Method Details
-
isValidExecution
public boolean isValidExecution()Checks if the execution is valid.- Returns:
- true, if successful
-
execute
protected void execute(AppointmentProposeEvent event, PoolKit poolKit) throws DAException, DAValidateException Proposes a list of possible appointments slots for the given activity.- Specified by:
executein classValidExecutionBusinessTask<AppointmentProposeEvent>- Parameters:
event- theAppointmentProposeEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
validateData
Validates the input data.- Parameters:
input- theAppointmentProposeInput- Throws:
DAValidateException- the DA validate exception
-
checkBookingWorkOrder
protected void checkBookingWorkOrder(WorkOrder workOrder, PoolKit poolKit) throws DAValidateException, DAException Checks that the givenWorkOrderhas a not cancelled booking work order.- Parameters:
workOrder- the givenWorkOrderpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
createWorkOrder
protected WorkOrder createWorkOrder(BOWorkOrderHeader workOrderHeader, TechnicalObject technicalObject, PoolKit poolKit) throws DAValidateException, DAException Creates theWorkOrderstarting from the given data.- Parameters:
workOrderHeader- theBOWorkOrderHeadercontaining the work order datatechnicalObject- theTechnicalObjectrelated to the work orderpoolKit- thePoolKit- Returns:
- the created
WorkOrder - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
searchWorkOrder
protected WorkOrder searchWorkOrder(BOWorkOrderHeader workOrderHeader, PoolKit poolKit) throws DAValidateException, DAException Searches for a work order with the given characteristics.- Parameters:
workOrderHeader- theBOWorkOrderHeadercontaining the data used as filterspoolKit- thePoolKit- Returns:
- the loaded
WorkOrder - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadWorkOrder
Loads theWorkOrderfrom the given id.- Parameters:
id- theWorkOrderidpoolKit- thePoolKit- Returns:
- the loaded
WorkOrder - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadAvailableSlots
protected List<ExternalTeamTimeSlot> loadAvailableSlots(WorkOrder workOrder, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
loadExistingTemporaryAppointment
protected BOAppointment loadExistingTemporaryAppointment(Long id, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
insertAppointment
protected Long insertAppointment(WorkOrder workOrder, BOWorkOrderOperation woOperation, ExternalTeamTimeSlot firstSlot, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
getActivityCost
protected Long getActivityCost(BOOperationActivity operationActivity, BOWorkOrderOperation woOperation, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
insertAgenda
protected void insertAgenda(Long appointmentId, PoolKit poolKit) throws DAException, DAValidateException - Throws:
DAExceptionDAValidateException
-
loadOperationActivity
protected BOOperationActivity loadOperationActivity(Long id, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-