Package net.pricefx.formulaengine
Interface PayoutRecordManager
-
public interface PayoutRecordManager
API that can be accessed via the 'payoutRecords' binding, only available in a RebateRecord calculation context (i.e. when calculating a RebateReocrd in a RebateRecordCalculation task). *Example groovy:
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] ) }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(String type, String name, Map<?,?>... attributeValues)
Add a previously non-existing PayoutRecord, identified by type & namevoid
addOrUpdate(String type, String name, Map<?,?>... attributeValues)
Convenience method, adding a PayoutRecord if one with the given type & name does not yest exist, and updating it otherwise.void
bulkLoadMode()
Switches to bulk-load mode, which is recommended when the volume of records to be added or updated exceeds 100k (in regular mode, 100k records are created in around 10min).int
delete(Filter... filters)
Delete PayoutRecords linked to the current RebateRecord, adhering to one or more optional Filter criteriaCollection<PayoutRecord>
find(Filter... filters)
Retreive PayoutRecords linked to the current RebateRecord, adhering to one or more optional Filter criteriavoid
flush()
To be called when all records have been created and/or updated.PayoutRecord
get(String type, String name)
Retreives the payout record, if any, with the given type and name, linked to the current RebateRecord.void
update(String type, String name, Map<?,?>... attributeValues)
Updates the existing PayoutRecord, if any, identified by the given type & name
-
-
-
Method Detail
-
get
PayoutRecord get(String type, String name)
Retreives the payout record, if any, with the given type and name, linked to the current RebateRecord.- Parameters:
type
-name
-- Returns:
- The payment record converted to its map representation
-
add
void add(String type, String name, Map<?,?>... attributeValues) throws PersistenceServiceException
Add a previously non-existing PayoutRecord, identified by type & name- Parameters:
type
- A free-text type for 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 for the record, unique withing the (RebateRecord,type) namespace.- Throws:
PersistenceServiceException
-
update
void update(String type, String name, Map<?,?>... attributeValues) throws PersistenceServiceException
Updates the existing PayoutRecord, if any, identified by the given type & name- Parameters:
type
-name
-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
Convenience method, adding a PayoutRecord if one with the given type & name does not yest exist, and updating it otherwise. Important note: in bulk-load mode, there is no advantage to be had from calling addOrUpdate because the bulk-load always performs an insert (for a new record) or replace (for an existing record), regardless of weather the record was added with add() or addOrUpdate().- Parameters:
type
-name
-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<PayoutRecord> find(Filter... filters)
Retreive PayoutRecords linked to the current RebateRecord, adhering to one or more optional Filter criteria- Parameters:
filters
-- Returns:
- Collection of PayoutRecords matching the above conditions, each in its map representation.
-
delete
int delete(Filter... filters)
Delete PayoutRecords linked to the current RebateRecord, adhering to one or more optional Filter criteria- Parameters:
filters
-- Returns:
- The number of actually deleted records
-
bulkLoadMode
void bulkLoadMode()
Switches to bulk-load mode, which is recommended 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 replaced in full, which is different to the regular node, where only the passed in 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.
-
-