Class BTTimesheetWarningsCalculate
java.lang.Object
overit.geocall.bl.BusinessTask<TimesheetWarningsCalculateEvent>
overit.geocallapp.wfm.core.bl.timesheet.task.BTTimesheet<TimesheetWarningsCalculateEvent>
overit.geocallapp.wfm.core.bl.timesheet.task.BTTimesheetWarningsCalculate
- All Implemented Interfaces:
Serializable,Tool
@Event(TimesheetWarningsCalculateEvent.class)
public class BTTimesheetWarningsCalculate
extends BTTimesheet<TimesheetWarningsCalculateEvent>
Business task in order to calculate all the
BOWarning of a timesheet.
When the TimesheetWarningsCalculateEvent is launched
the BT notices the call and calculates all the BOWarning of a timesheet basing on the event's input.- Since:
- 9.2
- See Also:
- GCApi:
- task
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckGapNotAccountedWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) This warning must be generated when two consecutive tasks of the same shift have an in between time gap grater than the threshold defined in the configuration.protected voidcheckInconsistentDurationWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) This warning must be generated when the task original duration is different from the reference interval (inserted manually by the user) and it is also different from the task effective duration (which considers tasks overlapping)protected voidcheckOverlapWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) This warning must be generated whether two or more tasks are overlapped and the task with max priority is not unique.protected voidcheckOvertimeWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) This warning must be generated whether the "out-of-shift overtime" task category begins before the task shift starts or it finishes after the task shift ends.protected voidcheckShiftGapWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) This warning must be calculated for every shift of the timesheet and its generated when the planned shift duration is grater than the accounted one.protected voidcheckShiftNotRespectedWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) This warning must be generated for every shift of the timesheet and its generated when the actual shift starts after the planned one or when the actual shift ends before the planned one.protected booleancheckWarningDuplication(BOWarning warning, PoolKit poolKit) It checks if a warning with the same information as the one given as input already exists.protected voidcreateTaskWarning(BOTask task, Long warningType, BOWorkShift shift, PoolKit poolKit) Creates theBOWarningassociated to the givenBOTaskand the eventualBOWorkShiftwith the needed informations.protected voidcreateWorkShiftWarning(Timesheet timesheet, Long warningType, BOWorkShift shift, PoolKit poolKit) Creates theBOWarningassociated to the givenTimesheetandBOWorkShiftwith the needed informations.protected voiddeleteOldWarnings(Long timesheetId, PoolKit poolKit) It deletes all the old warning of the given timesheet.protected voidelaborateInBetweenTaskGap(TimesheetEntitiesAggregate aggregate, Long gapThreshold, BOWorkShift shift, PoolKit poolKit) This check is performed on the list of active tasks sorted by date.protected voidexecute(TimesheetWarningsCalculateEvent event, PoolKit poolKit) Performs the warnings calculation after deleting all old warnings of the given timesheet and basing on the configuration of the timesheet (user) profile.protected LonggetMinutesDifference(Date from, Date to) protected voidinsertWarning(BOWarning warning, PoolKit poolKit) If the givenBOWarningdoes not yet exists, it calls theWarningInsertEventto perform the insert of the warning.protected TimesheetEntitiesAggregateloadAggregate(Timesheet timesheet, PoolKit poolKit) It loads the timesheet aggregate object.Methods inherited from class overit.geocallapp.wfm.core.bl.timesheet.task.BTTimesheet
body, checkTimesheetActivation, throwInactiveTimesheetExceptionMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Field Details
-
warnings
-
-
Constructor Details
-
BTTimesheetWarningsCalculate
public BTTimesheetWarningsCalculate()Instantiates a newBTTimesheetWarningsCalculate.
-
-
Method Details
-
execute
protected void execute(TimesheetWarningsCalculateEvent event, PoolKit poolKit) throws DAException, DAValidateException Performs the warnings calculation after deleting all old warnings of the given timesheet and basing on the configuration of the timesheet (user) profile.- Specified by:
executein classBTTimesheet<TimesheetWarningsCalculateEvent>- Parameters:
event- theTimesheetWarningsCalculateEventpoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadAggregate
protected TimesheetEntitiesAggregate loadAggregate(Timesheet timesheet, PoolKit poolKit) throws DAValidateException, DAException It loads the timesheet aggregate object.- Parameters:
timesheet- the givenTimesheetused to load all the related entities of the aggregatepoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
deleteOldWarnings
protected void deleteOldWarnings(Long timesheetId, PoolKit poolKit) throws DAValidateException, DAException It deletes all the old warning of the given timesheet.- Parameters:
timesheetId- the id of the given timesheetpoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkShiftGapWarning
protected void checkShiftGapWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) throws DAValidateException, DAException This warning must be calculated for every shift of the timesheet and its generated when the planned shift duration is grater than the accounted one.- Parameters:
aggregate- theTimesheetEntitiesAggregatepoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkGapNotAccountedWarning
protected void checkGapNotAccountedWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) throws DAValidateException, DAException This warning must be generated when two consecutive tasks of the same shift have an in between time gap grater than the threshold defined in the configuration.- Parameters:
aggregate- theTimesheetEntitiesAggregatepoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
elaborateInBetweenTaskGap
protected void elaborateInBetweenTaskGap(TimesheetEntitiesAggregate aggregate, Long gapThreshold, BOWorkShift shift, PoolKit poolKit) throws DAValidateException, DAException This check is performed on the list of active tasks sorted by date. It confronts two consecutive tasks at the time and, in case their in between time gap is grater than the threshold, generates a warning for each of them.- Parameters:
aggregate- theTimesheetEntitiesAggregategapThreshold- the gap threshold permitted by the {linkBOProfile}shift- the currentBOWorkShiftpoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkOverlapWarning
protected void checkOverlapWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) throws DAValidateException, DAException This warning must be generated whether two or more tasks are overlapped and the task with max priority is not unique.- Parameters:
aggregate- theTimesheetEntitiesAggregatepoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkOvertimeWarning
protected void checkOvertimeWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) throws DAValidateException, DAException This warning must be generated whether the "out-of-shift overtime" task category begins before the task shift starts or it finishes after the task shift ends.- Parameters:
aggregate- theTimesheetEntitiesAggregatepoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkShiftNotRespectedWarning
protected void checkShiftNotRespectedWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) throws DAValidateException, DAException This warning must be generated for every shift of the timesheet and its generated when the actual shift starts after the planned one or when the actual shift ends before the planned one.- Parameters:
aggregate- theTimesheetEntitiesAggregatepoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkInconsistentDurationWarning
protected void checkInconsistentDurationWarning(TimesheetEntitiesAggregate aggregate, PoolKit poolKit) throws DAValidateException, DAException This warning must be generated when the task original duration is different from the reference interval (inserted manually by the user) and it is also different from the task effective duration (which considers tasks overlapping)- Parameters:
aggregate- theTimesheetEntitiesAggregatepoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
createWorkShiftWarning
protected void createWorkShiftWarning(Timesheet timesheet, Long warningType, BOWorkShift shift, PoolKit poolKit) throws DAValidateException, DAException Creates theBOWarningassociated to the givenTimesheetandBOWorkShiftwith the needed informations.- Parameters:
timesheet- the currentTimesheetwarningType- the id of theBOWarningTypeshift- theBOWorkShiftpoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
createTaskWarning
protected void createTaskWarning(BOTask task, Long warningType, BOWorkShift shift, PoolKit poolKit) throws DAValidateException, DAException Creates theBOWarningassociated to the givenBOTaskand the eventualBOWorkShiftwith the needed informations.- Parameters:
task- the currentTimesheetwarningType- the id of theBOWarningTypeshift- theBOWorkShiftpoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
insertWarning
protected void insertWarning(BOWarning warning, PoolKit poolKit) throws DAValidateException, DAException If the givenBOWarningdoes not yet exists, it calls theWarningInsertEventto perform the insert of the warning.- Parameters:
warning- theBOWarningto be insertedpoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkWarningDuplication
protected boolean checkWarningDuplication(BOWarning warning, PoolKit poolKit) throws DAValidateException, DAException It checks if a warning with the same information as the one given as input already exists. If so, the insertion is not performed: one task can only have one warning of a certain type.- Parameters:
warning- theBOWarningto be insertedpoolKit- the pool kit- Returns:
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
getMinutesDifference
-