Class BTBaseActivityManualAssignment<T extends ActivityManualAssignmentInput>
java.lang.Object
overit.geocall.bl.BusinessTask<SimpleBusinessEvent<T,ActivityManualAssignmentOutput>>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<SimpleBusinessEvent<T,ActivityManualAssignmentOutput>>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<SimpleBusinessEvent<T,ActivityManualAssignmentOutput>>
overit.geocallapp.wfm.orchestrator.scheduling.bl.activityassignment.task.BTBaseActivityManualAssignment<T>
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
- Direct Known Subclasses:
BTActivityManualAssignment,BTActivityManualTeamAssignment
public abstract class BTBaseActivityManualAssignment<T extends ActivityManualAssignmentInput>
extends ValidPermissionBusinessTask<SimpleBusinessEvent<T,ActivityManualAssignmentOutput>>
Business task in order to schedule an activity to a resource.
Error Code:
Error Code:
Codes.ManualScheduling.STATUS_NOT_ALLOWEDCodes.ManualScheduling.ACTIVITY_DATE_BLOCKEDCodes.ManualScheduling.WRONG_APPOINTMENT_DATECodes.ManualScheduling.APPOINTMENT_ALREADY_DEFINEDCodes.ManualScheduling.INVALID_ACTIVITY_COORDINATESCodes.ManualScheduling.CANNOT_DEDUCE_DEPARTURE_ADDRESSCodes.ManualScheduling.CANNOT_DEDUCE_ARRIVAL_ADDRESSCodes.ManualScheduling.INVALID_ARRIVAL_ADDRESS_COORDINATESCodes.ManualScheduling.INVALID_DEPARTURE_ADDRESS_COORDINATESCodes.ManualScheduling.WORKSHIFT_TIME_EXCEEDEDCodes.ManualScheduling.ACTION_NOT_ALLOWED_ON_PASSED_DAYSCodes.ManualScheduling.ACTION_NOT_POSSIBLE_ON_LOCKED_DAYSCodes.ManualScheduling.OPERATION_IS_BOOKINGCodes.ManualScheduling.RESOURCE_UNAVAILABLECodes.ManualScheduling.ACTIVITY_SCHEDULING_MODE_NOT_VALIDCodes.ManualScheduling.OPERATION_NOT_ALLOWED_FROM_PROJECTCodes.ManualScheduling.WORKSHIFT_END_TIME_EXCEEDEDCodes.ManualScheduling.WORKSHIFT_OVERTIME_TIME_EXCEEDEDCodes.ManualScheduling.WORKORDER_BY_ORDER
- Since:
- 18.0
- See Also:
- GCApi:
- task
-
Field Summary
FieldsFields inherited from class overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidalignAgenda(PoolKit poolKit) Method that calls the align agenda task, this task will do some checks and modify values related to the agendas of the scheduling.protected abstract voidassignActivity(PoolKit poolKit) protected voidBuilds the response object of the paste taskprotected voidcalculateMissingSkills(PoolKit poolKit) Calculates the resource/team missing skills for the current work order operation.protected voidcalculateTimeAndDistanceInformation(SchedulingTeamResource resource, PoolKit poolKit) Calculates the time and distance values for the current scheduling.protected voidcheckActivity(PoolKit poolKit) Checks the status of the work-order operation before start the scheduling process.protected voidCheck if there is an appointment slot defined for the activity, and returns an error if there isn't
a time intersection between this slot and the resource shift.protected voidChecks if the appointment dates are valid for the work shift.protected abstract voidcheckCrewShell(PoolKit poolKit) protected voidcheckFreezingDay(PoolKit poolKit) Check if the activity can be pasted evaluating the freezing days defined in the operation center.protected voidcheckScheduledTimeOnWorkshift(SchedulingTeamResource resource, PoolKit poolKit) Checks if the pasted activity is contained in the work shift time (considering also the overtime).protected voidcheckSchedulingsOfAgendas(Set<Long> agendas, PoolKit poolKit) Check if the activity is already planned in the current appointment.protected BOAgendacreateNewAgenda(PoolKit poolKit) Create a new record on Agenda table for the current appointment.protected voidexecute(SimpleBusinessEvent<T, ActivityManualAssignmentOutput> event, PoolKit poolKit) Executes the actual business logic after validation has passed.protected List<BOScheduling> Saves the initial list of schedulings of the agenda in order to call the procedure that replace the triggerprotected SchedulingIntegrationServicegetIntegrationService(PoolKit poolKit) protected LongReturns the activity duration.protected SchedulingLockgetLock()protected abstract Longprotected voidinitialChecks(PoolKit poolKit) Initial checks that evaluate if the operations is assignable to a resource.protected voidinitializeContext(PoolKit poolKit) Initialize the context object that will store all the data and configurations of the task.protected LonginsertBasicScheduling(SchedulingTeamResource resource, PoolKit poolKit) Insert the scheduling record for the activity.booleanDetermines whether the current state is valid for execution.protected voidlaunchCompleteManualActionEvent(PoolKit poolKit) LaunchSchedulingNotificationEventto notify that the scheduling action is completed.protected voidlaunchSchedulingCheckEvent(SchedulingTeamResource resource, PoolKit poolKit) Event for notify that a new scheduling has been just created.protected abstract SchedulingTeamLoads the team on which the activity will be assignedprotected voidloadWorkShiftDays(PoolKit poolKit) Retrieves the work shift days for the specified workShiftTimeLine.protected voidnotifyActivityScheduled(SchedulingTeamResource resource, PoolKit poolKit) Notify that an activity has been scheduled.protected voidnotifyInsert(BOAppointment appointment, PoolKit poolKit) protected voidprepareTeam(PoolKit poolKit) Loads the team and execute some checks on it.protected voidreloadSchedulings(SchedulingTeamResource resource, Long newSchedulingId) Reloads the schedulings for a specified SchedulingTeamResourceprotected voidretrieveAgenda(PoolKit poolKit) Retrieve the agenda for the appointment.protected voidretrieveAppointment(PoolKit poolKit) Retrieve the appointment for the assignment.protected voidSaves the initial list of schedulings of the agenda in order to call the procedure that replace the triggerprotected voidsavePlanningHistory(PoolKit poolKit) LaunchPlanningActionHistorySaveEventto save a planning action history.voidsetContext(ManualAssignmentContext context) protected voidUpdate the execution order on all the schedulings after the current.protected voidUpdate the parent scheduling filed for the current scheduling.protected voidAligns previous and next scheduling with the new time-distance values calculated on the current scheduling.protected voidupdateSchedulings(PoolKit poolKit) Save all the schedulings of the work shifts.protected voidupdateStatus(PoolKit poolKit) Method that callsUpdateStatusManualSchedulingEventand updates the status of the appointment, agenda, work order and operation entities related to the scheduling.protected voidupdateWorkshiftTourData(SchedulingTeamResource resource, PoolKit poolKit) Calculates the new tour data for the current work shift and updates all the schedulings.protected voidMethods 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
-
Field Details
-
eventInput
-
output
-
-
Constructor Details
-
BTBaseActivityManualAssignment
public BTBaseActivityManualAssignment()
-
-
Method Details
-
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
-
execute
protected void execute(SimpleBusinessEvent<T, ActivityManualAssignmentOutput> event, PoolKit poolKit) throws DAException, DAValidateExceptionDescription copied from class:ValidExecutionBusinessTaskExecutes the actual business logic after validation has passed.- Specified by:
executein classValidExecutionBusinessTask<SimpleBusinessEvent<T extends ActivityManualAssignmentInput,ActivityManualAssignmentOutput>> - Parameters:
event- the input event to processpoolKit- thePoolKit- Throws:
DAException- if a data access error occurs during executionDAValidateException- if validation fails during execution
-
getLock
- Throws:
DAExceptionDAValidateException
-
validateEventInput
protected void validateEventInput() -
initializeContext
Initialize the context object that will store all the data and configurations of the task.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getIntegrationService
protected SchedulingIntegrationService getIntegrationService(PoolKit poolKit) throws DAValidateException - Throws:
DAValidateException
-
getContext
-
setContext
-
loadWorkShiftDays
Retrieves the work shift days for the specified workShiftTimeLine.- Parameters:
poolKit- ThePoolKit- Throws:
DAValidateException- If there is an error with the validation process.DAException- If there is an error while retrieving work shift timeline or setting work shift days.
-
prepareTeam
Loads the team and execute some checks on it.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateExceptionDAException
-
loadTeam
Loads the team on which the activity will be assigned- Parameters:
poolKit- thePoolKit- Returns:
- Throws:
DAValidateExceptionDAException
-
initialChecks
Initial checks that evaluate if the operations is assignable to a resource.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkCrewShell
- Throws:
DAValidateExceptionDAException
-
checkActivity
Checks the status of the work-order operation before start the scheduling process.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkFreezingDay
Check if the activity can be pasted evaluating the freezing days defined in the operation center.
Activities cannot be assigned in the past or in freezing days.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkActivityBlockDate
Check if there is an appointment slot defined for the activity, and returns an error if there isn't
a time intersection between this slot and the resource shift.- Throws:
DAValidateException
-
checkBookingDate
Checks if the appointment dates are valid for the work shift.- Throws:
DAValidateException
-
retrieveAppointment
Retrieve the appointment for the assignment.
This is the logic of the retrieving process: - if exists an appointment in open status, use that appointment cleaning the old data;
- else if exists any appointment not in status (cancelled/closed), throw exception;
- else create a new appointment.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateExceptionDAException
-
notifyInsert
protected void notifyInsert(BOAppointment appointment, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
retrieveAgenda
Retrieve the agenda for the appointment.
This is the logic of the retrieving process: - if exists one or more agenda in open status for the appointment, take one random;
- else if exists any agenda not in status cancelled/closed, throw exception;
- else create a new agenda.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- if the retrieved agenda fails validationDAException- if an exception occurs during the retrieval process
-
checkSchedulingsOfAgendas
protected void checkSchedulingsOfAgendas(Set<Long> agendas, PoolKit poolKit) throws DAValidateException, DAException Check if the activity is already planned in the current appointment.- Parameters:
agendas- the set of agendas of the appointmentpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
createNewAgenda
Create a new record on Agenda table for the current appointment.- Parameters:
poolKit- thePoolKit- Returns:
- the new agenda record
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
assignActivity
- Throws:
DAValidateExceptionDAException
-
insertBasicScheduling
protected Long insertBasicScheduling(SchedulingTeamResource resource, PoolKit poolKit) throws DAValidateException, DAException Insert the scheduling record for the activity.- Parameters:
poolKit- thePoolKit- Returns:
- the id of the new scheduling
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getPlanningAction
-
saveInitialSchedulings
protected void saveInitialSchedulings()Saves the initial list of schedulings of the agenda in order to call the procedure that replace the trigger -
getAllResourcesSchedulings
Saves the initial list of schedulings of the agenda in order to call the procedure that replace the trigger -
getInterventionDuration
Returns the activity duration. -
updatePreviousNextSchedulingCoordinatesPath
Aligns previous and next scheduling with the new time-distance values calculated on the current scheduling. -
updateSchedulings
Save all the schedulings of the work shifts.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateStatus
Method that callsUpdateStatusManualSchedulingEventand updates the status of the appointment, agenda, work order and operation entities related to the scheduling.
If required, the agenda is validated also the crew shell schedulings.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
reloadSchedulings
protected void reloadSchedulings(SchedulingTeamResource resource, Long newSchedulingId) throws DAValidateException, DAException Reloads the schedulings for a specified SchedulingTeamResource- Parameters:
resource- the SchedulingTeamResource to reload the schedulings fornewSchedulingId- the ID of the new scheduling to set as the current scheduling position- Throws:
DAValidateException- when validation failsDAException- when an error occurs during the reloading process
-
updateParentScheduling
protected void updateParentScheduling()Update the parent scheduling filed for the current scheduling. -
notifyActivityScheduled
protected void notifyActivityScheduled(SchedulingTeamResource resource, PoolKit poolKit) throws DAValidateException, DAException Notify that an activity has been scheduled. Here we launch this event for execute the planning actions.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
alignAgenda
Method that calls the align agenda task, this task will do some checks and modify values related to the agendas of the scheduling. This is the call to the new business task that is replacing the trigger AGGIORNAAAGENDA.- Parameters:
poolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
calculateTimeAndDistanceInformation
protected void calculateTimeAndDistanceInformation(SchedulingTeamResource resource, PoolKit poolKit) throws DAValidateException, DAException Calculates the time and distance values for the current scheduling. This calculation affects only the in-memory BOScheduling object of the current scheduling.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
savePlanningHistory
LaunchPlanningActionHistorySaveEventto save a planning action history.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
calculateMissingSkills
Calculates the resource/team missing skills for the current work order operation.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateNextsSchedulingsOrder
Update the execution order on all the schedulings after the current. -
updateWorkshiftTourData
protected void updateWorkshiftTourData(SchedulingTeamResource resource, PoolKit poolKit) throws DAValidateException, DAException Calculates the new tour data for the current work shift and updates all the schedulings.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
launchCompleteManualActionEvent
protected void launchCompleteManualActionEvent(PoolKit poolKit) throws DAException, DAValidateException LaunchSchedulingNotificationEventto notify that the scheduling action is completed.- Parameters:
poolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
launchSchedulingCheckEvent
protected void launchSchedulingCheckEvent(SchedulingTeamResource resource, PoolKit poolKit) throws DAValidateException, DAException Event for notify that a new scheduling has been just created. This event execute some check (ex: multistage violations, permits, ..) and raise exception if there is a blocking error.- Parameters:
poolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
buildOutput
protected void buildOutput()Builds the response object of the paste task -
checkScheduledTimeOnWorkshift
protected void checkScheduledTimeOnWorkshift(SchedulingTeamResource resource, PoolKit poolKit) throws DAValidateException, DAException Checks if the pasted activity is contained in the work shift time (considering also the overtime).- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-