]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5564: Have publish and anonymous retrieve working for blob service.
authorRichard Millet <richard.millet@berkeley.edu>
Tue, 22 Jan 2013 06:11:19 +0000 (22:11 -0800)
committerRichard Millet <richard.millet@berkeley.edu>
Tue, 22 Jan 2013 06:11:19 +0000 (22:11 -0800)
services/article/3rdparty/nuxeo-platform-cs-article/src/main/resources/schemas/articles_common.xsd
services/article/jaxb/src/main/java/org/collectionspace/services/ArticlesCommonJAXBSchema.java
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml
services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoBlobUtils.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java

index 479da4663174527120b60068ea62bf76166e3767..05cbf53235539ee6e1bb2cc26dd0154d37dea033 100644 (file)
     targetNamespace="http://collectionspace.org/article/"
     version="0.1">
     
-               <xs:element name="articleNumber" type="xs:string"/>                             <!-- An ID for the article (different than the CSID) -->
-               <xs:element name="articleContentUrl" type="xs:string"/>                 <!-- The URL of the article's content -->
-               <xs:element name="articleJobId" type="xs:string"/>                              <!-- The asynch job ID -if any -->
-               <xs:element name="articleSource" type="xs:string"/>                             <!-- The name of the service/resource that was used to create the article. -->
-               <xs:element name="articlePublisher" type="xs:string"/>                  <!-- The user who published the article -->     
-               <xs:element name="accessExpirationDate" type="xs:dateTime"/>    <!-- When the article is no longer available for access -->
-               <xs:element name="accessedCount" type="xs:integer"/>                    <!-- How many times the article has been accessed. -->
-               <xs:element name="accessCountLimit" type="xs:integer"/>                 <!-- The maximum times the article can be accessed. -->
+       <xs:element name="articleNumber" type="xs:string" />                    <!-- An ID for the article (different than the CSID) -->
+       <xs:element name="articleContentCsid" type="xs:string" />               <!-- The URL of the article's content -->
+       <xs:element name="articleJobId" type="xs:string" />                             <!-- The asynch job ID -if any -->
+       <xs:element name="articleSource" type="xs:string" />                    <!-- The name of the service/resource that was used to create the article. -->
+       <xs:element name="articlePublisher" type="xs:string" />                 <!-- The user who published the article -->
+       <xs:element name="accessExpirationDate" type="xs:dateTime" />   <!-- When the article is no longer available for access -->
+       <xs:element name="accessedCount" type="xs:integer" />                   <!-- How many times the article has been accessed. -->
+       <xs:element name="accessCountLimit" type="xs:integer" />                <!-- The maximum times the article can be accessed. -->
 </xs:schema>
index 9c4c56a572367eabe0643fde010857cc138dff4e..a121f7374ac0e2486308e26a884b829912a8c511 100644 (file)
@@ -8,7 +8,7 @@ package org.collectionspace.services;
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="articleNumber" type="xs:string" />                    <!-- An ID for the article (different than the CSID) -->
-                               <xs:element name="articleContentUrl" type="xs:string" />                <!-- The URL of the article's content -->
+                               <xs:element name="articleContentCsid" type="xs:string" />               <!-- The URL of the article's content -->
                                <xs:element name="articleJobId" type="xs:string" />                             <!-- The asynch job ID -if any -->
                                <xs:element name="articleSource" type="xs:string" />                    <!-- The name of the service/resource that was used to create the article. -->
                                <xs:element name="articlePublisher" type="xs:string" />                 <!-- The user who published the article -->
@@ -22,7 +22,7 @@ package org.collectionspace.services;
 
 public interface ArticlesCommonJAXBSchema {
     final static String ARTICLE_NUMBER = "articleNumber";
-    final static String ARTICLE_CONTENT_URL = "articleContentUrl";
+    final static String ARTICLE_CONTENT_CSID = "articleContentCsid";
     final static String ARTICLE_JOB_ID = "articleJobId";
     final static String ARTICLE_SOURCE = "articleSource";
     final static String ARTICLE_PUBLISHER = "articlePublisher";
index baae7d62c97afe3a79ee45feed9a252812d68b65..594f69c105078c350614e7f0c76567cbb512711d 100644 (file)
                             <service:xpath>articleNumber</service:xpath>
                         </service:ListResultField>
                         <service:ListResultField>
-                            <service:element>articleContentUrl</service:element>
-                            <service:xpath>articleContentUrl</service:xpath>
+                            <service:element>articleContentCsid</service:element>
+                            <service:xpath>articleContentCsid</service:xpath>
                         </service:ListResultField>
                     </service:ListResultsFields>
                 </service:params>
             <service:properties xmlns:service="http://collectionspace.org/services/config/service">
                 <types:item xmlns:types="http://collectionspace.org/services/config/types">
                     <types:key>objectNameProperty</types:key>
-                    <types:value>articleContentUrl</types:value>
+                    <types:value>articleContentCsid</types:value>
                 </types:item>
                 <types:item xmlns:types="http://collectionspace.org/services/config/types">
                     <types:key>objectNumberProperty</types:key>
index e82530497f5604a1f164c861aceba66ba89cff75..3b70eb5aaf3c20b48a7b6c425f41e8df47e993dd 100644 (file)
@@ -984,9 +984,12 @@ public class NuxeoBlobUtils {
                \r
                try {\r
                        result = getBlobOutput(ctx, repoSession, repositoryId, null, true, outMimeType);\r
-               }\r
-               \r
-               finally {\r
+                       if (outMimeType.length() == 0) {\r
+                               BlobsCommon blobsCommon = result.getBlobsCommon();\r
+                               String mimeType = blobsCommon.getMimeType();\r
+                               outMimeType.append(mimeType);\r
+                       }                       \r
+               } finally {\r
                        if (repoSessionCleanup == true) {\r
                                releaseRepositorySession(ctx, repositoryClient, repoSession);\r
                        }\r
index 7a5e386f56157102d07327af77156a72cbd51015..16b50717253bb8d857a9bdc830eb931369c3d8ad 100644 (file)
@@ -37,6 +37,7 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 import javax.xml.bind.JAXBElement;
 
+import org.collectionspace.authentication.spi.AuthNContext;
 import org.collectionspace.services.authorization.AccountPermission;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.lifecycle.TransitionDef;
@@ -324,8 +325,9 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
             addOutputPart(unQObjectProperties, schema, partMeta);
         }
         
+        MultipartServiceContext ctx = (MultipartServiceContext) getServiceContext();
+
         if (supportsHierarchy() == true) {
-            MultipartServiceContext ctx = (MultipartServiceContext) getServiceContext();
             String showSiblings = ctx.getQueryParams().getFirst(CommonAPI.showSiblings_QP);
             if (Tools.isTrue(showSiblings)) {
                 showSiblings(wrapDoc, ctx);
@@ -345,7 +347,10 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
             }
         }
         
-        addAccountPermissionsPart();
+        String currentUser = ctx.getUserId();
+        if (currentUser.equalsIgnoreCase(AuthNContext.ANONYMOUS_USER) == false) {
+               addAccountPermissionsPart();
+        }
     }
     
     private void addExtraCoreValues(DocumentModel docModel, Map<String, Object> unQObjectProperties)