Arena  1.0
A content management system
 All Classes Files Functions Variables Pages
Plugins.DataSource.DataLists.ADataList Class Reference

A list of data retrieved from a database. More...

+ Inheritance diagram for Plugins.DataSource.DataLists.ADataList:

Public Member Functions

def __init__
 Construct a new data list instance. More...
 
def init
 Initialize a new data list instance. More...
 
def fetch
 Fetch the list from the data source. More...
 
def append
 Append the specified item to the list. More...
 
def remove
 Remove the specified item from the list. More...
 
def toString
 Construct a string representation of the list. More...
 
def DataSource
 Retrieve the data source used by the list. More...
 
def item
 Retrieve the specified value from the list. More...
 
def items
 Retrieve the dictionary object used to store column values and primary keys. More...
 
def __getitem__
 Obtain the specified value from the list. More...
 
def __setitem__
 Set the value of the specified item. More...
 
def __delitem__
 Delete the specified item from the list. More...
 
def keys
 Retrieve the list of keys in use by the list. More...
 
def __contains__
 
- Public Member Functions inherited from Library.Base.Events.ALoggingEventfulObject
def __init__
 Constructor. More...
 
def init
 Initializer.
 
def error
 Generate an error event. More...
 
def log
 Log the specified item. More...
 
def Log
 Retrieve the log used by the class.
 
- Public Member Functions inherited from Library.Base.Events.AnEventfulObject
def __init__
 Constructor. More...
 
def init
 Initializer.
 
def __del__
 Destructor.
 
def parseParams
 Parse the specified parameters, looking for named events and setting event handlers as appropriate. More...
 
def generate
 Generate the named event.
 
def update
 Update the events generated by the object.
 
def error
 Generate an error event. More...
 
def toString
 Construct a string representation of the object. More...
 
def on
 Set the handler for the specified event. More...
 
def onMultiple
 Set handlers for multiple events. More...
 
def handlerFor
 Retrieve the handler for the specified event. More...
 
def generates
 Determine whether or not the object generates the named event. More...
 
def __getitem__
 Retrieve the value of the named property.
 
def __setitem__
 Set the value of the named property.
 
- Public Member Functions inherited from Library.Base.Classwork.AnObject
def init
 Initialize a new object instance. More...
 
def __init__
 Construct and initialize a new instance of AnObject. More...
 
def __del__
 Destroy the object instance. More...
 
def displayName
 Construct a "pretty" display name for the class instance, based on the name of its class. More...
 
def implements
 Determine whether the class instance is related to the specified class. More...
 
def toString
 Return a string representation of the class, suitable for output to a console or text-based device. More...
 
def __str__
 Return a string representation of the class. More...
 
def classname
 Return the name of the class from which the instance was created. More...
 
def name
 Return the name of the class. More...
 
- Public Member Functions inherited from Library.String.Utilities.IsPrintable
def toString
 Return a string representation of the class conveniently. More...
 
def __str__
 Return a string representation of the class. More...
 
def printTo
 Print a string representation of the class to the specified stream. More...
 

Detailed Description

A list of data retrieved from a database.

This class is used to organize and maintain a list of values that is retrieved from a database. The method of obtaining the list is left up to descendant classes, but it will generally represent a single column retrieved by means of a query. As such, this class stores the column values as keys within the list and the primary key for each row that contains the column value is stored as a subordinate value to that key. In this way, the list can be searched for a specific value (using Python's 'in' operator) while making updates to the source easy, since the primary key of each value is associated with the value.

This class is meant to be overridden by descendant classes which provide more specific functionality (such as the ability to actually retrieve the list from a database). This class should not be directly instantiated.

Constructor & Destructor Documentation

def Plugins.DataSource.DataLists.ADataList.__init__ (   Self,
  params 
)

Construct a new data list instance.

In addition to the parameters expected by ALoggingEventfulObject.__init__(), this routine expects that params will contain the following items:

  • DataSource – The data source from which the list will operate.

Member Function Documentation

def Plugins.DataSource.DataLists.ADataList.__delitem__ (   Self,
  key 
)

Delete the specified item from the list.

This routine is defined for convenience, so that ADataList and its descendants can be used as though they were Python dictionary objects.

This method simply calls ADataList.remove().

def Plugins.DataSource.DataLists.ADataList.__getitem__ (   Self,
  key 
)

Obtain the specified value from the list.

This routine is defined for convenience, so that ADataList and its descendants can be used as though they were Python dictionary objects.

If key is not found, a KeyError exception is raised by this routine.

def Plugins.DataSource.DataLists.ADataList.__setitem__ (   Self,
  key,
  value 
)

Set the value of the specified item.

This routine is defined for convenience, so that ADataList and its descendants can be used as though they were Python dictionary objects.

Note that, unlike a Python dictionary object, new items cannot be added to the list by this method; that must be done through a call to ADataList.append().

def Plugins.DataSource.DataLists.ADataList.append (   Self,
  item 
)

Append the specified item to the list.

This method should be implemented by descendant classes which will, among other things, update the list as it is stored in the data source. An integer value should be returned to indicate whether or not the item was successfully added to the list.

This method generates the append event.

Returns
A return value of zero (0) indicates that the item was successfully appended to the list; any other value indicates an error of some kind occurred. The meaning of such a return value is left to descendant classes to define.
def Plugins.DataSource.DataLists.ADataList.DataSource (   Self)

Retrieve the data source used by the list.

This will be the class instance that represents the database or other data source from which the values in the list were retrieved.

def Plugins.DataSource.DataLists.ADataList.fetch (   Self)

Fetch the list from the data source.

This method should be implemented by descendant classes. It should return an integer value that indicates how many values were successfully retrieved from the data source.

This method generates the fetch event.

Returns
A return value of less than zero (0) indicates a failure of some kind. A return value of zero may not mean that an error has occurred; only that data matching the query was not found. The meaning of return values less than zero is left to descendant classes to define.
def Plugins.DataSource.DataLists.ADataList.init (   Self)

Initialize a new data list instance.

The routine sets the value of ADataList.delimiter to that specified by #dlDefaultItemsDelimiter. This delimiter will be used to separate values when the list is converted to a string by a call to ADataList.toString().

def Plugins.DataSource.DataLists.ADataList.item (   Self,
  key 
)

Retrieve the specified value from the list.

Remember that ADataList and its descendants represent a column of data, not an individual record. The values of that column are stored internally as keys in a dictionary, while the primary key of each column is stored as a subordinate value associated with that key.

def Plugins.DataSource.DataLists.ADataList.items (   Self)

Retrieve the dictionary object used to store column values and primary keys.

def Plugins.DataSource.DataLists.ADataList.keys (   Self)

Retrieve the list of keys in use by the list.

Remember that ADataList and its descendants store a column of data rather than an individual record. The values in the column are stored internally as keys within a Python dictionary, while the primary key associated with each value is stored as a subordinate value to that key. This method returns the list of values in the column, separated from their primary keys and any other information which the data list might store about them.

This method is provided for convenience, so that ADataList and its descendants can be used as though they were Python dictionary objects.

def Plugins.DataSource.DataLists.ADataList.remove (   Self,
  item 
)

Remove the specified item from the list.

This method should be implemented by descendant classes which will, among other things, remove the specified item from the data source. An integer value should be returned to indicate whether or not the removal succeeded.

This method generates the remove event.

Returns
A return value of zero (0) indicates that the item was removed successfully from the list; any other value indicates an error of some kind occurred. The meaning of a such a return value is left to descendant classes to define.
def Plugins.DataSource.DataLists.ADataList.toString (   Self)

Construct a string representation of the list.

This method calls String.implode() to condense the items in the list into a string of delimited values. If the list is empty, an empty string will be returned.


The documentation for this class was generated from the following file: