it.dtt.ca.history
Class History

java.lang.Object
  extended by it.dtt.ca.history.History

public class History
extends java.lang.Object

Container class used to keep an history of items of various kind.

Histories will depend upon the current user.

The current user is defined and retrieved using the org.dvb.user.GeneralPreference("UserName", String userName).

The user name is stored by:

  • GeneralPreference myPref = new GeneralPreference("UserName", "John Doe");
  • UserPreferenceManager.getInstance().write(myPref);

    And can be read by:

  • GeneralPreference myPref = new GeneralPreference("UserName").
  • UserPreferenceManager.getInstance().read(myPref);
  • String myUserName = myPref.getMostFavourite();


    Field Summary
    static int MESSAGE_HISTORY
              Identifies a history of messages from the broadcaster
    static int PPV_HISTORY
              Identifies an history collecting bought packages.
    static int RECHARGE_HISTORY
              Identifies an history of card recharges
     
    Constructor Summary
    History(int type)
              Create an History object.
     
    Method Summary
     int getHistoryLength()
              Returns the length of the history items.
     int getHistoryType()
              Identifies the type of history carried within the specific object
     HistoryItem getItem(int index)
              Retrieves a History Item at the specified index.
     HistoryItem[] getItems()
              Retrieves all items collected in this history object.
     void setItems(HistoryItem[] items)
              Sets an array of HistoryItem within an History instance.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    PPV_HISTORY

    public static final int PPV_HISTORY
    Identifies an history collecting bought packages.

    See Also:
    Constant Field Values

    RECHARGE_HISTORY

    public static final int RECHARGE_HISTORY
    Identifies an history of card recharges

    See Also:
    Constant Field Values

    MESSAGE_HISTORY

    public static final int MESSAGE_HISTORY
    Identifies a history of messages from the broadcaster

    See Also:
    Constant Field Values
    Constructor Detail

    History

    public History(int type)
    Create an History object.

    Parameters:
    type - the type of history to create.
    Method Detail

    getHistoryType

    public int getHistoryType()
    Identifies the type of history carried within the specific object

    Returns:
    history type

    getItems

    public HistoryItem[] getItems()
    Retrieves all items collected in this history object. All the items returned shall be of the appropriate sub-class of HistoryItem for the type of this History instance

    Returns:
    an array of history items

    getHistoryLength

    public int getHistoryLength()
    Returns the length of the history items.

    Returns:
    history length

    getItem

    public HistoryItem getItem(int index)
    Retrieves a History Item at the specified index. The index is zero based.

    Returns:
    a history item

    setItems

    public void setItems(HistoryItem[] items)
                  throws java.lang.IllegalArgumentException,
                         java.lang.NullPointerException
    Sets an array of HistoryItem within an History instance. If the Conditional Access allows changing permanently the history, then calling this method with an empty array will clear the history. Calling the method with a null parameter will throw a NullPointerException

    Parameters:
    items - The items to set.
    Throws:
    java.lang.IllegalArgumentException - if any of the items in the array are not of the appropriate sub-class of HistoryItem for the type of this History instance
    java.lang.NullPointerException