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
Relation service.
It handles a registry of graph instances through extension points.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<String,GraphDescription> Graph name -> descriptionfinal Map<String,GraphFactory> Graph name -> factory.Graph name -> graph instance.Graph type -> class.static final ComponentNameFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TgetAdapter(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.getAllResources(Serializable object, Map<String, Object> context) Computes all resources corresponding to the given object.getGraph(String name, CoreSession session) Gets a registered graph by name.getGraphByName(String name) Gets a registered graph by name.protected GraphgetGraphFromRegistries(GraphDescription graphDescription, CoreSession session) Gets the graph from the registries.Gets the list containing the graph names.getResource(String namespace, Serializable object, Map<String, Object> context) Gets a resource given a namespace and a serializable object.Gets an object representing this resource given a namespace.getTransientGraph(String type) Gets a transient graph.protected GraphvoidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) protected voidregisterGraph(Object contribution) Registers a graph instance.voidstart(ComponentContext context) Start the component.voidunregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) protected voidunregisterGraph(Object contribution) Unregisters a graph.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, stop, unregister, unregisterExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
NAME
-
graphTypes
Graph type -> class. -
graphDescriptions
Graph name -> description -
graphFactories
Graph name -> factory. -
graphRegistry
Graph name -> graph instance. -
resourceAdapterRegistry
-
-
Constructor Details
-
RelationService
public RelationService()
-
-
Method Details
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContributionin classDefaultComponent
-
getAdapter
Description copied from interface:AdaptableReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.- Specified by:
getAdapterin interfaceAdaptable- Overrides:
getAdapterin classDefaultComponent- Parameters:
adapter- the adapter class to look up- Returns:
- a object castable to the given class, or
nullif this object does not have an adapter for the given class
-
getGraphTypes
-
registerGraph
Registers a graph instance.The graph has to be declared as using a type already registered in the graph type registry.
-
unregisterGraph
Unregisters a graph. -
getGraphByName
Description copied from interface:RelationManagerGets a registered graph by name.- Specified by:
getGraphByNamein interfaceRelationManager- Parameters:
name- string name of the graph used at registration- Returns:
- the graph
-
getGraph
Description copied from interface:RelationManagerGets a registered graph by name.A
CoreSessionshould be passed to provide a context in which to store relations when using a "core" graph.- Specified by:
getGraphin interfaceRelationManager- Parameters:
name- string name of the graph used at registrationsession- the core session- Returns:
- the graph
-
getGraphFromRegistries
Gets the graph from the registries. -
newGraph
-
getTransientGraph
Description copied from interface:RelationManagerGets a transient graph.- Specified by:
getTransientGraphin interfaceRelationManager- Parameters:
type- The graph type.- Returns:
- the graph.
-
getResource
Description copied from interface:RelationManagerGets 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:
getResourcein interfaceRelationManager
-
getAllResources
Description copied from interface:RelationManagerComputes all resources corresponding to the given object.Context can hold any object useful for the adapters, like a
CoreSession.- Specified by:
getAllResourcesin interfaceRelationManager- Returns:
- the resources as a set
-
getResourceRepresentation
public Serializable getResourceRepresentation(String namespace, Resource resource, Map<String, Object> context) Description copied from interface:RelationManagerGets an object representing this resource given a namespace.Context can hold any object useful for the adapters, like a
CoreSession.- Specified by:
getResourceRepresentationin interfaceRelationManager
-
getGraphNames
Description copied from interface:RelationManagerGets the list containing the graph names.- Specified by:
getGraphNamesin interfaceRelationManager
-
start
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-