Revision: 56480
Author:   uhommes
Date:     2015-10-30 15:58:01 +0100 (Fri, 30 Oct 2015)
Log Message:
-----------
CMS-9624 remove hippo text property when the binary is no longer a pdf

Modified Paths:
--------------
    
hippo-cms7/cms/branches/hippo-cms-3.0.x/api/src/main/java/org/hippoecm/frontend/plugins/gallery/model/DefaultGalleryProcessor.java
    
hippo-cms7/cms/branches/hippo-cms-3.0.x/editor/frontend/src/main/java/org/hippoecm/frontend/editor/plugins/resource/ResourceUploadPlugin.java

Modified: 
hippo-cms7/cms/branches/hippo-cms-3.0.x/api/src/main/java/org/hippoecm/frontend/plugins/gallery/model/DefaultGalleryProcessor.java
===================================================================
--- 
hippo-cms7/cms/branches/hippo-cms-3.0.x/api/src/main/java/org/hippoecm/frontend/plugins/gallery/model/DefaultGalleryProcessor.java
  2015-10-30 14:25:25 UTC (rev 56479)
+++ 
hippo-cms7/cms/branches/hippo-cms-3.0.x/api/src/main/java/org/hippoecm/frontend/plugins/gallery/model/DefaultGalleryProcessor.java
  2015-10-30 14:58:01 UTC (rev 56480)
@@ -53,6 +53,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.hippoecm.repository.api.HippoNodeType.HIPPO_TEXT;
+
 /**
  * Gallery processor that puts a resized version of the image in the primary 
item and populates
  * other resource child nodes with the original.
@@ -298,6 +300,8 @@
                 if (MimeTypeHelper.isPdfMimeType(mimeType)) {
                     InputStream dataInputStream = 
primaryChild.getProperty(JcrConstants.JCR_DATA).getBinary().getStream();
                     
ResourceHelper.handlePdfAndSetHippoTextProperty(primaryChild,dataInputStream);
+                } else if (node.hasProperty(HIPPO_TEXT)) {
+                    node.getProperty(HIPPO_TEXT).remove();
                 }
             }
             for (NodeDefinition childDef : 
node.getPrimaryNodeType().getChildNodeDefinitions()) {

Modified: 
hippo-cms7/cms/branches/hippo-cms-3.0.x/editor/frontend/src/main/java/org/hippoecm/frontend/editor/plugins/resource/ResourceUploadPlugin.java
===================================================================
--- 
hippo-cms7/cms/branches/hippo-cms-3.0.x/editor/frontend/src/main/java/org/hippoecm/frontend/editor/plugins/resource/ResourceUploadPlugin.java
       2015-10-30 14:25:25 UTC (rev 56479)
+++ 
hippo-cms7/cms/branches/hippo-cms-3.0.x/editor/frontend/src/main/java/org/hippoecm/frontend/editor/plugins/resource/ResourceUploadPlugin.java
       2015-10-30 14:58:01 UTC (rev 56480)
@@ -36,6 +36,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.hippoecm.repository.api.HippoNodeType.HIPPO_TEXT;
+
 /**
  * Plugin for uploading resources into the JCR repository.
  * This plugin can be configured with specific types, so not all file types 
are allowed to be uploaded.
@@ -83,10 +85,11 @@
         Node node = nodeModel.getNode();
         try {
             ResourceHelper.setDefaultResourceProperties(node, mimeType, 
upload.getInputStream(), fileName);
-
             if (MimeTypeHelper.isPdfMimeType(mimeType)) {
                 InputStream inputStream = 
node.getProperty(JcrConstants.JCR_DATA).getBinary().getStream();
                 ResourceHelper.handlePdfAndSetHippoTextProperty(node, 
inputStream);
+            } else if (node.hasProperty(HIPPO_TEXT)) {
+                node.getProperty(HIPPO_TEXT).remove();
             }
         } catch (RepositoryException | IOException ex) {
             if (log.isDebugEnabled()) {

_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to