Class BTNearestWorkShiftSearch
java.lang.Object
overit.geocall.bl.BusinessTask<NearestWorkShiftSearchEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<NearestWorkShiftSearchEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<NearestWorkShiftSearchEvent>
overit.geocallapp.wfm.calendars.bl.workshift.exception.task.BTNearestWorkShiftSearch
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(NearestWorkShiftSearchEvent.class)
public class BTNearestWorkShiftSearch
extends ValidPermissionBusinessTask<NearestWorkShiftSearchEvent>
Business task used to find the
When the
BOWorkShift that is nearest the reference date. When the
NearestWorkShiftSearchEvent is launched
the BT notices the call and searches the BOWorkShift basing on the event's input. - 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 TimeLineRangecalculateOverlappingRange(List<BOWorkShift> workShifts, Date referenceDate, PoolKit poolKit) Calculates theTimeLineRangethat overlaps the reference date.protected voidexecute(NearestWorkShiftSearchEvent event, PoolKit poolKit) Calculates the nearest work shift using theTimeLineobjects.booleanDetermines whether the current state is valid for execution.protected List<BOWorkShift> searchWorkShifts(NearestWorkShiftSearchInput input, PoolKit poolKit) Searches for all the non cancelled work shifts related to the given resource and whose start date is within the range of (reference date-1) and (reference dates +1).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
-
BTNearestWorkShiftSearch
public BTNearestWorkShiftSearch()
-
-
Method Details
-
execute
protected void execute(NearestWorkShiftSearchEvent event, PoolKit poolKit) throws DAException, DAValidateException Calculates the nearest work shift using theTimeLineobjects.- Specified by:
executein classValidExecutionBusinessTask<NearestWorkShiftSearchEvent>- Parameters:
event- theNearestWorkShiftSearchEventpoolKit- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
calculateOverlappingRange
protected TimeLineRange calculateOverlappingRange(List<BOWorkShift> workShifts, Date referenceDate, PoolKit poolKit) Calculates theTimeLineRangethat overlaps the reference date. If no intersection is found, it approximates the reference date range by 8 hours in past and in the future.- Parameters:
workShifts- list ofBOWorkShiftsreferenceDate- the reference datepoolKit- thePoolKit- Returns:
- the time line range that overlaps the reference date
-
searchWorkShifts
protected List<BOWorkShift> searchWorkShifts(NearestWorkShiftSearchInput input, PoolKit poolKit) throws DAValidateException, DAException Searches for all the non cancelled work shifts related to the given resource and whose start date is within the range of (reference date-1) and (reference dates +1).- Parameters:
input- theNearestWorkShiftSearchInputpoolKit- thePoolKit- Returns:
- a list of loaded
BOWorkShift - Throws:
DAValidateException- the DA validate exceptionDAException- the DA 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
-