Class BTTimesheetTaskUpdate
java.lang.Object
overit.geocall.bl.BusinessTask<TimesheetTaskUpdateEvent>
overit.geocallapp.wfm.core.bl.timesheet.task.BTTimesheet<TimesheetTaskUpdateEvent>
overit.geocallapp.wfm.core.bl.timesheet.task.BTTimesheetTaskUpdate
- All Implemented Interfaces:
Serializable,Tool
@Event(TimesheetTaskUpdateEvent.class)
public class BTTimesheetTaskUpdate
extends BTTimesheet<TimesheetTaskUpdateEvent>
Business task in order to update a
When the
BOTask. When the
TimesheetTaskUpdateEvent is launched the BT notices the call
and updates the BOTask basing on the event's input. Required fields:
- timesheet task id
Error Code:
Codes.Timesheet.Validation.TIMESHEET_NOT_EDITABLECodes.Timesheet.Validation.END_DATE_EARLIER_START_DATECodes.Timesheet.Validation.TIMESHEET_NOT_INCLUDE_DATESCodes.Timesheet.Validation.SERVER_EDIT_NOT_ALLOWEDCodes.Timesheet.Validation.MOBILE_EDIT_NOT_ALLOWEDCodes.Timesheet.Validation.FUTURE_INSERTION_NOT_AVAILABLECodes.Timesheet.Validation.UNAVAILABILITY_REASON_REQUIREDCodes.Timesheet.Validation.INTERVENTION_REQUIRED
After updating tht timesheet task, it recalculates all the timesheet
durations and warnings.
- Since:
- 9.2
- See Also:
- GCApi:
- task
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculateDuration(Timesheet timesheet, PoolKit poolKit) Calculates all the timesheet durations.protected List<TimesheetShiftCalculationOutput> calculateTaskShifts(Timesheet timesheet, Date startDate, Date endDate, PoolKit poolKit) protected voidcalculateWarnings(Timesheet timesheet, PoolKit poolKit) Calculates all the timesheet warnings.protected voidcancelLinkedTasks(PoolKit poolKit, List<BOTask> linkedTasks) protected voidcheckTimesheetState(Timesheet timesheet) Checks the timesheet state for this operation.protected BOEventEntitycreateEventEntity(Long intervention) Create a newBOEventEntitythat refers to an intervention.protected voidexecute(TimesheetTaskUpdateEvent event, PoolKit poolKit) Updates theBOTaskand recalculates all the timesheet durations and warnings.protected LonginsertEventEntity(BOEventEntity eventEntity, PoolKit poolKit) Inserts theBOEventEntityin the repository.protected voidinsertTasks(TimesheetTaskUpdateInput input, Long user, Date startDate, Date endDate, PoolKit poolKit) protected booleanloadLinkedTasks(BOTask task, PoolKit poolKit) protected BOTaskLoads aBOTask.protected TimesheetloadTimesheet(TimesheetTaskUpdateInput input, PoolKit poolKit) Loads theTimesheet.protected BOTaskprepareTaskData(TimesheetTaskUpdateInput input, BOTask task, Long eventEntityId) Prepares the task data for the update.protected voidupdateEventEntity(BOEventEntity eventEntity, PoolKit poolKit) Updates theBOEventEntityin the repository.protected voidupdateTask(TimesheetTaskUpdateInput input, Timesheet timesheet, BOTask task, PoolKit poolKit) Updates theBOTask.protected LongupsertEventEntity(TimesheetTaskUpdateInput input, Timesheet timesheet, BOTask task, PoolKit poolKit) Insert or update theBOEventEntityrelated to the task.protected voidvalidateData(TimesheetTaskUpdateInput input, Timesheet timesheet, PoolKit poolKit) Validates the event's input data.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
-
Constructor Details
-
BTTimesheetTaskUpdate
public BTTimesheetTaskUpdate()
-
-
Method Details
-
execute
protected void execute(TimesheetTaskUpdateEvent event, PoolKit poolKit) throws DAException, DAValidateException Updates theBOTaskand recalculates all the timesheet durations and warnings.- Specified by:
executein classBTTimesheet<TimesheetTaskUpdateEvent>- Parameters:
event- the timesheet task update eventpoolKit- the pool kit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
loadTimesheet
protected Timesheet loadTimesheet(TimesheetTaskUpdateInput input, PoolKit poolKit) throws DAValidateException, DAException Loads theTimesheet.- Parameters:
input- the input of the eventpoolKit- the pool kit- Returns:
- the laoded
Timesheet - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
checkTimesheetState
Checks the timesheet state for this operation.- Parameters:
timesheet- the givenTimesheet- Throws:
DAValidateException
-
validateData
protected void validateData(TimesheetTaskUpdateInput input, Timesheet timesheet, PoolKit poolKit) throws DAValidateException, DAException Validates the event's input data.- Parameters:
input- the input of the eventtimesheet- the givenTimesheetpoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
loadTask
Loads aBOTask.- Parameters:
taskId- the task idpoolKit- the pool kit- Returns:
- the
BOTaskwith the given id - Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
isSameShift
protected boolean isSameShift(Timesheet timesheet, BOTask task, Date startDate, Date endDate, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
calculateTaskShifts
protected List<TimesheetShiftCalculationOutput> calculateTaskShifts(Timesheet timesheet, Date startDate, Date endDate, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
updateTask
protected void updateTask(TimesheetTaskUpdateInput input, Timesheet timesheet, BOTask task, PoolKit poolKit) throws DAValidateException, DAException Updates theBOTask.- Parameters:
input- the input of the eventtimesheet- the givenTimesheetpoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
upsertEventEntity
protected Long upsertEventEntity(TimesheetTaskUpdateInput input, Timesheet timesheet, BOTask task, PoolKit poolKit) throws DAValidateException, DAException Insert or update theBOEventEntityrelated to the task.- Parameters:
input- the input of the eventtimesheet- the givenTimesheetpoolKit- the pool kit- Returns:
- the event entity id
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
createEventEntity
Create a newBOEventEntitythat refers to an intervention.- Parameters:
intervention- the intervention id- Returns:
- the new event entity
-
insertEventEntity
protected Long insertEventEntity(BOEventEntity eventEntity, PoolKit poolKit) throws DAValidateException, DAException Inserts theBOEventEntityin the repository.- Parameters:
eventEntity- the given event entitypoolKit- the pool kit- Returns:
- the inserted event entity id
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
updateEventEntity
protected void updateEventEntity(BOEventEntity eventEntity, PoolKit poolKit) throws DAValidateException, DAException Updates theBOEventEntityin the repository.- Parameters:
eventEntity- the given event entitypoolKit- the pool kit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
prepareTaskData
Prepares the task data for the update.- Parameters:
input- the input of the event- Returns:
- the
BOTaskcontaining the new values for the update
-
calculateDuration
protected void calculateDuration(Timesheet timesheet, PoolKit poolKit) throws DAValidateException, DAException Calculates all the timesheet durations.- Parameters:
timesheet- the givenTimesheetpoolKit- the pool kit- Throws:
DAExceptionDAValidateException
-
calculateWarnings
protected void calculateWarnings(Timesheet timesheet, PoolKit poolKit) throws DAValidateException, DAException Calculates all the timesheet warnings.- Parameters:
timesheet- the givenTimesheetpoolKit- the pool kit- Throws:
DAExceptionDAValidateException
-
cancelLinkedTasks
protected void cancelLinkedTasks(PoolKit poolKit, List<BOTask> linkedTasks) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
loadLinkedTasks
protected List<BOTask> loadLinkedTasks(BOTask task, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-
insertTasks
protected void insertTasks(TimesheetTaskUpdateInput input, Long user, Date startDate, Date endDate, PoolKit poolKit) throws DAValidateException, DAException - Throws:
DAValidateExceptionDAException
-