import org.collectionspace.services.nuxeo.CollectionSpaceServiceNuxeoImpl;\r
import org.collectionspace.services.collectionobject.CollectionObject;\r
import org.collectionspace.services.CollectionObjectJAXBSchema;\r
+import org.collectionspace.services.nuxeo.NuxeoUtils;\r
\r
import org.dom4j.Document;\r
import org.dom4j.DocumentException;\r
import org.dom4j.io.SAXReader;\r
import org.restlet.resource.Representation;\r
\r
+import org.nuxeo.ecm.core.api.IdRef;\r
+import org.nuxeo.ecm.core.api.repository.RepositoryInstance;\r
+import org.nuxeo.ecm.core.api.DocumentModel;\r
+import org.nuxeo.ecm.core.api.DocumentRef;\r
+\r
+\r
+\r
/**\r
* @author remillet\r
* \r
\r
public Document getCollectionObject(String csid) throws DocumentException,\r
IOException {\r
+ \r
+ // Calling via Nuxeo Java API\r
+ //getCollectionObjectViaJavaAPI(csid);\r
+ \r
+ // Return to normal Nuxeo REST call\r
List<String> pathParams = new ArrayList<String>();\r
Map<String, String> queryParams = new HashMap<String, String>();\r
\r
\r
return document;\r
}\r
+ \r
+ /*\r
+ * Prototype method for calling the Nuxeo Java API\r
+ */\r
+ private Document getCollectionObjectViaJavaAPI(String csid)\r
+ throws DocumentException, IOException {\r
+ Document result = null;\r
+ RepositoryInstance repoSession = null;\r
+ \r
+ try {\r
+ repoSession = getRepositorySession();\r
+ DocumentRef documentRef = new IdRef(csid);\r
+ DocumentModel documentModel = repoSession.getDocument(documentRef);\r
+ result = NuxeoUtils.getDocument(repoSession, documentModel);\r
+ } catch (Exception e) {\r
+ if (logger.isDebugEnabled()) {\r
+ e.printStackTrace();\r
+ }\r
+ } finally {\r
+ if (repoSession != null) {\r
+ releaseRepositorySession(repoSession);\r
+ }\r
+ }\r
+ \r
+ // Dump out the contents of the result to stdout\r
+ System.out.println(result.asXML());\r
+ \r
+ return result;\r
+ }\r
\r
public Document getCollectionObjectList() throws DocumentException,\r
IOException {\r