cancel
Showing results for 
Search instead for 
Did you mean: 

content rule fails to trigger after nodeService.createNode

chatch
Champ in-the-making
Champ in-the-making
I have a rule on a folder that transforms any new content that is RTF into HTML. If I add content via the web client using 'Add Content' it triggers fine. However from the following code snippet it fails to trigger:


        NodeRef typeNodeRef = nodeService.createNode(
                typeParentRef,
                ContentModel.ASSOC_CONTAINS,
                QName.createQName("{http://www.alfresco.org/model/content/1.0}"
                        + filename), typeQName, properties).getChildRef();
        logger.debug("created type with ref=" + typeNodeRef);

        ContentReader contentReader = contentService.getRawReader(contentUrl);
        contentReader.setMimetype(reqParams.get("mimetype"));

        ContentWriter contentWriter = contentService.getWriter(typeNodeRef,
                ContentModel.PROP_CONTENT, true);
        contentWriter.setMimetype(reqParams.get("mimetype"));

        contentWriter.putContent(contentReader);

The code is run in a WebScript (inherits from DeclarativeWebScript).  Also the folder that the rule is on is created from a space template in the same web script but I don't believe this should be a problem?

I can actually pull back the rule and action programmatically and invoke it to get it to work but obviously this is not ideal… 

Has anyone seen something like this or have any idea what I can try?
1 REPLY 1

erik_kirs
Champ in-the-making
Champ in-the-making
Please check that content is not empty - seems that in this case Alfresco does not trigger content rules!