public static void assertNotEmpty(Item<?,?> item) { assert !item.isEmpty() : "Item "+item+" is empty"; }
private boolean hasNoValue(Item aPrioriTargetItem) { return aPrioriTargetItem == null || (aPrioriTargetItem.isEmpty() && !aPrioriTargetItem.isIncomplete()); }
private V getSingleValue(Item<V, D> item) { if (item == null || item.isEmpty()) { return null; } else if (item.size() == 1) { return item.getAnyValue(); } else { throw new IllegalStateException("Multiple values where single one was expected: " + item); } }
/** * @return mode (adding, deleting, keeping) with respect to the *current* object (not the old one) */ @NotNull public PlusMinusZero getMode() { if (assignmentIdi.getItemNew() == null || assignmentIdi.getItemNew().isEmpty()) { return MINUS; } else if (presentInCurrentObject) { return ZERO; } else { return PLUS; } }
private boolean hasValue(Item<V,D> item, ItemDelta<V,D> itemDelta) throws SchemaException { if (item == null || item.isEmpty()) { return itemDelta != null && itemDelta.addsAnyValue(); } else { if (itemDelta == null || itemDelta.isEmpty()) { return true; } else { Item<V,D> clonedItem = item.clone(); itemDelta.applyToMatchingPath(clonedItem, ParameterizedEquivalenceStrategy.DEFAULT_FOR_DELTA_APPLICATION); return !clonedItem.isEmpty(); } } }
public boolean containsItem(ItemPath path, boolean acceptEmptyItem) throws SchemaException { if (!path.startsWithName()) { throw new IllegalArgumentException("Attempt to lookup item using a non-name path "+path+" in "+this); } QName subName = path.firstToName(); ItemPath rest = path.rest(); Item item = findItemByQName(subName); if (item != null) { if (rest.isEmpty()) { return (acceptEmptyItem || !item.isEmpty()); } else { // Go deeper if (item instanceof PrismContainer) { return ((PrismContainer<?>)item).containsItem(rest, acceptEmptyItem); } else { return (acceptEmptyItem || !item.isEmpty()); } } } return false; }
@Override public AssignmentType getAssignmentNew() { if (assignmentIdi == null || assignmentIdi.getItemNew() == null || assignmentIdi.getItemNew().isEmpty()) { return null; } return ((PrismContainer<AssignmentType>) assignmentIdi.getItemNew()).getRealValue(); }
private FactorOutResultSingle<O> factorOutForAddDelta(Collection<? extends ItemPath> paths, boolean cloneDelta) { List<Item<?, ?>> itemsFound = new ArrayList<>(); for (ItemPath path : paths) { Item<?, ?> item = objectToAdd.findItem(path); if (item != null && !item.isEmpty()) { itemsFound.add(item); } } if (itemsFound.isEmpty()) { return new FactorOutResultSingle<>(this, null); } ObjectDeltaImpl<O> remainder = cloneIfRequested(cloneDelta); ObjectDeltaImpl<O> offspring = createOffspring(); for (Item<?, ?> item : itemsFound) { remainder.getObjectToAdd().remove(item); offspring.addModification(ItemDeltaUtil.createAddDeltaFor(item)); } return new FactorOutResultSingle<>(remainder, offspring); }
if (item.getDefinition() != null) { boolean isHidden = NotificationFunctionsImpl.isAmongHiddenPaths(item.getPath(), hiddenPaths); if (!isHidden && (showOperationalAttributes || !item.getDefinition().isOperational()) && !item.isEmpty()) { toBeDisplayed.add(item);
private void cleanupAllTheWayUp(Item<?,?> item) { if (item.isEmpty()) { PrismValue itemParent = item.getParent(); if (itemParent != null) { ((PrismContainerValue<?>)itemParent).remove(item); if (itemParent.isEmpty()) { Itemable itemGrandparent = itemParent.getParent(); if (itemGrandparent != null) { if (itemGrandparent instanceof Item<?,?>) { cleanupAllTheWayUp((Item<?,?>)itemGrandparent); } } } } } }
private FactorOutResultMulti<O> factorOutValuesForAddDelta(ItemPath path, boolean cloneDelta) { Item<?, ?> item = objectToAdd.findItem(path); if (item == null || item.isEmpty()) { return new FactorOutResultMulti<>(this); } ObjectDeltaImpl<O> remainder = cloneIfRequested(cloneDelta); remainder.getObjectToAdd().remove(item); FactorOutResultMulti<O> rv = new FactorOutResultMulti<>(remainder); for (PrismValue value : item.getValues()) { ObjectDeltaImpl<O> offspring = createOffspring(); offspring.addModification(ItemDeltaUtil.createAddDeltaFor(item, value)); rv.offsprings.add(offspring); } return rv; }
return true; if (item.isEmpty()) { return false;
if (!subItem.isEmpty()) { value = subItem.getAnyValue(); } else {
mapping, aprioriItemDelta, mapping.isSourceless()); } else if (mapping.getStrength() == MappingStrengthType.WEAK) { if (itemNew != null && !itemNew.isEmpty() || itemDelta.addsAnyValue()) { continue;
if (existingTargetItem != null && !existingTargetItem.isEmpty() && mapping.getStrength() == MappingStrengthType.WEAK) { LOGGER.trace("Mapping {} is weak and target already has a value {}, skipping.", mapping, existingTargetItem);
&& !targetFocusItem.isEmpty()) { Collection<V> replace = new ArrayList<>(); replace.add(LensUtil.cloneAndApplyMetadata(value, isAssignment, originMapping.getMappingType()));