public PrismValueDeltaSetTriple<V> toDeltaSetTriple(PrismContext prismContext) { return ItemDeltaUtil.toDeltaSetTriple(itemOld, delta, prismContext); }
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); }
public static boolean isEmpty(ObjectDeltaType deltaType) { if (deltaType == null) { return true; } if (deltaType.getChangeType() == ChangeTypeType.DELETE) { return false; } else if (deltaType.getChangeType() == ChangeTypeType.ADD) { return deltaType.getObjectToAdd() == null || deltaType.getObjectToAdd().asPrismObject().isEmpty(); } else { for (ItemDeltaType itemDeltaType : deltaType.getItemDelta()) { if (!ItemDeltaUtil.isEmpty(itemDeltaType)) { return false; } } return true; } }
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; }
@Override public <V extends PrismValue,D extends ItemDefinition> ExpressionEvaluator<V,D> createEvaluator(Collection<JAXBElement<?>> evaluatorElements, D outputDefinition, ExpressionFactory factory, String contextDescription, Task task, OperationResult result) throws SchemaException { Validate.notNull(outputDefinition, "output definition must be specified for literal expression evaluator"); Item<V,D> output = StaticExpressionUtil.parseValueElements(evaluatorElements, outputDefinition, contextDescription); PrismValueDeltaSetTriple<V> deltaSetTriple = ItemDeltaUtil.toDeltaSetTriple(output, null, prismContext); return new LiteralExpressionEvaluator<>(deltaSetTriple); }
@Override public PrismValueDeltaSetTriple<V> evaluate(ExpressionEvaluationContext context) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException { String constName = constEvaluatorType.getValue(); String stringValue = constantsManager.getConstantValue(constName); Item<V, D> output = outputDefinition.instantiate(); Object value = ExpressionUtil.convertToOutputValue(stringValue, outputDefinition, protector); if (output instanceof PrismProperty) { ((PrismProperty<Object>) output).addRealValue(value); } else { throw new UnsupportedOperationException( "Can only generate values of property, not " + output.getClass()); } return ItemDeltaUtil.toDeltaSetTriple(output, null, prismContext); }
@Override public PrismValueDeltaSetTriple<V> evaluate(ExpressionEvaluationContext context) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException { long counter = getSequenceCounter(sequentialValueEvaluatorType.getSequenceRef().getOid(), repositoryService, context.getResult()); Object value = ExpressionUtil.convertToOutputValue(counter, outputDefinition, protector); Item<V,D> output = outputDefinition.instantiate(); if (output instanceof PrismProperty) { ((PrismProperty<Object>)output).addRealValue(value); } else { throw new UnsupportedOperationException("Can only generate values of property, not "+output.getClass()); } return ItemDeltaUtil.toDeltaSetTriple(output, null, prismContext); }
@Override public PrismValueDeltaSetTriple<V> evaluate(ExpressionEvaluationContext context) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException { Source<V,D> source; if (context.getSources().isEmpty()) { throw new ExpressionEvaluationException("asIs evaluator cannot work without a source in "+ context.getContextDescription()); } if (context.getSources().size() > 1) { Source<V,D> defaultSource = (Source<V,D>) context.getDefaultSource(); if (defaultSource != null) { source = defaultSource; } else { throw new ExpressionEvaluationException("asIs evaluator cannot work with more than one source ("+ context.getSources().size() +" sources specified) without specification of a default source, in "+ context.getContextDescription()); } } else { source = (Source<V,D>) context.getSources().iterator().next(); } PrismValueDeltaSetTriple<V> sourceTriple = ItemDeltaUtil.toDeltaSetTriple(source.getItemOld(), source.getDelta(), prismContext); if (sourceTriple == null) { return null; } return ExpressionUtil.toOutputTriple(sourceTriple, outputDefinition, context.getAdditionalConvertor(), source.getResidualPath(), protector, prismContext); }
PrismValueDeltaSetTriple<V> outputTriple = ItemDeltaUtil.toDeltaSetTriple((Item<V,D>)resolveContext.getItemOld(), (ItemDelta<V,D>)resolveContext.getDelta(), prismContext);
return ItemDeltaUtil.toDeltaSetTriple(output, null, prismContext);
return ItemDeltaUtil.toDeltaSetTriple(output, null, prismContext);