pyworkflow.mapper.mapper module¶
-
class
pyworkflow.mapper.mapper.
Mapper
(dictClasses=None)[source]¶ Bases:
object
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)[source]¶ Annotate an object with the original class name
-
getRelationChilds
(relName, parentObj)[source]¶ Return all “child” objects for a given relation. Params:
relName: the name of the relation. parentObj: this is “parent” in the relation- Returns:
- a list of “child” objects.
-
getRelationParents
(relName, childObj)[source]¶ Return all “parent” objects for a given relation. Params:
relName: the name of the relation. childObj: this is “child” in the relation- Returns:
- a list of “parent” objects.
-
insertRelation
(relName, creatorObj, parentObj, childObj)[source]¶ 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
-
selectByClass
(className, includeSubclasses=True)[source]¶ 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
-