Package Products :: Package ZenRelations :: Module RelSchema |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenRelations.RelSchema

     1  ##############################################################################
     2  #
     3  # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
     4  #
     5  # This content is made available according to terms specified in
     6  # License.zenoss under the directory where your Zenoss product is installed.
     7  #
     8  ##############################################################################
     9
    10
    11  __doc__="""$Id: ToManyRelationship.py,v 1.48 2003/11/12 22:05:48 edahl Exp $"""
    12
    13  __version__ = "$Revision: 1.48 $"[11:-2]
    14
    15
    16  RELMETATYPES = (
    17      'ToOneRelationship', 'ToManyContRelationship', 'ToManyRelationship')
    18
    19 -class RelSchema:
    20
    21 -    def __init__(self, remoteType, remoteClass, remoteName):
    22          self.remoteType = remoteType
    23          self.remoteClass = remoteClass
    24          self.remoteName = remoteName
    25
    26 -    def createRelation(self, name):
    27          return self._relationClass(name)
    28
    29 -    def checkType(self, relationship):
    30          """Check that a relationship instance is of correct type"""
    31          return isinstance(relationship, self._relationClass)
    32
    33
    34 -class ToOne(RelSchema):
    35      from ToOneRelationship import ToOneRelationship
    36      _relationClass = ToOneRelationship
    37
    38 -class ToMany(RelSchema):
    39      from ToManyRelationship import ToManyRelationship
    40      _relationClass = ToManyRelationship
    41
    42 -class ToManyCont(RelSchema):
    43      from ToManyContRelationship import ToManyContRelationship
    44      _relationClass = ToManyContRelationship
    45