Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)

113684 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3) (PARTIAL MERGE)
      113603 cturlica: Merged DEV to V4.2-BUG-FIX (4.2.6)
         113602 cturlica: MNT-14504: Cloud pull process not working after large delete


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@113727 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2015-10-06 08:58:59 +00:00
parent 98f27883be
commit 998ebb98de
10 changed files with 327 additions and 8 deletions

View File

@@ -238,4 +238,57 @@ public class Node2ServiceImpl extends NodeServiceImpl implements NodeService, Ve
return result;
}
/**
* {@inheritDoc}
* <p>
*
* Implementation for version store v2
*/
@Override
public List<AssociationRef> getTargetAssocsByPropertyValue(NodeRef sourceRef, QNamePattern qnamePattern, QName propertyQName, Serializable propertyValue)
{
// If lightWeightVersionStore call default version store implementation.
if (sourceRef.getStoreRef().getIdentifier().equals(VersionModel.STORE_ID))
{
return super.getTargetAssocsByPropertyValue(sourceRef, qnamePattern, propertyQName, propertyValue);
}
// Get the assoc references from the version store.
List<ChildAssociationRef> childAssocRefs = this.dbNodeService.getChildAssocs(VersionUtil.convertNodeRef(sourceRef),
Version2Model.CHILD_QNAME_VERSIONED_ASSOCS, qnamePattern);
List<AssociationRef> result = new ArrayList<AssociationRef>(childAssocRefs.size());
for (ChildAssociationRef childAssocRef : childAssocRefs)
{
// Get the assoc reference.
NodeRef childRef = childAssocRef.getChildRef();
NodeRef referencedNode = (NodeRef) this.dbNodeService.getProperty(childRef, ContentModel.PROP_REFERENCE);
if (this.dbNodeService.exists(referencedNode))
{
Long assocDbId = (Long) this.dbNodeService.getProperty(childRef, Version2Model.PROP_QNAME_ASSOC_DBID);
// Check if property type validation has to be done.
if (propertyQName != null)
{
Serializable propertyValueRetrieved = this.dbNodeService.getProperty(referencedNode, propertyQName);
// Check if property value has been retrieved (property
// exists) and is equal to the requested value.
if (propertyValueRetrieved == null || !propertyValueRetrieved.equals(propertyValue))
{
continue;
}
}
// Build an assoc ref to add to the returned list.
AssociationRef newAssocRef = new AssociationRef(assocDbId, sourceRef, childAssocRef.getQName(), referencedNode);
result.add(newAssocRef);
}
}
return result;
}
}