public void removeItems(List<? extends ItemPath> itemsToRemove) { for (ItemPath itemToRemove : itemsToRemove) { Item item = findItem(itemToRemove); // reduce to "removeItem" after fixing that method implementation if (item != null) { removeItem(item.getPath(), Item.class); } } }
public void keepPaths(List<? extends ItemPath> keep) { if (items != null) { for (Iterator<Item<?, ?>> iterator = items.iterator(); iterator.hasNext(); ) { Item<?, ?> item = iterator.next(); ItemPath itemPath = item.getPath().removeIds(); if (!ItemPathCollectionsUtil.containsSuperpathOrEquivalent(keep, itemPath)) { iterator.remove(); } else { if (item instanceof PrismContainer) { ((PrismContainer<?>) item).getValues().forEach(v -> v.keepPaths(keep)); } else { // TODO some additional checks here (e.g. when trying to keep 'name/xyz' - this is illegal) } } } } }
public void removePaths(List<? extends ItemPath> remove) { if (items != null) { for (Iterator<Item<?, ?>> iterator = items.iterator(); iterator.hasNext(); ) { Item<?, ?> item = iterator.next(); ItemPath itemPath = item.getPath().removeIds(); if (ItemPathCollectionsUtil.containsEquivalent(remove, itemPath)) { iterator.remove(); } else if (ItemPathCollectionsUtil.containsSuperpath(remove, itemPath)) { if (item instanceof PrismContainer) { ((PrismContainer<?>) item).getValues().forEach(v -> v.removePaths(remove)); } } } } }
public static <V extends PrismValue, D extends ItemDefinition> ItemDelta<V, D> createAddDeltaFor(Item<V, D> item) { ItemDelta<V, D> rv = item.createDelta(item.getPath()); rv.addValuesToAdd(item.getClonedValues()); return rv; }
@SuppressWarnings("unchecked") public static <V extends PrismValue, D extends ItemDefinition> ItemDelta<V, D> createAddDeltaFor(Item<V, D> item, PrismValue value) { ItemDelta<V, D> rv = item.createDelta(item.getPath()); rv.addValueToAdd((V) CloneUtil.clone(value)); return rv; }
for (Item item : items) { if (item.getDefinition() != null) { boolean isHidden = NotificationFunctionsImpl.isAmongHiddenPaths(item.getPath(), hiddenPaths); if (!isHidden && (showOperationalAttributes || !item.getDefinition().isOperational()) && !item.isEmpty()) { toBeDisplayed.add(item);
private <V extends PrismValue, D extends ItemDefinition> void msg(ValidationResult result, OperationResultStatus status, Item<V, D> item, String message) { ValidationItem resultItem = new ValidationItem(); resultItem.setStatus(status); if (item != null) { resultItem.setItemPath(item.getPath()); } LocalizableMessage lMessage = new SingleLocalizableMessage(null, null, message); resultItem.setMessage(lMessage); result.addItem(resultItem); } }
while (iterator.hasNext()) { Item<?,?> item = iterator.next(); ItemPath itemPath = item.getPath(); ItemDefinition<?> itemDef = item.getDefinition(); if (itemDef != null && itemDef.isElaborate()) {
Collection<ItemDelta<?,?>> subSubItemDeltas = new ArrayList<>(); for (ItemDelta<?,?> subItemDelta: subItemDeltas) { CompareResult compareComplex = subItemDelta.getPath().compareComplex(subAnyItem.getPath()); if (compareComplex == CompareResult.EQUIVALENT || compareComplex == CompareResult.SUBPATH) { subSubItemDeltas.add(subItemDelta);
ItemPath itemPath = item.getPath(); if (itemPath.isEmpty()) { return;
protected void assertPrismContext(Visitable value) { value.accept(v -> { if (v instanceof Item) { Item item = (Item) v; String label = item.getPath() + ": " + v; assertNotNull("No prism context in " + label, item.getPrismContextLocal()); } else if (v instanceof PrismContainerValue) { PrismContainerValue pcv = (PrismContainerValue) v; String label = pcv.getPath() + ": " + v; assertNotNull("No prism context in " + label, pcv.getPrismContextLocal()); } }); }
ItemPath itemPath = item.getPath(); AccessDecision itemDecision = itemDecisionFunction.decide(itemPath.namedSegmentsOnly(), removingContainer); logSubitemDecision(itemDecision, decisionContextDesc, itemPath);
public void applyTo(Item item, ParameterizedEquivalenceStrategy strategy) throws SchemaException { ItemPath itemPath = item.getPath(); ItemPath deltaPath = getPath(); CompareResult compareComplex = itemPath.compareComplex(deltaPath); if (compareComplex == CompareResult.EQUIVALENT) { applyToMatchingPath(item, strategy); cleanupAllTheWayUp(item); } else if (compareComplex == CompareResult.SUBPATH) { if (item instanceof PrismContainer<?>) { PrismContainer<?> container = (PrismContainer<?>)item; ItemPath remainderPath = deltaPath.remainder(itemPath); Item subItem = container.findOrCreateItem(remainderPath, getItemClass(), getDefinition()); applyToMatchingPath(subItem, strategy); } else { throw new SchemaException("Cannot apply delta "+this+" to "+item+" as delta path is below the item path and the item is not a container"); } } else if (compareComplex == CompareResult.SUPERPATH) { throw new SchemaException("Cannot apply delta "+this+" to "+item+" as delta path is above the item path"); } else if (compareComplex == CompareResult.NO_RELATION) { throw new SchemaException("Cannot apply delta "+this+" to "+item+" as paths do not match"); } }
stringValue = valuePolicyGenerator.generate(output.getPath(), valuePolicyType, DEFAULT_LENGTH, true, originResolver, context.getContextDescription(), context.getTask(), context.getResult()); } else { stringValue = valuePolicyGenerator.generate(output.getPath(), valuePolicyType, DEFAULT_LENGTH, false, originResolver, context.getContextDescription(), context.getTask(), context.getResult());
protected void assertDefinitions(Visitable value) { value.accept(v -> { if (v instanceof Item) { Item item = (Item) v; String label = item.getPath() + ": " + v; //System.out.println("Checking " + label); if (item.getDefinition() == null) { assertTrue("No definition in " + label, isDynamic(item.getPath())); } else { assertNotNull("No prism context in definition of " + label, item.getDefinition().getPrismContext()); } } else if (v instanceof PrismContainerValue) { PrismContainerValue pcv = (PrismContainerValue) v; String label = pcv.getPath() + ": " + v; //System.out.println("Checking " + label); if (pcv.getComplexTypeDefinition() == null) { fail("No complex type definition in " + label); } else { assertNotNull("No prism context in definition of " + label, pcv.getComplexTypeDefinition().getPrismContext()); } } }); }
ItemPath subPath = subItemOld.getPath().remainder(path); PartiallyResolvedItem<IV,ID> partialValue = subItemOld.findPartial(subPath); if (partialValue != null && partialValue.getItem() != null) {
for (Item<?,?> item: credentialsContainer.getValue().getItems()) { ContainerDelta<?> cdelta = prismContext.deltaFactory().container().create (item.getPath(), (PrismContainerDefinition)item.getDefinition()); cdelta.addValuesToAdd(((PrismContainer)item).getValue().clone()); AuthorizationDecisionType cdecision = evaluateCredentialDecision(context, securityConstraints, cdelta); LOGGER.trace("AUTZ: credential add {} decision: {}", item.getPath(), cdecision); if (cdecision == AuthorizationDecisionType.ALLOW) { pathsToRemove.add(item.getPath()); } else if (cdecision == AuthorizationDecisionType.DENY) { if (LOGGER.isTraceEnabled()) {