public boolean removeEdge( ProcessEdge processEdge ) { return graph.removeEdge( processEdge ); }
public ProcessEdge removeEdge( Process sourceVertex, Process targetVertex ) { return graph.removeEdge( sourceVertex, targetVertex ); }
/** * This method is synchronized and removes an edge from a simple directed graph stored in static memory of this process. * * @param graph synchronized parameter contains a reference to simple digraph {@code org.jgrapht.graph.SimpleDirectedGraph}. * @param relation contains parent-child relationship targeted for removal. * @return {@code org.jgrapht.graph.SimpleDirectedGraph} containing the vertices of {@code String}, and edges, as {@link Relationship}s that correspond to relational data. */ private static void removeEdge( SimpleDirectedGraph<String, Relationship> graph, Relationship relation ) { LOG.debug( "removeEdge" ); synchronized ( graph ) { graph.removeEdge( relation ); } }
@Test public void test100AddWithOverwrite() throws Exception { OperationResult opResult = new OperationResult("===[ test100AddWithOverwrite ]==="); _test100LoadOrgStructure(); _test150CheckClosure(); String parentOid = orgsByLevels.get(0).get(0); String childOid = orgsByLevels.get(1).get(0); PrismObject<OrgType> childOrg = repositoryService.getObject(OrgType.class, childOid, null, opResult); childOrg.asObjectable().getParentOrgRef().clear(); LOGGER.info("+++ adding object with 'overwrite' option +++"); repositoryService.addObject(childOrg, RepoAddOptions.createOverwrite(), opResult); orgGraph.removeEdge(childOid, parentOid); checkOrgGraph(); boolean problem = checkClosureMatrix(); assertFalse("Closure problem was detected", problem); }
protected void removeObjectParent(ObjectType object, ObjectReferenceType parentOrgRef, boolean useReplace, OperationResult opResult) throws Exception { List<ItemDelta> modifications = new ArrayList<>(); if (!useReplace) { // standard case PrismReferenceValue existingValue = parentOrgRef.asReferenceValue(); ItemDelta removeParent = prismContext.deltaFactory().reference().createModificationDelete(object.getClass(), OrgType.F_PARENT_ORG_REF, existingValue.clone()); modifications.add(removeParent); } else { // using REPLACE modification List<PrismReferenceValue> newValues = new ArrayList<>(); for (ObjectReferenceType ort : object.getParentOrgRef()) { if (!ort.getOid().equals(parentOrgRef.getOid())) { newValues.add(ort.asReferenceValue().clone()); } } PrismObjectDefinition objectDefinition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(object.getClass()); ItemDelta replaceParent = prismContext.deltaFactory().reference().createModificationReplace(OrgType.F_PARENT_ORG_REF, objectDefinition, newValues); modifications.add(replaceParent); } repositoryService.modifyObject(object.getClass(), object.getOid(), modifications, opResult); if (object instanceof OrgType) { orgGraph.removeEdge(object.getOid(), parentOrgRef.getOid()); } }
private void removeEdge(Edge edge) throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException { List<ItemDelta> modifications = new ArrayList<>(); ObjectReferenceType parentOrgRef = new ObjectReferenceType(); parentOrgRef.setType(OrgType.COMPLEX_TYPE); parentOrgRef.setOid(edge.getAncestor()); ItemDelta removeParent = prismContext.deltaFactory().reference() .createModificationDelete(OrgType.class, OrgType.F_PARENT_ORG_REF, parentOrgRef.asReferenceValue()); modifications.add(removeParent); repositoryService.modifyObject(OrgType.class, edge.getDescendant(), modifications, new OperationResult("dummy")); synchronized(this) { orgGraph.removeEdge(edge.getDescendant(), edge.getAncestor()); } }