mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
124656 rmunteanu: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 124582 rmunteanu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2) 124539 jvonka: Merged 50N-NDB (5.0.4) to 5.0.N (5.0.4) 124514: MNT-15211: NDB-specific workaround fix for trashcan restore (since NDB does not support partial rollback on constraint violation) - this fix is dialect-specific (hence does not impact existing supported DB types) - note: MySQL Cluster NDB - experimental/unsupported git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127764 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2016 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -1390,6 +1390,37 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
||||
|
||||
if (!allowAuditableAspect) addAuditableAspect = false;
|
||||
|
||||
Long id = newNodeImplInsert(node);
|
||||
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
|
||||
node.lock();
|
||||
nodesCache.setValue(id, node);
|
||||
// Pre-populate some of the other caches so that we don't immediately query
|
||||
setNodeAspectsCached(id, nodeAspects);
|
||||
setNodePropertiesCached(id, Collections.<QName, Serializable>emptyMap());
|
||||
|
||||
if (isDebugEnabled)
|
||||
{
|
||||
logger.debug("Created new node: \n" + " " + node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
protected Long newNodeImplInsert(NodeEntity node)
|
||||
{
|
||||
Long id = null;
|
||||
Savepoint savepoint = controlDAO.createSavepoint("newNodeImpl");
|
||||
try
|
||||
@@ -1425,32 +1456,8 @@ public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
|
||||
throw new NodeExistsException(dbTargetNode.getNodePair(), e);
|
||||
}
|
||||
}
|
||||
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
|
||||
node.lock();
|
||||
nodesCache.setValue(id, node);
|
||||
// Pre-populate some of the other caches so that we don't immediately query
|
||||
setNodeAspectsCached(id, nodeAspects);
|
||||
setNodePropertiesCached(id, Collections.<QName, Serializable>emptyMap());
|
||||
|
||||
if (isDebugEnabled)
|
||||
{
|
||||
logger.debug("Created new node: \n" + " " + node);
|
||||
}
|
||||
return node;
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user