- class pyworkflow.mapper.mapper.Mapper(dictClasses=None)
This class will serves as a Data Mapper pattern. It will store/retrieve objects from some storage environment. (like SQL, XML or others) The mapper should have access to class dictionary in order to build any give class by name
- ORIGINAL_CLASS_NAME_ATTRIBUTE = 'oldClassName'
- static annotateClassName(instance, oldClassName)
Annotate an object with the original class name
Commit changes made to the storage
Delete all relations created by object creatorObj
Return True if the id is in the database
Return the full object name such as: grandparent.parent.objName
- static getObjectPersistingClassName(instance)
Retrieve the parent object of another.
- getRelationChilds(relName, parentObj)
Return all “child” objects for a given relation. Params:
relName: the name of the relation. parentObj: this is “parent” in the relation
a list of “child” objects.
- getRelationParents(relName, childObj)
Return all “parent” objects for a given relation. Params:
relName: the name of the relation. childObj: this is “child” in the relation
a list of “parent” objects.
Return all relations created by creatorObj.
Insert a new object into the system, the id will be set
- insertRelation(relName, creatorObj, parentObj, childObj)
This function will add a new relation between two objects. Params:
relName: the name of the relation to be added. creatorObj: this object will be the one who register the relation. parentObj: this is “parent” in the relation childObj: this is “child” in the relation
Return all object from storage
Select object meetings some criteria
- selectByClass(className, includeSubclasses=True)
Select all object of a give class. By default object of subclasses will be retrieved also. This behaviour can be changed by passing includeSubclass=False
Return the object which id is objId
Return only the first element
Stores an object, it can be inserted or updated
- update(obj, direction='to')
Update an existing object, the id should not be None direction can be “to” or “from” which indicates the priority of the update. If “to” is used, object data is put in storage. If “from”, object data is retrieved from storage
Update object data with storage info
Update storage with object info