Package gnue :: Package appserver :: Module geasSession :: Class geasSession
[show private | hide private]

Class geasSession


Method Summary
  __init__(self, connections, authAdapter, sm, params)
  call(self, classname, obj_id_list, procedurename, parameters)
Call a procedure of a given class on a sequence of gnue_id's.
  commit(self)
This function commit the currently running transaction.
  delete(self, classname, obj_id_list)
Delete objects of a given class.
  load(self, classname, obj_id_list, propertylist)
Load data or datatypes of a given class from the database backend.
  request(self, classname, conditions, sortorder, propertylist)
Create a new list instance containing all items of a given class matching the requested conditions.
  rollback(self)
Rollback the active transaction.
  store(self, classname, obj_id_list, propertylist, data)
Store data for a given class in the backend database.
  __addConditionToContent(self, classdef, content, tree)
This function adds all GCField instances in a condition tree to the given content dictionary.
  __cancelOperation(self)
  __confirmOperation(self)
  __convertCondition(self, classdef, condition, contentdict)
  __dbHandlesTree(self, tree, classdef)
This function traverses the given condition tree and determines if it can be handled by the datasource completely.
  __filterCondition(self, classdef)
  __filterValue(self, filterId)
  __findInstance(self, classdef, object_id, propertylist)
  __getClassdef(self, classname)
  __getFieldname(self, classdef, propertyname, contentdict, add, skipCalculated)
  __getProcdef(self, classdef, procedurename)
  __getPropertyDef(self, propertyname, classdef)
This function gets the property definition for a given propertyname, resolving references.
  __getSortElement(self, item)
This function converts the given sortelement to a properly defined sort-item-dictionary.
  __newInstance(self, classdef)
  __splitCondition(self, condition, classdef)
This function splits up a given condition into a condition which is handled by the datasource, and another one which has to be processed by appserver.
  __splitIntoAnd(self, tree, forest)
This function splits a condition tree into several independant subtrees which can be re-combined via AND.
  __startOperation(self, operation)
  __usable(self, element, classdef)
  _destroy(self)
  _start(self, user, password)

Class Variable Summary
int _MAX_CYCLES = 50                                                                    

Method Details

__init__(self, connections, authAdapter, sm, params)
(Constructor)

call(self, classname, obj_id_list, procedurename, parameters)

Call a procedure of a given class on a sequence of gnue_id's.
Parameters:
classname - name of the class
obj_id_list - sequence of gnue_id's representing the objects to call the procedure for
procedurename - name of the procedure to call
parameters - dictionary of parameters to pass to each call
Returns:
sequence of sequences with the procedure-results one per gnue_id

commit(self)

This function commit the currently running transaction. But before the backend will be requested to do so, all dirty instances are validated.

delete(self, classname, obj_id_list)

Delete objects of a given class. A single call of this function is treated as an atomic operation. If on delete fails, all previous deletes will be revoked.
Parameters:
classname - name of the class to delete objects from
obj_id_list - sequence of gnue_id's representing the objects to delete

load(self, classname, obj_id_list, propertylist)

Load data or datatypes of a given class from the database backend.
Parameters:
classname - name of the class to retrieve data for
obj_id_list - sequence of gnue_id's to fetch data for. If such a gnue_id is None the datatypes of the properties will be fetched instead of the data values.
propertylist - sequence of propertynames to fetch data or datatypes for.
Returns:
sequence of sequences holding the result-values (one per gnue_id)

request(self, classname, conditions, sortorder, propertylist)

Create a new list instance containing all items of a given class matching the requested conditions. The elements are sorted according to the given sortorder and preloaded with the given properties.
Parameters:
classname - name of the class to fetch items from
conditions - a condition (list, dictionary, GConditionTree, ...) acceptable to GCondition.buildCondition to filter items
sortorder -

list of sort-instructions to build the resulting list. Such a sort-instruction could be a string, a tuple, a list or a dictionary. A sort item consists of three parts: propertyname, sort-direction and case-sensitiveness.

string : propertyname tuple, list: (propertyname, descending, ignorecase) dictionary : {'name': ..., 'descending': ..., 'ignorecase': ...}

A sort item must not be completeley defined. If an element is omitted, the following defaults apply: descending = False, ignorecase = False
propertylist - sequence of properties to fetch for each item in the resulting list. Such propertynames could also be reference properties like 'x_foo.y_bar'. In this case the needed join would be added automatically.
Returns:
geasList.geasList instance

rollback(self)

Rollback the active transaction.

store(self, classname, obj_id_list, propertylist, data)

Store data for a given class in the backend database. All changes within a single call of this function are treated as an atomic operation. The update stamps (gnue_create*, gnue_modify*) will be updated automatically if needed.
Parameters:
classname - name of the class to store data for
obj_id_list - sequence of gnue_id's representing the objects to store data for. A gnue_id of None represents a new object. In this case a new gnue_id will be generated.
propertylist - sequence of the properties to store data for
data - sequence of sequences with the actual data values, one sequence per object-id. Order of propertylist and data-sequence must match.

__addConditionToContent(self, classdef, content, tree)

This function adds all GCField instances in a condition tree to the given content dictionary.

__cancelOperation(self)

__confirmOperation(self)

__convertCondition(self, classdef, condition, contentdict)

__dbHandlesTree(self, tree, classdef)

This function traverses the given condition tree and determines if it can be handled by the datasource completely.

__filterCondition(self, classdef)

__filterValue(self, filterId)

__findInstance(self, classdef, object_id, propertylist)

__getClassdef(self, classname)

__getFieldname(self, classdef, propertyname, contentdict, add, skipCalculated=True)

__getProcdef(self, classdef, procedurename)

__getPropertyDef(self, propertyname, classdef)

This function gets the property definition for a given propertyname, resolving references.

__getSortElement(self, item)

This function converts the given sortelement to a properly defined sort-item-dictionary.
Parameters:
item - sort-element in any form (string, list, tuple, dict, ...)
Returns:
dictionary with three keys: 'name', 'descending', 'ignorecase'

__newInstance(self, classdef)

__splitCondition(self, condition, classdef)

This function splits up a given condition into a condition which is handled by the datasource, and another one which has to be processed by appserver.

__splitIntoAnd(self, tree, forest)

This function splits a condition tree into several independant subtrees which can be re-combined via AND.

__startOperation(self, operation)

__usable(self, element, classdef)

_destroy(self)

_start(self, user, password)


Class Variable Details

_MAX_CYCLES

Type:
int
Value:
50                                                                    


GNUe Home

Private API

Developer's Corner