diff --git a/source/java/org/alfresco/repo/audit/AuditableAspectTest.java b/source/java/org/alfresco/repo/audit/AuditableAspectTest.java
index 701e1c805b..5f1c098be8 100644
--- a/source/java/org/alfresco/repo/audit/AuditableAspectTest.java
+++ b/source/java/org/alfresco/repo/audit/AuditableAspectTest.java
@@ -39,7 +39,6 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.debug.NodeStoreInspector;
-import org.apache.chemistry.tck.atompub.fixture.AssertNotExistVisitor;
import org.springframework.context.ApplicationContext;
/**
@@ -228,9 +227,11 @@ public class AuditableAspectTest extends TestCase
}
/**
- * ALF-2565: Allow cm:auditable values to be set programmatically
+ * ALF-2565: Allow cm:auditable values to be set programmatically
+ * ALF-4117: NodeDAO: Allow cm:auditable to be set
+ * ALF-3569: Alfresco repository CIFS driver not setting timestamps
*/
- public void testCreateNodeWithAuditableProperties_ALF_2565()
+ public void testCreateAndUpdateAuditableProperties()
{
// Create a person (which doesn't have auditable capability by default)
Map personProps = new HashMap();
@@ -271,7 +272,11 @@ public class AuditableAspectTest extends TestCase
{
behaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); // Lasts for txn
// Set the auditable properties explicitly
- auditableProps.put(ContentModel.PROP_MODIFIER, "ThisUser");
+ Long currentTime = System.currentTimeMillis();
+ auditableProps.put(ContentModel.PROP_CREATOR, "Creator-" +currentTime);
+ auditableProps.put(ContentModel.PROP_CREATED, new Date(currentTime - 1000L));
+ auditableProps.put(ContentModel.PROP_MODIFIER, "Modifier-" + currentTime);
+ auditableProps.put(ContentModel.PROP_MODIFIED, new Date(currentTime - 1000L));
nodeService.addProperties(nodeRef, auditableProps);
// Done
return null;
diff --git a/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java b/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java
index c2d83aa186..92aae8a5d7 100644
--- a/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java
+++ b/source/java/org/alfresco/repo/domain/node/AbstractNodeDAOImpl.java
@@ -1269,13 +1269,15 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
if (auditableProps != null)
{
nodeUpdate.setAuditableProperties(auditableProps);
+ nodeUpdate.setUpdateAuditableProperties(true);
}
}
- // else
- // {
- // // SAIL-390: NodeDAO: Allow cm:auditable to be set
- // // The nodeUpdate had auditable properties set, so we just use that directly
- // }
+ else
+ {
+ // ALF-4117: NodeDAO: Allow cm:auditable to be set
+ // The nodeUpdate had auditable properties set, so we just use that directly
+ nodeUpdate.setUpdateAuditableProperties(true);
+ }
}
else
{
@@ -1582,7 +1584,8 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
* false if the properties are a complete set
* @return Returns true if any properties were changed
*/
- private boolean setNodePropertiesImpl(Long nodeId,
+ private boolean setNodePropertiesImpl(
+ Long nodeId,
Map newProps,
boolean isAddOnly)
{
@@ -1599,7 +1602,11 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
AuditablePropertiesEntity auditableProps = null;
if (!policyBehaviourFilter.isEnabled(node.getNodeRef(), ContentModel.ASPECT_AUDITABLE))
{
- auditableProps = new AuditablePropertiesEntity();
+ auditableProps = node.getAuditableProperties();
+ if (auditableProps == null)
+ {
+ auditableProps = new AuditablePropertiesEntity();
+ }
boolean containedAuditProperties = auditableProps.setAuditValues(null, null, newProps);
if (!containedAuditProperties)
{