public ObjectTemplateType clone() { ObjectTemplateType object = new ObjectTemplateType(); PrismObject value = asPrismObject().clone(); object.setupContainer(value); return object; }
public List<ObjectReferenceType> createIncludeRefList() { PrismForJAXBUtil.createReference(asPrismContainerValue(), F_INCLUDE_REF); return getIncludeRef(); }
public List<ObjectTemplateMappingType> createMappingList() { PrismForJAXBUtil.createContainer(asPrismContainerValue(), F_MAPPING); return getMapping(); }
public List<ObjectTemplateItemDefinitionType> createItemList() { PrismForJAXBUtil.createContainer(asPrismContainerValue(), F_ITEM); return getItem(); }
for (ObjectReferenceType includeRef: objectTemplateType.getIncludeRef()) { PrismObject<ObjectTemplateType> includeObject = includeRef.asReferenceValue().getObject(); if (includeObject == null) { ObjectTemplateType includeObjectType = modelObjectResolver.resolve(includeRef, ObjectTemplateType.class, null, "include reference in "+objectTemplateType + " in " + contextDesc, task, result); includeObject = includeObjectType.asPrismObject(); for (ObjectTemplateItemDefinitionType def : objectTemplateType.getItem()) { if (def.getRef() == null) { throw new IllegalStateException("Item definition with null ref in " + contextDesc);
public static void copyFromJAXB(ObjectTemplateType jaxb, RObjectTemplate repo, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException { copyAssignmentHolderInformationFromJAXB(jaxb, repo, repositoryContext, generatorResult); repo.setType(RUtil.getRepoEnumValue(jaxb.asPrismObject().getElementName(), RObjectTemplateType.class)); repo.setNameCopy(RPolyString.copyFromJAXB(jaxb.getName())); repo.getIncludeRef().addAll(RUtil.safeListReferenceToSet( jaxb.getIncludeRef(), repo, RReferenceOwner.INCLUDE, repositoryContext.relationRegistry)); } }
public <O extends ObjectType> void applyObjectTemplateToDefinition(PrismObjectDefinition<O> objectDefinition, ObjectTemplateType objectTemplateType, OperationResult result) throws ObjectNotFoundException, SchemaException { if (objectTemplateType == null) { return; } for (ObjectReferenceType includeRef: objectTemplateType.getIncludeRef()) { PrismObject<ObjectTemplateType> subTemplate = cacheRepositoryService.getObject(ObjectTemplateType.class, includeRef.getOid(), null, result); applyObjectTemplateToDefinition(objectDefinition, subTemplate.asObjectable(), result); } for (ObjectTemplateItemDefinitionType templateItemDefType: objectTemplateType.getItem()) { ItemPathType ref = templateItemDefType.getRef(); if (ref == null) { throw new SchemaException("No 'ref' in item definition in "+objectTemplateType); } ItemPath itemPath = prismContext.toPath(ref); ItemDefinition itemDef = objectDefinition.findItemDefinition(itemPath); if (itemDef != null) { applyObjectTemplateItem(itemDef, templateItemDefType, "item " + itemPath + " in object type " + objectDefinition.getTypeName() + " as specified in item definition in " + objectTemplateType); } else { OperationResult subResult = result.createMinorSubresult(SchemaTransformer.class.getName() + ".applyObjectTemplateToDefinition"); subResult.recordPartialError("No definition for item " + itemPath + " in object type " + objectDefinition.getTypeName() + " as specified in item definition in " + objectTemplateType); continue; } } }
private <AH extends AssignmentHolderType, T extends AssignmentHolderType> void collectMappingsFromTemplate(LensContext<AH> context, List<FocalMappingSpec> mappings, ObjectTemplateType objectTemplateType, String contextDesc, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, PolicyViolationException, SecurityViolationException, ConfigurationException, CommunicationException { if (objectTemplateType == null) { return; } LOGGER.trace("Collecting mappings from {}", objectTemplateType); // Process includes for (ObjectReferenceType includeRef: objectTemplateType.getIncludeRef()) { PrismObject<ObjectTemplateType> includeObject = includeRef.asReferenceValue().getObject(); if (includeObject == null) { ObjectTemplateType includeObjectType = modelObjectResolver.resolve(includeRef, ObjectTemplateType.class, null, "include reference in "+objectTemplateType + " in " + contextDesc, task, result); includeObject = includeObjectType.asPrismObject(); // Store resolved object for future use (e.g. next waves). includeRef.asReferenceValue().setObject(includeObject); } LOGGER.trace("Including template {}", includeObject); ObjectTemplateType includeObjectType = includeObject.asObjectable(); collectMappingsFromTemplate(context, mappings, includeObjectType, "include "+includeObject+" in "+objectTemplateType + " in " + contextDesc, task, result); } // Process own mappings collectMappings(mappings, objectTemplateType); }
/** * Create an instance of {@link ObjectTemplateType } * */ public ObjectTemplateType createObjectTemplateType() { return new ObjectTemplateType(); }
private void collectMappings(List<FocalMappingSpec> mappings, ObjectTemplateType objectTemplateType) { for (ObjectTemplateMappingType mapping: objectTemplateType.getMapping()) { mappings.add(new FocalMappingSpec(mapping, objectTemplateType)); } for (ObjectTemplateItemDefinitionType templateItemDefType: objectTemplateType.getItem()) { for (ObjectTemplateMappingType mapping: templateItemDefType.getMapping()) { setMappingTarget(mapping, templateItemDefType.getRef()); mappings.add(new FocalMappingSpec(mapping, objectTemplateType)); } } }
public ObjectTemplateType mapping(ObjectTemplateMappingType value) { getMapping().add(value); return this; }
public ObjectTemplateType includeRef(ObjectReferenceType value) { getIncludeRef().add(value); return this; }
public ObjectTemplateType item(ObjectTemplateItemDefinitionType value) { getItem().add(value); return this; }
public ObjectTemplateType(PrismContext prismContext) { setupContainer(new PrismObjectImpl(_getContainerName(), getClass(), prismContext)); }
@XmlElement(name = "iterationSpecification") public IterationSpecificationType getIterationSpecification() { return PrismForJAXBUtil.getPropertyValue(asPrismContainerValue(), F_ITERATION_SPECIFICATION, IterationSpecificationType.class); }
public ObjectReferenceType beginArchetypeRef() { ObjectReferenceType value = new ObjectReferenceType(); archetypeRef(value); return value; }
@Override public PrismObject<ObjectTemplateType> asPrismObject() { return asPrismContainer(); }
return; for (ObjectReferenceType includeRef: objectTemplateType.getIncludeRef()) { PrismObject<ObjectTemplateType> subTemplate = cacheRepositoryService.getObject(ObjectTemplateType.class, includeRef.getOid(), null, result); applyObjectTemplateToObject(object, subTemplate.asObjectable(), result); for (ObjectTemplateItemDefinitionType templateItemDefType: objectTemplateType.getItem()) { ItemPathType ref = templateItemDefType.getRef(); if (ref == null) {
/** * Create an instance of {@link ObjectTemplateType } * */ public ObjectTemplateType createObjectTemplateType() { return new ObjectTemplateType(); }
private void assertObjectTemplateInternals(PrismObject<ObjectTemplateType> object, QName elementName) throws SchemaException { int assignmentValuesFound = 0; for (ObjectTemplateMappingType mappingType : object.asObjectable().getMapping()) { if (mappingType.getExpression() != null) { if (mappingType.getTarget() != null && mappingType.getTarget().getPath() != null && UserType.F_ASSIGNMENT.equivalent(mappingType.getTarget().getPath().getItemPath())) { ItemDefinition assignmentDef = getPrismContext().getSchemaRegistry() .findObjectDefinitionByCompileTimeClass(UserType.class) .findItemDefinition(UserType.F_ASSIGNMENT); for (JAXBElement evaluator : mappingType.getExpression().getExpressionEvaluator()) { if (evaluator.getValue() instanceof RawType) { RawType rawType = (RawType) evaluator.getValue(); System.out.println("\nraw assignment:\n" + rawType); Item assignment = rawType.getParsedItem(assignmentDef); System.out.println("\nassignment:\n" + assignment.debugDump()); assignmentValuesFound++; } } } } } assertEquals("wrong # of assignment values found in mapping", 2, assignmentValuesFound); }