public abstract class StatelessPreRatingContext
extends java.lang.Object
A StatelessPreRatingContext handles possibly several StatelessRatingContext dedicated to different charges. That enables to manage a set of pending pre-ratings that are linked with different charges, even if we need to bind them together.
As an example, one StatelessPreRatingContext can be linked in the integration with one particular end user. Therefore, that enables to achieve post-rate calls related to this user, even if the post-rate caller doesn't know what charge code has been used at pre-rate time.
The rating record history does not take into account the modification of the (related stateless rating) context that could occur during the life of the context. That means that, while rating record history is not empty, values of parameters and translation instances should not be modified, in order to ensure all re-rating implied by a post-rate will use same data. Counters' values should not be modified either (except modification due to a rating), in order not to bend the history of counters' values. Modifications have no impact, so are allowed, when rating record history is empty. If modifications are needed even with not empty history, a specific integration may use workarounds:
This limitation implies also the incompatibility between stateless pre-rating
and stateless rating: since a StatelessRatingContext is embedded within a
StatelessPreRatingContext in order to use it for stateless pre-rating,
it should not be used concurrently for stateless rating.
However, if it is needs to rate on a StatelessRatingContext embedded into
a StatelessPreRatingContext without having pre-rate behaviour involved
(i.e. without the need to post rate later, not recording the event in
case of empty history), it's possible to call pre-rate with a 0 or negative
value for the argument postrateDeadline of
StatelessServiceClient.statelessPreRate(StatelessRatingEvent, String, StatelessPreRatingContext, Date, long, long, boolean, boolean).
This abstract class should not be extended by the developer. The only legal
way to get one instance of this class is to call newInstance()or
newInstance(String) static methods.
| Modifier and Type | Method and Description |
|---|---|
abstract StatelessRatingContext |
addStatelessRatingContext(StatelessRatingContext ratingContext,
java.lang.String chargeCode)
Adds in this StatelessPreRatingContext a StatelessRatingContext
dedicated to the given charge code.
|
abstract java.lang.String |
getChargeCode(long reservationUID)
Returns the charge code on which a pre-rate has been done with the
given reservation uid, or null if the reservation uid is unknown in
this StatelessPreRatingContext.
|
abstract java.util.List<java.lang.String> |
getChargeCodes()
Returns a list containing any charge code for which one
StatelessRatingContext is dedicated in this StatelessPreRatingContext.
|
abstract java.lang.String |
getContextID()
Returns the context ID.
|
abstract java.util.List<java.lang.Long> |
getNotResolvedReservationUID(java.util.Date date)
Returns the list of all reservationUID not yet resolved, ignoring those
expired at given date.
|
abstract StatelessRatingContext |
getStatelessRatingContext(java.lang.String chargeCode)
Returns the StatelessRatingContext dedicated to the given charge code.
|
abstract boolean |
isChargeRemovable(java.lang.String chargeCode)
Returns true if and only if the StatelessRatingContext dedicated to the
given charge code can be removed from this StatelessPreRatingContext
without losing any pending pre-rating (i.e.
|
abstract boolean |
isChargeRemovable(java.lang.String chargeCode,
java.util.Date expirationDate)
Returns true if and only if the StatelessRatingContext dedicated to the
given charge code can be removed from this StatelessPreRatingContext
without losing any pending pre-rating (i.e.
|
abstract boolean |
isRemovable()
Returns true if and only if there are no more pending pre-rating related
to this StatelessPreRatingContext.
|
abstract boolean |
isRemovable(java.util.Date expirationDate)
Returns true if and only if there are no more pending pre-rating related
to this StatelessPreRatingContext.
|
static StatelessPreRatingContext |
newInstance()
Creates a newly allocated StatelessPreRatingContext object.
|
static StatelessPreRatingContext |
newInstance(java.lang.String contextID)
Creates a newly allocated StatelessPreRatingContext object.
|
abstract StatelessRatingContext |
removeStatelessRatingContext(java.lang.String chargeCode)
Removes from this StatelessPreRatingContext the StatelessRatingContext
dedicated to the given charge code.
|
abstract void |
setContextID(java.lang.String contextID)
Sets the context ID.
|
public static final StatelessPreRatingContext newInstance()
public static final StatelessPreRatingContext newInstance(java.lang.String contextID)
contextID - the context ID for the created context.public abstract void setContextID(java.lang.String contextID)
contextID - the context ID.public abstract java.lang.String getContextID()
setContextID(String)public abstract StatelessRatingContext addStatelessRatingContext(StatelessRatingContext ratingContext, java.lang.String chargeCode)
ratingContext - a StatelessRatingContextchargeCode - the charge code for which the ratingContext will be
dedicatedStatelessServiceClient.statelessPreRate(StatelessRatingEvent,
String, StatelessPreRatingContext, Date, long, long, boolean,
boolean)public abstract StatelessRatingContext removeStatelessRatingContext(java.lang.String chargeCode)
chargeCode - a charge code.public abstract StatelessRatingContext getStatelessRatingContext(java.lang.String chargeCode)
chargeCode - the charge codepublic abstract java.lang.String getChargeCode(long reservationUID)
reservationUID - public abstract java.util.List<java.lang.Long> getNotResolvedReservationUID(java.util.Date date)
date - the date to compare to expirationLongpublic abstract java.util.List<java.lang.String> getChargeCodes()
Stringpublic abstract boolean isChargeRemovable(java.lang.String chargeCode,
java.util.Date expirationDate)
chargeCode - the charge codeexpirationDate - the date used to take into account not expired pending pre-rating.removeStatelessRatingContext(String)with the given
charge code as argument.public abstract boolean isChargeRemovable(java.lang.String chargeCode)
isChargeRemovable(chargeCode, null)chargeCode - the charge coderemoveStatelessRatingContext(String)with the given
charge code as argument.public abstract boolean isRemovable(java.util.Date expirationDate)
expirationDate - the date used to take into account not expired pending pre-rating.public abstract boolean isRemovable()
isRemovable(null)