]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-202: First support for POSTing vocab items along with vocab (container) payload.
authorremillet <remillet@yahoo.com>
Thu, 18 Jan 2018 15:57:19 +0000 (07:57 -0800)
committerremillet <remillet@yahoo.com>
Thu, 18 Jan 2018 15:57:19 +0000 (07:57 -0800)
22 files changed:
services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/PostWithItems/postWithItems-vocab.xml
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java
services/client/src/main/java/org/collectionspace/services/client/PayloadPart.java
services/client/src/main/java/org/collectionspace/services/client/PoxPayload.java
services/common/src/main/cspace/config/services/service-config.xml
services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java
services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoBlobUtils.java
services/common/src/main/java/org/collectionspace/services/common/relation/RelationUtils.java
services/common/src/main/java/org/collectionspace/services/common/repository/RepositoryClient.java
services/common/src/main/java/org/collectionspace/services/common/storage/StorageClient.java
services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java
services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoRepositoryClientImpl.java [moved from services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java with 99% similarity]
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java
services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java
services/servicegroup/service/src/main/java/org/collectionspace/services/servicegroup/nuxeo/ServiceGroupDocumentModelHandler.java
services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java

index b2e1809f2fc0a1c09dacf8889dadd9ce9a1d3fdb..4bb5382f2ad0dfac68b5ecfd7d3b58112c277cc0 100644 (file)
@@ -8,13 +8,11 @@
     </ns3:vocabularies_common>
     <ns2:abstract-common-list xmlns:ns2="http://collectionspace.org/services/jaxb">
         <list-item>
-            <proposed>true</proposed>
             <order>1</order>
             <displayName>PostWithItems item PostWithItems1</displayName>
             <shortIdentifier>PostWithItems1</shortIdentifier>
         </list-item>
         <list-item>
-            <proposed>true</proposed>
             <order>2</order>
             <displayName>PostWithItems item PostWithItems2</displayName>
             <shortIdentifier>ShowItemsItem2</shortIdentifier>
index 7277ca066d1434137c47197781ca6287201ed446..883b4504d87e198034985a8bc7ca42a739c1b191 100644 (file)
@@ -86,7 +86,7 @@ import org.collectionspace.services.lifecycle.TransitionDef;
 import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentFilter;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.workflow.WorkflowCommon;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthorityItemSpecifier;
@@ -162,23 +162,23 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      */
     protected DocumentHandler<?, AbstractCommonList, DocumentModel, DocumentModelList> createItemDocumentHandler(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
-            String inAuthority, String parentShortIdentifier)
+            String inAuthority, String containerShortIdentifier)
             throws Exception {
         String authorityRefNameBase;
         AuthorityItemDocumentModelHandler<?> docHandler;
 
-        if (parentShortIdentifier == null) {
+        if (containerShortIdentifier == null) {
             authorityRefNameBase = null;
         } else {
-            ServiceContext<PoxPayloadIn, PoxPayloadOut> parentCtx = createServiceContext(getServiceName());
-            if (parentShortIdentifier.equals(FETCH_SHORT_ID)) { // We need to fetch this from the repo
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> containerCtx = createServiceContext(getServiceName());
+            if (containerShortIdentifier.equals(FETCH_SHORT_ID)) { // We need to fetch this from the repo
                 if (ctx.getCurrentRepositorySession() != null) {
-                       parentCtx.setCurrentRepositorySession(ctx.getCurrentRepositorySession()); // We need to use the current repo session if one exists
+                       containerCtx.setCurrentRepositorySession(ctx.getCurrentRepositorySession()); // We need to use the current repo session if one exists
                 }
                 // Get from parent document
-                parentShortIdentifier = getAuthShortIdentifier(parentCtx, inAuthority);
+                containerShortIdentifier = getAuthShortIdentifier(containerCtx, inAuthority);
             }
-            authorityRefNameBase = buildAuthorityRefNameBase(parentCtx, parentShortIdentifier);
+            authorityRefNameBase = buildAuthorityRefNameBase(containerCtx, containerShortIdentifier);
         }
 
         docHandler = (AuthorityItemDocumentModelHandler<?>) createDocumentHandler(ctx,
@@ -310,7 +310,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
         ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(item.inAuthority.resource);
         
         // HACK - this really must be moved to the doc handler, not here. No Nuxeo specific stuff here!
-        RepositoryClientImpl client = (RepositoryClientImpl)getRepositoryClient(ctx);
+        NuxeoRepositoryClientImpl client = (NuxeoRepositoryClientImpl)getRepositoryClient(ctx);
         String parentcsid = client.findDocCSID(repoSession, ctx, whereClause);
 
         String itemWhereClause = RefNameServiceUtils.buildWhereForAuthItemByName(authorityItemCommonSchemaName, item.getShortIdentifier(), parentcsid);
@@ -322,7 +322,10 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
 
 
     @POST
-    public Response createAuthority(String xmlPayload) {
+    public Response createAuthority(
+               @Context ResourceMap resourceMap,
+               @Context UriInfo uriInfo,
+               String xmlPayload) {
        //
        // Requests to create new authorities come in on new threads. Unfortunately, we need to synchronize those threads on this block because, as of 8/27/2015, we can't seem to get Nuxeo
        // transaction code to deal with a database level UNIQUE constraint violations on the 'shortidentifier' column of the vocabularies_common table.
@@ -592,7 +595,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      */
     @DELETE
     @Path("{csid}")
-    public Response deleteAuthority(
+    public Response deleteAuthority( // # Delete this authority and all of it's items.
             @Context Request request,
             @Context UriInfo uriInfo,
             @PathParam("csid") String specifier) {
@@ -1460,6 +1463,10 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
        ServiceDescription result = super.getDescription(ctx);
        result.setSubresourceDocumentType(this.getItemDocType(ctx.getTenantId()));
        return result;
-    }    
+    }
+
+       public Response createAuthority(String xmlPayload) {
+               return this.createAuthority(null, null, xmlPayload);
+       }    
     
 }
index d65cb2bca99866271fb47c4218f69c6502396f63..86c8d47c2911bcf0861badf081a8154389060389 100644 (file)
@@ -62,7 +62,7 @@ import org.collectionspace.services.jaxb.AbstractCommonList.ListItem;
 import org.collectionspace.services.lifecycle.TransitionDef;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.dom4j.Element;
 import org.nuxeo.ecm.core.api.ClientException;
@@ -252,7 +252,8 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
     }
 
     /**
-     * This method should only be used as part of a SAS synch operation.
+     * This method should ***only*** be used as part of a SAS synch operation.
+     * 
      * @param ctx
      * @param refNameList
      * @return
@@ -735,7 +736,7 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
         CoreSessionInterface repoSession = null;
         boolean releaseSession = false;
 
-       RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx);
+       NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl)this.getRepositoryClient(ctx);
         try {
                repoSession = nuxeoRepoClient.getRepositorySession(ctx);
             DocumentWrapper<DocumentModel> wrapDoc = nuxeoRepoClient.getDocFromCsid(ctx, repoSession, authCSID);
index 7e0fb4b97e18e2f72ce3a310de070d19263d95df..7cc8e3ed26053afe1799726c27b6a17498d92663 100644 (file)
@@ -55,7 +55,7 @@ import org.collectionspace.services.config.service.ObjectPartType;
 import org.collectionspace.services.lifecycle.TransitionDef;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.relation.RelationsCommonList;
 import org.collectionspace.services.vocabulary.VocabularyItemJAXBSchema;
@@ -1009,7 +1009,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
        boolean releaseRepoSession = false;
         
        try {
-               RepositoryClientImpl repoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx);
+               NuxeoRepositoryClientImpl repoClient = (NuxeoRepositoryClientImpl)this.getRepositoryClient(ctx);
                repoSession = this.getRepositorySession();
                if (repoSession == null) {
                        repoSession = repoClient.getRepositorySession(ctx);
@@ -1140,8 +1140,8 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
         String filteredTerm;
         StringBuilder filteredTermBuilder = new StringBuilder(term);
         // Term contains no anchor or wildcard characters.
-        if ( (! term.contains(RepositoryClientImpl.USER_SUPPLIED_ANCHOR_CHAR))
-                && (! term.contains(RepositoryClientImpl.USER_SUPPLIED_WILDCARD)) ) {
+        if ( (! term.contains(NuxeoRepositoryClientImpl.USER_SUPPLIED_ANCHOR_CHAR))
+                && (! term.contains(NuxeoRepositoryClientImpl.USER_SUPPLIED_WILDCARD)) ) {
             filteredTerm = term;
         } else {
             // Term contains at least one such character.
@@ -1149,10 +1149,10 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                 // Filter the starting anchor or wildcard character, if any.
                 String firstChar = filteredTermBuilder.substring(0,1);
                 switch (firstChar) {
-                    case RepositoryClientImpl.USER_SUPPLIED_ANCHOR_CHAR:
+                    case NuxeoRepositoryClientImpl.USER_SUPPLIED_ANCHOR_CHAR:
                         anchorAtStart = true;
                         break;
-                    case RepositoryClientImpl.USER_SUPPLIED_WILDCARD:
+                    case NuxeoRepositoryClientImpl.USER_SUPPLIED_WILDCARD:
                         filteredTermBuilder.deleteCharAt(0);
                         break;
                 }
@@ -1163,12 +1163,12 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                 int lastPos = filteredTermBuilder.length() - 1;
                 String lastChar = filteredTermBuilder.substring(lastPos);
                 switch (lastChar) {
-                    case RepositoryClientImpl.USER_SUPPLIED_ANCHOR_CHAR:
+                    case NuxeoRepositoryClientImpl.USER_SUPPLIED_ANCHOR_CHAR:
                         filteredTermBuilder.deleteCharAt(lastPos);
-                        filteredTermBuilder.insert(filteredTermBuilder.length(), RepositoryClientImpl.ENDING_ANCHOR_CHAR);
+                        filteredTermBuilder.insert(filteredTermBuilder.length(), NuxeoRepositoryClientImpl.ENDING_ANCHOR_CHAR);
                         anchorAtEnd = true;
                         break;
-                    case RepositoryClientImpl.USER_SUPPLIED_WILDCARD:
+                    case NuxeoRepositoryClientImpl.USER_SUPPLIED_WILDCARD:
                         filteredTermBuilder.deleteCharAt(lastPos);
                         break;
                 }
@@ -1177,7 +1177,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                 }
                 filteredTerm = filteredTermBuilder.toString();
                 // Filter all other wildcards, if any.
-                filteredTerm = filteredTerm.replaceAll(RepositoryClientImpl.USER_SUPPLIED_WILDCARD_REGEX, ZERO_OR_MORE_ANY_CHAR_REGEX);
+                filteredTerm = filteredTerm.replaceAll(NuxeoRepositoryClientImpl.USER_SUPPLIED_WILDCARD_REGEX, ZERO_OR_MORE_ANY_CHAR_REGEX);
                 if (logger.isTraceEnabled()) {
                     logger.trace(String.format("After replacing user wildcards = %s", filteredTerm));
                 }
index 86caddda40d52d89faed88da616267f013cc3232..62898cd810a36471d2ed057fe98bf34958b96ef7 100644 (file)
@@ -39,7 +39,7 @@ import org.collectionspace.services.authorization.URIResourceImpl;
 import org.collectionspace.services.authorization.perms.ActionType;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 import org.collectionspace.services.batch.BatchCommon;
 import org.collectionspace.services.batch.BatchCommon.ForDocTypes;
 import org.collectionspace.services.batch.BatchCommon.ForRoles;
@@ -222,7 +222,7 @@ public class BatchDocumentModelHandler extends NuxeoDocumentModelHandler<BatchCo
                CoreSessionInterface repoSession = null;
                boolean releaseRepoSession = false;
 
-               RepositoryClientImpl repoClient = (RepositoryClientImpl) this.getRepositoryClient(ctx);
+               NuxeoRepositoryClientImpl repoClient = (NuxeoRepositoryClientImpl) this.getRepositoryClient(ctx);
                if (repoSession == null) {
                        repoSession = repoClient.getRepositorySession(ctx);
                        releaseRepoSession = true;
index 73129346a65b53d3497259aa2300248bbeffab70..50800d0bd2bc62f4ba4ec4fd15b73fca821dac91 100644 (file)
@@ -76,6 +76,10 @@ public abstract class PayloadPart {
        }
        
        public Element getElementBody() {
+               if (elementBody == null) {
+                       elementBody = asElement();
+               }
+               
                return elementBody;
        }
 
index 52508e5530f5eb42be6c2d3ce0aafdf537ca805e..ac51a5a82d440064d55404cbf0001544ae52cd07 100644 (file)
@@ -360,7 +360,7 @@ public abstract class PoxPayload<PT extends PayloadPart> {
                m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);
                //Marshal object into file.
                m.marshal(jaxbObject, outputStream);
-               text = outputStream.toString("UTF8");
+               text = outputStream.toString("UTF8"); // FIXME: This method could/should be using JaxbUtils.toString() method
 
                Document doc = DocumentHelper.parseText(text);
                result = doc.getRootElement(); //FIXME: REM - call .detach() to free the element
index 7353357fd3c90b4ba455a65a1795290d16f83753..1561b754861abf1c46de2ecb36199c1a7f382010 100644 (file)
@@ -29,7 +29,7 @@
         <user>Administrator</user>
         <password>Administrator</password>
         <client-type>java</client-type>
-        <client-class>org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl</client-class>
+        <client-class>org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl</client-class>
         <properties>
             <types:item><types:key>pageSizeDefault</types:key><types:value>40</types:value></types:item> <!-- Use 'pgSz' query param to override this on a per request bassis. -->
             <types:item><types:key>pageSizeMax</types:key><types:value>2500</types:value></types:item> <!-- No list result page size can be greater than this amount -->
index 7bbd0bc86290d52973c2c7771c64c6f10260903c..75cc0501d0399f501ac9362887e52d9e81a023a4 100644 (file)
@@ -893,6 +893,10 @@ public abstract class AbstractServiceContextImpl<IT, OT>
                if (currentRepoSesssionRefCount == 0) {
                        this.currentRepositorySession = null;
                }
+               
+               if (currentRepoSesssionRefCount < 0) {
+                       throw new RuntimeException("Attempted to clear/close a repository session that has already been cleared/closed.");
+               }
        }
        
        @Override
index 0202ab13bcf8028049fea9166c6c0e917124ddc5..8b2bd79e1d9978f306bc6f169e80a16476dbf3be 100644 (file)
@@ -92,7 +92,7 @@ import org.collectionspace.services.blob.MeasuredPartGroupList;
 import org.collectionspace.services.jaxb.BlobJAXBSchema;
 import org.collectionspace.services.nuxeo.client.java.CommonList;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 import org.collectionspace.services.nuxeo.extension.thumbnail.ThumbnailConstants;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.config.service.ListResultField;
@@ -633,7 +633,7 @@ public class NuxeoBlobUtils {
        static private CoreSessionInterface getRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
                        RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient) {
                CoreSessionInterface result = null;             
-               RepositoryClientImpl nuxeoClient = (RepositoryClientImpl)repositoryClient;
+               NuxeoRepositoryClientImpl nuxeoClient = (NuxeoRepositoryClientImpl)repositoryClient;
                
                try {
                        result = nuxeoClient.getRepositorySession(ctx);
@@ -647,7 +647,7 @@ public class NuxeoBlobUtils {
        static private void releaseRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
                        RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient,
                        CoreSessionInterface repoSession) throws TransactionException {
-               RepositoryClientImpl nuxeoClient = (RepositoryClientImpl)repositoryClient;
+               NuxeoRepositoryClientImpl nuxeoClient = (NuxeoRepositoryClientImpl)repositoryClient;
                nuxeoClient.releaseRepositorySession(ctx, repoSession);
        }
        
index 812fda13e296b449f1600465187035f001970539..b245b098a92b2a3d583c1ab3946861d81aa86009 100644 (file)
@@ -15,7 +15,7 @@ import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.repository.RepositoryClient;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
@@ -51,7 +51,7 @@ public class RelationUtils {
         // relations_common:subjectRefName = 'urn:cspace:core.collectionspace.org:placeauthorities:name(place):item:name(Amystan1348082103923)\'Amystan\''"
         String query = String.format("%s:%s = '%s'", IRelationsManager.SERVICE_COMMONPART_NAME, targetField, escapedRefName);
 
-        RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl) repoClient;
+        NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl) repoClient;
         DocumentWrapper<DocumentModelList> docListWrapper = nuxeoRepoClient.findDocs(ctx, repoSession,
                 docTypes, query, orderByClause, pageSize, pageNum, computeTotal);
         DocumentModelList docList = docListWrapper.getWrappedObject();
index 23f7376f82d3247a40bb9e3479071b7a6f3f35f4..4b674a190810d6c59bb5e3ca25175017d8ed679d 100644 (file)
@@ -26,6 +26,8 @@ package org.collectionspace.services.common.repository;
 import java.util.Hashtable;
 import java.util.List;
 
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentHandler;
@@ -193,4 +195,12 @@ public interface RepositoryClient<IT, OT> extends StorageClient {
         */
        boolean delete(ServiceContext ctx, List<String> idList, DocumentHandler handler)
                        throws DocumentNotFoundException, DocumentException, TransactionException;
+
+       /**
+        * 
+        * @param ctx
+        * @return
+        * @throws Exception 
+        */
+       public CoreSessionInterface getRepositorySession(ServiceContext<IT, OT> ctx) throws Exception;
 }
index 168f64d711b2fa6314b611ee5f03af575eb22dff..bcc6419c5673d06a4b6d443da9ebd8e95943a89c 100644 (file)
@@ -19,6 +19,8 @@ package org.collectionspace.services.common.storage;
 
 import java.util.List;
 
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentException;
@@ -28,6 +30,7 @@ import org.collectionspace.services.common.document.TransactionException;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthorityItemSpecifier;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
 import org.collectionspace.services.lifecycle.TransitionDef;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 
 /**
  *
@@ -164,4 +167,7 @@ public interface StorageClient {
        boolean delete(ServiceContext ctx, Object entityFound, DocumentHandler handler)
                        throws DocumentNotFoundException, DocumentException;
 
+       void releaseRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, Object repoSession)
+                       throws TransactionException;
+
 }
index b0665fc8d836732dcb9effe2e45b95bc1e8458a8..831f179547b7257c27ddc745e4d7b82d35d30e1b 100644 (file)
@@ -38,6 +38,8 @@ import org.collectionspace.services.common.storage.StorageClient;
 import org.collectionspace.services.common.storage.TransactionContext;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthorityItemSpecifier;
 import org.collectionspace.services.common.context.ServiceContextProperties;
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.lifecycle.TransitionDef;
@@ -588,4 +590,10 @@ public class JpaStorageClientImpl implements StorageClient {
                return true;
        }
 
+       @Override
+       public void releaseRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, Object repoSession)
+                       throws TransactionException {
+               // TODO Auto-generated method stub              
+       }
+
 }
index 189798e7729edba345e594479f33806f2f86a0fd..691ab4402ae0f82fee5eb3904a7371ec2b69460d 100644 (file)
@@ -68,7 +68,7 @@ import org.collectionspace.services.common.relation.RelationUtils;
 import org.collectionspace.services.common.repository.RepositoryClient;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 import org.collectionspace.services.common.security.SecurityUtils;
 import org.collectionspace.services.config.service.ServiceBindingType;
 import org.collectionspace.services.jaxb.AbstractCommonList;
@@ -406,7 +406,7 @@ public class RefNameServiceUtils {
         Map<String, ServiceBindingType> queriedServiceBindings = new HashMap<String, ServiceBindingType>();
         Map<String, List<AuthRefConfigInfo>> authRefFieldsByService = new HashMap<String, List<AuthRefConfigInfo>>();
 
-        RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl) repoClient;
+        NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl) repoClient;
         try {
             // Ignore any provided page size and number query parameters in
             // the following call, as they pertain to the list of authority
@@ -563,7 +563,7 @@ public class RefNameServiceUtils {
         final String ORDER_BY_VALUE = CollectionSpaceClient.CORE_CREATED_AT  // "collectionspace_core:createdAt";
                                           + ", " + IQueryManager.NUXEO_UUID; // CSPACE-6333: Add secondary sort on uuid, in case records have the same createdAt timestamp.
 
-        if (repoClient instanceof RepositoryClientImpl == false) {
+        if (repoClient instanceof NuxeoRepositoryClientImpl == false) {
             throw new InternalError("updateAuthorityRefDocs() called with unknown repoClient type!");
         }
         
@@ -598,7 +598,7 @@ public class RefNameServiceUtils {
                                queriedServiceBindings, authRefFieldsByService, // Perform the refName updates on the list of document models
                         newRefName);
                 if (nRefsFoundThisPage > 0) {
-                    ((RepositoryClientImpl) repoClient).saveDocListWithoutHandlerProcessing(ctx, repoSession, docList, true); // Flush the document model list out to Nuxeo storage
+                    ((NuxeoRepositoryClientImpl) repoClient).saveDocListWithoutHandlerProcessing(ctx, repoSession, docList, true); // Flush the document model list out to Nuxeo storage
                     nRefsFound += nRefsFoundThisPage;
                 }
 
@@ -675,7 +675,7 @@ public class RefNameServiceUtils {
             query += " AND " + whereClauseAdditions;
         }
         // Now we have to issue the search
-        RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl) repoClient;
+        NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl) repoClient;
         DocumentWrapper<DocumentModelList> docListWrapper = nuxeoRepoClient.findDocs(ctx, repoSession,
                 docTypes, query, orderByClause, pageSize, pageNum, computeTotal);
         // Now we gather the info for each document into the list and return
index 3e8bf0facae6775025896835e03a41600c2bc47f..162b982d2d6772149d2c404058220bf21f558bbb 100644 (file)
@@ -219,7 +219,7 @@ public abstract class NuxeoDocumentModelHandler<T> extends RemoteDocumentModelHa
        public AbstractCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
                CommonList commonList = new CommonList();
                CoreSessionInterface repoSession = null;
-               RepositoryClientImpl repoClient = null;
+               NuxeoRepositoryClientImpl repoClient = null;
                boolean releaseRepoSession = false;
 
                AbstractServiceContextImpl ctx = (AbstractServiceContextImpl) getServiceContext();
@@ -245,8 +245,8 @@ public abstract class NuxeoDocumentModelHandler<T> extends RemoteDocumentModelHa
 
                try {
                        if (markRtSbj != null) {
-                               repoClient = (RepositoryClientImpl) this.getRepositoryClient(ctx);
-                               RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl) repoClient;
+                               repoClient = (NuxeoRepositoryClientImpl) this.getRepositoryClient(ctx);
+                               NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl) repoClient;
                                repoSession = this.getRepositorySession();
                                if (repoSession == null) {
                                        repoSession = repoClient.getRepositorySession(ctx);
similarity index 99%
rename from services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java
rename to services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoRepositoryClientImpl.java
index e95c958daade81a58a9c422130b5675a1804f2f7..0a97f3c71feba0344b92ef2d43c45559d2e96dd0 100644 (file)
@@ -97,12 +97,12 @@ import org.slf4j.LoggerFactory;
  *
  * $LastChangedRevision: $ $LastChangedDate: $
  */
-public class RepositoryClientImpl implements RepositoryClient<PoxPayloadIn, PoxPayloadOut> {
+public class NuxeoRepositoryClientImpl implements RepositoryClient<PoxPayloadIn, PoxPayloadOut> {
        
     /**
      * The logger.
      */
-    private final Logger logger = LoggerFactory.getLogger(RepositoryClientImpl.class);
+    private final Logger logger = LoggerFactory.getLogger(NuxeoRepositoryClientImpl.class);
 //    private final Logger profilerLogger = LoggerFactory.getLogger("remperf");
 //    private String foo = Profiler.createLogger();
     public static final String NUXEO_CORE_TYPE_DOMAIN = "Domain";
@@ -120,7 +120,7 @@ public class RepositoryClientImpl implements RepositoryClient<PoxPayloadIn, PoxP
     /**
      * Instantiates a new repository java client impl.
      */
-    public RepositoryClientImpl() {
+    public NuxeoRepositoryClientImpl() {
         //Empty constructor
     }
 
@@ -2000,6 +2000,7 @@ public class RepositoryClientImpl implements RepositoryClient<PoxPayloadIn, PoxP
         return workspaceId;
     }
 
+    @Override
     public CoreSessionInterface getRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) throws Exception {
         return getRepositorySession(ctx, ctx.getRepositoryName(), ctx.getTimeoutSecs());
     }
@@ -2075,8 +2076,10 @@ public class RepositoryClientImpl implements RepositoryClient<PoxPayloadIn, PoxP
      *
      * @param repoSession the repo session
      */
-    public void releaseRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, CoreSessionInterface repoSession) throws TransactionException {
+    @Override
+    public void releaseRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, Object repositorySession) throws TransactionException {
         try {
+               CoreSessionInterface repoSession = (CoreSessionInterface)repositorySession;
             NuxeoClientEmbedded client = NuxeoConnectorEmbedded.getInstance().getClient();
             // release session
             if (ctx != null) {
index 2dacf87d8085e4e6540ac1503fdcb16f71aa585a..52166f15623006dafe6b35daf5d4c2b07cd2f6d8 100644 (file)
@@ -767,7 +767,7 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
                
                boolean releaseRepoSession = false;
                ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
-               RepositoryClientImpl repoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx);
+               NuxeoRepositoryClientImpl repoClient = (NuxeoRepositoryClientImpl)this.getRepositoryClient(ctx);
                CoreSessionInterface repoSession = this.getRepositorySession();
                if (repoSession == null) {
                        repoSession = repoClient.getRepositorySession(ctx);
index 09f2a1d4a25e2757ef8081d3fffa704063829d7e..e79d37eca3723f6b9d2e3e15dd0c618db79d8a92 100644 (file)
@@ -52,7 +52,7 @@ import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.config.service.ServiceBindingType;
 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
@@ -397,7 +397,7 @@ public class RelationDocumentModelHandler
             // provided as an alternate identifier.
         }
         if (Tools.notBlank(csid)) {
-               RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl)getRepositoryClient(ctx);
+               NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl)getRepositoryClient(ctx);
             DocumentWrapper<DocumentModel> docWrapper = nuxeoRepoClient.getDocFromCsid(ctx, repoSession, csid);
             docModel = docWrapper.getWrappedObject();
         } else { //  if (Tools.isBlank(objectCsid)) {
index ae572bc94a4fab5cda4a0bd7705f5741a04dd1d0..0256887ebf24c791e005d63fdfc50448f41c6698 100644 (file)
@@ -75,7 +75,7 @@ import org.collectionspace.services.common.storage.JDBCTools;
 import org.collectionspace.services.jaxb.InvocableJAXBSchema;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.jfree.util.Log;
 import org.nuxeo.ecm.core.api.DocumentModel;
@@ -152,7 +152,7 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler<Report
                                +invocationMode);
                }
                
-               RepositoryClientImpl repoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx);
+               NuxeoRepositoryClientImpl repoClient = (NuxeoRepositoryClientImpl)this.getRepositoryClient(ctx);
                repoSession = this.getRepositorySession();
                if (repoSession == null) {
                        repoSession = repoClient.getRepositorySession(ctx);
index cebc0614d6db08b5fdf77169520303526bef6b32..4878c866b7d6d6ba8abd9a2a4c8e17e63cb2feda 100644 (file)
@@ -35,7 +35,7 @@ import javax.ws.rs.core.Response;
 import org.collectionspace.services.nuxeo.client.java.CommonList;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
-import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.client.CollectionSpaceClient;
@@ -117,7 +117,7 @@ public class ServiceGroupDocumentModelHandler
        boolean releaseRepoSession = false;
         
        try { 
-               RepositoryClientImpl repoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx);
+               NuxeoRepositoryClientImpl repoClient = (NuxeoRepositoryClientImpl)this.getRepositoryClient(ctx);
                repoSession = this.getRepositorySession();
                if (repoSession == null) {
                        repoSession = repoClient.getRepositorySession(ctx);
@@ -185,9 +185,9 @@ public class ServiceGroupDocumentModelHandler
                List<String> serviceGroupNames,
                Map<String, ServiceBindingType> queriedServiceBindings,
                CoreSessionInterface repoSession,
-               RepositoryClientImpl repoClient) throws Exception {
+               NuxeoRepositoryClientImpl repoClient) throws Exception {
         
-        RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl)repoClient;
+        NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl)repoClient;
         // Get the service bindings for this tenant
         TenantBindingConfigReaderImpl tReader = ServiceMain.getInstance().getTenantBindingConfigReader();
         // We need to get all the procedures, authorities, and objects.
@@ -241,7 +241,7 @@ public class ServiceGroupDocumentModelHandler
                list.setPageNum(pageNum);
                list.setPageSize(pageSize);
 
-               RepositoryClientImpl repoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx);
+               NuxeoRepositoryClientImpl repoClient = (NuxeoRepositoryClientImpl)this.getRepositoryClient(ctx);
                repoSession = this.getRepositorySession();
                if (repoSession == null) {
                        repoSession = repoClient.getRepositorySession(ctx);
@@ -307,7 +307,7 @@ public class ServiceGroupDocumentModelHandler
        
                String tenantId = ctx.getTenantId();
                CoreSessionInterface repoSession = null;
-               RepositoryClientImpl repoClient = null;
+               NuxeoRepositoryClientImpl repoClient = null;
                boolean releaseRepoSession = false;
                
                MultivaluedMap<String, String> queryParams = getServiceContext().getQueryParams();
@@ -329,8 +329,8 @@ public class ServiceGroupDocumentModelHandler
                
                try {
                        if (markRtSbj != null) {
-                               repoClient = (RepositoryClientImpl) this.getRepositoryClient(ctx);
-                               RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl) repoClient;
+                               repoClient = (NuxeoRepositoryClientImpl) this.getRepositoryClient(ctx);
+                               NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl) repoClient;
                                repoSession = this.getRepositorySession();
                                if (repoSession == null) {
                                        repoSession = repoClient.getRepositorySession(ctx);
index db1a002c005c6e4426bc2807b4e0f87b3cdb7ddd..034535d643bf81e247c008e126576e8ef413b694 100644 (file)
 package org.collectionspace.services.vocabulary;
 
 import org.collectionspace.services.client.IClientQueryParams;
+import org.collectionspace.services.client.PayloadInputPart;
+import org.collectionspace.services.client.PoxPayload;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.VocabularyClient;
+import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.common.CSWebApplicationException;
+import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.UriInfoWrapper;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.context.ServiceBindingUtils;
 import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.DocumentException;
+import org.collectionspace.services.common.document.DocumentHandler;
+import org.collectionspace.services.common.document.JaxbUtils;
+import org.collectionspace.services.common.repository.RepositoryClient;
 import org.collectionspace.services.common.vocabulary.AuthorityResource;
+import org.collectionspace.services.common.vocabulary.AuthorityServiceUtils;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.jaxb.AbstractCommonList.ListItem;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
+import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl;
 import org.collectionspace.services.vocabulary.nuxeo.VocabularyItemDocumentModelHandler;
-
+import org.collectionspace.services.workflow.WorkflowCommon;
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.w3c.dom.Element;
 
 import javax.ws.rs.GET;
+import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Request;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
 
 @Path("/" + VocabularyClient.SERVICE_PATH_COMPONENT)
@@ -66,7 +84,132 @@ public class VocabularyResource extends
                                VOCABULARIES_COMMON, VOCABULARYITEMS_COMMON);
        }
 
-    @GET
+    @Override
+       @POST
+    public Response createAuthority(
+               @Context ResourceMap resourceMap,
+               @Context UriInfo uriInfo,
+               String xmlPayload) {
+       //
+       // Requests to create new authorities come in on new threads. Unfortunately, we need to synchronize those threads on this block because, as of 8/27/2015, we can't seem to get Nuxeo
+       // transaction code to deal with a database level UNIQUE constraint violations on the 'shortidentifier' column of the vocabularies_common table.
+       // Therefore, to prevent having multiple authorities with the same shortid, we need to synchronize
+       // the code that creates new authorities.  The authority document model handler will first check for authorities with the same short id before
+       // trying to create a new authority.
+       //
+       synchronized(AuthorityResource.class) {
+               try {
+                   PoxPayloadIn input = new PoxPayloadIn(xmlPayload);
+                   ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(input);
+                               RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient = this.getRepositoryClient(ctx);
+                               
+                               CoreSessionInterface repoSession = repoClient.getRepositorySession(ctx);
+                               try {
+                           DocumentHandler<?, AbstractCommonList, DocumentModel, DocumentModelList> handler = createDocumentHandler(ctx);                          
+                           String csid = repoClient.create(ctx, handler);
+                           handleItemsPayload(repoSession, csid, resourceMap, uriInfo, input);
+                           UriBuilder path = UriBuilder.fromResource(resourceClass);
+                           path.path("" + csid);
+                           Response response = Response.created(path.build()).build();
+                           return response;
+                   } catch (Throwable t) {
+                       repoSession.setTransactionRollbackOnly();
+                       throw t;
+                   } finally {
+                       repoClient.releaseRepositorySession(ctx, repoSession);
+                   }
+               } catch (Exception e) {
+                   throw bigReThrow(e, ServiceMessages.CREATE_FAILED);
+               }
+       }
+    }
+    
+    private void handleItemsPayload(CoreSessionInterface repoSession,
+               String parentIdentifier,
+               ResourceMap resourceMap,
+               UriInfo uriInfo,
+               PoxPayloadIn input) throws Exception {
+       PayloadInputPart abstractCommonListPart  = input.getPart(PoxPayload.ABSTRACT_COMMON_LIST_ROOT_ELEMENT_LABEL);
+       if (abstractCommonListPart != null) {
+               AbstractCommonList itemsList = (AbstractCommonList) abstractCommonListPart.getBody();
+               for (ListItem item : itemsList.getListItem()) {
+                       PoxPayloadIn itemXmlPayload = getItemXmlPayload(item);
+                       Response res = this.createAuthorityItem(repoSession, resourceMap, uriInfo, parentIdentifier, itemXmlPayload);
+               }
+       }
+       
+       }
+    
+    /**
+     * This is very brittle.  If the class VocabularyitemsCommon changed with new fields we'd have to
+     * update this method.
+     * 
+     * @param item
+     * @return
+     * @throws DocumentException 
+     */
+       private PoxPayloadIn getItemXmlPayload(ListItem item) throws DocumentException {
+               PoxPayloadIn result = null;
+
+               VocabularyitemsCommon vocabularyItem = new VocabularyitemsCommon();
+               for (Element ele : item.getAny()) {
+                       String fieldName = ele.getTagName();
+                       String fieldValue = ele.getTextContent();
+                       switch (fieldName) {
+                               case "displayName":
+                                       vocabularyItem.setDisplayName(fieldValue);
+                                       break;
+                                       
+                               case "shortIdentifier":
+                                       vocabularyItem.setShortIdentifier(fieldValue);
+                                       break;
+                                       
+                               case "order":
+                                       vocabularyItem.setOrder(fieldValue);
+                                       break;
+                                       
+                               case "source":
+                                       vocabularyItem.setSource(fieldValue);
+                                       break;
+                                       
+                               case "sourcePage":
+                                       vocabularyItem.setSourcePage(fieldValue);
+                                       break;
+                                       
+                               case "description":
+                                       vocabularyItem.setDescription(fieldValue);
+                                       
+                               default:
+                                       throw new DocumentException(String.format("Unknown field '%s' in vocabulary item payload.",
+                                                       fieldName));
+                       }
+               }
+               
+               result = new PoxPayloadIn(VocabularyClient.SERVICE_ITEM_PAYLOAD_NAME, vocabularyItem, 
+                       VOCABULARYITEMS_COMMON);
+
+               return result;
+       }
+    
+       private Response createAuthorityItem(
+               CoreSessionInterface repoSession,
+               ResourceMap resourceMap,
+               UriInfo uriInfo,
+               String parentIdentifier, // Either a CSID or a URN form -e.g., a8ad38ec-1d7d-4bf2-bd31 or urn:cspace:name(bugsbunny)
+               PoxPayloadIn input) throws Exception {
+       Response result = null;
+       
+        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), input, resourceMap, uriInfo);
+        ctx.setCurrentRepositorySession(repoSession);
+        
+        result = createAuthorityItem(ctx, parentIdentifier, AuthorityServiceUtils.UPDATE_REV,
+                       AuthorityServiceUtils.PROPOSED, AuthorityServiceUtils.NOT_SAS_ITEM);
+
+        return result;
+    }
+    
+
+       @GET
     @Path("{csid}")
     @Override
     public Response get(