Interface PayoutRecordManager


public interface PayoutRecordManager
API that can be accessed via the 'payoutRecords' binding (available in the RebateRecord calculation context — i.e., when calculating a RebateRecord in a RebateRecordCalculation task), or via the 'accrualRecords' binding (available in the CompensationRecord calculation context).

Example (payoutRecords):


 def rr = rebateRecords.get("Q1")               // api.currentItem()
 for (def i=0; i < 100000; i++) {
                payoutRecords.add("Accrual", "Q1-"+i, [attribute1: rr?.attribute1, attribute2: rr?.attribute2, attribute3: rr?.attribute3] )
                payoutRecords.add("Summary", "Q1-"+i, [attribute1: rr?.attribute1, attribute2: rr?.attribute2, attribute3: rr?.attribute3] )
 }
 
Payment records managed through this API are always associated with the current RebateRecord.

Example (accrualRecords):


          if (api.isInputGenerationExecution()) return

          def cor = api.currentItem()
          def compensationId = cor?.uniqueName
          def compensationRecordId = cor?.sourceId

          accrualRecords.add("Accrual", compensationId+"-"+compensationRecordId, [attribute1: "A"] )
          accrualRecords.add("Summary", compensationId+"-"+compensationRecordId)
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(String type, String name, Map<?,?>... attributeValues)
    Adds a new PayoutRecord or AccrualRecord, specified by the type and name.
    void
    addOrUpdate(String type, String name, Map<?,?>... attributeValues)
    The convenience method, adds a PayoutRecord/AccrualRecord if no record with the given type and name exists.
    void
    Switches to the bulk-load mode.
    int
    delete(Filter... filters)
    Deletes PayoutRecords/AccrualRecords linked to the current RebateRecord/CompensationRecord that match one or more optional Filter criteria.
    Collection<CompensationAgreementPayoutRecord>
    find(Filter... filters)
    Retrieves PayoutRecords or AccrualRecords linked to the current RebateRecord/CompensationRecord that match one or more optional Filter criteria.
    void
    To be called when all records have been created and/or updated.
    CompensationAgreementPayoutRecord
    get(String type, String name)
    Retrieves the existing payout or accrual record with the given type and name, linked to the current RebateRecord/CompensationRecord.
    void
    update(String type, String name, Map<?,?>... attributeValues)
    Updates the existing PayoutRecord or AccrualRecord (if any) specified by the given type and name.
  • Method Details

    • get

      CompensationAgreementPayoutRecord get(String type, String name)
      Retrieves the existing payout or accrual record with the given type and name, linked to the current RebateRecord/CompensationRecord.
      Parameters:
      type - The type of the record.
      name - The name of the record.
      Returns:
      The payout or accrual record converted to its map representation.
    • add

      void add(String type, String name, Map<?,?>... attributeValues) throws PersistenceServiceException
      Adds a new PayoutRecord or AccrualRecord, specified by the type and name.
      Parameters:
      type - A free-text type of the record. While it can be freely set, the usual patterns is that there are few different payment record types.
      name - A free-text name of the record. Unique within the (RebateRecord/CompensationRecord,type) namespace.
      Throws:
      PersistenceServiceException
    • update

      void update(String type, String name, Map<?,?>... attributeValues) throws PersistenceServiceException
      Updates the existing PayoutRecord or AccrualRecord (if any) specified by the given type and name.
      Parameters:
      type - A free-text type of the record. While it can be freely set, the usual patterns is that there are few different payment record types.
      name - A free-text name of the record you want to update.
      attributeValues - Attribute to value map (ex. {attribute1: "ABC", ...}). If an attribute is to be set to null, it needs to be included in the map as such.
      Throws:
      PersistenceServiceException - When a PayoutRecord.attribute cannot be set to the given value
    • addOrUpdate

      void addOrUpdate(String type, String name, Map<?,?>... attributeValues) throws PersistenceServiceException
      The convenience method, adds a PayoutRecord/AccrualRecord if no record with the given type and name exists. Performs an update if the record with the given type and name already exists. Important note: in the bulk-load mode, there is no advantage from calling the addOrUpdate method because the bulk-load always performs an insert (for a new record) or replace (for an existing record), regardless of whether the record was added with add() or addOrUpdate().
      Parameters:
      type - A free-text type of the record. While it can be freely set, the usual patterns is that there are few different payment record types.
      name - A free-text name of the record.
      attributeValues - Attribute to value map (ex. {attribute1: "ABC", ...}). If an attribute is to be set to null, it needs to be included in the map as such.
      Throws:
      PersistenceServiceException - When a PayoutRecord.attribute cannot be set to the given value
    • find

      Collection<CompensationAgreementPayoutRecord> find(Filter... filters)
      Retrieves PayoutRecords or AccrualRecords linked to the current RebateRecord/CompensationRecord that match one or more optional Filter criteria.
      Parameters:
      filters -
      Returns:
      Collection of PayoutRecords/AccrualRecords matching the above conditions, each in its map representation.
    • delete

      int delete(Filter... filters)
      Deletes PayoutRecords/AccrualRecords linked to the current RebateRecord/CompensationRecord that match one or more optional Filter criteria.
      Parameters:
      filters -
      Returns:
      The number of actually deleted records.
    • bulkLoadMode

      void bulkLoadMode()
      Switches to the bulk-load mode. It is recommended to use the bulk-load mode when the volume of records to be added or updated exceeds 100k (in regular mode, 100k records are created in around 10min).
      Important note: When existing records are bulk-loaded, the original records are fully overwritten. This is different from the regular mode where only the specified attributes/value pairs are updated.
    • flush

      void flush()
      To be called when all records have been created and/or updated. If skipped the more recent additions and updates will not be persisted in the database.