Class BTLoanResourcePropertiesCopy
java.lang.Object
overit.geocall.bl.BusinessTask<ResourceNotificationEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidExecutionBusinessTask<ResourceNotificationEvent>
overit.geocallapp.utilities.core.bl.common.validexecution.ValidPermissionBusinessTask<ResourceNotificationEvent>
overit.geocallapp.wfm.resources.bl.resource.loan.task.BTLoanResourcePropertiesCopy
- All Implemented Interfaces:
Serializable,Tool,ValidExecution
@Event(ResourceNotificationEvent.class)
public class BTLoanResourcePropertiesCopy
extends ValidPermissionBusinessTask<ResourceNotificationEvent>
Business task that handles the copy of properties between a source
When the
BOResource and its associated loan resources. When the
ResourceNotificationEvent is launched the BT notices the call and:
- Verifies if the updated resource is a source resource (not a loan)
- If it is a source resource:
- Searches for all loan resources associated with this source
- For each loan resource found, copies general properties from the source while preserving loan-specific properties
- 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 voidcopyProperties(BOResource sourceResource, BOResource loanResource, PoolKit poolKit) Copies properties from a source resource to a loan resource, while preserving specific loan ones.protected voidexecute(ResourceNotificationEvent event, PoolKit poolKit) Aligns the properties from a source resource to all the related loan resources.booleanDetermines whether the current state is valid for execution.protected List<BOResource> searchLoanResources(BOResource resource, PoolKit poolKit) Searches for loan resources associated with the given source resource.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
-
BTLoanResourcePropertiesCopy
public BTLoanResourcePropertiesCopy()
-
-
Method Details
-
execute
protected void execute(ResourceNotificationEvent event, PoolKit poolKit) throws DAException, DAValidateException Aligns the properties from a source resource to all the related loan resources.- Specified by:
executein classValidExecutionBusinessTask<ResourceNotificationEvent>- Parameters:
event- theResourceNotificationEventpoolKit- thePoolKit- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
searchLoanResources
protected List<BOResource> searchLoanResources(BOResource resource, PoolKit poolKit) throws DAException, DAValidateException Searches for loan resources associated with the given source resource.- Parameters:
resource- the source resourcepoolKit- thePoolKit- Returns:
- a list of loan resources associated with the source resource
- Throws:
DAValidateException- the DA validate exceptionDAException- the DA exception
-
copyProperties
protected void copyProperties(BOResource sourceResource, BOResource loanResource, PoolKit poolKit) throws DAException, DAValidateException Copies properties from a source resource to a loan resource, while preserving specific loan ones. The method creates a merged resource that combines:- Most properties from the source resource (type, name, surname, etc.)
- Specific properties that must be preserved from the loan resource (password, color, etc.)
ResourceUpdateEvent.- Parameters:
sourceResource- the source resource from which to copy most propertiesloanResource- the loan resource to be updatedpoolKit- thePoolKit- 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
-