From 798e35c455f1d9e5491048e1fa76a5354d802a25 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 28 Sep 2010 10:46:20 +0000 Subject: [PATCH] In the HTML rendering engine, when extracting out images, don't include WCM specific associations. (We'll put back some more general ones once composite content hopefully offers a suitable one) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22737 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/rendition-services-context.xml | 4 +- .../TikaPoweredContentTransformer.java | 4 +- .../executer/HTMLRenderingEngine.java | 27 ++----------- .../executer/HTMLRenderingEngineTest.java | 38 ++++++++++--------- 4 files changed, 27 insertions(+), 46 deletions(-) diff --git a/config/alfresco/rendition-services-context.xml b/config/alfresco/rendition-services-context.xml index ce6cb81787..5b4a93789f 100644 --- a/config/alfresco/rendition-services-context.xml +++ b/config/alfresco/rendition-services-context.xml @@ -133,9 +133,7 @@ - - + parent="baseRenderingAction" /> getParameterDefinitions() { @@ -219,19 +208,9 @@ public class HTMLRenderingEngine extends AbstractRenderingEngine ).getChildRef(); } - // If we can, associate it with the rendered HTML, so - // that they're properly linked - QName assocType = SECONDARY_IMAGE; - if(primary) - { - assocType = PRIMARY_IMAGE; - } - if(dictionaryService.getAssociation(assocType) != null) - { - nodeService.createAssociation( - context.getDestinationNode(), img, assocType - ); - } + // TODO Once composite content is properly supported, + // at this point we'll associate the new image with + // the rendered HTML node so the dependency is tracked. // Put the image into the node ContentWriter writer = contentService.getWriter( diff --git a/source/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngineTest.java b/source/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngineTest.java index 9de9deb0cd..a3fc29bb01 100644 --- a/source/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngineTest.java +++ b/source/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngineTest.java @@ -284,10 +284,11 @@ public class HTMLRenderingEngineTest extends BaseAlfrescoSpringTest // Check we didn't get any images for(ChildAssociationRef ref : nodeService.getChildAssocs(htmlNode)) { - if(ref.getTypeQName().equals(HTMLRenderingEngine.PRIMARY_IMAGE)) - fail("Found unexpected primary image of rendered html"); - if(ref.getTypeQName().equals(HTMLRenderingEngine.SECONDARY_IMAGE)) - fail("Found unexpected secondary image of rendered html"); + // TODO Check against composite content associations when present +// if(ref.getTypeQName().equals(HTMLRenderingEngine.PRIMARY_IMAGE)) +// fail("Found unexpected primary image of rendered html"); +// if(ref.getTypeQName().equals(HTMLRenderingEngine.SECONDARY_IMAGE)) +// fail("Found unexpected secondary image of rendered html"); } // All done @@ -376,21 +377,22 @@ public class HTMLRenderingEngineTest extends BaseAlfrescoSpringTest assertEquals(1, nodeService.getChildAssocs(imgFolder).size()); + // TODO Check against composite content associations when present // Check the associations if supported - if(dictionaryService.getAssociation(HTMLRenderingEngine.PRIMARY_IMAGE) != null) - { - boolean hasPrimary = false; - boolean hasSecondary = false; - for(ChildAssociationRef ref : nodeService.getChildAssocs(htmlNode)) - { - if(ref.getTypeQName().equals(HTMLRenderingEngine.PRIMARY_IMAGE)) - hasPrimary = true; - if(ref.getTypeQName().equals(HTMLRenderingEngine.SECONDARY_IMAGE)) - hasSecondary = true; - } - assertEquals(true, hasPrimary); - assertEquals(false, hasSecondary); - } +// if(dictionaryService.getAssociation(HTMLRenderingEngine.PRIMARY_IMAGE) != null) +// { +// boolean hasPrimary = false; +// boolean hasSecondary = false; +// for(ChildAssociationRef ref : nodeService.getChildAssocs(htmlNode)) +// { +// if(ref.getTypeQName().equals(HTMLRenderingEngine.PRIMARY_IMAGE)) +// hasPrimary = true; +// if(ref.getTypeQName().equals(HTMLRenderingEngine.SECONDARY_IMAGE)) +// hasSecondary = true; +// } +// assertEquals(true, hasPrimary); +// assertEquals(false, hasSecondary); +// } // All done tidyUpSourceDoc();