Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)

127078 rneamtu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2)
      127046 amorarasu: MNT-16277: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4)
         126884 amorarasu: MNT-15710: No invalid synchronizations should appear in the cloud sync manager (step 2 - clean invalid synchronizations already created).


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@127124 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Cristian Turlica
2016-05-16 14:47:10 +00:00
parent 4d0939f110
commit b861424c72
4 changed files with 203 additions and 2 deletions

View File

@@ -702,6 +702,19 @@ public interface NodeDAO extends NodeBulkLoader
final QName assocTypeQName,
ChildAssocRefQueryCallback resultsCallback);
/**
* @param parentNodeId the parent node id
* @param minNodeId the minimum node ID (inclusive), <tt>null</tt> for no limitation on the minimum value of the node id
* @param maxNodeId the maximum node ID (exclusive), <tt>null</tt> for no limitation on the maximum value of the node id
* @param assocToExcludeTypeQNames the node associations to exclude, <tt>null</tt> for no filtering of the associations types
* @return list of child nodes
*/
public List<Node> selectChildAssocsWithoutNodeAssocsOfTypes(
final Long parentNodeId,
final Long minNodeId,
final Long maxNodeId,
final Set<QName> assocToExcludeTypeQNames);
/**
* Finds the association between the node's primary parent and the node itself
*
@@ -873,6 +886,16 @@ public interface NodeDAO extends NodeBulkLoader
*/
public Long getMaxNodeId();
/**
* Returns the [minId, maxId] interval for nodes of a type, with the transaction time in the given window time.
*
* @param type the node type
* @param startTxnTime the starting transaction time, <tt>null</tt> is allowed, case in which no minimum transaction time is considered
* @param endTxnTime the end transaction time, <tt>null</tt> is allowed, case in which no maximum transaction time is considered
* @return the interval, as a pair
*/
public Pair<Long, Long> getNodeIdsIntervalForType(QName type, Long startTxnTime, Long endTxnTime);
/**
* Select children by property values
*/

View File

@@ -114,6 +114,7 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
private static final String DELETE_NODE_PROPERTIES = "alfresco.node.delete_NodeProperties";
private static final String SELECT_NODE_MIN_ID = "alfresco.node.select_NodeMinId";
private static final String SELECT_NODE_MAX_ID = "alfresco.node.select_NodeMaxId";
private static final String SELECT_NODE_INTERVAL_BY_TYPE = "alfresco.node.select_MinMaxNodeIdForNodeType";
private static final String SELECT_NODES_WITH_ASPECT_IDS = "alfresco.node.select_NodesWithAspectIds";
private static final String INSERT_NODE_ASSOC = "alfresco.node.insert.insert_NodeAssoc";
private static final String UPDATE_NODE_ASSOC = "alfresco.node.update_NodeAssoc";
@@ -138,6 +139,8 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
private static final String SELECT_CHILD_ASSOC_OF_PARENT_BY_NAME = "alfresco.node.select_ChildAssocOfParentByName";
private static final String SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_PARENT_ASSOCS_OF_TYPE =
"alfresco.node.select_ChildAssocsOfParentWithoutParentAssocsOfType";
private static final String SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_NODE_ASSOCS_OF_TYPE =
"alfresco.node.select_ChildAssocsOfParentWithoutNodeAssocsOfType";
private static final String SELECT_PARENT_ASSOCS_OF_CHILD = "alfresco.node.select_ParentAssocsOfChild";
private static final String UPDATE_PARENT_ASSOCS_OF_CHILD = "alfresco.node.update_ParentAssocsOfChild";
private static final String DELETE_SUBSCRIPTIONS = "alfresco.node.delete_NodeSubscriptions";
@@ -373,6 +376,38 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
return (Long) template.selectOne(SELECT_NODE_MAX_ID);
}
@Override
public Pair<Long, Long> getNodeIdsIntervalForType(QName type, Long startTxnTime, Long endTxnTime)
{
final Pair<Long, Long> intervalPair = new Pair<Long, Long>(LONG_ZERO, LONG_ZERO);
Pair<Long, QName> typePair = qnameDAO.getQName(type);
if (typePair == null)
{
// Return default
return intervalPair;
}
TransactionQueryEntity txnQuery = new TransactionQueryEntity();
txnQuery.setTypeQNameId(typePair.getFirst());
txnQuery.setMinCommitTime(startTxnTime);
txnQuery.setMaxCommitTime(endTxnTime);
ResultHandler resultHandler = new ResultHandler()
{
@SuppressWarnings("unchecked")
public void handleResult(ResultContext context)
{
Map<Long, Long> result = (Map<Long, Long>) context.getResultObject();
if (result != null)
{
intervalPair.setFirst(result.get("minId"));
intervalPair.setSecond(result.get("maxId"));
}
}
};
template.select(SELECT_NODE_INTERVAL_BY_TYPE, txnQuery, resultHandler);
return intervalPair;
}
@Override
protected void updatePrimaryChildrenSharedAclId(
Long txnId,
@@ -1385,7 +1420,30 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
resultsCallback.done();
}
@SuppressWarnings("unchecked")
@Override
public List<Node> selectChildAssocsWithoutNodeAssocsOfTypes(Long parentNodeId, Long minNodeId, Long maxNodeId, Set<QName> assocTypeQNames)
{
IdsEntity idsEntity = new IdsEntity();
// Parent node id
Assert.notNull(parentNodeId, "The parent node id must not be null.");
idsEntity.setIdOne(parentNodeId);
// Node ids selection interval
idsEntity.setIdTwo(minNodeId);
idsEntity.setIdThree(maxNodeId);
// Associations types to exclude
if (assocTypeQNames != null)
{
Set<Long> childNodeTypeQNameIds = qnameDAO.convertQNamesToIds(assocTypeQNames, false);
if (childNodeTypeQNameIds.size() > 0)
{
idsEntity.setIds(new ArrayList<Long>(childNodeTypeQNameIds));
}
}
return template.selectList(SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_NODE_ASSOCS_OF_TYPE, idsEntity);
}
@Override
protected List<ChildAssocEntity> selectPrimaryParentAssocs(Long childNodeId)
{
@@ -1665,7 +1723,7 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
if (deletedTypePair == null)
{
// Nothing to do
return 0L;
return LONG_ZERO;
}
TransactionQueryEntity txnQuery = new TransactionQueryEntity();
txnQuery.setTypeQNameId(deletedTypePair.getFirst());