Class RatingSessionModel

java.lang.Object
com.highdeal.bart.hci.RatingSessionModel
All Implemented Interfaces:
XMLMarshallable

public class RatingSessionModel extends Object implements XMLMarshallable
The rating session model is the main class of the rating process.

Basically, the rating process selects CDRs (CDRModel) and sends them to the SAP Convergent Charging rating engine using batch service.

The rating process is launch using the RunRatingSessionOp operation. On client side User should define the following parameters:
  • The max consumption: selected CDRs will have a consumption date before this max consumption date.
  • The batch rating group ID: a rating session is performed on only one batch rating group ID. You can't run two rating session on the same batch rating group ID.
  • The description: A user define description.
  • The mode: described below.
With all modes, CDRs are rated in the order of their consumption date. Those mode can be divided into two types:

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="rating">
   <xs:complexType>
     <xs:attribute name="sessionID" type="xs:string"/>
     <xs:attribute name="batchRatingGroupId" type="xs:string"/>
     <xs:attribute name="subscriptionID" type="xs:string"/>
     <xs:attribute name="startDate" type="xs:dateTime"/>
     <xs:attribute name="duration" type="xs:string"/>
     <xs:attribute name="mode" type="RatingSessionModeType"/>
     <xs:attribute name="maxConsumptionDate" type="xs:dateTime"/>
     <xs:attribute name="nbCDRRated" type="xs:string"/>
     <xs:attribute name="nbCDRError" type="xs:string"/>
     <xs:attribute name="description" type="xs:string"/>
     <xs:attribute name="status" type="RatingSessionStatusType"/>
   </xs:complexType>
 </xs:element>
<xs:simpleType name="RatingSessionStatusType">
   <xs:restriction  base="xs:string">
     <xs:enumeration value="inProgress"/>
     <xs:enumeration value="ended"/>
     <xs:enumeration value="stopped"/>
     <xs:enumeration value="cleaned"/>
   </xs:restriction>
 </xs:simpleType>
<xs:simpleType name="RatingSessionModeType">
   <xs:restriction base="xs:string">
     <xs:enumeration value="subscription-firstFail"/>
     <xs:enumeration value="subscription-most"/>
     <xs:enumeration value="subscription-try"/>
     <xs:enumeration value="subscription-windowed-firstFail"/>
     <xs:enumeration value="subscription-windowed-most"/>
     <xs:enumeration value="subscription-windowed-try"/>
     <xs:enumeration value="day-most"/>
     <xs:enumeration value="day-subscription-firstFail"/>
     <xs:enumeration value="azimut"/> <!-- deprecated -->
   </xs:restriction>
 </xs:simpleType>

  • Field Details

    • TAG_NAME

      public static final String TAG_NAME
      See Also:
    • IN_PROGRESS_STATUS

      public static final int IN_PROGRESS_STATUS
      This status indicates that the rating session is running.
      See Also:
    • ENDED_STATUS

      public static final int ENDED_STATUS
      This status indicates that the rating session is ended.
      See Also:
    • STOPPED_STATUS

      public static final int STOPPED_STATUS
      This status indicates that the rating session has been stopped manually.
      See Also:
    • CLEANED_STATUS

      public static final int CLEANED_STATUS
      This status indicates that the rating session has been badly stopped and cleaned at the server restart.
      See Also:
    • SELECTING_SUBS_STATUS

      public static final int SELECTING_SUBS_STATUS
      This status indicates that the rating session is running and selecting the subscriptions.
      See Also:
    • RATING_CDRS_STATUS

      public static final int RATING_CDRS_STATUS
      This status indicates that the rating session is running and rating the selected subscriptions.
      See Also:
  • Constructor Details

    • RatingSessionModel

      public RatingSessionModel()
      Builds an empty rating session model
    • RatingSessionModel

      public RatingSessionModel(Integer batchRatingGroupId, Date maxConsumptionDate, String description, RatingSessionModel.Mode mode)
      Build a rating session with batch rating group Id, max consumption date and description.
    • RatingSessionModel

      public RatingSessionModel(Long OID, Integer batchRatingGroupId, Date startDate, Long duration, RatingSessionModel.Mode mode, Date maxConsumptionDate, Long nbCDRRated, Long nbCDRError, String description, int status)
      Build a rating session with full information. This constructor is reserved for internal use.
    • RatingSessionModel

      public RatingSessionModel(Long OID, Integer batchRatingGroupId, Long cdrSubscriptionID, Date startDate, Long duration, RatingSessionModel.Mode mode, Date maxConsumptionDate, Long nbCDRRated, Long nbCDRError, String description, int status)
      Build a rating session with full information. This constructor is reserved for internal use.
  • Method Details

    • getDuration

      public Long getDuration()
      Gets the rating session duration.
      Returns:
      the rating session duration.
    • _setDuration

      public void _setDuration(Long d)
      Sets the rating session duration.
      Parameters:
      d - the duration
    • getNbCDRRated

      public Long getNbCDRRated()
      Gets the number of rated CDRs.
      Returns:
      the number of rated CDRs.
    • _setNbCDRRated

      public void _setNbCDRRated(Long nbRated)
      Sets the number of rated CDRs
      Parameters:
      nbRated - the number of rated CDRs
    • getNbCDRError

      public Long getNbCDRError()
      Gets the number of erroneous CDRs.
      Returns:
      the number of erroneous CDRs.
    • _setNbCDRError

      public void _setNbCDRError(Long nbError)
      Sets the number of erroneous CDRs.
      Parameters:
      nbError - the number of erroneous CDRs
    • _getOID

      public Long _getOID()
      Gets the identifier of the rating session.
      Returns:
      the identifier of the rating session.
    • _setOID

      public void _setOID(Long oid)
      Sets the identifier of the rating session.
      Parameters:
      oid - the identifier
    • getDescription

      public String getDescription()
      Gets the description of the rating session.
      Returns:
      the description of the rating session.
    • setDescription

      public void setDescription(String description)
      Sets the description of the rating session.
      Parameters:
      description - the description
    • getStartDate

      public Date getStartDate()
      Gets the start date of the rating session.
      Returns:
      the start of the rating session.
    • _setStartDate

      public void _setStartDate(Date sd)
      Sets the start date of the rating session.
      Parameters:
      sd - the start date
    • getMaxConsumptionDate

      public Date getMaxConsumptionDate()
      Gets the max consumption date of the rating session.
      Returns:
      the max consumption date of the rating session.
    • setMaxConsumptionDate

      public void setMaxConsumptionDate(Date consumptionDate)
      Sets the max consumption of the rating session.
      Parameters:
      consumptionDate - the max consumption date
    • getMode

      public RatingSessionModel.Mode getMode()
      Gets the mode of the rating session.
      Returns:
      the mode of the rating session.
    • setMode

      public void setMode(RatingSessionModel.Mode mode)
      Sets the mode of the rating session.
      Parameters:
      mode - the mode of the rating session
    • getStatus

      public int getStatus()
      Gets the status of the rating session.
      Returns:
      the status of the rating session.
    • _setStatus

      public void _setStatus(int statusType)
      Sets the status of the rating session. This should be reserved for internal use.
      Parameters:
      statusType - the new status
    • getBatchRatingGroupId

      public Integer getBatchRatingGroupId()
      Gets the batch rating group identifier of the rating session.
      Returns:
      the batch rating group identifier.
    • setBatchRatingGroupId

      public void setBatchRatingGroupId(Integer batchRatingGroupId)
      Sets the batch rating group identifier of the rating session.
      Parameters:
      batchRatingGroupId - the batch rating group identifier
    • getCDRSubscriptionID

      public Long getCDRSubscriptionID()
      Gets the CDR subscription Id.
      Returns:
      the CDR subscription Id.
    • setCDRSubscriptionID

      public void setCDRSubscriptionID(Long subscriptionID)
      Sets the CDR subscription Id.
      Parameters:
      subscriptionID - the subscription Id
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setAttributes

      public void setAttributes(XMLAttributes atts)
      Description copied from interface: XMLMarshallable
      Sets the attributes of the XML representation of the element being processed.
      Specified by:
      setAttributes in interface XMLMarshallable
      Parameters:
      atts - The XML attributes of the current element
    • addChild

      public void addChild(String tagName, XMLMarshallable child)
      Description copied from interface: XMLMarshallable
      Adds a child to the object, the child representing the marshallable object which must be added to the element.
      Specified by:
      addChild in interface XMLMarshallable
      Parameters:
      tagName - The name of tag for the child
      child - The child to be added
    • addCharacterData

      public void addCharacterData(String cData)
      Description copied from interface: XMLMarshallable
      Adds character data to the content element.
      Specified by:
      addCharacterData in interface XMLMarshallable
      Parameters:
      cData - The character data to be added
    • marshal

      public void marshal(XMLOutputter output)
      Description copied from interface: XMLMarshallable
      Gives an XML representation of this object, including its children.
      Specified by:
      marshal in interface XMLMarshallable
      Parameters:
      output - The XML output to marshal the object into
    • innerMarshall

      public void innerMarshall(XMLOutputter output)
      This method is used by subclasses only.
    • getStatusStringRepresentation

      public String getStatusStringRepresentation()
      Return a String representation of rating mode
      Returns:
      a String representation of rating mode