@Override public Graph getGraph() { return this.contextNode.getGraph(); }
@Override public Graph getGraph() { return this.getContextNode().getGraph(); }
@Override public Graph getGraph() { return this.getContextNode().getGraph(); }
CopyUtil.copyGraph(tempGraph, this.getBaseContextNode().getGraph(), null);
CopyUtil.copyGraph(tempGraph, this.getBaseContextNode().getGraph(), null);
@Override public XdiCommonRoot findCommonRoot() { return new XdiCommonRoot(this.getContextNode().getGraph().getRootContextNode(false)); }
private void processConnect(LinkContractTemplate linkContractTemplate, ConnectOperation operation, Graph operationResultGraph, ExecutionContext executionContext) throws Xdi2MessagingException { if (log.isDebugEnabled()) log.debug("Preparing to instantiate link contract template " + linkContractTemplate); // set variable values Map<XDIArc, Object> variableValues = operation.getVariableValues(); variableValues.put(XDILinkContractConstants.XDI_ARC_V_FROM, operation.getMessage().getSenderXDIAddress()); variableValues.put(XDILinkContractConstants.XDI_ARC_V_TO, executionContext.getCurrentMessagingContainer().getOwnerXDIAddress()); // instantiate link contract LinkContractInstantiation linkContractInstantiation = new LinkContractInstantiation(linkContractTemplate); linkContractInstantiation.setVariableValues(variableValues); LinkContract linkContract; try { linkContract = linkContractInstantiation.execute(); } catch (Exception ex) { throw new Xdi2MessagingException("Cannot instantiate link contract: " + ex.getMessage(), ex, executionContext); } // write link contract and index into operation result graph CopyUtil.copyGraph(linkContract.getContextNode().getGraph(), operationResultGraph, null); // first delete link contract in target graph if it exists already ContextNode linkContractContextNode = this.getTargetGraph(executionContext).getDeepContextNode(linkContract.getContextNode().getXDIAddress()); if (linkContractContextNode != null) linkContractContextNode.delete(); // write link contract and index into target graph if (this.getTargetGraph(executionContext) != null) { CopyUtil.copyGraph(linkContract.getContextNode().getGraph(), this.getTargetGraph(executionContext), null); XdiEntityCollection xdiLinkContractIndex = Index.getEntityIndex(this.getTargetGraph(executionContext), XDILinkContractConstants.XDI_ARC_CONTRACT, true); Index.setEntityIndexAggregation(xdiLinkContractIndex, linkContract.getXdiEntity()); } }
public void setDID(DID did) { if (did.equals(this.getDID())) return; ContextNode newContextNode = this.getContextNode().getGraph().setDeepContextNode(did.getXDIAddress()); CopyUtil.copyContextNodeContents(this.getContextNode(), newContextNode, null); this.getContextNode().delete(); this.xdiEntity = XdiAbstractEntity.fromContextNode(newContextNode); }
private Graph resolveGraph(XDIAddress contextNodeXDIAddress) { XDIArc firstArc = contextNodeXDIAddress.getFirstXDIArc(); if (XdiPeerRoot.isValidXDIArc(firstArc)) { firstArc = XdiPeerRoot.getXDIAddressOfPeerRootXDIArc(firstArc).getFirstXDIArc(); } else if (XdiInnerRoot.isValidXDIArc(firstArc)) { firstArc = XdiInnerRoot.getSubjectOfInnerRootXDIArc(firstArc).getFirstXDIArc(); } Graph resolvedGraph = null; if (XDI_ARC_MSG_VARIABLE.equals(firstArc)) { resolvedGraph = this.getMessage().getContextNode().getGraph(); } else if (XDI_ARC_FROM_VARIABLE.equals(firstArc)) { resolvedGraph = this.getTargetGraph(); } else if (XDI_ARC_FROM_PEER_VARIABLE.equals(firstArc)) { resolvedGraph = this.getTargetGraph(); } else { resolvedGraph = this.getTargetGraph(); } if (log.isTraceEnabled()) log.trace("getGraph(" + contextNodeXDIAddress + ") --> " + resolvedGraph); return resolvedGraph; }
CopyUtil.copyGraph(pushLinkContract.getContextNode().getGraph(), messageDeferredPushResultGraph, null); CopyUtil.copyGraph(pushLinkContract.getContextNode().getGraph(), this.getTargetGraph(executionContext), null); XdiEntityCollection xdiLinkContractIndex = Index.getEntityIndex(this.getTargetGraph(executionContext), XDILinkContractConstants.XDI_ARC_CONTRACT, true); Index.setEntityIndexAggregation(xdiLinkContractIndex, pushLinkContract.getXdiEntity().getXDIAddress());
assertEquals(contextNodesArray.length, literalsArray.length); for (ContextNode contextNode : contextNodesArray) if (contextNode != null) assertTrue(contextNode.getGraph().getDeepContextNode(contextNode.getXDIAddress()) != null); for (Iterator<XDIAddress> it = arcs.iterator(); it.hasNext(); ) assertTrue(contextNodesArray[i].getGraph().getDeepContextNode(contextNodesArray[i].getXDIAddress()).getRelations(it.next()) != null); assertEquals(arcs.size(), contextNodesArray[i].getRelationCount()); assertEquals(arcs.size(), new IteratorCounter(contextNodesArray[i].getRelations()).count());
assertEquals(contextNodesArray.length, literalsArray.length); for (ContextNode contextNode : contextNodesArray) if (contextNode != null) assertTrue(contextNode.getGraph().getDeepContextNode(contextNode.getXDIAddress()) != null); for (Iterator<XDIAddress> it = arcs.iterator(); it.hasNext(); ) assertTrue(contextNodesArray[i].getGraph().getDeepContextNode(contextNodesArray[i].getXDIAddress()).getRelations(it.next()) != null); assertEquals(arcs.size(), contextNodesArray[i].getRelationCount()); assertEquals(arcs.size(), new IteratorCounter(contextNodesArray[i].getRelations()).count());