Class BTWorkShiftActivityValidation
java.lang.Object
overit.geocall.bl.BusinessTask<WorkShiftActivityValidationEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<WorkShiftActivityValidationEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<WorkShiftActivityValidationEvent>
overit.geocallapp.wfm.orchestrator.scheduling.bl.activityvalidation.task.BTWorkShiftActivityValidation
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(WorkShiftActivityValidationEvent.class)
public class BTWorkShiftActivityValidation
extends ValidPermissionBusinessTask<WorkShiftActivityValidationEvent>
Business task that validate all the work shifts as input.
It updates the agenda status and operation status and call the
Error Code:
It updates the agenda status and operation status and call the
SchedulingNotificationEvent for the valid
operations related to the work shifts. Error Code:
- Since:
- 17.0
- See Also:
- GCApi:
- task
-
Field Summary
Fields inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassociateOperationWithWorkShift(List<BOWorkShift> workShifts, PoolKit poolKit) Creates the map containing the link between operation and work shifts (key: operation id and value: all the related work shifts for that operation id).protected voidcheckCrewShellWorkShifts(List<BOWorkShift> workShifts, PoolKit poolKit) Validate the work shifts in input, the steps are the following: 1.protected voidexecute(WorkShiftActivityValidationEvent event, PoolKit poolKit) Executes the actual business logic after validation has passed.protected SchedulingIntegrationServicegetIntegrationService(PoolKit poolKit) protected BOWorkShiftgetRelatedWorkShift(BOWorkOrderOperation validOperation, List<BOWorkShift> mapWorkShifts) Get work shifts for the operation, we might have more than one work shift associated to the same operation in the "team case".getValidAgendas(BOWorkOrderOperation validOperation, PoolKit poolKit) Method that returns the valid agendas related to the operation in input.protected List<BOWorkOrderOperation> getValidOperations(PoolKit poolKit) Method that returns a list of valid work order operations(where status is not CANCELLED or CLOSED).getWorkShiftDays(PoolKit poolKit, Long workShiftId) Retrieves the list of work shift days for a specific work shift.booleanDetermines whether the current state is valid for execution.protected voidlaunchCompleteManualActionEvent(PoolKit poolKit) Method that calls theSchedulingNotificationEventat the end of the validation.protected voidnotifyActivityValidated(BOWorkOrderOperation validOperation, List<BOWorkShift> workShifts, PoolKit poolKit) Notifies the validation of an activity.protected voidrecalculateWorkOrderOperationStatus(Long operationId, PoolKit poolKit) Recalculates the work order operation status.protected voidupdateAgendaStatus(List<BOAgenda> validAgendas, PoolKit poolKit) Update the status of the agenda if its status is equal to OPEN.protected voidupdateStatus(BOWorkOrderOperation validOperation, List<BOAgenda> validAgendas, PoolKit poolKit) Method that updates the operation and agenda status.protected voidValidates the data before performing the work shift activity validation.Methods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
checkValidExecution, getException, throwExceptionIfInvalidMethods inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask
body, getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTWorkShiftActivityValidation
public BTWorkShiftActivityValidation()
-
-
Method Details
-
execute
protected void execute(WorkShiftActivityValidationEvent event, PoolKit poolKit) throws DAException, DAValidateException Description copied from class:ValidExecutionBusinessTaskExecutes the actual business logic after validation has passed.- Specified by:
executein classValidExecutionBusinessTask<WorkShiftActivityValidationEvent>- Parameters:
event- the input event to processpoolKit- thePoolKit- Throws:
DAException- if a data access error occurs during executionDAValidateException- if validation fails during execution
-
checkCrewShellWorkShifts
protected void checkCrewShellWorkShifts(List<BOWorkShift> workShifts, PoolKit poolKit) throws DAValidateException, DAException Validate the work shifts in input, the steps are the following: 1. Check if work shift is crew shell, if not it doesn't do any checks 2. If work shift is crew shell it search the crew shell by setting the dummy user equal to the work shift user If a crew shell is found is means the work shift is the correct crew shell's work shift, if no crews shells are found it means that in input we have a work shift of a technicians working in a crew shell. After this check is performed a check in the composition that can't be empty- Parameters:
workShifts- the list of work shifts to be checkedpoolKit- thePoolKit- Throws:
DAValidateException- if the work shift is not validDAException- if an error occurs during the process
-
getWorkShiftDays
protected List<Date> getWorkShiftDays(PoolKit poolKit, Long workShiftId) throws DAValidateException, DAException Retrieves the list of work shift days for a specific work shift.- Parameters:
poolKit- thePoolKitworkShiftId- the ID of the work shift- Returns:
- the list of work shift days
- Throws:
DAValidateException- if the work shift is not validDAException- if an error occurs during the process
-
getIntegrationService
protected SchedulingIntegrationService getIntegrationService(PoolKit poolKit) throws DAValidateException - Throws:
DAValidateException
-
associateOperationWithWorkShift
protected void associateOperationWithWorkShift(List<BOWorkShift> workShifts, PoolKit poolKit) throws DAException, DAValidateException Creates the map containing the link between operation and work shifts (key: operation id and value: all the related work shifts for that operation id).- Parameters:
workShifts- the input work shifts- Throws:
DAExceptionDAValidateException
-
validate
Validates the data before performing the work shift activity validation.- Throws:
DAValidateException- the DA validate exceptionDAException
-
getValidOperations
protected List<BOWorkOrderOperation> getValidOperations(PoolKit poolKit) throws DAValidateException, DAException Method that returns a list of valid work order operations(where status is not CANCELLED or CLOSED).- Parameters:
poolKit- thePoolKit- Returns:
- a list of the work order operations that are not in status CANCELLED or CLOSED
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getRelatedWorkShift
protected BOWorkShift getRelatedWorkShift(BOWorkOrderOperation validOperation, List<BOWorkShift> mapWorkShifts) Get work shifts for the operation, we might have more than one work shift associated to the same operation in the "team case". But we just need operationCenter and start date and these data don't change between work shifts of the same operation.- Parameters:
validOperation- the operation to be validatedmapWorkShifts- a map containing id of work shift as key and as value its relatedBOWorkShiftso we don't have to load again the work shifts.- Returns:
BOWorkShiftrelated to the operation
-
getValidAgendas
protected List<BOAgenda> getValidAgendas(BOWorkOrderOperation validOperation, PoolKit poolKit) throws DAException, DAValidateException Method that returns the valid agendas related to the operation in input.- Parameters:
validOperation- an operation in status != CANCELLED or CLOSEDpoolKit- thePoolKit- Returns:
- a list of valid agendas
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
updateStatus
protected void updateStatus(BOWorkOrderOperation validOperation, List<BOAgenda> validAgendas, PoolKit poolKit) throws DAException, DAValidateException Method that updates the operation and agenda status.- Parameters:
validOperation- the operation to update the statusvalidAgendas- the agendas related to the operation to update the statuspoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
updateAgendaStatus
protected void updateAgendaStatus(List<BOAgenda> validAgendas, PoolKit poolKit) throws DAException, DAValidateException Update the status of the agenda if its status is equal to OPEN.- Parameters:
validAgendas- list ofBOAgendapoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
recalculateWorkOrderOperationStatus
protected void recalculateWorkOrderOperationStatus(Long operationId, PoolKit poolKit) throws DAValidateException, DAException Recalculates the work order operation status.- Parameters:
operationId- the work order operation idpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
notifyActivityValidated
protected void notifyActivityValidated(BOWorkOrderOperation validOperation, List<BOWorkShift> workShifts, PoolKit poolKit) throws DAValidateException, DAException Notifies the validation of an activity.- Parameters:
validOperation- The validated work order operationworkShifts- The list of work shiftspoolKit- ThePoolKit- Throws:
DAValidateException- If the work shift is not validDAException- If an error occurs during the process
-
launchCompleteManualActionEvent
protected void launchCompleteManualActionEvent(PoolKit poolKit) throws DAException, DAValidateException Method that calls theSchedulingNotificationEventat the end of the validation.- Parameters:
poolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
isValidExecution
public boolean isValidExecution()Description copied from interface:ValidExecutionDetermines whether the current state is valid for execution.- Returns:
- true if execution is valid, false otherwise
-