Beispiel #1
0
def get_root_aggregate(resource):
    """
    Returns an aggregate from the root entity repository for the given 
    registered resource.

    :param resource: registered resource
    """
    repo = as_repository(resource)
    return repo.get_aggregate(resource)
Beispiel #2
0
def get_root_aggregate(resource):
    """
    Returns an aggregate from the root entity repository for the given 
    registered resource.

    :param resource: registered resource
    """
    repo = as_repository(resource)
    return repo.get_aggregate(resource)
Beispiel #3
0
 def add(self, irc):
     repo = as_repository(irc)
     coll = repo.get_collection(irc)
     if coll.__name__ in self.__collections:
         raise ValueError('Root collection for collection name %s '
                          ' already exists.' % coll.__name__)
     # We need to tell the repository that the service object should be
     # set as the parent for the newly created collection.
     repo.set_collection_parent(irc, self)
     # Update the collection name -> registered resource mapping.
     self.__collections[coll.__name__] = irc
Beispiel #4
0
def get_root_collection(resource):
    """
    Returns a clone of the collection from the repository registered for the
    given registered resource.

    :param resource: registered resource
    :type resource: class implementing or instance providing or subclass of
        a registered resource interface.
    """
    repo = as_repository(resource)
    return repo.get_collection(resource)
Beispiel #5
0
def get_root_collection(resource):
    """
    Returns a clone of the collection from the repository registered for the
    given registered resource.

    :param resource: registered resource
    :type resource: class implementing or instance providing or subclass of
        a registered resource interface.
    """
    repo = as_repository(resource)
    return repo.get_collection(resource)
Beispiel #6
0
    def __getitem__(self, key):
        """
        Overrides __getitem__ to return a clone of the requested collection.

        :param key: collection name.
        :type key: str
        :returns: object implementing
          :class:`everest.resources.interfaces.ICollectionResource`.
        """
        irc = self.__collections[key]
        repo = as_repository(irc)
        coll = repo.get_collection(irc)
        coll.__parent__ = self
        return coll
Beispiel #7
0
 def __enter__(self):
     repo = as_repository(self.__context)
     self.__session = repo.session_factory()
     self.__session.configure_loaders(self.__context, self.__configuration)
Beispiel #8
0
 def __enter__(self):
     repo = as_repository(self.__context)
     self.__session = repo.session_factory()
     self.__session.configure_loaders(self.__context, self.__configuration)
Beispiel #9
0
 def remove(self, irc):
     repo = as_repository(irc)
     coll = repo.get_collection(irc)
     del self.__collections[coll.__name__]