public static String dumpAssignment(AssignmentType assignmentType) { StringBuilder sb = new StringBuilder(); if (assignmentType.getConstruction() != null) { sb.append("Constr(").append(assignmentType.getConstruction().getDescription()).append(") "); } if (assignmentType.getTargetRef() != null) { sb.append("-["); if (assignmentType.getTargetRef().getRelation() != null) { sb.append(assignmentType.getTargetRef().getRelation().getLocalPart()); } sb.append("]-> ").append(assignmentType.getTargetRef().getOid()); } return sb.toString(); }
sb.append("id:").append(assignmentType.getId()).append(" "); if (assignmentType.getConstruction() != null) { sb.append("Constr '").append(assignmentType.getConstruction().getDescription()).append("' ");
if (getConstructionType() != null && getConstructionType().getDescription() != null) { sb.append("\n"); DebugUtil.debugDumpLabel(sb, "description", indent + 1); sb.append(" ").append(getConstructionType().getDescription());
ConstructionType ct = (ConstructionType) value; Object resource = (ct.getResource() != null ? ct.getResource().getName() : (ct.getResourceRef() != null ? ct.getResourceRef().getOid() : null)); return "resource object" + (resource != null ? " on " + resource : "") + (ct.getDescription() != null ? ": " + ct.getDescription() : ""); } else if (value instanceof Enum) { return value.toString();
DebugUtil.indentDebugDump(sb, 1); if (assignmentType.getConstruction() != null) { sb.append("Constr(").append(assignmentType.getConstruction().getDescription()).append(") ");
@Test public void test004TwoWriters_TwoAttributesEach__OneReader() throws Exception { PropertyModifierThread[] mts = new PropertyModifierThread[]{ new PropertyModifierThread(1, UserType.F_GIVEN_NAME, true, ItemPath.create(UserType.F_ASSIGNMENT, 1L, AssignmentType.F_DESCRIPTION), true), new PropertyModifierThread(2, UserType.F_FAMILY_NAME, true, ItemPath.create(UserType.F_ASSIGNMENT, 1L, AssignmentType.F_CONSTRUCTION), true), }; Checker checker = (iteration, oid) -> { PrismObject<UserType> userRetrieved = repositoryService.getObject(UserType.class, oid, null, new OperationResult("dummy")); String givenName = userRetrieved.asObjectable().getGivenName().getOrig(); String familyName = userRetrieved.asObjectable().getFamilyName().getOrig(); String assignmentDescription = userRetrieved.asObjectable().getAssignment().get(0).getDescription(); String referenceDescription = userRetrieved.asObjectable().getAssignment().get(0).getConstruction().getDescription(); LOGGER.info("[" + iteration + "] givenName = " + givenName + ", assignment description = " + assignmentDescription + ", familyName = " + familyName + ", referenceDescription = " + referenceDescription); if (!givenName.equals(assignmentDescription)) { String msg = "Inconsistent object state: GivenName = " + givenName + ", assignment description = " + assignmentDescription; LOGGER.error(msg); throw new AssertionError(msg); } if (!familyName.equals(referenceDescription)) { String msg = "Inconsistent object state: FamilyName = " + familyName + ", account construction description = " + referenceDescription; LOGGER.error(msg); throw new AssertionError(msg); } }; concurrencyUniversal("Test4", 60000L, 0L, mts, checker); }
private void createCustomConstruction(RoleType role, String name, int order) { ConstructionType c = new ConstructionType(prismContext); c.setDescription(name); c.setResourceRef(ObjectTypeUtil.createObjectRef(RESOURCE_DUMMY_EMPTY_OID, ObjectTypes.RESOURCE)); ResourceAttributeDefinitionType nameDef = new ResourceAttributeDefinitionType(); nameDef.setRef(new ItemPathType(ItemPath.create(new QName(SchemaConstants.NS_ICF_SCHEMA, "name")))); MappingType outbound = new MappingType(); outbound.setName(name); ExpressionType expression = new ExpressionType(); ScriptExpressionEvaluatorType script = new ScriptExpressionEvaluatorType(); script.setCode( "import com.evolveum.midpoint.model.impl.lens.TestAssignmentProcessor2\n\n" + "TestAssignmentProcessor2.startCallback('" + name + "')\n" + "this.binding.variables.each {k,v -> TestAssignmentProcessor2.variableCallback(k, v, '" + name + "')}\n" + "TestAssignmentProcessor2.finishCallback('" + name + "')\n" + "return null"); expression.getExpressionEvaluator().add(new ObjectFactory().createScript(script)); outbound.setExpression(expression); nameDef.setOutbound(outbound); c.getAttribute().add(nameDef); AssignmentType a = new AssignmentType(prismContext); a.setDescription("Assignment for " + c.getDescription()); a.setConstruction(c); addAssignmentOrInducement(role, order, a); }
dataRead = ((ConstructionType)user.findContainer(attribute2).getValue().getValue()).getDescription(); } else { dataRead = user.findProperty(attribute2).getRealValue(String.class);
private void collectConstruction(AssignmentPathSegmentImpl segment, PlusMinusZero mode, boolean isValid, EvaluationContext ctx) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException { assertSourceNotNull(segment.source, ctx.evalAssignment); AssignmentType assignmentType = getAssignmentType(segment, ctx); ConstructionType constructionType = assignmentType.getConstruction(); LOGGER.trace("Preparing construction '{}' in {}", constructionType.getDescription(), segment.source); Construction<AH> construction = new Construction<>(constructionType, segment.source); // We have to clone here as the path is constantly changing during evaluation construction.setAssignmentPath(ctx.assignmentPath.clone()); construction.setFocusOdo(focusOdo); construction.setLensContext(lensContext); construction.setObjectResolver(objectResolver); construction.setPrismContext(prismContext); construction.setMappingFactory(mappingFactory); construction.setMappingEvaluator(mappingEvaluator); construction.setOriginType(OriginType.ASSIGNMENTS); construction.setChannel(channel); construction.setOrderOneObject(segment.getOrderOneObject()); construction.setValid(isValid); construction.setRelativityMode(mode); // Do not evaluate the construction here. We will do it in the second pass. Just prepare everything to be evaluated. if (mode == null) { return; // null mode (i.e. plus + minus) means 'ignore the payload' } ctx.evalAssignment.addConstruction(construction, mode); }
c.setResourceRef(ObjectTypeUtil.createObjectRef(RESOURCE_DUMMY_EMPTY_OID, ObjectTypes.RESOURCE)); AssignmentType a = new AssignmentType(prismContext); a.setDescription("Assignment for " + c.getDescription()); a.setConstruction(c); addAssignmentOrInducement(abstractRole, i, a);