/** * Returns true if the collection contains a path equivalent to pathToBeFound. */ public static boolean containsEquivalent(Collection<? extends ItemPath> paths, ItemPath pathToBeFound) { for (ItemPath path : paths) { if (path.equivalent(pathToBeFound)) { return true; } } return false; }
public boolean matchesExactly(ItemPath itemPath) { return this.itemPath.equivalent(itemPath); }
/** * Compares with the other object either literally (exact = true) or via .equivalent (exact = false). */ default boolean equals(Object other, boolean exact) { if (exact) { return equals(other); } else { return other instanceof ItemPath && equivalent((ItemPath) other); } }
public Map.Entry<ItemPath, Collection<ObjectFilter>> getKnownComponentFilter(ItemPath path) { for (Map.Entry<ItemPath, Collection<ObjectFilter>> entry : knownComponentFilters.entrySet()) { if (path.equivalent(entry.getKey())) { return entry; } } return null; }
public Map.Entry<ItemPath, Collection<? extends PrismValue>> getKnownComponent(ItemPath path) { for (Map.Entry<ItemPath, Collection<? extends PrismValue>> entry : knownComponents.entrySet()) { if (path.equivalent(entry.getKey())) { return entry; } } return null; }
public static <T> DeltaSetTriple<? extends T> find(Map<? extends ItemPath, DeltaSetTriple<? extends T>> tripleMap, ItemPath path) { List<Map.Entry<? extends ItemPath, DeltaSetTriple<? extends T>>> matching = tripleMap.entrySet().stream() .filter(e -> path.equivalent(e.getKey())) .collect(Collectors.toList()); if (matching.isEmpty()) { return null; } else if (matching.size() == 1) { return matching.get(0).getValue(); } else { throw new IllegalStateException("Multiple matching entries for key '" + path + "' in " + tripleMap); } } }
public static <T> PropertyDelta<T> findPropertyDelta(Collection<? extends ItemDelta> modifications, ItemPath propertyPath) { for (ItemDelta delta: modifications) { if (delta instanceof PropertyDelta && delta.getPath().equivalent(propertyPath)) { return (PropertyDelta) delta; } } return null; }
public static <O extends Objectable> void assertEquivalent(String message, ItemPath expected, ItemPath actual) { if (!ItemPath.equivalent(expected, actual)) { fail(message + ": expected:\n" + expected + "\nreal:\n" + actual); } }
public static <D extends ItemDelta> void removeItemDelta(Collection<? extends ItemDelta> deltas, ItemPath propertyPath, Class<D> deltaType) { if (deltas == null) { return; } Iterator<? extends ItemDelta> deltasIterator = deltas.iterator(); while (deltasIterator.hasNext()) { ItemDelta<?,?> delta = deltasIterator.next(); if (deltaType.isAssignableFrom(delta.getClass()) && delta.getPath().equivalent(propertyPath)) { deltasIterator.remove(); } } }
public boolean matches(@NotNull QName typeName, @NotNull ItemPath path) { return QNameUtil.match(this.typeName, typeName) && itemPath.equivalent(path); }
public static void assertPathEquivalent(String message, ItemPath expected, ItemPath actual) { if (!expected.equivalent(actual)) { assert false : message + ": expected " + MiscUtil.getValueWithClass(expected) + ", was " + MiscUtil.getValueWithClass(actual); } }
public boolean equivalent(Object other) { if (!(other instanceof ItemPathType)) { return false; } ItemPath thisPath = getItemPath(); ItemPath otherPath = ((ItemPathType) other).getItemPath(); return thisPath.equivalent(otherPath); }
public boolean matches(String resourceOid, ShadowKindType kind, String intent, QName objectClassName, ItemPath path) { return this.resourceOid.equals(resourceOid) && this.kind == kind && ObjectUtils.equals(this.intent, intent) && QNameUtil.match(getObjectClassName(), objectClassName) && this.itemPath.equivalent(path); }
private boolean hasChangesOnResource( Collection<? extends ItemDelta> itemDeltas) { for (ItemDelta itemDelta : itemDeltas) { if (isAttributeDelta(itemDelta) || SchemaConstants.PATH_PASSWORD.equivalent(itemDelta.getParentPath())) { return true; } else if (SchemaConstants.PATH_ACTIVATION.equivalent(itemDelta.getParentPath())){ return true; } else if (ShadowType.F_ASSOCIATION.equivalent(itemDelta.getPath())) { return true; } } return false; }
private SceneImpl findPartialSceneByPath(SceneImpl scene, ItemPath deltaParentPath) { for (SceneImpl subscene : scene.getPartialScenes()) { if (subscene.getSourceAbsPath().equivalent(deltaParentPath) && subscene.getChangeType() == MODIFY) { return subscene; } } return null; }
private boolean deltaContains(ObjectDeltaType delta) { for (ItemDeltaType itemDelta: delta.getItemDelta()) { ItemPath deltaPath = itemDelta.getPath().getItemPath(); if (itemPath.equivalent(deltaPath)) { return true; } } return false; }
private ValidationItem findItem(ValidationResult validationResult, ItemPath expectedPath) { for (ValidationItem valItem : validationResult.getItems()) { if (expectedPath.equivalent(valItem.getItemPath())) { return valItem; } } return null; } }
public ObjectDeltaTypeAsserter<RA> assertHasModification(ItemPath itemPath) { for (ItemDeltaType itemDelta: delta.getItemDelta()) { if (itemPath.equivalent(itemDelta.getPath().getItemPath())) { return this; } } fail("No modification for "+itemPath+" in "+desc()); return null; // not reached }
protected void assertHasModification(ObjectDeltaType deltaType, ItemPath itemPath) { for (ItemDeltaType itemDelta: deltaType.getItemDelta()) { if (itemPath.equivalent(itemDelta.getPath().getItemPath())) { return; } } fail("No modification for "+itemPath+" in delta"); }
private boolean dependsOn(FocalMappingSpec mappingSpec1, FocalMappingSpec mappingSpec2) { MappingType mapping1 = mappingSpec1.getMappingType(); MappingType mapping2 = mappingSpec2.getMappingType(); if (mapping2.getTarget() == null || mapping2.getTarget().getPath() == null) { return false; } ItemPath targetPath = mapping2.getTarget().getPath().getItemPath().stripVariableSegment(); for (VariableBindingDefinitionType source : mapping1.getSource()) { ItemPath sourcePath = prismContext.toPath(source.getPath()); if (sourcePath != null && stripFocusVariableSegment(sourcePath).equivalent(targetPath)) { return true; } } return false; }