private ObjectOrderingImpl(ItemPath orderBy, OrderDirection direction) { if (ItemPath.isEmpty(orderBy)) { throw new IllegalArgumentException("Null or empty ordering path is not supported."); } this.orderBy = orderBy; this.direction = direction; }
ObjectGroupingImpl(ItemPath groupBy) { if (ItemPath.isEmpty(groupBy)) { throw new IllegalArgumentException("Null or empty groupBy path is not supported."); } this.groupBy = groupBy; }
@Override public <T extends ItemDefinition> T findItemDefinition(@NotNull ItemPath path, @NotNull Class<T> clazz) { if (path.isEmpty()) { if (clazz.isAssignableFrom(this.getClass())) { return (T) this; } else { throw new IllegalArgumentException("Looking for definition of class " + clazz + " but found " + this); } } else { throw new IllegalArgumentException("No definition for path " + path + " in " + this); } }
private Object getRealContent(Item<?,?> item, ItemPath residualPath) { if (residualPath == null || residualPath.isEmpty()) { return item; } if (item == null) { return null; } return item.find(residualPath); }
@Override public S_FilterExit desc(ItemPath path) { if (ItemPath.isEmpty(path)) { throw new IllegalArgumentException("There must be non-empty path for desc(...) ordering"); } return addOrdering(ObjectOrderingImpl.createOrdering(path, OrderDirection.DESCENDING)); }
@Override public S_FilterExit group(ItemPath path) { if (ItemPath.isEmpty(path)) { throw new IllegalArgumentException("There must be non-empty path for uniq(...) grouping"); } return addGrouping(ObjectGroupingImpl.createGrouping(path)); }
/** * Returns true if the path starts with the standard segment name (i.e. NOT variable nor special symbol). */ default boolean startsWithName() { return !isEmpty() && ItemPath.isName(first()); }
/** * Returns true if the path starts with variable name ($...). */ default boolean startsWithVariable() { return !isEmpty() && ItemPath.isVariable(first()); }
/** * Returns true if the path starts with an object reference (@). */ default boolean startsWithObjectReference() { return !isEmpty() && ItemPath.isObjectReference(first()); }
/** * Returns true if the path starts with with value Id. */ default boolean startsWithId() { return !isEmpty() && ItemPath.isId(first()); }
/** * Returns true if the path starts with an identifier (#). */ default boolean startsWithIdentifier() { return !isEmpty() && ItemPath.isIdentifier(first()); }
/** * Returns true if the path starts with the specified name (approximate match). */ default boolean startsWithName(QName name) { return !isEmpty() && QNameUtil.match(name, firstToNameOrNull()); } //endregion
@Override public Object find(ItemPath path) { if (path == null || path.isEmpty()) { return this; } if (!isSingleValue()) { throw new IllegalStateException("Attempt to resolve sub-path '"+path+"' on multi-value property " + getElementName()); } PrismPropertyValue<T> value = getValue(); return value.find(path); }
public static <T> PropertyDelta<T> findPropertyDelta(Collection<? extends ItemDelta> modifications, QName propertyName) { for (ItemDelta delta: modifications) { if (delta instanceof PropertyDelta && delta.getParentPath().isEmpty() && QNameUtil.match(delta.getElementName(), propertyName)) { return (PropertyDelta) delta; } } return null; } }
/** * Returns the value of the first segment if it is a variable name segment; otherwise null. */ default QName firstToVariableNameOrNull() { if (isEmpty()) { return null; } else { Object first = first(); return isVariable(first) ? toVariableName(first) : null; } }
@Override public Object find(ItemPath path) { if (path == null || path.isEmpty()) { return this; } if (!isSingleValue()) { throw new IllegalStateException("Attempt to resolve sub-path '"+path+"' on multi-value reference " + getElementName()); } PrismReferenceValue value = getValue(); return value.find(path); }
private void synchronizeWithQuartzIfNeeded(Collection<ItemDelta<?, ?>> deltas, OperationResult parentResult) { if (isRecreateQuartzTrigger()) { synchronizeWithQuartz(parentResult); return; } for (ItemDelta<?, ?> delta : deltas) { if (delta.getParentPath().isEmpty() && quartzRelatedProperties.contains(delta.getElementName())) { synchronizeWithQuartz(parentResult); return; } } }
public void applyTo(PrismContainerValue containerValue, ParameterizedEquivalenceStrategy strategy) throws SchemaException { ItemPath deltaPath = getPath(); if (ItemPath.isEmpty(deltaPath)) { throw new IllegalArgumentException("Cannot apply empty-path delta " + this + " directly to a PrismContainerValue " + containerValue); } Item subItem = containerValue.findOrCreateItem(deltaPath, getItemClass(), getDefinition()); applyToMatchingPath(subItem, strategy); }
@Override public <IV extends PrismValue,ID extends ItemDefinition> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path) { if (path == null || path.isEmpty()) { return new PartiallyResolvedItem<>((Item<IV, ID>) this, null); } if (!isSingleValue()) { throw new IllegalStateException("Attempt to resolve sub-path '"+path+"' on multi-value reference " + getElementName()); } PrismReferenceValue value = getValue(); return value.findPartial(path); }
@Override public <IV extends PrismValue,ID extends ItemDefinition> PartiallyResolvedItem<IV,ID> findPartial(ItemPath path) { if (path == null || path.isEmpty()) { return new PartiallyResolvedItem<>((Item<IV, ID>) getParent(), null); } return new PartiallyResolvedItem<>((Item<IV, ID>) getParent(), path); }