Class RelationService

java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.platform.relations.services.RelationService
All Implemented Interfaces:
Serializable, RelationManager, Adaptable, Component, Extensible, TimestampedService

public class RelationService extends DefaultComponent implements RelationManager
Relation service.

It handles a registry of graph instances through extension points.

See Also:
  • Field Details

  • Constructor Details

    • RelationService

      public RelationService()
  • Method Details

    • registerContribution

      public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
      Overrides:
      registerContribution in class DefaultComponent
    • unregisterContribution

      public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
      Overrides:
      unregisterContribution in class DefaultComponent
    • getAdapter

      public <T> T getAdapter(Class<T> adapter)
      Description copied from interface: Adaptable
      Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found.
      Specified by:
      getAdapter in interface Adaptable
      Overrides:
      getAdapter in class DefaultComponent
      Parameters:
      adapter - the adapter class to look up
      Returns:
      a object castable to the given class, or null if this object does not have an adapter for the given class
    • getGraphTypes

      public List<String> getGraphTypes()
    • registerGraph

      protected void registerGraph(Object contribution)
      Registers a graph instance.

      The graph has to be declared as using a type already registered in the graph type registry.

    • unregisterGraph

      protected void unregisterGraph(Object contribution)
      Unregisters a graph.
    • getGraphByName

      public Graph getGraphByName(String name)
      Description copied from interface: RelationManager
      Gets a registered graph by name.
      Specified by:
      getGraphByName in interface RelationManager
      Parameters:
      name - string name of the graph used at registration
      Returns:
      the graph
    • getGraph

      public Graph getGraph(String name, CoreSession session)
      Description copied from interface: RelationManager
      Gets a registered graph by name.

      A CoreSession should be passed to provide a context in which to store relations when using a "core" graph.

      Specified by:
      getGraph in interface RelationManager
      Parameters:
      name - string name of the graph used at registration
      session - the core session
      Returns:
      the graph
    • getGraphFromRegistries

      protected Graph getGraphFromRegistries(GraphDescription graphDescription, CoreSession session)
      Gets the graph from the registries.
    • newGraph

      protected Graph newGraph(String className)
    • getTransientGraph

      public Graph getTransientGraph(String type)
      Description copied from interface: RelationManager
      Gets a transient graph.
      Specified by:
      getTransientGraph in interface RelationManager
      Parameters:
      type - The graph type.
      Returns:
      the graph.
    • getResource

      public Resource getResource(String namespace, Serializable object, Map<String,Object> context)
      Description copied from interface: RelationManager
      Gets a resource given a namespace and a serializable object.

      There can be several resources with different namespaces associated to an incoming object. A document can for instance be used to refer to itself as a precise version as well as to the set of all versions.

      Context can hold any object useful for the adapters, like a CoreSession.

      Specified by:
      getResource in interface RelationManager
    • getAllResources

      public Set<Resource> getAllResources(Serializable object, Map<String,Object> context)
      Description copied from interface: RelationManager
      Computes all resources corresponding to the given object.

      Context can hold any object useful for the adapters, like a CoreSession.

      Specified by:
      getAllResources in interface RelationManager
      Returns:
      the resources as a set
    • getResourceRepresentation

      public Serializable getResourceRepresentation(String namespace, Resource resource, Map<String,Object> context)
      Description copied from interface: RelationManager
      Gets an object representing this resource given a namespace.

      Context can hold any object useful for the adapters, like a CoreSession.

      Specified by:
      getResourceRepresentation in interface RelationManager
    • getGraphNames

      public List<String> getGraphNames()
      Description copied from interface: RelationManager
      Gets the list containing the graph names.
      Specified by:
      getGraphNames in interface RelationManager
    • start

      public void start(ComponentContext context)
      Description copied from interface: Component
      Start the component. This method is called after all the components were resolved and activated
      Specified by:
      start in interface Component
      Overrides:
      start in class DefaultComponent