protected AssignmentEvaluator<UserType> createAssignmentEvaluator() throws ObjectNotFoundException, SchemaException { PrismObject<UserType> userJack = userTypeJack.asPrismObject(); ObjectDeltaObject<UserType> focusOdo = new ObjectDeltaObject<>(userJack, null, null); focusOdo.recompute(); return createAssignmentEvaluator(focusOdo); }
return false; if (odo.getObjectDelta() != null && odo.getObjectDelta().isModify()) { if (autz.keepZoneOfControl()) { PrismObject<O> oldObject = odo.getOldObject(); if (oldObject == null) { throw new IllegalStateException("No old object in odo "+odo); return false; PrismObject<O> newObject = odo.getNewObject(); if (newObject == null) { throw new IllegalStateException("No new object in odo "+odo); PrismObject<O> object = odo.getOldObject(); if (object == null) { throw new IllegalStateException("No old object in odo "+odo); PrismObject<O> object = odo.getAnyObject(); if (object == null) { throw new IllegalStateException("No object in odo "+odo);
return false; } else if (!focusOdo.equals(other.focusOdo)) { return false;
public static <O extends ObjectType> AuthorizationParameters<O,ObjectType> buildObjectDelta(PrismObject<O> object, ObjectDelta<O> delta) throws SchemaException { ObjectDeltaObject<O> odo; if (delta != null && delta.isAdd()) { odo = new ObjectDeltaObject<>(null, delta, object); } else { odo = new ObjectDeltaObject<>(object, delta, null); odo.recomputeIfNeeded(false); } return new AuthorizationParameters<>(odo, null, null, null); }
public void addVariableDefinitions(Map<QName, Object> extraVariables, @NotNull Collection<QName> exceptFor) { for (Entry<QName, Object> entry : extraVariables.entrySet()) { if (QNameUtil.matchAny(entry.getKey(), exceptFor)) { continue; } Object value = entry.getValue(); if (!areDeltasAllowed() && value instanceof ObjectDeltaObject<?>) { ObjectDeltaObject<?> odo = (ObjectDeltaObject<?>)value; if (odo.getObjectDelta() != null) { throw new IllegalArgumentException("Cannot use variables with deltas in addVariableDefinitions. Use addVariableDefinitionsOld or addVariableDefinitionsNew."); } value = odo.getOldObject(); } variables.put(entry.getKey(), value); } }
@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 void testScriptSystemVariablesConditionEmptyFalse(final String TEST_NAME, String filename) throws Exception { System.out.println("===[ "+TEST_NAME+"]==="); // GIVEN ObjectDelta<UserType> delta = evaluator.getPrismContext().deltaFactory().object() .createModificationReplaceProperty(UserType.class, evaluator.USER_OLD_OID, evaluator.toPath("name"), PrismTestUtil.createPolyString("Jack")); MappingImpl<PrismPropertyValue<PolyString>,PrismPropertyDefinition<PolyString>> mapping = evaluator.createMapping( filename, TEST_NAME, "title", delta); PrismObject<UserType> user = (PrismObject<UserType>) mapping.getSourceContext().getOldObject(); user.asObjectable().getEmployeeType().add("SAILOR"); user.asObjectable().setEmployeeNumber("666"); mapping.getSourceContext().recompute(); OperationResult opResult = new OperationResult(TEST_NAME); // WHEN mapping.evaluate(null, opResult); // THEN PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple(); assertNull("Unexpected value in outputTriple: "+outputTriple, outputTriple); }
public static <O extends ObjectType> AuthorizationParameters<O,ObjectType> buildObjectDelete(PrismObject<O> object) { // TODO: Do we need to create delta here? ObjectDeltaObject<O> odo = new ObjectDeltaObject<>(object, null, null); return new AuthorizationParameters<>(odo, null, null, null); }
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); }
XMLGregorianCalendar nextRecomputeTime = collectTripleFromMappings(context, mappings, phase, focusOdo, focusOdo.getNewObject(), outputTripleMap, iteration, iterationToken, now, task, result); String contextDesc = "object template "+objectTemplateDesc+ " for focus "+focusOdo.getAnyObject(); Collection<ItemDelta<?,?>> itemDeltas = computeItemDeltas(outputTripleMap, itemDefinitionsMap, focusOdo.getObjectDelta(), focusOdo.getNewObject(), focusDefinition, contextDesc);
if (getFocusOdo().getOldObject() == null) { builder = builder.conditionMaskOld(false); if (getFocusOdo().getNewObject() == null) { builder = builder.conditionMaskNew(false);
focusOdoCloned = focusOdo.clone(); } else { LOGGER.trace("Updating focusOdo because of chained mappings; chained source path: {}", path); consolidator.setIvwoTriple(triple); consolidator.setItemDefinition(itemDefinition); consolidator.setAprioriItemDelta(getAprioriItemDelta(focusOdo.getObjectDelta(), path)); consolidator.setItemContainer(focusOdo.getNewObject()); consolidator.setValueMatcher(null); consolidator.setComparator(null); focusOdoCloned.update(itemDelta);
public PrismObject<O> getNewObject() { if (odo == null) { return null; } return odo.getNewObject(); }
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);
public ObjectDelta<O> getDelta() { if (odo == null) { return null; } return odo.getObjectDelta(); }
public PrismObject<O> getOldObject() { if (odo == null) { return null; } return odo.getOldObject(); }
public PrismObject<O> getAnyObject() { if (odo == null) { return null; } return odo.getAnyObject(); }
builder -> { ItemDeltaItem<PrismPropertyValue<T>,PrismPropertyDefinition<T>> sourceIdi = context.getFocusContext().getObjectDeltaObject().findIdi(focusPropertyPath); if (capValidFrom != null && capValidTo != null) { computedIdi = context.getFocusContext().getObjectDeltaObject().findIdi(focusPropertyPath); computedIdi = context.getFocusContext().getObjectDeltaObject().findIdi(SchemaConstants.PATH_ACTIVATION_EFFECTIVE_STATUS);
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((assignmentPath == null) ? 0 : assignmentPath.hashCode()); result = prime * result + ((channel == null) ? 0 : channel.hashCode()); result = prime * result + ((constructionType == null) ? 0 : constructionType.hashCode()); result = prime * result + ((focusOdo == null) ? 0 : focusOdo.hashCode()); result = prime * result + (isValid ? 1231 : 1237); result = prime * result + ((lensContext == null) ? 0 : lensContext.hashCode()); result = prime * result + ((objectResolver == null) ? 0 : objectResolver.hashCode()); result = prime * result + ((originType == null) ? 0 : originType.hashCode()); result = prime * result + ((prismContext == null) ? 0 : prismContext.hashCode()); result = prime * result + ((source == null) ? 0 : source.hashCode()); return result; }
return this; ObjectDeltaObject<O> object = doClone ? this.clone() : this;