Class BTLoanResourcePropertiesCopy

All Implemented Interfaces:
Serializable, Tool, ValidExecution

Business task that handles the copy of properties between a source 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
This process ensures that loan resources maintain up-to-date properties from their source resource while preserving their unique loan-specific ones.
Since:
18.0
See Also:
GCApi:
task
  • 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:
      execute in class ValidExecutionBusinessTask<ResourceNotificationEvent>
      Parameters:
      event - the ResourceNotificationEvent
      poolKit - the PoolKit
      Throws:
      DAValidateException - the DA validate exception
      DAException - 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 resource
      poolKit - the PoolKit
      Returns:
      a list of loan resources associated with the source resource
      Throws:
      DAValidateException - the DA validate exception
      DAException - 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.)
      These specific properties are preserved (not overwritten with source resource data) because they contain loan-specific configurations. After merging the properties, the method updates the loan resource through a ResourceUpdateEvent.
      Parameters:
      sourceResource - the source resource from which to copy most properties
      loanResource - the loan resource to be updated
      poolKit - the PoolKit
      Throws:
      DAValidateException - the DA validate exception
      DAException - the DA exception
    • isValidExecution

      public boolean isValidExecution()
      Description copied from interface: ValidExecution
      Determines whether the current state is valid for execution.
      Returns:
      true if execution is valid, false otherwise