Class BTSchedulingResourceSave
java.lang.Object
overit.geocall.bl.BusinessTask<SchedulingResourceSaveEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<SchedulingResourceSaveEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<SchedulingResourceSaveEvent>
overit.geocallapp.wfm.core.bl.schedule.schedulingresource.task.BTSchedulingResourceSave
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(SchedulingResourceSaveEvent.class)
public class BTSchedulingResourceSave
extends ValidPermissionBusinessTask<SchedulingResourceSaveEvent>
Business task in order to save a
When the
SchedulingResource. When the
SchedulingResourceSaveEvent is launched the BT notices the
call and saves the SchedulingResource basing on the event's input.
Required fields:
- type
- name
- surname
- operation center
- serial number
- resource type
Permission:
Error Code:
Codes.C270_1125: Invalid value for propertyCodes.MODULE_NOT_ACTIVE: Module {0} is not active
- Since:
- 9.2
- 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 voidbody(SchedulingResourceSaveEvent event, PoolKit poolKit) Main execution method that validates before proceeding with business logic.protected voidcheckAddressOrigin(SchedulingResource schedulingResource, Long addressId, String description, boolean userAddress, PoolKit pk) Validates the address origin (existence, not a technical object address, resource or operation center address)protected voidexecute(SchedulingResourceSaveEvent event, PoolKit pk) Writes the saved scheduling resource id into the event journal.protected voidinsertResource(BOSchedulingUser user, PoolKit pk) Saves only theBOSchedulingUser.booleanDetermines whether the current state is valid for execution.protected voidnormalizeAddress(HashGetter addressData, PooledConnection conn) Normalizes the address.protected DBViewPrepares the operation center addresses for the scheduling resource, recalculating all related departure/arrival points.protected DBViewSaves the resource addresses performing a normalization and prepares aDBViewwhich contains all resource addresses data.protected voidSaves theSchedulingResource.protected voidvalidate(BOSchedulingUser user) Checks whether the user the timesheet profile is set and if the timesheet management is active.protected voidvalidateDepartureAndArrivalAddresses(DBView dbvResourceAddresses, DBView dbvOperationCenterAddresses) Validates departure and arrival addresses.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
getEventMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Field Details
-
schedulingResource
-
-
Constructor Details
-
BTSchedulingResourceSave
public BTSchedulingResourceSave()
-
-
Method Details
-
body
protected void body(SchedulingResourceSaveEvent event, PoolKit poolKit) throws DAException, DAValidateException Description copied from class:ValidExecutionBusinessTaskMain execution method that validates before proceeding with business logic. This method stores the input event and performs validation usingValidExecutionBusinessTask.checkValidExecution(). If validation passes, it delegates to theValidExecutionBusinessTask.execute(Object, PoolKit)method for actual business logic execution.- Overrides:
bodyin classValidExecutionBusinessTask<SchedulingResourceSaveEvent>- Parameters:
event- the input event to processpoolKit- thePoolKit- Throws:
DAException- if a data access error occurs during executionDAValidateException- if validation fails and exceptions are enabled
-
execute
protected void execute(SchedulingResourceSaveEvent event, PoolKit pk) throws DAException, DAValidateException Writes the saved scheduling resource id into the event journal.- Specified by:
executein classValidExecutionBusinessTask<SchedulingResourceSaveEvent>- Parameters:
event- theSchedulingResourceSaveEventpk- thePoolKit- Throws:
DAException- the DA exceptionDAValidateException- the DA validate 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
-
prepareResourceAddresses
Saves the resource addresses performing a normalization and prepares aDBViewwhich contains all resource addresses data.- Parameters:
pk- thePoolKit- Returns:
- the resource addresses
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
prepareOperationCenterAddresses
protected DBView prepareOperationCenterAddresses(PoolKit pk) throws DAException, DAValidateException Prepares the operation center addresses for the scheduling resource, recalculating all related departure/arrival points.- Parameters:
pk- thePoolKit- Returns:
- the operation center addresses
- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
normalizeAddress
protected void normalizeAddress(HashGetter addressData, PooledConnection conn) throws DAException, DAValidateException Normalizes the address.- Parameters:
addressData- the address dataconn- the connection- Throws:
DAException- the DA exceptionDAValidateException- the DA validate exception
-
insertResource
protected void insertResource(BOSchedulingUser user, PoolKit pk) throws DAValidateException, DAException Saves only theBOSchedulingUser. If the user is a new one an insertion in performed, otherwise the selected user is updated. When the resource is saved, its relations with the team and the warehouses are updated too.- Parameters:
user- the userpk- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
save
protected void save(DBView resourceAddresses, DBView ocAddress, PoolKit pk) throws DAValidateException, DAException Saves theSchedulingResource. TheBOSchedulingUseris updated with the new data, i.e. the resources addresses data and the operation center addresses data.- Parameters:
resourceAddresses- the resource addressesocAddress- the operation center addresspk- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
validateDepartureAndArrivalAddresses
protected void validateDepartureAndArrivalAddresses(DBView dbvResourceAddresses, DBView dbvOperationCenterAddresses) throws DAValidateException Validates departure and arrival addresses.- Parameters:
dbvResourceAddresses- the resource addressesdbvOperationCenterAddresses- the operation center addresses- Throws:
DAValidateException- the DA validate exception
-
checkAddressOrigin
protected void checkAddressOrigin(SchedulingResource schedulingResource, Long addressId, String description, boolean userAddress, PoolKit pk) throws DAValidateException, DAException Validates the address origin (existence, not a technical object address, resource or operation center address)- Parameters:
schedulingResource- the scheduling resourceaddressId- the address iddescription- the descriptionuserAddress- the user addresspk- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
validate
Checks whether the user the timesheet profile is set and if the timesheet management is active.- Parameters:
user- theBOSchedulingUser- Throws:
DAValidateException- the DA validate exception
-