From 62ea9bf5718e970c85b4073ba4f2f490a574efa7 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Fri, 9 Sep 2011 13:37:35 +0000 Subject: [PATCH] Fixed cm:auditable setting not being pushed the DB - Changes were being put into the cache but missing an update trigger to push to the DB - Fixes ALF-10224: Test disabled: GetChildrenCannedQueryTest.testPropertySorting git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30386 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/domain/node/AbstractNodeDAOImpl.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java b/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java index 30674d442c..c980d3b82f 100644 --- a/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java +++ b/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java @@ -1831,20 +1831,24 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO // Copy cm:auditable if (!policyBehaviourFilter.isEnabled(node.getNodeRef(), ContentModel.ASPECT_AUDITABLE)) { - AuditablePropertiesEntity auditableProps = node.getAuditableProperties(); - if (auditableProps == null) + // Only bother if cm:auditable properties are present + if (AuditablePropertiesEntity.hasAuditableProperty(newProps.keySet())) { - auditableProps = new AuditablePropertiesEntity(); + AuditablePropertiesEntity auditableProps = node.getAuditableProperties(); + if (auditableProps == null) + { + auditableProps = new AuditablePropertiesEntity(); + } + boolean containedAuditProperties = auditableProps.setAuditValues(null, null, newProps); + if (!containedAuditProperties) + { + // Double-check (previous hasAuditableProperty should cover it) + // The behaviour is disabled, but no audit properties were passed in + auditableProps = null; + } + nodeUpdate.setAuditableProperties(auditableProps); + nodeUpdate.setUpdateAuditableProperties(true); } - boolean containedAuditProperties = auditableProps.setAuditValues(null, null, newProps); - if (!containedAuditProperties) - { - // The behaviour is disabled, but no audit properties were passed in - auditableProps = null; - } - nodeUpdate.setAuditableProperties(auditableProps); - // We DON'T set the update flag because the update depends on the aspect being enabled, etc. - // nodeUpdate.setUpdateAuditableProperties(true); } // Remove cm:auditable