use of java.util.Arrays.asList in project alfresco-repository by Alfresco.
the class EventsServiceImpl method nodeMoved.
@Override
public void nodeMoved(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) {
NodeRef nodeRef = newChildAssocRef.getChildRef();
NodeInfo nodeInfo = getNodeInfo(nodeRef, NodeMovedEvent.EVENT_TYPE);
if (nodeInfo.checkNodeInfo()) {
String username = AuthenticationUtil.getFullyAuthenticatedUser();
String networkId = TenantUtil.getCurrentDomain();
String objectId = nodeInfo.getNodeId();
String siteId = nodeInfo.getSiteId();
String txnId = AlfrescoTransactionSupport.getTransactionId();
long timestamp = System.currentTimeMillis();
Long modificationTime = nodeInfo.getModificationTimestamp();
String nodeType = nodeInfo.getType().toPrefixString(namespaceService);
NodeRef oldParentNodeRef = oldChildAssocRef.getParentRef();
NodeRef newParentNodeRef = newChildAssocRef.getParentRef();
NodeRef oldNodeRef = oldChildAssocRef.getChildRef();
NodeRef newNodeRef = newChildAssocRef.getChildRef();
String oldParentNodeName = (String) nodeService.getProperty(oldParentNodeRef, ContentModel.PROP_NAME);
String newParentNodeName = (String) nodeService.getProperty(newParentNodeRef, ContentModel.PROP_NAME);
String oldNodeName = (String) nodeService.getProperty(oldNodeRef, ContentModel.PROP_NAME);
String newNodeName = (String) nodeService.getProperty(newNodeRef, ContentModel.PROP_NAME);
List<Path> newParentPaths = nodeService.getPaths(newParentNodeRef, false);
List<String> newPaths = getPaths(newParentPaths, Arrays.asList(newParentNodeName, newNodeName));
// renames are handled by an onUpdateProperties callback, we just deal with real moves here.
if (!oldParentNodeRef.equals(newParentNodeRef)) {
List<List<String>> toParentNodeIds = getNodeIds(newParentPaths);
List<Path> oldParentPaths = nodeService.getPaths(oldParentNodeRef, false);
List<String> previousPaths = getPaths(oldParentPaths, Arrays.asList(oldParentNodeName, oldNodeName));
List<List<String>> previousParentNodeIds = getNodeIds(oldParentPaths);
Set<String> aspects = nodeInfo.getAspectsAsStrings();
Map<String, Serializable> properties = nodeInfo.getProperties();
Client alfrescoClient = getAlfrescoClient(nodeInfo.getClient());
Event event = new NodeMovedEvent(nextSequenceNumber(), oldNodeName, newNodeName, txnId, timestamp, networkId, siteId, objectId, nodeType, previousPaths, previousParentNodeIds, username, modificationTime, newPaths, toParentNodeIds, alfrescoClient, aspects, properties);
sendEvent(event);
}
}
}
use of java.util.Arrays.asList in project alfresco-repository by Alfresco.
the class EventsServiceImpl method secondaryAssociationDeleted.
@Override
public void secondaryAssociationDeleted(final ChildAssociationRef secAssociation) {
NodeInfo nodeInfo = getNodeInfo(secAssociation.getChildRef(), NodeRemovedEvent.EVENT_TYPE);
if (nodeInfo.checkNodeInfo()) {
String username = AuthenticationUtil.getFullyAuthenticatedUser();
String networkId = TenantUtil.getCurrentDomain();
String name = nodeInfo.getName();
String objectId = nodeInfo.getNodeId();
String siteId = nodeInfo.getSiteId();
String txnId = AlfrescoTransactionSupport.getTransactionId();
NodeRef secParentNodeRef = secAssociation.getParentRef();
String secParentNodeName = (String) nodeService.getProperty(secAssociation.getParentRef(), ContentModel.PROP_NAME);
List<Path> secParentPath = nodeService.getPaths(secParentNodeRef, true);
List<String> nodePaths = getPaths(secParentPath, Arrays.asList(secParentNodeName, name));
List<List<String>> pathNodeIds = this.getNodeIds(secParentPath);
long timestamp = System.currentTimeMillis();
Long modificationTime = nodeInfo.getModificationTimestamp();
String nodeType = nodeInfo.getType().toPrefixString(namespaceService);
Client alfrescoClient = getAlfrescoClient(nodeInfo.getClient());
Set<String> aspects = nodeInfo.getAspectsAsStrings();
Map<String, Serializable> properties = nodeInfo.getProperties();
Event event = new NodeRemovedEvent(nextSequenceNumber(), name, txnId, timestamp, networkId, siteId, objectId, nodeType, nodePaths, pathNodeIds, username, modificationTime, alfrescoClient, aspects, properties);
sendEvent(event);
}
}
use of java.util.Arrays.asList in project bullet-core by yahoo.
the class QuantileSketchingStrategyTest method testRounding.
@Test
public void testRounding() {
QuantileSketchingStrategy distribution = makeDistribution(DistributionType.QUANTILE, 20, 6, 0.0, 1.0, 0.1);
IntStream.range(0, 10).mapToDouble(i -> i * 0.1).mapToObj(d -> RecordBox.get().add("field", d).getRecord()).forEach(distribution::consume);
Clip result = distribution.getResult();
Map<String, Object> metadata = (Map<String, Object>) result.getMeta().asMap().get("meta");
Assert.assertEquals(metadata.size(), 7);
Assert.assertFalse((Boolean) metadata.get("isEst"));
List<BulletRecord> records = result.getRecords();
Assert.assertEquals(records.size(), 11);
Set<String> actualQuantilePoints = records.stream().map(r -> r.typedGet(QUANTILE_FIELD).getValue().toString()).collect(Collectors.toSet());
Set<String> expectedQuantilePoints = new HashSet<>(Arrays.asList("0.0", "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"));
Assert.assertEquals(actualQuantilePoints, expectedQuantilePoints);
Assert.assertEquals(distribution.getRecords(), result.getRecords());
Assert.assertEquals(distribution.getMetadata().asMap(), result.getMeta().asMap());
}
Aggregations