mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix error applying cm:auditable during node creation
- cm:auditable was being recorded in the cache but not written through to the DB - The problem manifested itself during server restart of a Share Site containing links git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20776 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -913,15 +913,13 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
TransactionEntity txn = getCurrentTransaction();
|
TransactionEntity txn = getCurrentTransaction();
|
||||||
node.setTransaction(txn);
|
node.setTransaction(txn);
|
||||||
|
|
||||||
Set<QName> nodeAspects = null;
|
|
||||||
|
|
||||||
// Audit
|
// Audit
|
||||||
|
boolean addAuditableAspect = false;
|
||||||
if (auditableProps != null)
|
if (auditableProps != null)
|
||||||
{
|
{
|
||||||
// Client-supplied cm:auditable values
|
// Client-supplied cm:auditable values
|
||||||
node.setAuditableProperties(auditableProps);
|
node.setAuditableProperties(auditableProps);
|
||||||
|
addAuditableAspect = true;
|
||||||
nodeAspects = Collections.singleton(ContentModel.ASPECT_AUDITABLE);
|
|
||||||
}
|
}
|
||||||
else if (AuditablePropertiesEntity.hasAuditableAspect(nodeTypeQName, dictionaryService))
|
else if (AuditablePropertiesEntity.hasAuditableAspect(nodeTypeQName, dictionaryService))
|
||||||
{
|
{
|
||||||
@@ -929,12 +927,7 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
auditableProps = new AuditablePropertiesEntity();
|
auditableProps = new AuditablePropertiesEntity();
|
||||||
auditableProps.setAuditValues(null, null, true, 0L);
|
auditableProps.setAuditValues(null, null, true, 0L);
|
||||||
node.setAuditableProperties(auditableProps);
|
node.setAuditableProperties(auditableProps);
|
||||||
|
addAuditableAspect = true;
|
||||||
nodeAspects = Collections.singleton(ContentModel.ASPECT_AUDITABLE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nodeAspects = Collections.<QName>emptySet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Long id = null;
|
Long id = null;
|
||||||
@@ -962,6 +955,18 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
}
|
}
|
||||||
node.setId(id);
|
node.setId(id);
|
||||||
|
|
||||||
|
Set<QName> nodeAspects = null;
|
||||||
|
if (addAuditableAspect)
|
||||||
|
{
|
||||||
|
Long auditableAspectQNameId = qnameDAO.getOrCreateQName(ContentModel.ASPECT_AUDITABLE).getFirst();
|
||||||
|
insertNodeAspect(id, auditableAspectQNameId);
|
||||||
|
nodeAspects = Collections.<QName>singleton(ContentModel.ASPECT_AUDITABLE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nodeAspects = Collections.<QName>emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
// Lock the node and cache
|
// Lock the node and cache
|
||||||
node.lock();
|
node.lock();
|
||||||
nodesCache.setValue(id, node);
|
nodesCache.setValue(id, node);
|
||||||
@@ -1551,6 +1556,11 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
Map<QName, Serializable> newProps,
|
Map<QName, Serializable> newProps,
|
||||||
boolean isAddOnly)
|
boolean isAddOnly)
|
||||||
{
|
{
|
||||||
|
if (isAddOnly && newProps.size() == 0)
|
||||||
|
{
|
||||||
|
return false; // No point adding nothing
|
||||||
|
}
|
||||||
|
|
||||||
Node node = getNodeNotNull(nodeId);
|
Node node = getNodeNotNull(nodeId);
|
||||||
// Copy inbound values
|
// Copy inbound values
|
||||||
newProps = new HashMap<QName, Serializable>(newProps);
|
newProps = new HashMap<QName, Serializable>(newProps);
|
||||||
@@ -1888,6 +1898,10 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
|||||||
|
|
||||||
public boolean addNodeAspects(Long nodeId, Set<QName> aspectQNames)
|
public boolean addNodeAspects(Long nodeId, Set<QName> aspectQNames)
|
||||||
{
|
{
|
||||||
|
if (aspectQNames.size() == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Copy the inbound set
|
// Copy the inbound set
|
||||||
Set<QName> aspectQNamesToAdd = new HashSet<QName>(aspectQNames);
|
Set<QName> aspectQNamesToAdd = new HashSet<QName>(aspectQNames);
|
||||||
// Get existing
|
// Get existing
|
||||||
|
Reference in New Issue
Block a user