Class BTActivityRemoval
java.lang.Object
overit.geocall.bl.BusinessTask<ActivityRemovalEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<ActivityRemovalEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<ActivityRemovalEvent>
overit.geocallapp.wfm.orchestrator.scheduling.bl.activityremoval.task.BTActivityRemoval
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(ActivityRemovalEvent.class)
public class BTActivityRemoval
extends ValidPermissionBusinessTask<ActivityRemovalEvent>
Business task in order to remove an activity to a resource.
Error Code:
Error Code:
Codes.ManualScheduling.INVALID_INTERVENTIONCodes.ManualScheduling.MULTI_DAY_INTERVENTIONCodes.ManualScheduling.IN_CHARGE_INTERVENTIONCodes.ManualScheduling.NO_ACTIVITY_SCHEDULINGSCodes.ManualScheduling.FROZEN_SCHEDULINGSCodes.ManualScheduling.OPERATION_IS_BOOKINGCodes.ManualScheduling.WORKORDER_BY_ORDERCodes.ManualScheduling.OPERATION_NOT_ALLOWED_FROM_PROJECTCodes.ManualScheduling.LINKED_ACTIVITYCodes.ManualScheduling.ACTION_NOT_ALLOWED_ON_PASSED_DAYSCodes.ManualScheduling.ACTION_NOT_POSSIBLE_ON_LOCKED_DAYS
- 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 voidBuilds the response object of the paste taskprotected voidcalculateMissingSkills(PoolKit poolKit) Calculates the resource/team missing skills for the current work order operation.protected voidChecks the status of the work-order operation before start the scheduling process.protected voidcheckFreezingDay(PoolKit poolKit) Check if the activity can be removed evaluating the freezing days defined in the operation center.protected voidChecks if the activity is related to another activity, and stop the process if necessaryprotected voidexecute(ActivityRemovalEvent event, PoolKit poolKit) Executes the actual business logic after validation has passed.protected List<BOScheduling> findActivitySchedulings(PoolKit poolKit) Loads the schedulings related to the activity to removeprotected List<BOScheduling> Gets a list of all the work shift scheduling for all the resources in the team.Retrieves a set of all scheduling IDs associated with the team resources.protected SchedulingIntegrationServicegetIntegrationService(PoolKit poolKit) protected SchedulingLockgetLock()Gets the timeslot for the activity removalprotected LonggetScheduledActivityAddress(BOScheduling scheduling, PoolKit poolKit) Returns the address Id of the input schedulingprotected List<BOWorkShift> getWorkShiftFromScheduling(List<BOScheduling> schedulings, PoolKit poolKit) Retrieves the work shifts associated with the team members in the provided list of schedulings.protected voidinitializeContext(PoolKit poolKit) Initialize the context object that will store all the data and configurations of the task.booleanDetermines whether the current state is valid for execution.protected voidlaunchCompleteRemovalActionEvent(PoolKit poolKit) LaunchSchedulingNotificationEventto notify that the scheduling removal action is completed.protected voidlaunchPlanningAction(PoolKit poolKit) Notify the activity removal in order to launch the planning actionprotected voidlaunchSchedulingCheckEvent(PoolKit poolKit) Event for notify that some schedulings has been removed.protected voidprepareTeam(PoolKit poolKit) The method distinguishes between two main scenarios: 1.protected voidremoveActivity(PoolKit poolKit) Remove all the schedulings of the input activity.protected voidretrieveAgenda(PoolKit poolKit) Retrieve the agenda related to the activity to remove.protected voidretrieveAppointment(PoolKit poolKit) Retrieve the appointment related to the activity to remove.protected voidSaves the initial list of scheduling of the agenda in order to call the procedure that replace the triggerprotected voidsavePlanningHistory(PoolKit poolKit) LaunchPlanningActionHistorySaveEventto save a planning action history.voidsetContext(ManualRemovalContext context) protected voidUpdates the arrival date of the new first activity if the removed activity was the first of the day.protected voidupdatedPreviousAndNextSchedulings(SchedulingTeamResource resource, PoolKit poolKit) Calculates the new time and space distance for the previous and the next schedulings.protected voidUpdates the execution order of all the schedulings after the current one.protected voidupdateSchedulings(PoolKit poolKit) Save all the schedulings of the work shifts.protected voidupdateStatus(PoolKit poolKit) Method that callsUpdateStatusRemovalSchedulingEventand 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.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
-
Field Details
-
activityId
-
-
Constructor Details
-
BTActivityRemoval
public BTActivityRemoval()
-
-
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
-
getIntegrationService
protected SchedulingIntegrationService getIntegrationService(PoolKit poolKit) throws DAValidateException - Throws:
DAValidateException
-
execute
protected void execute(ActivityRemovalEvent event, PoolKit poolKit) throws DAException, DAValidateException Description copied from class:ValidExecutionBusinessTaskExecutes the actual business logic after validation has passed.- Specified by:
executein classValidExecutionBusinessTask<ActivityRemovalEvent>- Parameters:
event- the input event to processpoolKit- thePoolKit- Throws:
DAException- if a data access error occurs during executionDAValidateException- if validation fails during execution
-
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
-
getContext
-
setContext
-
retrieveAppointment
Retrieve the appointment related to the activity to remove.
For not multi-day activities, we will have only one open appointment, or one or more close appointments (activities with outcome that can also be cancelled)- Parameters:
poolKit- thePoolKit- Throws:
DAValidateExceptionDAException
-
retrieveAgenda
Retrieve the agenda related to the activity to remove.
At this point we have already calculated the right appointment, so we can have only one open or closed agenda- Parameters:
poolKit- thePoolKit- Throws:
DAValidateExceptionDAException
-
prepareTeam
The method distinguishes between two main scenarios: 1. Empty Crew Shell Scenario: If the foreman is marked as a "dummy", the method identifies this as an empty crew shell scenario. Empty crew shell scenario means that the crew shell is empty or the technicians still don't have the transferred scheduling. It retrieves the corresponding BOCrewShell using the foremanId. 2. Single, Team, and Crew Shell with Technician Scenario(technicians already have the transferred scheduling): If the foreman is not a dummy, the method identifies this as a scenario where actual scheduling is involved. It retrieves a list of BOScheduling objects representing scheduled activities. From these, it filters out the work shift associated with the foreman and stores it in workShiftForeman. If workShiftForeman is part of a crew shell, the method retrieves the corresponding BOCrewShellComposition and loads the BOCrewShell. Team Construction: Depending on whether a crewShell is available: 1. Without Crew Shell: The method collects the IDs of the team members from their work shifts and ensures the workShiftForemanId is not null. It then constructs a SchedulingTeam using the SchedulingTeamBuilder. 2. With Crew Shell: The method constructs a SchedulingTeam using the CrewShellSchedulingTeamBuilder, passing in the crewShell and startDate.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- if there are any issues with the data retrievedDAException- if there are any other exceptions during the data retrieval process
-
findActivitySchedulings
protected List<BOScheduling> findActivitySchedulings(PoolKit poolKit) throws DAValidateException, DAException Loads the schedulings related to the activity to remove- Parameters:
poolKit- thePoolKit- Throws:
DAValidateExceptionDAException
-
getWorkShiftFromScheduling
protected List<BOWorkShift> getWorkShiftFromScheduling(List<BOScheduling> schedulings, PoolKit poolKit) throws DAValidateException, DAException Retrieves the work shifts associated with the team members in the provided list of schedulings.- Parameters:
schedulings- The list ofBOSchedulingobjects to retrieve the work shifts for.poolKit- ThePoolKit- Returns:
- A list of
BOWorkShiftobjects representing the work shifts for the team members. - Throws:
DAValidateException- If there is an issue validating the input data.DAException- If there is an error retrieving the work shifts.
-
checkActivity
Checks the status of the work-order operation before start the scheduling process.- Throws:
DAValidateException- the DA validate exception
-
checkLinkedActivity
Checks if the activity is related to another activity, and stop the process if necessary- Throws:
DAValidateException- the DA validate exception
-
checkFreezingDay
Check if the activity can be removed evaluating the freezing days defined in the operation center.
Activities scheduled before today or scheduled in freezing days cannot be removed.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getLock
Gets the timeslot for the activity removal- Returns:
- Throws:
DAExceptionDAValidateException
-
removeActivity
Remove all the schedulings of the input activity.
In this version of the removal activity functionality, we don't support linked activities,
so the full set of schedulings to remove is completely defined into the SchedulingTeam schedulings- Parameters:
poolKit- thePoolKit- Throws:
DAExceptionDAValidateException
-
updatedPreviousAndNextSchedulings
protected void updatedPreviousAndNextSchedulings(SchedulingTeamResource resource, PoolKit poolKit) throws DAValidateException, DAException Calculates the new time and space distance for the previous and the next schedulings.- Parameters:
resource- theSchedulingTeamResourcepoolKit- thePoolKit- Throws:
DAValidateExceptionDAException
-
getScheduledActivityAddress
protected Long getScheduledActivityAddress(BOScheduling scheduling, PoolKit poolKit) throws DAValidateException, DAException Returns the address Id of the input scheduling- Parameters:
scheduling- theBOSchedulingpoolKit- thePoolKit- Returns:
- the address Id of the input scheduling
- Throws:
DAValidateExceptionDAException
-
updateNextSchedulingsOrder
Updates the execution order of all the schedulings after the current one. -
updatedFirstSchedulingArrivalDate
Updates the arrival date of the new first activity if the removed activity was the first of the day. -
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
-
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
-
updateSchedulings
Save all the schedulings of the work shifts.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateStatus
Method that callsUpdateStatusRemovalSchedulingEventand updates the status of the appointment, agenda, work order and operation entities related to the scheduling.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
saveInitialSchedulings
protected void saveInitialSchedulings()Saves the initial list of scheduling of the agenda in order to call the procedure that replace the trigger -
getAllResourcesSchedulings
Gets a list of all the work shift scheduling for all the resources in the team.- Returns:
- a list of
BOScheduling
-
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
-
savePlanningHistory
LaunchPlanningActionHistorySaveEventto save a planning action history.- Parameters:
poolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
launchPlanningAction
Notify the activity removal in order to launch the planning action- Parameters:
poolKit- thePoolKit- Throws:
DAValidateExceptionDAException
-
launchSchedulingCheckEvent
Event for notify that some schedulings has been removed.- Parameters:
poolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
launchCompleteRemovalActionEvent
protected void launchCompleteRemovalActionEvent(PoolKit poolKit) throws DAException, DAValidateException LaunchSchedulingNotificationEventto notify that the scheduling removal action is completed.- Parameters:
poolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
getChangedSchedulings
Retrieves a set of all scheduling IDs associated with the team resources. This includes the previous scheduling ID for each resource, as well as the IDs of all schedulings in the work shift schedule for each resource- Returns:
- a set of scheduling IDs
-
buildOutput
protected void buildOutput()Builds the response object of the paste task
-