Difference between revisions of "Accounting Model"
Luca.frosini (Talk | contribs) (→Single Usage Record) |
Luca.frosini (Talk | contribs) (→Single Usage Record) |
||
Line 23: | Line 23: | ||
=== Single Usage Record === | === Single Usage Record === | ||
− | Used to identify if an UsageRecord is referred to a single operation to account. | + | Used to identify if an ''UsageRecord'' is referred to a single operation to account. |
Common SingleUsageRecord fields: | Common SingleUsageRecord fields: |
Revision as of 11:19, 1 December 2015
The Accounting Model is based on the concept of Usage Record (UR).
Contents
Accounting Usage Records Hierarchy
Interfaces
Abstract Implementation
Interfaces
Usage Record
This is the very basic interface to respect for every Usage Record. It mainly define the generic access methods. In particular:
- Getter and Setter for basic fields;
- Generic Key-Value method both to set and retrieve a single value (key:String, value:Comparable<? extends Serializable>);
- Generic Map<String, Comparable<? extends Serializable>> to set all property at once.
Single Usage Record
Used to identify if an UsageRecord is referred to a single operation to account.
Common SingleUsageRecord fields:
- id
- consumerId
- creationTime
- scope
- operationResult
Fields derived from UsageRecord implementation type (internal use only):
- usageRecordType
Aggregated Usage Record
Used to identify if an UsageRecord is referred to the aggregation of one (degenerate case) or more UsageRecords becoming from different accounting operations.
This interface define additional methods which allow to retry information regarding
- how many SingleUsageRecords were aggregated
- the time interval related to the aggregated SingleUsageRecords
Common AggregatedUsageRecord fields:
- startTime
- endTime
- aggregated
- operationCount
Abstract Implementation
Basic Usage Record
This is an abstract class which implements the UsageRecord interface and moreover contains basic functionality to reduce the amount of time and lines of code to create a new type of Usage Records. It uses extensively decorators and
Even if is not strictly mandatory, the developers is strongly encouraged to inherits from this base class to create a new UsageRecord, so that he/she can take advance of validations and harmonization facility provided.