public PrismObject<O> getNewObject() { if (odo == null) { return null; } return odo.getNewObject(); }
/** * Adds map of extra variables to the expression. * If there are variables with deltas (ObjectDeltaObject) it takes the "new" version * of the object. */ public void addVariableDefinitionsNew(Map<QName, Object> extraVariables) { for (Entry<QName, Object> entry : extraVariables.entrySet()) { Object value = entry.getValue(); if (value instanceof ObjectDeltaObject<?>) { ObjectDeltaObject<?> odo = (ObjectDeltaObject<?>)value; value = odo.getNewObject(); } else if (value instanceof ItemDeltaItem<?,?>) { ItemDeltaItem<?,?> idi = (ItemDeltaItem<?,?>)value; value = idi.getItemNew(); } variables.put(entry.getKey(), value); } }
public <O extends ObjectType> PrismObject<O> getObjectNew(QName name) throws SchemaException { Object object = get(name); if (object == null) { return null; } if (object instanceof PrismObject) { return (PrismObject<O>) object; } if (object instanceof ObjectDeltaObject<?>) { ObjectDeltaObject<O> odo = (ObjectDeltaObject<O>)object; return odo.getNewObject(); } throw new SchemaException("Expected object in variable "+name+", but found type "+object.getClass()); }
@Override public void shortDump(StringBuilder sb) { sb.append("odo="); if (odo == null) { sb.append("null"); } else { sb.append("("); sb.append(odo.getOldObject()).append(","); sb.append(odo.getObjectDelta()).append(","); sb.append(odo.getNewObject()); sb.append(")"); } sb.append(","); shortDumpElement(sb, "target", target); shortDumpElement(sb, "relation", relation); if (orderConstraints != null) { sb.append("orderConstraints="); SchemaDebugUtil.shortDumpOrderConstraintsList(sb, orderConstraints); sb.append(", "); } if (sb.length() > 1) { sb.setLength(sb.length() - 2); } }
public <V extends PrismValue, D extends ItemDefinition , AH extends AssignmentHolderType> MappingImpl<V, D> createFocusMapping(final MappingFactory mappingFactory, final LensContext<AH> context, final MappingType mappingType, ObjectType originObject, ObjectDeltaObject<AH> focusOdo, AssignmentPathVariables assignmentPathVariables, PrismObject<SystemConfigurationType> configuration, XMLGregorianCalendar now, String contextDesc, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException { Integer iteration = null; String iterationToken = null; if (focusOdo.getNewObject() != null) { AH focusNewType = focusOdo.getNewObject().asObjectable(); iteration = focusNewType.getIteration(); iterationToken = focusNewType.getIterationToken(); } else if (focusOdo.getOldObject() != null) { AH focusOldType = focusOdo.getOldObject().asObjectable(); iteration = focusOldType.getIteration(); iterationToken = focusOldType.getIterationToken(); } return createFocusMapping(mappingFactory, context, mappingType, originObject, focusOdo, null, focusOdo.getAnyObject(), assignmentPathVariables, iteration, iterationToken, configuration, now, contextDesc, task, result); }
return false; PrismObject<O> newObject = odo.getNewObject(); if (newObject == null) { throw new IllegalStateException("No new object in odo "+odo);
.getDefaultExpressionVariables(getFocusOdo().getNewObject().asObjectable(), null, null, null); if (assignmentPathVariables == null) { assignmentPathVariables = LensUtil.computeAssignmentPathVariables(getAssignmentPath());
private <R extends AbstractRoleType> boolean isVirtualAssignment(AssignmentPathSegmentImpl segment, EvaluationContext ctx) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { AH focusNew = focusOdo.getNewObject().asObjectable(); Collection<R> forcedRoles = new HashSet<>(); try {
XMLGregorianCalendar nextRecomputeTime = collectTripleFromMappings(context, mappings, phase, focusOdo, focusOdo.getNewObject(), outputTripleMap, iteration, iterationToken, now, task, result); Collection<ItemDelta<?,?>> itemDeltas = computeItemDeltas(outputTripleMap, itemDefinitionsMap, focusOdo.getObjectDelta(), focusOdo.getNewObject(), focusDefinition, contextDesc);
consolidator.setItemDefinition(itemDefinition); consolidator.setAprioriItemDelta(getAprioriItemDelta(focusOdo.getObjectDelta(), path)); consolidator.setItemContainer(focusOdo.getNewObject()); consolidator.setValueMatcher(null); consolidator.setComparator(null);
mappingBuilder.conditionMaskOld(false); if (focusOdo.getNewObject() == null) { mappingBuilder.conditionMaskNew(false);
builder = builder.conditionMaskOld(false); if (getFocusOdo().getNewObject() == null) { builder = builder.conditionMaskNew(false);
ObjectDeltaObject<AH> focusOdo = focusContext.getObjectDeltaObject(); Collection<ItemDelta<?,?>> focusDeltas = objectTemplateProcessor.computeItemDeltas(focusOutputTripleMap, null, focusOdo.getObjectDelta(), focusOdo.getNewObject(), focusContext.getObjectDefinition(), "focus mappings in assignments of "+focusContext.getHumanReadableName()); LOGGER.trace("Computed focus deltas: {}", focusDeltas);
protected AssignmentEvaluator<UserType> createAssignmentEvaluator(ObjectDeltaObject<UserType> focusOdo) throws ObjectNotFoundException, SchemaException { LensContext<UserType> lensContext = createLensContext(UserType.class); LensFocusContext<UserType> focusContext = lensContext.getOrCreateFocusContext(); focusContext.setObjectOld(focusOdo.getOldObject()); focusContext.setPrimaryDelta(focusOdo.getObjectDelta()); focusContext.setObjectCurrent(focusOdo.getOldObject()); focusContext.setObjectNew(focusOdo.getNewObject()); return new AssignmentEvaluator.Builder<UserType>() .repository(repositoryService) .focusOdo(focusOdo) .objectResolver(objectResolver) .systemObjectCache(systemObjectCache) .relationRegistry(relationRegistry) .prismContext(prismContext) .activationComputer(activationComputer) .now(clock.currentTimeXMLGregorianCalendar()) .mappingFactory(mappingFactory) .mappingEvaluator(mappingEvaluator) .lensContext(lensContext) .build(); }
boolean isAssignmentValid = LensUtil.isAssignmentValid(focusOdo.getNewObject().asObjectable(), assignmentType, now, activationComputer, focusStateModel); if (isAssignmentValid || segment.isValidityOverride()) {