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
Modifier and TypeFieldDescriptionprotected final Map<String,
GraphDescription> Graph name -> descriptionfinal Map<String,
GraphFactory> Graph name -> factory.Graph name -> graph instance.Graph type -> class.static final ComponentName
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
getAdapter
(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 Graph
getGraphFromRegistries
(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 Graph
void
registerContribution
(Object contribution, String extensionPoint, ComponentInstance contributor) protected void
registerGraph
(Object contribution) Registers a graph instance.void
start
(ComponentContext context) Start the component.void
unregisterContribution
(Object contribution, String extensionPoint, ComponentInstance contributor) protected void
unregisterGraph
(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, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContribution
in classDefaultComponent
-
getAdapter
Description copied from interface:Adaptable
Returns an object which is an instance of the given class associated with this object. Returnsnull
if no such object can be found.- Specified by:
getAdapter
in interfaceAdaptable
- Overrides:
getAdapter
in classDefaultComponent
- 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
-
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:RelationManager
Gets a registered graph by name.- Specified by:
getGraphByName
in interfaceRelationManager
- Parameters:
name
- string name of the graph used at registration- Returns:
- the graph
-
getGraph
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 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:RelationManager
Gets a transient graph.- Specified by:
getTransientGraph
in interfaceRelationManager
- Parameters:
type
- The graph type.- Returns:
- the graph.
-
getResource
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 interfaceRelationManager
-
getAllResources
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 interfaceRelationManager
- 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 interfaceRelationManager
-
getGraphNames
Description copied from interface:RelationManager
Gets the list containing the graph names.- Specified by:
getGraphNames
in interfaceRelationManager
-
start
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-