APPSREPO-549 : [3.1]CLONE - Error when Declare Record Rule has "Hide" selected (#263)

- small fix to prevent IndexOutOfBoundsException when generating RecordCreatedEvent for records that have been hidden on creation
This commit is contained in:
constantinpopa10
2018-11-02 10:16:11 +02:00
committed by Andrei Rebegea
parent cb2008eb61
commit 44cd5f14d0

View File

@@ -1033,8 +1033,13 @@ public class EventsServiceImpl extends AbstractEventsService implements EventsSe
//When a node is declared as a record, a secondary association is created for the original location, hence use just that.
List<Path> allPaths = nodeService.getPaths(nodeRef, false);
Path primaryPath = nodeService.getPath(nodeRef);
if (allPaths.size() >= 2)
{
allPaths.remove(primaryPath);
List<Path> secPath = Collections.singletonList(allPaths.get(0));
}
List<Path> recordPath = Collections.singletonList(allPaths.get(0));
Event event = RecordCreatedEvent.builder()
.seqNumber(nextSequenceNumber())
@@ -1045,8 +1050,8 @@ public class EventsServiceImpl extends AbstractEventsService implements EventsSe
.siteId(nodeInfo.getSiteId())
.nodeId(nodeInfo.getNodeId())
.nodeType(nodeInfo.getType().toPrefixString(namespaceService))
.paths(getPaths(secPath, Arrays.asList(nodeInfo.getName())))
.parentNodeIds(this.getNodeIdsFromParent(secPath))
.paths(getPaths(recordPath, Arrays.asList(nodeInfo.getName())))
.parentNodeIds(this.getNodeIdsFromParent(recordPath))
.username(AuthenticationUtil.getFullyAuthenticatedUser())
.nodeModificationTime(nodeInfo.getModificationTimestamp())
.client(getAlfrescoClient(nodeInfo.getClient()))