Nuxeo Enterprise Platform 5.3

org.nuxeo.ecm.platform.relations.io
Class IORelationAdapter

java.lang.Object
  extended by org.nuxeo.ecm.platform.io.api.AbstractIOResourceAdapter
      extended by org.nuxeo.ecm.platform.relations.io.IORelationAdapter
All Implemented Interfaces:
Serializable, IOResourceAdapter

public class IORelationAdapter
extends AbstractIOResourceAdapter

Adapter for import/export of relations

Author:
Anahide Tchertchian
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.nuxeo.ecm.platform.io.api.AbstractIOResourceAdapter
properties
 
Constructor Summary
IORelationAdapter()
           
 
Method Summary
 IOResources extractResources(String repo, Collection<DocumentRef> sources)
          Extract relations involving given documents.
protected  List<Statement> filterMatchingStatements(List<Statement> statements)
           
protected  CoreSession getCoreSession(String repo)
          Opens a system session
protected  DocumentRef getDocumentRef(RelationManager relManager, QNameResource resource)
           
protected  Statement getFilteredStatement(Statement statement)
           
protected  List<Statement> getMatchingStatements(Graph graph, Resource resource)
           
protected  RelationManager getRelationManager()
           
 void getResourcesAsXML(OutputStream out, IOResources resources)
          Export resources as XML.
 IOResources loadResourcesFromXML(InputStream in)
          Returns resources built from given stream.
 void setProperties(Map<String,Serializable> properties)
          Set properties.
 void storeResources(IOResources resources)
          Persists resources.
 IOResources translateResources(String repo, IOResources resources, DocumentTranslationMap map)
          Returns translated resources once copy has been done, passing a correspondence map.
protected static Statement updateDate(Statement statement, Literal newDate, List<Resource> properties)
           
 
Methods inherited from class org.nuxeo.ecm.platform.io.api.AbstractIOResourceAdapter
getBooleanProperty, getProperties, getStringArrayProperty, getStringProperty, setBooleanProperty, setStringArrayProperty, setStringProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IORelationAdapter

public IORelationAdapter()
Method Detail

setProperties

public void setProperties(Map<String,Serializable> properties)
Description copied from interface: IOResourceAdapter
Set properties.

Specified by:
setProperties in interface IOResourceAdapter
Overrides:
setProperties in class AbstractIOResourceAdapter

getCoreSession

protected CoreSession getCoreSession(String repo)
                              throws Exception
Opens a system session

Throws:
Exception

getRelationManager

protected RelationManager getRelationManager()
                                      throws Exception
Throws:
Exception

getMatchingStatements

protected List<Statement> getMatchingStatements(Graph graph,
                                                Resource resource)
                                         throws CloneNotSupportedException
Throws:
CloneNotSupportedException

getFilteredStatement

protected Statement getFilteredStatement(Statement statement)
                                  throws CloneNotSupportedException
Throws:
CloneNotSupportedException

filterMatchingStatements

protected List<Statement> filterMatchingStatements(List<Statement> statements)
                                            throws CloneNotSupportedException
Throws:
CloneNotSupportedException

getDocumentRef

protected DocumentRef getDocumentRef(RelationManager relManager,
                                     QNameResource resource)

extractResources

public IOResources extractResources(String repo,
                                    Collection<DocumentRef> sources)
Extract relations involving given documents.

The adapter properties will filter which relations must be taken into account.

Specified by:
extractResources in interface IOResourceAdapter
Specified by:
extractResources in class AbstractIOResourceAdapter
Parameters:
repo - TODO
sources - locations of documents to consider. Has to include documents children if needed.
Returns:
a structure holding associated resources.

getResourcesAsXML

public void getResourcesAsXML(OutputStream out,
                              IOResources resources)
Description copied from interface: IOResourceAdapter
Export resources as XML.

Specified by:
getResourcesAsXML in interface IOResourceAdapter
Specified by:
getResourcesAsXML in class AbstractIOResourceAdapter
resources - resources previously extracted thanks to IOResourceAdapter.extractResources(String, Collection) or IOResourceAdapter.translateResources(String, IOResources, DocumentTranslationMap)

loadResourcesFromXML

public IOResources loadResourcesFromXML(InputStream in)
Description copied from interface: IOResourceAdapter
Returns resources built from given stream.

Specified by:
loadResourcesFromXML in interface IOResourceAdapter
Specified by:
loadResourcesFromXML in class AbstractIOResourceAdapter

storeResources

public void storeResources(IOResources resources)
Description copied from interface: IOResourceAdapter
Persists resources.

Specified by:
storeResources in interface IOResourceAdapter
Specified by:
storeResources in class AbstractIOResourceAdapter
Parameters:
resources - resources previously extracted thanks to IOResourceAdapter.extractResources(String, Collection) or IOResourceAdapter.translateResources(String, IOResources, DocumentTranslationMap)

updateDate

protected static Statement updateDate(Statement statement,
                                      Literal newDate,
                                      List<Resource> properties)

translateResources

public IOResources translateResources(String repo,
                                      IOResources resources,
                                      DocumentTranslationMap map)
Description copied from interface: IOResourceAdapter
Returns translated resources once copy has been done, passing a correspondence map.

Specified by:
translateResources in interface IOResourceAdapter
Specified by:
translateResources in class AbstractIOResourceAdapter
Parameters:
repo - target repository for resources.
resources - resources previously extracted thanks to IOResourceAdapter.extractResources(String, Collection)
map - correspondence map between old locations and new ones.
Returns:
translated resources.

Nuxeo Enterprise Platform 5.3

Copyright © 2010 Nuxeo SAS. All Rights Reserved.