Class BTResourceInterventionSearch
java.lang.Object
overit.geocall.bl.BusinessTask<ResourceInterventionSearchEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<ResourceInterventionSearchEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<ResourceInterventionSearchEvent>
overit.geocallapp.wfm.orchestrator.workorders.bl.intervention.task.BTResourceInterventionSearch
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(ResourceInterventionSearchEvent.class)
public class BTResourceInterventionSearch
extends ValidPermissionBusinessTask<ResourceInterventionSearchEvent>
It performs various checks and validations on the provided
ResourceInterventionSearchFilter and then executes the search for interventions based on the filter criteria.
It is triggered by the ResourceInterventionSearchEvent.- Since:
- 18.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 booleancheckWorkOrderFilter(Collection<Long> woOperations, ResourceInterventionSearchFilter filter) Check for the presence of the filter for work order or work order operation.protected voidexecute(ResourceInterventionSearchEvent event, PoolKit poolKit) It first checks if the resource is a team leader OR if it's not a team leader but has associated interventions.protected Collection<Long> filterWorkOrderOperations(Collection<Long> woOperations, ResourceInterventionSearchFilter input) Filters the collection of work order operations based on the provided input.protected WorkOrdersIntegrationServicegetIntegrationService(PoolKit poolKit) Retrieves the WorkOrdersIntegrationService instance.protected Collection<Long> getInterventionsFromResources(ResourceInterventionSearchFilter filter, PoolKit poolKit) Retrieves the interventions from resources based on the provided search filter.protected Collection<Long> getWoOperations(ResourceInterventionSearchFilter input, PoolKit poolKit) Retrieves the collection of work order operations based on the provided input.booleanDetermines whether the current state is valid for execution.searchInterventionResources(ResourceInterventionSearchFilter filter, PoolKit poolKit) Retrieves a list of intervention resource IDs based on the provided search filter.protected PageResponse<BOIntervention> searchInterventions(ResourceInterventionSearchEvent event, PoolKit poolKit, InterventionSearchFilter interventionSearchFilter, Collection<Long> woOperations, ResourceInterventionSearchFilter filter) Searches for interventions based on the provided search filter.searchScheduling(List<BOWorkShift> workShiftList, PoolKit poolKit) Searches for scheduling based on the providedBOWorkShiftlist.protected Collection<Long> searchWorkOrderOperations(ResourceInterventionSearchFilter input, PoolKit poolKit) Retrieves the collection of work order operations based on the provided input.protected List<BOWorkShift> searchWorkShifts(ResourceInterventionSearchFilter filter, PoolKit poolKit) Searches for work shifts based on the provided filter.Sets the start and end date search parameters for the resource intervention search.protected voidvalidate(ResourceInterventionSearchFilter filter, PoolKit poolKit) Validates the input for resource intervention search event.protected voidvalidateDates(Date startDate, Date endDate) Validates the start and end dates for resource intervention.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
-
BTResourceInterventionSearch
public BTResourceInterventionSearch()
-
-
Method Details
-
execute
protected void execute(ResourceInterventionSearchEvent event, PoolKit poolKit) throws DAException, DAValidateException It first checks if the resource is a team leader OR if it's not a team leader but has associated interventions. Then it checks if there are no work order operations filter OR if there are work orders operations filter specified and matching operations found. If these conditions are met, it proceeds to set additional search parameters: It sets the work order operations It sets the status from the filter It adds extension search parameters It flags this as a resource interventions search Finally, it performs the actual search for interventions using these parameters.- Specified by:
executein classValidExecutionBusinessTask<ResourceInterventionSearchEvent>- Parameters:
event- theResourceInterventionSearchEventpoolKit- thePoolKit- Throws:
DAExceptionDAValidateException
-
searchInterventions
protected PageResponse<BOIntervention> searchInterventions(ResourceInterventionSearchEvent event, PoolKit poolKit, InterventionSearchFilter interventionSearchFilter, Collection<Long> woOperations, ResourceInterventionSearchFilter filter) throws DAValidateException, DAException Searches for interventions based on the provided search filter.- Parameters:
event- theResourceInterventionSearchEventpoolKit- thePoolKitinterventionSearchFilter- theInterventionSearchFilterto use for the searchwoOperations- the collection of work order operations to filter byfilter- theResourceInterventionSearchFiltercontaining the search criteria- Returns:
- a
PageResponsecontaining the matchingBOInterventionresults - Throws:
DAValidateException- if any validation errors occur during the searchDAException- if any other errors occur during the search
-
checkWorkOrderFilter
protected boolean checkWorkOrderFilter(Collection<Long> woOperations, ResourceInterventionSearchFilter filter) Check for the presence of the filter for work order or work order operation.- Parameters:
woOperations- the work order operationsfilter- the resource intervention search filter- Returns:
- true if the search should proceed, false otherwise.
-
validate
protected void validate(ResourceInterventionSearchFilter filter, PoolKit poolKit) throws DAValidateException, DAException Validates the input for resource intervention search event.- Parameters:
filter- The resource intervention search filter.poolKit- thePoolKit- Throws:
DAValidateException- If any validation error occurs.DAException- If any error occurs during the validation process.
-
validateDates
Validates the start and end dates for resource intervention.- Parameters:
startDate- The start date of the intervention.endDate- The end date of the intervention.- Throws:
DAValidateException- If the start date is after the end date, or if the date range exceeds the maximum limit defined in the properties.
-
setStartEndDate
Sets the start and end date search parameters for the resource intervention search.- Parameters:
filter- The resource intervention search filter containing the start and end dates.- Returns:
- A map containing the start and end date search parameters.
-
getWoOperations
protected Collection<Long> getWoOperations(ResourceInterventionSearchFilter input, PoolKit poolKit) throws DAException, DAValidateException Retrieves the collection of work order operations based on the provided input.- Parameters:
input- The input object containing filters for returning the activities assigned to a resourcepoolKit- ThePoolKit- Returns:
- A collection of work order operations that match the provided input filters
- Throws:
DAException- If an error occurs in the data access layerDAValidateException- If any validation error occurs
-
searchWorkOrderOperations
protected Collection<Long> searchWorkOrderOperations(ResourceInterventionSearchFilter input, PoolKit poolKit) throws DAException, DAValidateException Retrieves the collection of work order operations based on the provided input.- Parameters:
input- The input object containing filters for returning the activities assigned to a resourcepoolKit- ThePoolKit- Returns:
- A collection of work order operation IDs that match the provided input filters
- Throws:
DAException- If an error occurs in the data access layerDAValidateException- If any validation error occurs
-
filterWorkOrderOperations
protected Collection<Long> filterWorkOrderOperations(Collection<Long> woOperations, ResourceInterventionSearchFilter input) Filters the collection of work order operations based on the provided input.- Parameters:
woOperations- The collection of work order operation ids to be filteredinput- The input object containing filters for returning the activities assigned to a resource- Returns:
- A collection of work order operation ids that match the provided input filters
-
getInterventionsFromResources
protected Collection<Long> getInterventionsFromResources(ResourceInterventionSearchFilter filter, PoolKit poolKit) throws DAException, DAValidateException Retrieves the interventions from resources based on the provided search filter.- Parameters:
filter- The resource intervention search filter.poolKit- ThePoolKit.- Returns:
- A collection of intervention IDs that match the provided search filter.
- Throws:
DAException- If an error occurs in the data access layer.DAValidateException- If any validation error occurs.
-
searchInterventionResources
protected List<Long> searchInterventionResources(ResourceInterventionSearchFilter filter, PoolKit poolKit) throws DAValidateException, DAException Retrieves a list of intervention resource IDs based on the provided search filter.- Parameters:
filter- The resource intervention search filter.poolKit- ThePoolKit.- Returns:
- A list of intervention resource IDs that match the provided search filter.
- Throws:
DAValidateException- If any validation error occurs.DAException- If any error occurs during the search process.
-
searchWorkShifts
protected List<BOWorkShift> searchWorkShifts(ResourceInterventionSearchFilter filter, PoolKit poolKit) throws DAValidateException, DAException Searches for work shifts based on the provided filter.- Parameters:
filter- The resource intervention search filter.poolKit- ThePoolKit.- Returns:
- A list of
BOWorkShift. - Throws:
DAValidateException- If any validation error occurs.DAException- If any error occurs during the search process.
-
searchScheduling
protected List<Long> searchScheduling(List<BOWorkShift> workShiftList, PoolKit poolKit) throws DAValidateException, DAException Searches for scheduling based on the providedBOWorkShiftlist.- Parameters:
workShiftList- The List ofBOWorkShiftpoolKit- ThePoolKit- Returns:
- A List of Long values representing the agenda ids of the scheduling.
- Throws:
DAValidateException- If any validation error occurs.DAException- If any error occurs during the scheduling search process.
-
getIntegrationService
protected WorkOrdersIntegrationService getIntegrationService(PoolKit poolKit) throws DAValidateException Retrieves the WorkOrdersIntegrationService instance. If the instance hasn't been created yet, it will be created and stored for future use.- Parameters:
poolKit- ThePoolKit.- Returns:
- The
WorkOrdersIntegrationServiceinstance. - Throws:
DAValidateException- If any validation error occurs.
-
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
-