]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-410: Adding stubbed query/search service structure. Requires full clean build.
authorRichard Millet <richard.millet@berkeley.edu>
Fri, 4 Sep 2009 19:47:13 +0000 (19:47 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Fri, 4 Sep 2009 19:47:13 +0000 (19:47 +0000)
25 files changed:
services/JaxRsServiceProvider/pom.xml
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/nuxeo/CollectionObjectServiceNuxeoImpl.java
services/common/src/main/java/org/collectionspace/services/common/query/IQueryManager.java [new file with mode: 0644]
services/common/src/main/java/org/collectionspace/services/common/query/QueryManager.java [new file with mode: 0644]
services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java [new file with mode: 0644]
services/common/src/main/java/org/collectionspace/services/common/relation/IRelationsManager.java [moved from services/common/src/main/java/org/collectionspace/services/common/relation/RelationUtils.java with 95% similarity]
services/common/src/main/java/org/collectionspace/services/common/relation/RelationsManager.java
services/common/src/main/java/org/collectionspace/services/common/relation/nuxeo/RelationsManagerNuxeoImpl.java [moved from services/common/src/main/java/org/collectionspace/services/common/relation/nuxeo/RelationUtilsNuxeoImpl.java with 95% similarity]
services/common/src/main/java/org/collectionspace/services/nuxeo/CollectionSpaceServiceNuxeoImpl.java
services/intake/service/src/main/java/org/collectionspace/services/intake/IntakeServiceNuxeoImpl.java
services/pom.xml
services/query/.classpath [new file with mode: 0644]
services/query/.project [new file with mode: 0644]
services/query/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
services/query/.settings/org.maven.ide.eclipse.prefs [new file with mode: 0644]
services/query/pom.xml [new file with mode: 0644]
services/query/service/.classpath [new file with mode: 0644]
services/query/service/.project [new file with mode: 0644]
services/query/service/pom.xml [new file with mode: 0644]
services/query/service/src/main/java/org/collectionspace/services/query/QueryResource.java [new file with mode: 0644]
services/relation/service/src/main/java/org/collectionspace/services/relation/NewRelationResource.java
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationNuxeoConstants.java
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationServiceNuxeoImpl.java

index b155b43f5d67e0baf8292ec8f4ecd7a34b2bdf9f..422db5f4d9c1911df7a3aa0d540566cad6010906 100644 (file)
             <artifactId>org.collectionspace.services.intake.service</artifactId>\r
             <version>1.0</version>\r
         </dependency>\r
-\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.relation.service</artifactId>\r
             <version>1.0</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.query.service</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\r
         <dependency>\r
             <groupId>commons-io</groupId>\r
             <artifactId>commons-io</artifactId>\r
                     <port>8180</port>\r
                 </configuration>\r
                 <executions>\r
+                       \r
                     <execution>\r
                         <id>jboss-undeploy</id>\r
                         <phase>pre-integration-test</phase>\r
                             </fileNames>\r
                         </configuration>\r
                     </execution>\r
+                    \r
                 </executions>\r
             </plugin>\r
 \r
index 413442a02e1377e017b5d6dc1e5792343bb84616..65c4b42b604c15eaf59ffdf89bc96c5a8e6f2154 100644 (file)
@@ -5,6 +5,7 @@ import org.collectionspace.services.id.IDResource;
 import org.collectionspace.services.intake.IntakeResource;
 //import org.collectionspace.services.relation.RelationResource;
 import org.collectionspace.services.relation.NewRelationResource;
+import org.collectionspace.services.query.QueryResource;
 
 import javax.ws.rs.core.Application;
 import java.util.HashSet;
@@ -21,7 +22,8 @@ public class CollectionSpaceJaxRsApplication extends Application {
         singletons.add(new IDResource());
         singletons.add(new IntakeResource());
 //        singletons.add(new RelationResource());
-        singletons.add(new NewRelationResource());        
+        singletons.add(new NewRelationResource());
+        singletons.add(new QueryResource());
 //        singletons.add(new DomainIdentifierResource());
 //        singletons.add(new PingResource());
     }
index d0d8a9760a4d77a3ac8fafa1b3fa9a98d6bcea41..e19e56d3a9010ab6f7fb912c2930a2cbb18cc615 100644 (file)
@@ -48,18 +48,20 @@ public class CollectionObjectServiceNuxeoImpl extends
        public Document deleteCollectionObject(String csid)\r
                        throws DocumentException, IOException {\r
 \r
-               NuxeoRESTClient nxClient = getClient();\r
-               List<String> pathParams = new ArrayList<String>();\r
-               Map<String, String> queryParams = new HashMap<String, String>();\r
-\r
-               pathParams.add("default");\r
-               pathParams.add(csid);\r
-               pathParams.add("deleteDocumentRestlet");\r
-               Representation res = nxClient.get(pathParams, queryParams);\r
-               SAXReader reader = new SAXReader();\r
-               Document document = reader.read(res.getStream());\r
+               Document result = null;\r
+               \r
+//             NuxeoRESTClient nxClient = getClient();\r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//\r
+//             pathParams.add("default");\r
+//             pathParams.add(csid);\r
+//             pathParams.add("deleteDocumentRestlet");\r
+//             Representation res = nxClient.get(pathParams, queryParams);\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
                \r
-               return document;\r
+               return result;\r
        }\r
 \r
        public Document getCollectionObject(String csid) throws DocumentException,\r
@@ -69,21 +71,23 @@ public class CollectionObjectServiceNuxeoImpl extends
                //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
-               pathParams.add("default");\r
-               pathParams.add(csid);\r
-               pathParams.add("export");\r
-               queryParams.put("format", "XML");\r
-\r
-               NuxeoRESTClient nxClient = getClient();\r
-               Representation res = nxClient.get(pathParams, queryParams);\r
-\r
-               SAXReader reader = new SAXReader();\r
-               Document document = reader.read(res.getStream());\r
+               Document result = null;\r
+//             \r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//\r
+//             pathParams.add("default");\r
+//             pathParams.add(csid);\r
+//             pathParams.add("export");\r
+//             queryParams.put("format", "XML");\r
+//\r
+//             NuxeoRESTClient nxClient = getClient();\r
+//             Representation res = nxClient.get(pathParams, queryParams);\r
+//\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
 \r
-               return document;\r
+               return result;\r
        }\r
        \r
        \r
@@ -91,125 +95,130 @@ public class CollectionObjectServiceNuxeoImpl extends
                        IOException {\r
                Document result = null;\r
 \r
-               NuxeoRESTClient nxClient = getClient();\r
-               List<String> pathParams = new ArrayList<String>();\r
-               Map<String, String> queryParams = new HashMap<String, String>();\r
-               pathParams = Arrays.asList("default",\r
-                               CS_COLLECTIONOBJECT_WORKSPACE_UID, "browse");\r
-               Representation res = nxClient.get(pathParams, queryParams);\r
-               SAXReader reader = new SAXReader();\r
-               result = reader.read(res.getStream());\r
+//             NuxeoRESTClient nxClient = getClient();\r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//             pathParams = Arrays.asList("default",\r
+//                             CS_COLLECTIONOBJECT_WORKSPACE_UID, "browse");\r
+//             Representation res = nxClient.get(pathParams, queryParams);\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
 \r
                return result;\r
        }\r
 \r
        public Document postCollectionObject(CollectionObject co)\r
                        throws DocumentException, IOException {\r
-               NuxeoRESTClient nxClient = getClient();\r
-\r
-               List<String> pathParams = new ArrayList<String>();\r
-               Map<String, String> queryParams = new HashMap<String, String>();\r
-               pathParams.add("default");\r
-               pathParams.add(CS_COLLECTIONOBJECT_WORKSPACE_UID);\r
-               pathParams.add("createDocument");\r
-               queryParams.put("docType", CO_NUXEO_DOCTYPE);\r
-\r
-               // a default title for the Dublin Core schema\r
-               queryParams.put("dublincore:title", CO_NUXEO_DC_TITLE);\r
-\r
-               // CollectionObject core values\r
-               queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                               + CollectionObjectJAXBSchema.OBJECT_NUMBER, co\r
-                               .getObjectNumber());\r
-               queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                               + CollectionObjectJAXBSchema.OTHER_NUMBER, co.getOtherNumber());\r
-               queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                               + CollectionObjectJAXBSchema.BRIEF_DESCRIPTION, co\r
-                               .getBriefDescription());\r
-               queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                               + CollectionObjectJAXBSchema.COMMENTS, co.getComments());\r
-               queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                               + CollectionObjectJAXBSchema.DIST_FEATURES, co\r
-                               .getDistFeatures());\r
-               queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                               + CollectionObjectJAXBSchema.OBJECT_NAME, co.getObjectName());\r
-               queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                               + CollectionObjectJAXBSchema.RESPONSIBLE_DEPT, co\r
-                               .getResponsibleDept());\r
-               queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                               + CollectionObjectJAXBSchema.TITLE, co.getTitle());\r
-\r
-               ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);\r
-               Representation res = nxClient.post(pathParams, queryParams, bais);\r
-\r
-               SAXReader reader = new SAXReader();\r
-               Document document = reader.read(res.getStream());\r
-\r
-               return document;\r
+               Document result = null;\r
+               \r
+//             NuxeoRESTClient nxClient = getClient();\r
+//\r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//             pathParams.add("default");\r
+//             pathParams.add(CS_COLLECTIONOBJECT_WORKSPACE_UID);\r
+//             pathParams.add("createDocument");\r
+//             queryParams.put("docType", CO_NUXEO_DOCTYPE);\r
+//\r
+//             // a default title for the Dublin Core schema\r
+//             queryParams.put("dublincore:title", CO_NUXEO_DC_TITLE);\r
+//\r
+//             // CollectionObject core values\r
+//             queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                             + CollectionObjectJAXBSchema.OBJECT_NUMBER, co\r
+//                             .getObjectNumber());\r
+//             queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                             + CollectionObjectJAXBSchema.OTHER_NUMBER, co.getOtherNumber());\r
+//             queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                             + CollectionObjectJAXBSchema.BRIEF_DESCRIPTION, co\r
+//                             .getBriefDescription());\r
+//             queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                             + CollectionObjectJAXBSchema.COMMENTS, co.getComments());\r
+//             queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                             + CollectionObjectJAXBSchema.DIST_FEATURES, co\r
+//                             .getDistFeatures());\r
+//             queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                             + CollectionObjectJAXBSchema.OBJECT_NAME, co.getObjectName());\r
+//             queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                             + CollectionObjectJAXBSchema.RESPONSIBLE_DEPT, co\r
+//                             .getResponsibleDept());\r
+//             queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                             + CollectionObjectJAXBSchema.TITLE, co.getTitle());\r
+//\r
+//             ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);\r
+//             Representation res = nxClient.post(pathParams, queryParams, bais);\r
+//\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
+\r
+               return result;\r
        }\r
 \r
        public Document putCollectionObject(String csid, CollectionObject theUpdate)\r
                        throws DocumentException, IOException {\r
-               List<String> pathParams = new ArrayList<String>();\r
-               Map<String, String> queryParams = new HashMap<String, String>();\r
-               pathParams.add("default");\r
-               pathParams.add(csid);\r
-               pathParams.add("updateDocumentRestlet");\r
-\r
-               // todo: intelligent merge needed\r
-               if (theUpdate.getObjectNumber() != null) {\r
-                       queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                                       + CollectionObjectJAXBSchema.OBJECT_NUMBER, theUpdate\r
-                                       .getObjectNumber());\r
-               }\r
-\r
-               if (theUpdate.getOtherNumber() != null) {\r
-                       queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                                       + CollectionObjectJAXBSchema.OTHER_NUMBER, theUpdate\r
-                                       .getOtherNumber());\r
-               }\r
-\r
-               if (theUpdate.getBriefDescription() != null) {\r
-                       queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                                       + CollectionObjectJAXBSchema.BRIEF_DESCRIPTION, theUpdate\r
-                                       .getBriefDescription());\r
-               }\r
-\r
-               if (theUpdate.getComments() != null) {\r
-                       queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                                       + CollectionObjectJAXBSchema.COMMENTS, theUpdate\r
-                                       .getComments());\r
-               }\r
-\r
-               if (theUpdate.getDistFeatures() != null) {\r
-                       queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                                       + CollectionObjectJAXBSchema.DIST_FEATURES, theUpdate\r
-                                       .getDistFeatures());\r
-               }\r
-\r
-               if (theUpdate.getObjectName() != null) {\r
-                       queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                                       + CollectionObjectJAXBSchema.OBJECT_NAME, theUpdate\r
-                                       .getObjectName());\r
-               }\r
-\r
-               if (theUpdate.getResponsibleDept() != null) {\r
-                       queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                                       + CollectionObjectJAXBSchema.RESPONSIBLE_DEPT, theUpdate\r
-                                       .getResponsibleDept());\r
-               }\r
-\r
-               if (theUpdate.getTitle() != null) {\r
-                       queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
-                                       + CollectionObjectJAXBSchema.TITLE, theUpdate.getTitle());\r
-               }\r
-\r
-               NuxeoRESTClient nxClient = getClient();\r
-               Representation res = nxClient.get(pathParams, queryParams);\r
-               SAXReader reader = new SAXReader();\r
-               Document document = reader.read(res.getStream());\r
-\r
-               return document;\r
+               \r
+               Document result = null;\r
+               \r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//             pathParams.add("default");\r
+//             pathParams.add(csid);\r
+//             pathParams.add("updateDocumentRestlet");\r
+//\r
+//             // todo: intelligent merge needed\r
+//             if (theUpdate.getObjectNumber() != null) {\r
+//                     queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + CollectionObjectJAXBSchema.OBJECT_NUMBER, theUpdate\r
+//                                     .getObjectNumber());\r
+//             }\r
+//\r
+//             if (theUpdate.getOtherNumber() != null) {\r
+//                     queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + CollectionObjectJAXBSchema.OTHER_NUMBER, theUpdate\r
+//                                     .getOtherNumber());\r
+//             }\r
+//\r
+//             if (theUpdate.getBriefDescription() != null) {\r
+//                     queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + CollectionObjectJAXBSchema.BRIEF_DESCRIPTION, theUpdate\r
+//                                     .getBriefDescription());\r
+//             }\r
+//\r
+//             if (theUpdate.getComments() != null) {\r
+//                     queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + CollectionObjectJAXBSchema.COMMENTS, theUpdate\r
+//                                     .getComments());\r
+//             }\r
+//\r
+//             if (theUpdate.getDistFeatures() != null) {\r
+//                     queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + CollectionObjectJAXBSchema.DIST_FEATURES, theUpdate\r
+//                                     .getDistFeatures());\r
+//             }\r
+//\r
+//             if (theUpdate.getObjectName() != null) {\r
+//                     queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + CollectionObjectJAXBSchema.OBJECT_NAME, theUpdate\r
+//                                     .getObjectName());\r
+//             }\r
+//\r
+//             if (theUpdate.getResponsibleDept() != null) {\r
+//                     queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + CollectionObjectJAXBSchema.RESPONSIBLE_DEPT, theUpdate\r
+//                                     .getResponsibleDept());\r
+//             }\r
+//\r
+//             if (theUpdate.getTitle() != null) {\r
+//                     queryParams.put(CO_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + CollectionObjectJAXBSchema.TITLE, theUpdate.getTitle());\r
+//             }\r
+//\r
+//             NuxeoRESTClient nxClient = getClient();\r
+//             Representation res = nxClient.get(pathParams, queryParams);\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
+\r
+               return result;\r
        }\r
 \r
 }\r
diff --git a/services/common/src/main/java/org/collectionspace/services/common/query/IQueryManager.java b/services/common/src/main/java/org/collectionspace/services/common/query/IQueryManager.java
new file mode 100644 (file)
index 0000000..98c4887
--- /dev/null
@@ -0,0 +1,7 @@
+package org.collectionspace.services.common.query;\r
+\r
+public interface IQueryManager {\r
+       \r
+       public void execQuery(String queryString);\r
+\r
+}\r
diff --git a/services/common/src/main/java/org/collectionspace/services/common/query/QueryManager.java b/services/common/src/main/java/org/collectionspace/services/common/query/QueryManager.java
new file mode 100644 (file)
index 0000000..4cc2bf8
--- /dev/null
@@ -0,0 +1,11 @@
+package org.collectionspace.services.common.query;\r
+\r
+import org.collectionspace.services.common.query.nuxeo.QueryManagerNuxeoImpl;\r
+\r
+public class QueryManager {\r
+       static private final IQueryManager queryManager = new QueryManagerNuxeoImpl();\r
+       \r
+       static public void execQuery(String queryString) {\r
+               queryManager.execQuery(queryString);\r
+       }\r
+}\r
diff --git a/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java b/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java
new file mode 100644 (file)
index 0000000..8240ef4
--- /dev/null
@@ -0,0 +1,43 @@
+package org.collectionspace.services.common.query.nuxeo;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+import org.nuxeo.ecm.core.api.DocumentModel;\r
+import org.nuxeo.ecm.core.api.DocumentModelList;\r
+import org.nuxeo.ecm.core.api.repository.RepositoryInstance;\r
+import org.nuxeo.ecm.core.client.NuxeoClient;\r
+\r
+import org.collectionspace.services.nuxeo.client.java.NuxeoConnector;\r
+import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClient;\r
+import org.collectionspace.services.common.query.IQueryManager;\r
+\r
+public class QueryManagerNuxeoImpl implements IQueryManager {\r
+       \r
+       private final Logger logger = LoggerFactory\r
+                       .getLogger(RepositoryJavaClient.class);\r
+       \r
+       public void execQuery(String queryString) {\r
+               NuxeoClient client = null;\r
+               try {\r
+                       client = NuxeoConnector.getInstance().getClient();\r
+                       RepositoryInstance repoSession = client.openRepository();\r
+                       \r
+                       DocumentModelList docModelList = repoSession.query("SELECT * FROM Relation WHERE relation:relationtype.documentId1='updated-Subject-1'");\r
+//                     DocumentModelList docModelList = repoSession.query("SELECT * FROM Relation");\r
+//                     DocumentModelList docModelList = repoSession.query("SELECT * FROM CollectionObject WHERE collectionobject:objectNumber='objectNumber-1251305545865'");\r
+                       for (DocumentModel docModel : docModelList) {\r
+                               System.out.println("--------------------------------------------");\r
+                               System.out.println(docModel.getPathAsString());\r
+                               System.out.println(docModel.getName());\r
+                               System.out.println(docModel.getPropertyValue("dc:title"));\r
+//                             System.out.println("documentId1=" + docModel.getProperty("relation", "relationtype/documentId1").toString());\r
+                       }\r
+                       \r
+               } catch (Exception e) {\r
+                       // TODO Auto-generated catch block\r
+                       e.printStackTrace();\r
+               }               \r
+       }\r
+\r
+}\r
similarity index 95%
rename from services/common/src/main/java/org/collectionspace/services/common/relation/RelationUtils.java
rename to services/common/src/main/java/org/collectionspace/services/common/relation/IRelationsManager.java
index 26351b1a711cd2e1a9f8d7aca6cd64ebd4c5861c..07e17b35bad409b020759bb8c6545b19fc4e8ee9 100644 (file)
@@ -37,7 +37,7 @@ import org.nuxeo.ecm.core.api.DocumentModel;
 /**\r
  * The Interface RelationUtils.\r
  */\r
-public interface RelationUtils {\r
+public interface IRelationsManager {\r
 \r
        /**\r
         * Gets the relationships.\r
index a5043c58c774691eaab1bf99a121b814202f1036..4658e85cebebcb72bb44892f799081b2931f73b4 100644 (file)
@@ -30,9 +30,9 @@ import java.io.IOException;
 import java.util.List;\r
 \r
 import org.collectionspace.services.common.repository.DocumentException;\r
-import org.collectionspace.services.common.relation.nuxeo.RelationUtilsNuxeoImpl;\r
+import org.collectionspace.services.common.relation.nuxeo.RelationsManagerNuxeoImpl;\r
 import org.collectionspace.services.relation.Relation;\r
-import org.collectionspace.services.common.relation.RelationUtils;\r
+import org.collectionspace.services.common.relation.IRelationsManager;\r
 \r
 import org.dom4j.Document;\r
 import org.nuxeo.ecm.core.api.DocumentModel;\r
@@ -52,7 +52,7 @@ public class RelationsManager {
        static public final String OBJECT = "objectCsid";\r
 \r
        /** The relation utils. */\r
-       static private RelationUtils relationUtils = new RelationUtilsNuxeoImpl();\r
+       static private IRelationsManager relationUtils = new RelationsManagerNuxeoImpl();\r
 \r
        /**\r
         * Gets the relationships.\r
similarity index 95%
rename from services/common/src/main/java/org/collectionspace/services/common/relation/nuxeo/RelationUtilsNuxeoImpl.java
rename to services/common/src/main/java/org/collectionspace/services/common/relation/nuxeo/RelationsManagerNuxeoImpl.java
index 6e4d794e1e13eb7b99e9d35cf14d0a5f91b3793a..aa3effef6b62f1afa72737d67e699cd145a8c283 100644 (file)
@@ -35,7 +35,7 @@ import java.util.Map;
 \r
 import org.collectionspace.services.common.relation.RelationJAXBSchema;\r
 import org.collectionspace.services.common.relation.RelationListItemJAXBSchema;\r
-import org.collectionspace.services.common.relation.RelationUtils;\r
+import org.collectionspace.services.common.relation.IRelationsManager;\r
 \r
 import org.collectionspace.services.relation.Relation;\r
 import org.collectionspace.services.relation.RelationList;\r
@@ -65,7 +65,7 @@ import org.slf4j.LoggerFactory;
 /**\r
  * The Class RelationUtilsNuxeoImpl.\r
  */\r
-public class RelationUtilsNuxeoImpl implements RelationUtils {\r
+public class RelationsManagerNuxeoImpl implements IRelationsManager {\r
        \r
        /** The C s_ relatio n_ servic e_ name. */\r
        static public String CS_RELATION_SERVICE_NAME = "relations";\r
@@ -87,7 +87,7 @@ public class RelationUtilsNuxeoImpl implements RelationUtils {
        \r
        /** The logger. */\r
        private static Logger logger = LoggerFactory\r
-       .getLogger(RelationUtilsNuxeoImpl.class);       \r
+       .getLogger(RelationsManagerNuxeoImpl.class);    \r
 \r
 \r
        /**\r
index bcad5ee344b092ca740a60359a964a18dc29ae46..4b49abc02325f9d98e55a67afc456bbda6d98bcb 100644 (file)
@@ -36,129 +36,41 @@ import org.slf4j.LoggerFactory;
  */\r
 public abstract class CollectionSpaceServiceNuxeoImpl {\r
 \r
-       // replace host if not running on localhost\r
-       // static String CS_NUXEO_HOST = "173.45.234.217";\r
-       static String CS_NUXEO_HOST = "localhost";\r
-       static String CS_NUXEO_URI = "http://" + CS_NUXEO_HOST + ":8080/nuxeo";\r
        \r
        protected Logger logger = LoggerFactory\r
                        .getLogger(CollectionSpaceServiceNuxeoImpl.class);\r
 \r
-       public NuxeoRESTClient getClient() {\r
-               NuxeoRESTClient nxClient = new NuxeoRESTClient(CS_NUXEO_URI);\r
-\r
-               nxClient.setAuthType(NuxeoRESTClient.AUTH_TYPE_BASIC);\r
-               nxClient.setBasicAuthentication("Administrator", "Administrator");\r
-\r
-               return nxClient;\r
-       }\r
-\r
-// FIXME: Replace this method after integration of the relation code\r
-       protected RepositoryInstance getRepositorySession() throws Exception {\r
+//     public NuxeoRESTClient getClient() {\r
+//             NuxeoRESTClient nxClient = new NuxeoRESTClient(CS_NUXEO_URI);\r
+//\r
+//             nxClient.setAuthType(NuxeoRESTClient.AUTH_TYPE_BASIC);\r
+//             nxClient.setBasicAuthentication("Administrator", "Administrator");\r
+//\r
+//             return nxClient;\r
+//     }\r
+\r
+    \r
+    protected RepositoryInstance getRepositorySession() throws Exception {\r
                // FIXME: is it possible to reuse repository session?\r
                // Authentication failures happen while trying to reuse the session\r
-               NuxeoConnector nuxeoConnector = NuxeoConnector.getInstance();\r
-               return nuxeoConnector.getRepositorySession();\r
-       }\r
-                       \r
-       protected Document deleteDocument(RepositoryInstance repoSession, String csid)\r
-                       throws DocumentException, IOException {\r
-               Document result = null;\r
-\r
-               try {\r
-                       repoSession = getRepositorySession();\r
-                       DocumentRef relDocumentRef = new IdRef(csid);\r
-                       \r
-            try{\r
-                repoSession.removeDocument(relDocumentRef);\r
-            }catch(ClientException ce){\r
-                String msg = "could not find document to delete with id=" + csid;\r
-                logger.error(msg, ce);\r
-                throw new DocumentNotFoundException(msg, ce);\r
-            }\r
-            repoSession.save();                        \r
-               } catch (Exception e) {\r
-                       e.printStackTrace();\r
+               NuxeoClient client = NuxeoConnector.getInstance().getClient();\r
+               RepositoryInstance repoSession = client.openRepository();\r
+               if (logger.isDebugEnabled()) {\r
+                       logger.debug("getRepository() repository root: "\r
+                                       + repoSession.getRootDocument());\r
                }\r
-               \r
-               return result;\r
+               return repoSession;\r
        }\r
-       \r
-       protected Document listWorkspaceContent(RepositoryInstance repoSession,\r
-                       String workspaceName) {\r
-\r
-               DOMDocumentFactory domfactory = new DOMDocumentFactory();\r
-               DOMDocument result = (DOMDocument) domfactory.createDocument();\r
 \r
+    protected void releaseRepositorySession(RepositoryInstance repoSession) {\r
                try {\r
-                       repoSession = getRepositorySession();\r
-                       DocumentModel workspaceModel = NuxeoUtils.getWorkspaceModel(repoSession,\r
-                                       workspaceName);\r
-\r
-                       Element current = result.createElement("document");\r
-                       try {\r
-                               current.setAttribute("title", workspaceModel.getTitle());\r
-                       } catch (Exception e) {\r
-                               e.printStackTrace();\r
-                       }\r
-                       current.setAttribute("type", workspaceModel.getType());\r
-                       current.setAttribute("id", workspaceModel.getId());\r
-                       current.setAttribute("name", workspaceModel.getName());\r
-                       current.setAttribute("url", getRelURL(workspaceName, workspaceModel.getRef().toString()));\r
-                       result.setRootElement((org.dom4j.Element) current);\r
-\r
-                       if (workspaceModel.isFolder()) {\r
-                               // Element childrenElem = result.createElement("children");\r
-                               // root.appendChild(childrenElem);\r
-\r
-                               DocumentModelList children = null;\r
-                               try {\r
-                                       children = repoSession.getChildren(workspaceModel.getRef());\r
-                               } catch (ClientException e) {\r
-                                       e.printStackTrace();\r
-                               }\r
-\r
-                               for (DocumentModel child : children) {\r
-                                       Element el = result.createElement("document");\r
-                                       try {\r
-                                               el.setAttribute("title", child.getTitle());\r
-                                       } catch (DOMException e) {\r
-                                               e.printStackTrace();\r
-                                       } catch (ClientException e) {\r
-                                               e.printStackTrace();\r
-                                       }\r
-                                       el.setAttribute("type", child.getType());\r
-                                       el.setAttribute("id", child.getId());\r
-                                       el.setAttribute("name", child.getName());\r
-                                       el.setAttribute("url", getRelURL(workspaceName, child.getRef()\r
-                                                       .toString()));\r
-                                       current.appendChild(el);\r
-                               }\r
-                       }\r
-\r
-               } catch (Exception e) {\r
-                       e.printStackTrace();\r
-               }\r
-               \r
-               if (logger.isDebugEnabled() == true) {\r
-                       System.out.println(result.asXML());\r
-               }\r
-\r
-               return result;\r
-       }\r
-\r
-       protected void releaseRepositorySession(RepositoryInstance repoSession) {\r
-               try {\r
+                       NuxeoClient client = NuxeoConnector.getInstance().getClient();\r
                        // release session\r
-                       NuxeoConnector nuxeoConnector = NuxeoConnector.getInstance();\r
-                       nuxeoConnector.releaseRepositorySession(repoSession);\r
+                       client.releaseRepository(repoSession);\r
                } catch (Exception e) {\r
                        logger.error("Could not close the repository session", e);\r
                        // no need to throw this service specific exception\r
                }\r
        }\r
-       \r
-    private static String getRelURL(String repo, String uuid) {\r
-        return '/' + repo + '/' + uuid;\r
-    }  \r
+    \r
 }\r
index 63f5ee55ca6009cf92a4475e9d0a809a3cc7d868..003432699649966a368756730dd5e66e6c656007 100644 (file)
@@ -39,169 +39,177 @@ public class IntakeServiceNuxeoImpl extends
        public Document deleteIntake(String csid)\r
                        throws DocumentException, IOException {\r
 \r
-               NuxeoRESTClient nxClient = getClient();\r
-               List<String> pathParams = new ArrayList<String>();\r
-               Map<String, String> queryParams = new HashMap<String, String>();\r
-\r
-               pathParams.add("default");\r
-               pathParams.add(csid);\r
-               pathParams.add("deleteDocumentRestlet");\r
-               Representation res = nxClient.get(pathParams, queryParams);\r
-               SAXReader reader = new SAXReader();\r
-               Document document = reader.read(res.getStream());\r
+               Document result = null;\r
+               \r
+//             NuxeoRESTClient nxClient = getClient();\r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//\r
+//             pathParams.add("default");\r
+//             pathParams.add(csid);\r
+//             pathParams.add("deleteDocumentRestlet");\r
+//             Representation res = nxClient.get(pathParams, queryParams);\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
                \r
-               return document;\r
+               return result;\r
        }\r
 \r
        public Document getIntake(String csid) throws DocumentException,\r
                        IOException {\r
-               List<String> pathParams = new ArrayList<String>();\r
-               Map<String, String> queryParams = new HashMap<String, String>();\r
-\r
-               pathParams.add("default");\r
-               pathParams.add(csid);\r
-               pathParams.add("export");\r
-               queryParams.put("format", "XML");\r
-\r
-               NuxeoRESTClient nxClient = getClient();\r
-               Representation res = nxClient.get(pathParams, queryParams);\r
-\r
-               SAXReader reader = new SAXReader();\r
-               Document document = reader.read(res.getStream());\r
+               Document result = null;\r
+               \r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//\r
+//             pathParams.add("default");\r
+//             pathParams.add(csid);\r
+//             pathParams.add("export");\r
+//             queryParams.put("format", "XML");\r
+//\r
+//             NuxeoRESTClient nxClient = getClient();\r
+//             Representation res = nxClient.get(pathParams, queryParams);\r
+//\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
 \r
-               return document;\r
+               return result;\r
        }\r
 \r
        public Document getIntakeList() throws DocumentException,\r
                        IOException {\r
                Document result = null;\r
 \r
-               NuxeoRESTClient nxClient = getClient();\r
-               List<String> pathParams = new ArrayList<String>();\r
-               Map<String, String> queryParams = new HashMap<String, String>();\r
-               pathParams = Arrays.asList("default",\r
-                               CS_INTAKE_WORKSPACE_UID, "browse");\r
-               Representation res = nxClient.get(pathParams, queryParams);\r
-               SAXReader reader = new SAXReader();\r
-               result = reader.read(res.getStream());\r
+//             NuxeoRESTClient nxClient = getClient();\r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//             pathParams = Arrays.asList("default",\r
+//                             CS_INTAKE_WORKSPACE_UID, "browse");\r
+//             Representation res = nxClient.get(pathParams, queryParams);\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
 \r
                return result;\r
        }\r
 \r
        public Document postIntake(Intake co)\r
                        throws DocumentException, IOException {\r
-               NuxeoRESTClient nxClient = getClient();\r
-\r
-               List<String> pathParams = new ArrayList<String>();\r
-               Map<String, String> queryParams = new HashMap<String, String>();\r
-               pathParams.add("default");\r
-               pathParams.add(CS_INTAKE_WORKSPACE_UID);\r
-               pathParams.add("createDocument");\r
-               queryParams.put("docType", INTAKE_NUXEO_DOCTYPE);\r
-\r
-               // a default title for the Dublin Core schema\r
-               queryParams.put("dublincore:title", INTAKE_NUXEO_DC_TITLE);\r
-\r
-               // Intake core values\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.CURRENT_OWNER, co\r
-                               .getCurrentOwner());\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.DEPOSITOR, co.getDepositor());\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.DEPOSITORS_REQUIREMENTS, co\r
-                               .getDepositorsRequirements());\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.ENTRY_DATE, co.getEntryDate());\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.ENTRY_METHOD, co\r
-                               .getEntryMethod());\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.ENTRY_NOTE, co.getEntryNote());\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.ENTRY_NUMBER, co\r
-                               .getEntryNumber());\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.ENTRY_REASON, co.getEntryReason());\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.PACKING_NOTE, co.getPackingNote());\r
-               queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                               + IntakeJAXBSchema.RETURN_DATE, co.getReturnDate());\r
-\r
-               ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);\r
-               Representation res = nxClient.post(pathParams, queryParams, bais);\r
-\r
-               SAXReader reader = new SAXReader();\r
-               Document document = reader.read(res.getStream());\r
-\r
-               return document;\r
+               Document result = null;\r
+               \r
+//             NuxeoRESTClient nxClient = getClient();\r
+//\r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//             pathParams.add("default");\r
+//             pathParams.add(CS_INTAKE_WORKSPACE_UID);\r
+//             pathParams.add("createDocument");\r
+//             queryParams.put("docType", INTAKE_NUXEO_DOCTYPE);\r
+//\r
+//             // a default title for the Dublin Core schema\r
+//             queryParams.put("dublincore:title", INTAKE_NUXEO_DC_TITLE);\r
+//\r
+//             // Intake core values\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.CURRENT_OWNER, co\r
+//                             .getCurrentOwner());\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.DEPOSITOR, co.getDepositor());\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.DEPOSITORS_REQUIREMENTS, co\r
+//                             .getDepositorsRequirements());\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.ENTRY_DATE, co.getEntryDate());\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.ENTRY_METHOD, co\r
+//                             .getEntryMethod());\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.ENTRY_NOTE, co.getEntryNote());\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.ENTRY_NUMBER, co\r
+//                             .getEntryNumber());\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.ENTRY_REASON, co.getEntryReason());\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.PACKING_NOTE, co.getPackingNote());\r
+//             queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                             + IntakeJAXBSchema.RETURN_DATE, co.getReturnDate());\r
+//\r
+//             ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);\r
+//             Representation res = nxClient.post(pathParams, queryParams, bais);\r
+//\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
+\r
+               return result;\r
        }\r
 \r
        public Document putIntake(String csid, Intake theUpdate)\r
                        throws DocumentException, IOException {\r
-               List<String> pathParams = new ArrayList<String>();\r
-               Map<String, String> queryParams = new HashMap<String, String>();\r
-               pathParams.add("default");\r
-               pathParams.add(csid);\r
-               pathParams.add("updateDocumentRestlet");\r
-\r
-               // todo: intelligent merge needed\r
-               if (theUpdate.getCurrentOwner() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.CURRENT_OWNER, theUpdate.getCurrentOwner());\r
-               }\r
-\r
-               if (theUpdate.getDepositor() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.DEPOSITOR, theUpdate.getDepositor());\r
-               }\r
-\r
-               if (theUpdate.getDepositorsRequirements() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.DEPOSITORS_REQUIREMENTS, theUpdate.getDepositorsRequirements());\r
-               }\r
-\r
-               if (theUpdate.getEntryDate() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.ENTRY_DATE, theUpdate.getEntryDate());\r
-               }\r
-\r
-               if (theUpdate.getEntryMethod() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.ENTRY_METHOD, theUpdate.getEntryMethod());\r
-               }\r
-\r
-               if (theUpdate.getEntryNote() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.ENTRY_NOTE, theUpdate.getEntryNote());\r
-               }\r
-\r
-               if (theUpdate.getEntryNumber() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.ENTRY_NUMBER, theUpdate.getEntryNumber());\r
-               }\r
-\r
-               if (theUpdate.getEntryReason() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.ENTRY_REASON, theUpdate.getEntryReason());\r
-               }\r
-\r
-               if (theUpdate.getPackingNote() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.PACKING_NOTE, theUpdate.getPackingNote());\r
-               }\r
-\r
-               if (theUpdate.getReturnDate() != null) {\r
-                       queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
-                                       + IntakeJAXBSchema.RETURN_DATE, theUpdate.getReturnDate());\r
-               }\r
-\r
-               NuxeoRESTClient nxClient = getClient();\r
-               Representation res = nxClient.get(pathParams, queryParams);\r
-               SAXReader reader = new SAXReader();\r
-               Document document = reader.read(res.getStream());\r
-\r
-               return document;\r
+               Document result = null;\r
+               \r
+//             List<String> pathParams = new ArrayList<String>();\r
+//             Map<String, String> queryParams = new HashMap<String, String>();\r
+//             pathParams.add("default");\r
+//             pathParams.add(csid);\r
+//             pathParams.add("updateDocumentRestlet");\r
+//\r
+//             // todo: intelligent merge needed\r
+//             if (theUpdate.getCurrentOwner() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.CURRENT_OWNER, theUpdate.getCurrentOwner());\r
+//             }\r
+//\r
+//             if (theUpdate.getDepositor() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.DEPOSITOR, theUpdate.getDepositor());\r
+//             }\r
+//\r
+//             if (theUpdate.getDepositorsRequirements() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.DEPOSITORS_REQUIREMENTS, theUpdate.getDepositorsRequirements());\r
+//             }\r
+//\r
+//             if (theUpdate.getEntryDate() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.ENTRY_DATE, theUpdate.getEntryDate());\r
+//             }\r
+//\r
+//             if (theUpdate.getEntryMethod() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.ENTRY_METHOD, theUpdate.getEntryMethod());\r
+//             }\r
+//\r
+//             if (theUpdate.getEntryNote() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.ENTRY_NOTE, theUpdate.getEntryNote());\r
+//             }\r
+//\r
+//             if (theUpdate.getEntryNumber() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.ENTRY_NUMBER, theUpdate.getEntryNumber());\r
+//             }\r
+//\r
+//             if (theUpdate.getEntryReason() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.ENTRY_REASON, theUpdate.getEntryReason());\r
+//             }\r
+//\r
+//             if (theUpdate.getPackingNote() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.PACKING_NOTE, theUpdate.getPackingNote());\r
+//             }\r
+//\r
+//             if (theUpdate.getReturnDate() != null) {\r
+//                     queryParams.put(INTAKE_NUXEO_SCHEMA_NAME + ":"\r
+//                                     + IntakeJAXBSchema.RETURN_DATE, theUpdate.getReturnDate());\r
+//             }\r
+//\r
+//             NuxeoRESTClient nxClient = getClient();\r
+//             Representation res = nxClient.get(pathParams, queryParams);\r
+//             SAXReader reader = new SAXReader();\r
+//             result = reader.read(res.getStream());\r
+\r
+               return result;\r
        }\r
 \r
 }\r
index e6092187504e0ff0664e070f5971f312ce37ae2c..1286b5faeca0fbd157656049c85c689118f6bcd1 100644 (file)
@@ -19,6 +19,7 @@
         <module>common</module>\r
         <module>authentication</module>\r
         <module>relation</module>\r
+        <module>query</module>\r
         <module>id</module>\r
         <module>collectionobject</module>\r
         <module>intake</module>\r
diff --git a/services/query/.classpath b/services/query/.classpath
new file mode 100644 (file)
index 0000000..0469885
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+       <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+       <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
diff --git a/services/query/.project b/services/query/.project
new file mode 100644 (file)
index 0000000..0d231ba
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>org.collectionspace.services.collectionobject</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.maven.ide.eclipse.maven2Builder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+               <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/services/query/.settings/org.eclipse.jdt.core.prefs b/services/query/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..b634d9c
--- /dev/null
@@ -0,0 +1,5 @@
+#Thu Apr 30 16:21:29 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
diff --git a/services/query/.settings/org.maven.ide.eclipse.prefs b/services/query/.settings/org.maven.ide.eclipse.prefs
new file mode 100644 (file)
index 0000000..86c513b
--- /dev/null
@@ -0,0 +1,8 @@
+#Thu Jul 16 13:50:16 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
diff --git a/services/query/pom.xml b/services/query/pom.xml
new file mode 100644 (file)
index 0000000..e054046
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+    <parent>\r
+        <artifactId>org.collectionspace.services.main</artifactId>\r
+        <groupId>org.collectionspace.services</groupId>\r
+        <version>1.0</version>\r
+    </parent>\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <groupId>org.collectionspace.services</groupId>\r
+    <version>1.0</version>\r
+    <artifactId>org.collectionspace.services.query</artifactId>\r
+    <packaging>pom</packaging>\r
+    <name>services.query</name>\r
+\r
+    <modules>\r
+        <module>service</module>\r
+    </modules>\r
+\r
+    <build>\r
+        <pluginManagement>\r
+            <plugins>\r
+                <plugin>\r
+                    <groupId>org.apache.maven.plugins</groupId>\r
+                    <artifactId>maven-compiler-plugin</artifactId>\r
+                    <configuration>\r
+                        <source>1.5</source>\r
+                        <target>1.5</target>\r
+                    </configuration>\r
+                </plugin>\r
+                <plugin>\r
+                    <groupId>org.apache.maven.plugins</groupId>\r
+                    <artifactId>maven-site-plugin</artifactId>\r
+                    <configuration>\r
+                        <unzipCommand>/usr/bin/unzip -o &gt; err.txt</unzipCommand>\r
+                    </configuration>\r
+                </plugin>\r
+                <plugin>\r
+                    <groupId>org.apache.maven.plugins</groupId>\r
+                    <artifactId>maven-war-plugin</artifactId>\r
+                    <version>2.0.1</version>\r
+                    <configuration>\r
+                        <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>\r
+                        <archive>\r
+                            <manifest>\r
+                                <addClasspath>true</addClasspath>\r
+                            </manifest>\r
+                        </archive>\r
+                    </configuration>\r
+                </plugin>\r
+            </plugins>\r
+        </pluginManagement>\r
+        <plugins>\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-compiler-plugin</artifactId>\r
+                <version>2.0.2</version>\r
+                <configuration>\r
+                    <source>1.6</source>\r
+                    <target>1.6</target>\r
+                </configuration>\r
+            </plugin>\r
+        </plugins>\r
+    </build>\r
+</project>\r
+\r
diff --git a/services/query/service/.classpath b/services/query/service/.classpath
new file mode 100644 (file)
index 0000000..199bbbb
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+       <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+       <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+       <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
diff --git a/services/query/service/.project b/services/query/service/.project
new file mode 100644 (file)
index 0000000..2307d23
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>org.collectionspace.services.collectionobject.service</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.maven.ide.eclipse.maven2Builder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+               <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/services/query/service/pom.xml b/services/query/service/pom.xml
new file mode 100644 (file)
index 0000000..f60c5fc
--- /dev/null
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+\r
+    <parent>\r
+        <artifactId>org.collectionspace.services.query</artifactId>\r
+        <groupId>org.collectionspace.services</groupId>\r
+        <version>1.0</version>\r
+    </parent>\r
+    \r
+    <modelVersion>4.0.0</modelVersion>\r
+    <groupId>org.collectionspace.services</groupId>\r
+    <artifactId>org.collectionspace.services.query.service</artifactId>\r
+    <packaging>jar</packaging>\r
+    <version>1.0</version>\r
+    <name>services.query.service</name>\r
+\r
+    <dependencies>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.common</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-api</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-log4j12</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>junit</groupId>\r
+            <artifactId>junit</artifactId>\r
+            <version>4.1</version>\r
+            <scope>test</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.testng</groupId>\r
+            <artifactId>testng</artifactId>\r
+            <version>5.6</version>\r
+        </dependency>\r
+        \r
+        <!-- apache -->\r
+        <dependency>\r
+            <groupId>commons-beanutils</groupId>\r
+            <artifactId>commons-beanutils</artifactId>\r
+            <version>1.6.1</version>\r
+        </dependency>\r
+        <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->\r
+        <dependency>\r
+            <groupId>commons-logging</groupId>\r
+            <artifactId>commons-logging</artifactId>\r
+            <version>1.1</version>\r
+        </dependency>\r
+      <!-- javax -->\r
+\r
+\r
+        <dependency>\r
+            <groupId>javax.security</groupId>\r
+            <artifactId>jaas</artifactId>\r
+            <version>1.0.01</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>dom4j</groupId>\r
+            <artifactId>dom4j</artifactId>\r
+            <version>1.6.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        \r
+        <!-- jboss -->\r
+\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxrs</artifactId>\r
+            <version>1.0.2.GA</version>\r
+            <exclusions>\r
+                <exclusion>\r
+                    <groupId>tjws</groupId>\r
+                    <artifactId>webserver</artifactId>\r
+                </exclusion>\r
+            </exclusions>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxb-provider</artifactId>\r
+            <version>1.0.2.GA</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-multipart-provider</artifactId>\r
+            <version>1.0.2.GA</version>\r
+        </dependency>\r
+        \r
+        <!-- nuxeo -->\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-api</artifactId>\r
+            <version>${nuxeo.version.1.5}</version>\r
+            <exclusions>\r
+                <exclusion>\r
+                    <artifactId>jboss-remoting</artifactId>\r
+                    <groupId>jboss</groupId>\r
+                </exclusion>\r
+            </exclusions>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.restlet</groupId>\r
+            <artifactId>org.restlet</artifactId>\r
+            <version>1.0.7</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>com.noelios.restlet</groupId>\r
+            <artifactId>com.noelios.restlet.ext.httpclient</artifactId>\r
+            <version>1.0.7</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>com.noelios.restlet</groupId>\r
+            <artifactId>com.noelios.restlet</artifactId>\r
+            <version>1.0.7</version>\r
+        </dependency>\r
+\r
+    </dependencies>\r
+    \r
+    <build>\r
+        <finalName>collectionspace-services-query</finalName>\r
+        <plugins>\r
+            <plugin>\r
+                <groupId>org.codehaus.mojo</groupId>\r
+                <artifactId>jboss-maven-plugin</artifactId>\r
+                <configuration>\r
+                    <jbossHome>${jboss.dir}</jbossHome>\r
+                </configuration>\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-compiler-plugin</artifactId>\r
+                <configuration>\r
+                    <source>1.6</source>\r
+                    <target>1.6</target>\r
+                </configuration>\r
+            </plugin>\r
+        </plugins>\r
+    </build>\r
+</project>\r
+\r
diff --git a/services/query/service/src/main/java/org/collectionspace/services/query/QueryResource.java b/services/query/service/src/main/java/org/collectionspace/services/query/QueryResource.java
new file mode 100644 (file)
index 0000000..e99aeaf
--- /dev/null
@@ -0,0 +1,122 @@
+/**\r
+ *  This document is a part of the source code and related artifacts\r
+ *  for CollectionSpace, an open source collections management system\r
+ *  for museums and related institutions:\r
+\r
+ *  http://www.collectionspace.org\r
+ *  http://wiki.collectionspace.org\r
+\r
+ *  Copyright 2009 University of California at Berkeley\r
+\r
+ *  Licensed under the Educational Community License (ECL), Version 2.0.\r
+ *  You may not use this file except in compliance with this License.\r
+\r
+ *  You may obtain a copy of the ECL 2.0 License at\r
+\r
+ *  https://source.collectionspace.org/collection-space/LICENSE.txt\r
+\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+package org.collectionspace.services.query;\r
+\r
+import javax.ws.rs.Consumes;\r
+import javax.ws.rs.GET;\r
+import javax.ws.rs.Path;\r
+import javax.ws.rs.Produces;\r
+import javax.ws.rs.DELETE;\r
+import javax.ws.rs.POST;\r
+import javax.ws.rs.PUT;\r
+import javax.ws.rs.PathParam;\r
+import javax.ws.rs.WebApplicationException;\r
+import javax.ws.rs.core.Context;\r
+import javax.ws.rs.core.Response;\r
+import javax.ws.rs.core.UriBuilder;\r
+import javax.ws.rs.core.UriInfo;\r
+import javax.xml.bind.JAXBContext;\r
+import javax.xml.bind.Marshaller;\r
+\r
+import org.collectionspace.services.common.query.QueryManager;\r
+import org.collectionspace.services.common.NuxeoClientType;\r
+import org.collectionspace.services.common.ServiceMain;\r
+import org.collectionspace.services.common.repository.DocumentNotFoundException;\r
+import org.collectionspace.services.common.repository.DocumentHandler;\r
+import org.collectionspace.services.common.repository.RepositoryClient;\r
+import org.collectionspace.services.common.repository.RepositoryClientFactory;\r
+import org.jboss.resteasy.util.HttpResponseCodes;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+@Path("/query")\r
+@Consumes("application/xml")\r
+@Produces("application/xml")\r
+public class QueryResource {\r
+\r
+    public final static String SERVICE_NAME = "query";\r
+    final Logger logger = LoggerFactory.getLogger(QueryResource.class);\r
+    //FIXME retrieve client type from configuration\r
+    final static NuxeoClientType CLIENT_TYPE = ServiceMain.getInstance().getNuxeoClientType();\r
+\r
+    public QueryResource() {\r
+        // do nothing\r
+    }\r
+\r
+    @GET\r
+    @Path("{csid}")\r
+    public void getQuery(\r
+            @PathParam("csid") String csid) {\r
+        if(logger.isDebugEnabled()){\r
+            verbose("getQuery with csid=" + csid);\r
+        }\r
+        if(csid == null || "".equals(csid)){\r
+            logger.error("getQuery: missing csid!");\r
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(\r
+                    "get failed on getQuery csid=" + csid).type(\r
+                    "text/plain").build();\r
+            throw new WebApplicationException(response);\r
+        }\r
+\r
+        try {\r
+               QueryManager.execQuery(csid);\r
+        } catch(Exception e){\r
+            if(logger.isDebugEnabled()){\r
+                logger.debug("getQuery", e);\r
+            }\r
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
+                    "Get failed on query csid=" + csid).type(\r
+                    "text/plain").build();\r
+            throw new WebApplicationException(response);\r
+        }\r
+\r
+        if(false){\r
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
+                    "Get failed, the requested CSID:" + csid + ": was not found.").type(\r
+                    "text/plain").build();\r
+            throw new WebApplicationException(response);\r
+        }\r
+\r
+//        return intakeObject;\r
+    }\r
+\r
+//    private void verbose(String msg, Intake intakeObject) {\r
+//        try{\r
+//            verbose(msg);\r
+//            JAXBContext jc = JAXBContext.newInstance(\r
+//                    Intake.class);\r
+//\r
+//            Marshaller m = jc.createMarshaller();\r
+//            m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);\r
+//            m.marshal(intakeObject, System.out);\r
+//        }catch(Exception e){\r
+//            e.printStackTrace();\r
+//        }\r
+//\r
+//    }\r
+\r
+    private void verbose(String msg) {\r
+        System.out.println("QueryResource. " + msg);\r
+    }\r
+}\r
index 2f4f0096243229de39ca7a7b2e5b847a8f5ca885..2ec1700ec9aa38816eac450c49ba9685bceff7dd 100644 (file)
@@ -113,6 +113,9 @@ public class NewRelationResource extends CollectionSpaceResource {
                }
        }
        
+       /*
+        * Prototype for using NXQL -will move away from here once protyping is finished.
+        */
        @GET
        @Path("query/{queryValue}")
        public Response getQuery(@PathParam("queryValue") String queryString) {
@@ -122,6 +125,8 @@ public class NewRelationResource extends CollectionSpaceResource {
                if (logger.isDebugEnabled() == true) {
                        logger.debug("Query string is: " + queryString);
                }
+               
+               //getDefaultClient().
                                
                result = Response.status(Response.Status.ACCEPTED).entity(
                                                "Query performed. Look in $JBOSS_HOME/server/cspace/log/" +
index c6b74c1a65f97cb44268c177385eee8549482390..0db9aa60296b24e256fa63185566394e053ff32a 100644 (file)
@@ -28,7 +28,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.collectionspace.services.common.relation.RelationJAXBSchema;
-import org.collectionspace.services.common.relation.nuxeo.RelationUtilsNuxeoImpl;
+import org.collectionspace.services.common.relation.nuxeo.RelationsManagerNuxeoImpl;
 import org.collectionspace.services.common.relation.RelationsManager;
 
 import org.collectionspace.services.relation.Relation;
@@ -108,7 +108,7 @@ public class RelationDocumentModelHandler
         DocumentModel docModel = (DocumentModel) wrapDoc.getWrappedObject();
         Relation theRelation = new Relation();
         
-        RelationUtilsNuxeoImpl.fillRelationFromDocModel(theRelation, docModel);
+        RelationsManagerNuxeoImpl.fillRelationFromDocModel(theRelation, docModel);
 
         return theRelation;
     }
@@ -117,7 +117,7 @@ public class RelationDocumentModelHandler
     public void fillCommonObject(Relation relation, DocumentWrapper wrapDoc) throws Exception {
         DocumentModel docModel = (DocumentModel) wrapDoc.getWrappedObject();
 
-        RelationUtilsNuxeoImpl.fillDocModelFromRelation(relation, docModel);
+        RelationsManagerNuxeoImpl.fillDocModelFromRelation(relation, docModel);
     }
 
     @Override
@@ -140,7 +140,7 @@ public class RelationDocumentModelHandler
             if (RelationsManager.isQueryMatch(docModel, subjectCsid,
                                        predicate, objectCsid) == true) {
                                RelationListItem coListItem = new RelationListItem();
-                               RelationUtilsNuxeoImpl.fillRelationListItemFromDocModel(
+                               RelationsManagerNuxeoImpl.fillRelationListItemFromDocModel(
                                                coListItem, docModel);
                                list.add(coListItem);
                        }
index cc974846fa991c50d626aa42dadf468c728d727e..ca09458d8d4d3a24f01174013da41f3bbc956ae6 100644 (file)
@@ -1,7 +1,7 @@
 package org.collectionspace.services.relation.nuxeo;\r
 \r
-import org.collectionspace.services.common.relation.nuxeo.RelationUtilsNuxeoImpl;\r
+import org.collectionspace.services.common.relation.nuxeo.RelationsManagerNuxeoImpl;\r
 \r
 public class RelationNuxeoConstants {\r
-       static String NUXEO_DOCTYPE = RelationUtilsNuxeoImpl.REL_NUXEO_DOCTYPE;\r
+       static String NUXEO_DOCTYPE = RelationsManagerNuxeoImpl.REL_NUXEO_DOCTYPE;\r
 }
\ No newline at end of file
index 85273c21148e2f0a39b94e2487789651a1093dd4..f1e5a9ccbb3bda4ad9497cca94fe65e02f322465 100644 (file)
@@ -39,7 +39,7 @@ import java.util.List;
 import org.collectionspace.services.common.repository.DocumentException;\r
 //import org.collectionspace.services.nuxeo.NuxeoRESTClient;\r
 import org.collectionspace.services.nuxeo.CollectionSpaceServiceNuxeoImpl;\r
-import org.collectionspace.services.common.relation.nuxeo.RelationUtilsNuxeoImpl;\r
+import org.collectionspace.services.common.relation.nuxeo.RelationsManagerNuxeoImpl;\r
 import org.collectionspace.services.relation.Relation;\r
 import org.collectionspace.services.relation.RelationService;\r
 //import org.collectionspace.services.relation.RelationList;\r
@@ -82,20 +82,20 @@ public class RelationServiceNuxeoImpl extends
        public Document deleteRelation(String csid) throws DocumentException {\r
                Document result = null;\r
 \r
-               RepositoryInstance repoSession = null;\r
-               try {\r
-                       repoSession = getRepositorySession();\r
-                       result = deleteDocument(repoSession, csid);\r
-               } catch (Exception e) {\r
-                       if (logger.isDebugEnabled()) {\r
-                               logger.debug("Caught exception ", e);\r
-                       }\r
-                       throw new DocumentException(e);\r
-               } finally {\r
-                       if (repoSession != null) {\r
-                               releaseRepositorySession(repoSession);\r
-                       }\r
-               }\r
+//             RepositoryInstance repoSession = null;\r
+//             try {\r
+//                     repoSession = getRepositorySession();\r
+//                     result = deleteDocument(repoSession, csid);\r
+//             } catch (Exception e) {\r
+//                     if (logger.isDebugEnabled()) {\r
+//                             logger.debug("Caught exception ", e);\r
+//                     }\r
+//                     throw new DocumentException(e);\r
+//             } finally {\r
+//                     if (repoSession != null) {\r
+//                             releaseRepositorySession(repoSession);\r
+//                     }\r
+//             }\r
 \r
                return result;\r
        }\r
@@ -142,7 +142,7 @@ public class RelationServiceNuxeoImpl extends
                        repoSession = getRepositorySession();\r
                        List<Relation> relationList = RelationsManager.getRelationships(repoSession);\r
                        \r
-                       result = RelationUtilsNuxeoImpl.getDocument(relationList);\r
+                       result = RelationsManagerNuxeoImpl.getDocument(relationList);\r
                } catch (Exception e) {\r
                        if (logger.isDebugEnabled()) {\r
                                logger.debug("Caught exception ", e);\r
@@ -175,7 +175,7 @@ public class RelationServiceNuxeoImpl extends
                        List<Relation> relationList = RelationsManager.getRelationships(repoSession,\r
                                        subjectCsid, predicate, objectCsid);\r
                        \r
-                       result = RelationUtilsNuxeoImpl.getDocument(relationList);\r
+                       result = RelationsManagerNuxeoImpl.getDocument(relationList);\r
                } catch (Exception e) {\r
                        if (logger.isDebugEnabled()) {\r
                                logger.debug("Caught exception ", e);\r
@@ -205,7 +205,7 @@ public class RelationServiceNuxeoImpl extends
                \r
                try {\r
                        repoSession = getRepositorySession();\r
-            DocumentModel resultDocModel = RelationUtilsNuxeoImpl.createRelationship(repoSession, co);\r
+            DocumentModel resultDocModel = RelationsManagerNuxeoImpl.createRelationship(repoSession, co);\r
             repoSession.save();\r
             result = NuxeoUtils.getDocument(repoSession, resultDocModel);\r
                } catch (Exception e) {\r
@@ -239,7 +239,7 @@ public class RelationServiceNuxeoImpl extends
             repoSession = getRepositorySession();\r
             DocumentRef documentRef = new IdRef(csid);\r
             DocumentModel documentModel = repoSession.getDocument(documentRef);\r
-            RelationUtilsNuxeoImpl.fillDocModelFromRelation(theUpdate, documentModel);\r
+            RelationsManagerNuxeoImpl.fillDocModelFromRelation(theUpdate, documentModel);\r
             repoSession.saveDocument(documentModel);\r
             repoSession.save();\r
             result = NuxeoUtils.getDocument(repoSession, documentModel);\r