ZenRelations :: RelationshipManager :: RelationshipManager :: Class RelationshipManager
[hide private]
[frames] | no frames]

Class RelationshipManager

source code

                        ExtensionClass.Base --+            
                                              |            
                  OFS.CopySupport.CopyContainer --+        
                                                  |        
                    RelCopySupport.RelCopyContainer --+    
                                                      |    
                        ExtensionClass.Base --+       |    
                                              |       |    
                  OFS.CopySupport.CopyContainer --+   |    
                                                  |   |    
                        ExtensionClass.Base --+   |   |    
                                              |   |   |    
                      App.Management.Navigation --+   |    
                                                  |   |    
                        ExtensionClass.Base --+   |   |    
                                              |   |   |    
                            App.Management.Tabs --+   |    
                                                  |   |    
                           Acquisition.Implicit --+   |    
                                                  |   |    
                             Globals.Persistent --+   |    
                                                  |   |    
                    ExtensionClass.Base --+       |   |    
                                          |       |   |    
     webdav.EtagSupport.EtagSupport --+   |       |   |    
                                      |   |       |   |    
           webdav.Lockable.LockableItem --+       |   |    
                                          |       |   |    
                   webdav.Resource.Resource --+   |   |    
                                              |   |   |    
                   webdav.Collection.Collection --+   |    
                                                  |   |    
                    OFS.Traversable.Traversable --+   |    
                                                  |   |    
                    OFS.ObjectManager.ObjectManager --+    
                                                      |    
                        ExtensionClass.Base --+       |    
                                              |       |    
                    ExtensionClass.Base --+   |       |    
                                          |   |       |    
                 OFS.CopySupport.CopySource --+       |    
                                              |       |    
                    ExtensionClass.Base --+   |       |    
                                          |   |       |    
                        App.Management.Tabs --+       |    
                                              |       |    
                OFS.Traversable.Traversable --+       |    
                                              |       |    
                    ExtensionClass.Base --+   |       |    
                                          |   |       |    
                  AccessControl.Owned.Owned --+       |    
                                              |       |    
                                    ZItem.ZItem --+   |    
                                                  |   |    
                           Acquisition.Implicit --+   |    
                                                  |   |    
                        ExtensionClass.Base --+   |   |    
                                              |   |   |    
AccessControl.PermissionMapping.RoleManager --+   |   |    
                                              |   |   |    
                 AccessControl.Role.RoleManager --+   |    
                                                  |   |    
        PrimaryPathObjectManager.PrimaryPathManager --+    
                                                      |    
                            ExtensionClass.Base --+   |    
                                                  |   |    
                               App.Undo.UndoSupport --+    
                                                      |    
      PrimaryPathObjectManager.PrimaryPathObjectManager --+
                                                          |
                            ExtensionClass.Base --+       |
                                                  |       |
                          OFS.ZDOM.Node --+       |       |
                                          |       |       |
                           OFS.ZDOM.Element --+   |       |
                                              |   |       |
                 OFS.ZDOM.ElementWithAttributes --+       |
                                                  |       |
                OFS.PropertyManager.PropertyManager --+   |
                                                      |   |
                  ZenPropertyManager.ZenPropertyManager --+
                                                          |
                                                         RelationshipManager


RelationshipManger is an ObjectManager like class that can contain
relationships (in fact relationships can only be added to a 
RelationshipManager).

Relationships are defined on an RM by the hash _relations.  It
should be defined on the class so that it isn't stored in the database.
If there is inheritance involved remember to add the base class _relations
definition to the current class so that all relationships for the class
are defined on it.

remoteClassStr - is a string that represents the full path to the remote
                class.  Its a string because in most cases the classes
                will be in different modules which would cause a recursive
                import of the two modules.

_relations = (
    ("toonename", ToOne(ToMany, remoteClassStr, remoteName)), 
    ("tomanyname", ToMany(ToMany, remoteClassStr, remoteName)), 
    )



Instance Methods [hide private]
 
__init__(self, id, title=None, buildRelations=True) source code
 
getRelationshipManagerId(self)
Return our simple id if we are called from our primary path else return the full primary id.
source code
 
addRelation(self, name, obj)
Form a bi-directional relationship.
source code
 
removeRelation(self, name, obj=None)
Remove an object from a relationship.
source code
 
_setObject(self, id, object, roles=None, user=None, set_owner=1)
Track __primary_parent__ when we are set into an object
source code
 
manage_beforeDelete(self, item, container)
handle cut/past vs.
source code
 
_getCopy(self, container)
Create a copy of this relationship manager.
source code
 
_notifyOfCopyTo(self, container, op=0)
Manage copy/move/rename state for use in manage_beforeDelete.
source code
 
cb_isMoveable(self)
Prevent move unless we are being called from our primary path.
source code
 
moveMeBetweenRels(self, srcRelationship, destRelationship)
Move a relationship manager without deleting its relationships.
source code
 
moveObject(self, obj, destination)
Move obj from this RM to the destination RM
source code
 
buildRelations(self)
build our relations based on the schema defined in _relations
source code
 
getRelationships(self)
Returns a dictionary of relationship objects keyed by their names
source code
 
getRelationshipNames(self)
Return our relationship names
source code
 
checkRelations(self, repair=False)
Confirm the integrity of all relations on this object
source code
 
exportXml(self, ofile, ignorerels=[], root=False)
Return an xml based representation of a RelationshipManager...
source code
 
exportXmlProperties(self, ofile)
Return an xml representation of a RelationshipManagers properties...
source code
 
exportXmlRelationships(self, ofile, ignorerels=[])
Return an xml representation of Relationships
source code
 
manage_addRelation(self, name, obj, REQUEST=None)
make a relationship
source code
 
manage_removeRelation(self, name, id=None, REQUEST=None)
remove a relationship to be called from UI
source code
 
manage_workspace(self, REQUEST)
return the workspace of the related object using its primary path
source code

Inherited from PrimaryPathObjectManager.PrimaryPathObjectManager (private): _delObject

Inherited from RelCopySupport.RelCopyContainer: manage_linkObjects, manage_renameObject, manage_unlinkObjects

Inherited from RelCopySupport.RelCopyContainer (private): _getRelName, _getSourceObjects, _verifyObjectLink, _verifyObjectPaste

Inherited from OFS.CopySupport.CopyContainer: cb_dataItems, cb_dataValid, manage_CopyContainerAllItems, manage_CopyContainerFirstItem, manage_clone, manage_copyObjects, manage_cutObjects, manage_pasteObjects, manage_renameObjects, validClipData

Inherited from OFS.CopySupport.CopyContainer (private): _delOb, _getOb, _get_id, _setOb

Inherited from OFS.ObjectManager.ObjectManager: __class_init__, __getitem__, all_meta_types, filtered_meta_types, hasObject, list_imports, manage_FTPlist, manage_FTPstat, manage_afterAdd, manage_afterClone, manage_delObjects, manage_exportObject, manage_hasId, manage_importObject, objectIds, objectIds_d, objectItems, objectItems_d, objectMap, objectMap_d, objectValues, objectValues_d, superValues, tpValues

Inherited from OFS.ObjectManager.ObjectManager (private): _checkId, _importObjectFromFile, _subobject_permissions

Inherited from App.Management.Navigation: manage_zmi_logout

Inherited from App.Management.Tabs: class_manage_path, filtered_manage_options, tabs_path_default, tabs_path_info

Inherited from webdav.Collection.Collection: DELETE, HEAD, PUT, dav__init, listDAVObjects

Inherited from webdav.Resource.Resource: COPY, LOCK, MKCOL, MOVE, OPTIONS, PROPFIND, PROPPATCH, TRACE, UNLOCK, dav__simpleifhandler, dav__validate, manage_DAVget

Inherited from webdav.Lockable.LockableItem: wl_clearLocks, wl_delLock, wl_getLock, wl_hasLock, wl_isLocked, wl_lockItems, wl_lockTokens, wl_lockValues, wl_lockmapping, wl_setLock

Inherited from webdav.EtagSupport.EtagSupport: http__etag, http__parseMatchList, http__processMatchHeaders, http__refreshEtag

Inherited from OFS.Traversable.Traversable: absolute_url, absolute_url_path, getPhysicalPath, restrictedTraverse, unrestrictedTraverse, virtual_url_path

Inherited from PrimaryPathObjectManager.PrimaryPathManager: getPrimaryId, getPrimaryParent, getPrimaryPath, getPrimaryUrlPath, primaryAq

Inherited from ZItem.ZItem: __len__, __repr__, getId, manage_editedDialog, raise_standardErrorMessage, this, title_and_id, title_or_id, tpURL

Inherited from OFS.CopySupport.CopySource: cb_isCopyable, cb_userHasCopyOrMovePermission

Inherited from OFS.CopySupport.CopySource (private): _canCopy, _postCopy, _setId

Inherited from AccessControl.Owned.Owned: changeOwnership, getOwner, getOwnerTuple, getWrappedOwner, manage_changeOwnershipType, manage_fixupOwnershipAfterAdd, manage_takeOwnership, owner_info, userCanTakeOwnership

Inherited from AccessControl.Owned.Owned (private): _deleteOwnershipAfterAdd

Inherited from AccessControl.Role.RoleManager: ac_inherited_permissions, access_debug_info, acquiredRolesAreUsedBy, get_local_roles, get_local_roles_for_userid, get_valid_userids, has_local_roles, manage_access, manage_acquiredPermissions, manage_addLocalRoles, manage_changePermissions, manage_defined_roles, manage_delLocalRoles, manage_editRoles, manage_permission, manage_role, manage_setLocalRoles, permission_settings, permissionsOfRole, possible_permissions, rolesOfPermission, userdefined_roles, users_with_local_role, validRoles, valid_roles, validate_roles

Inherited from AccessControl.Role.RoleManager (private): _addRole, _delRoles, _has_user_defined_role, _setRoles

Inherited from AccessControl.PermissionMapping.RoleManager: manage_getPermissionMapping, manage_setPermissionMapping

Inherited from AccessControl.PermissionMapping.RoleManager (private): _isBeingAccessedAsZClassDefinedInstanceMethod, _isBeingUsedAsAMethod

Inherited from App.Undo.UndoSupport: get_request_var_or_attr, manage_undo_transactions, undoable_transactions

Inherited from ZenPropertyManager.ZenPropertyManager: deleteZenProperty, getOverriddenObjects, getZenRootNode, isLocal, manage_editProperties, saveZenProperties, setZenProperty, zenPropIsPassword, zenPropertyIds, zenPropertyItems, zenPropertyMap, zenPropertyOptions, zenPropertyPath, zenPropertyString, zenPropertyType

Inherited from ZenPropertyManager.ZenPropertyManager (private): _setPropValue, _setProperty, _updateProperty

Inherited from OFS.PropertyManager.PropertyManager: getProperty, getPropertyType, hasProperty, manage_addProperty, manage_changeProperties, manage_changePropertyTypes, manage_delProperties, propdict, propertyIds, propertyItems, propertyLabel, propertyMap, propertyValues, valid_property_id

Inherited from OFS.PropertyManager.PropertyManager (private): _delPropValue, _delProperty, _propertyMap, _wrapperCheck

Inherited from OFS.ZDOM.ElementWithAttributes: getAttribute, getAttributeNode, getAttributes

Inherited from OFS.ZDOM.Element: getChildNodes, getElementsByTagName, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getParentNode, getPreviousSibling, getTagName

Inherited from OFS.ZDOM.Node: getNodeValue, getOwnerDocument, hasChildNodes

Class Methods [hide private]
 
lookupSchema(cls, relname)
Lookup the schema definition for a relationship.
source code
Class Variables [hide private]
  _relations = ()
  meta_type = 'Relationship Manager'
  security = ClassSecurityInfo()
  manage_options = PrimaryPathObjectManager.manage_options+ ZenP...
  manage_main = DTMLFile('dtml/RelationshipManagerMain', globals())
  _operation = -1

Inherited from OFS.CopySupport.CopyContainer: __ac_permissions__, manage_renameForm

Inherited from OFS.ObjectManager.ObjectManager: isAnObjectManager, isPrincipiaFolderish, manage_addProduct, manage_importExportForm, manage_index_main, meta_types

Inherited from OFS.ObjectManager.ObjectManager (private): _objects

Inherited from App.Management.Navigation: manage, manage_copyright, manage_form_title, manage_menu, manage_page_footer, manage_page_header, manage_top_frame, manage_zmi_prefs, zope_quick_start

Inherited from App.Management.Tabs: manage_tabs

Inherited from webdav.Collection.Collection: __dav_collection__

Inherited from webdav.Resource.Resource: __dav_resource__, __http_methods__

Inherited from webdav.EtagSupport.EtagSupport: __implements__

Inherited from OFS.Traversable.Traversable: getPhysicalRoot

Inherited from ZItem.ZItem: REQUEST, __allow_access_to_unprotected_subobjects__, __name__, __propsets__, icon, id, isTopLevelPrincipiaApplicationObject, title

Inherited from ZItem.ZItem (private): _manage_editedDialog

Inherited from AccessControl.Owned.Owned: manage_owner

Inherited from AccessControl.Role.RoleManager: __ac_local_roles__, __ac_roles__, aclAChecked, aclEChecked, aclPChecked, manage_acquiredForm, manage_editLocalRoles, manage_listLocalRoles, manage_permissionForm, manage_roleForm, permissionMappingPossibleValues, selectedRoles, smallRolesWidget

Inherited from AccessControl.Role.RoleManager (private): _method_manage_access, _normal_manage_access

Inherited from App.Undo.UndoSupport: manage_UndoForm

Inherited from ZenPropertyManager.ZenPropertyManager: __pychecker__, manage_propertiesForm

Inherited from ZenPropertyManager.ZenPropertyManager (private): _onlystars

Inherited from OFS.PropertyManager.PropertyManager: manage_propertyTypeForm, propertysheets

Inherited from OFS.PropertyManager.PropertyManager (private): _properties, _reserved_names

Method Details [hide private]

removeRelation(self, name, obj=None)

source code 
Remove an object from a relationship. If no object is passed all objects are removed.

_setObject(self, id, object, roles=None, user=None, set_owner=1)

source code 
Track __primary_parent__ when we are set into an object
Overrides: PrimaryPathObjectManager.PrimaryPathObjectManager._setObject
(inherited documentation)

manage_beforeDelete(self, item, container)

source code 
handle cut/past vs. delete If we are being moved (cut/past) don't clear relationshp if we are being deleted set all relationship to None so that our related object don't have dangling references
Overrides: OFS.ObjectManager.ObjectManager.manage_beforeDelete

_getCopy(self, container)

source code 
Create a copy of this relationship manager. This involes copying relationships and removing invalid relations (ie ones with ToOne) and performing copies of any contained objects. Properties are also set on the new object.
Overrides: OFS.CopySupport.CopySource._getCopy

_notifyOfCopyTo(self, container, op=0)

source code 
Manage copy/move/rename state for use in manage_beforeDelete.
Overrides: OFS.CopySupport.CopySource._notifyOfCopyTo

cb_isMoveable(self)

source code 
Prevent move unless we are being called from our primary path.
Overrides: OFS.CopySupport.CopySource.cb_isMoveable

lookupSchema(cls, relname)
Class Method

source code 
Lookup the schema definition for a relationship. All base classes are checked until RelationshipManager is found.

exportXml(self, ofile, ignorerels=[], root=False)

source code 
Return an xml based representation of a RelationshipManager
<object id='/Devices/Servers/Windows/dhcp160.confmon.loc' 
    module='Products.Confmon.IpInterface' class='IpInterface'>
    <property id='name'>jim</property>
    <toone></toone>
    <tomany></tomany>
    <tomanycont></tomanycont>
</object>

exportXmlProperties(self, ofile)

source code 
Return an xml representation of a RelationshipManagers properties
<property id='name' type='type' mode='w' select_variable='selectvar'>
    value 
</property>
value will be converted to is correct python type on import

manage_workspace(self, REQUEST)

source code 
return the workspace of the related object using its primary path
Overrides: App.Management.Tabs.manage_workspace

Class Variable Details [hide private]

manage_options

Value:
PrimaryPathObjectManager.manage_options+ ZenPropertyManager.manage_opt\
ions