public SchemaHandlingType objectType(ResourceObjectTypeDefinitionType value) { getObjectType().add(value); return this; }
@NotNull static List<ObjectTypeRecord> extractFrom(SchemaHandlingType schemaHandling) { List<ObjectTypeRecord> rv = new ArrayList<>(); if (schemaHandling != null) { for (ResourceObjectTypeDefinitionType objectType : schemaHandling.getObjectType()) { rv.add(new ObjectTypeRecord(objectType)); } } return rv; }
private static SchemaHandlingType createNewSchemaHandling(File resourceFile, int iteration, PrismContext prismContext) throws SchemaException { PrismObject<ResourceType> resource = parseResource(resourceFile, prismContext); SchemaHandlingType schemaHandling = resource.asObjectable().getSchemaHandling(); ResourceObjectTypeDefinitionType accountType = schemaHandling.getObjectType().iterator().next(); List<ResourceAttributeDefinitionType> attrDefs = accountType.getAttribute(); ResourceAttributeDefinitionType attributeDefinitionType = attrDefs.get(rnd.nextInt(attrDefs.size())); attributeDefinitionType.setDescription(Integer.toString(iteration)); return schemaHandling; }
private void checkSchemaHandlingObjectTypes(ResourceValidationContext ctx, SchemaHandlingType schemaHandling) { int i = 1; for (ResourceObjectTypeDefinitionType objectType : schemaHandling.getObjectType()) { ItemPath path = ItemPath.create(ResourceType.F_SCHEMA_HANDLING, SchemaHandlingType.F_OBJECT_TYPE, i); checkSchemaHandlingObjectType(ctx, path, objectType); i++; } }
public List<ResourceObjectTypeDefinitionType> createObjectTypeList() { PrismForJAXBUtil.createContainer(asPrismContainerValue(), F_OBJECT_TYPE); return getObjectType(); }
public static ResourceObjectTypeDefinitionType findObjectTypeDefinition(PrismObject<ResourceType> resourceObject, @Nullable ShadowKindType kind, @Nullable String intent) { if (resourceObject == null || resourceObject.asObjectable().getSchemaHandling() == null) { return null; } for (ResourceObjectTypeDefinitionType def : resourceObject.asObjectable().getSchemaHandling().getObjectType()) { if (fillDefault(kind).equals(fillDefault(def.getKind())) && fillDefault(intent).equals(fillDefault(def.getIntent()))) { return def; } } return null; }
public static ResourceObjectTypeDefinitionType getResourceObjectTypeDefinitionType ( ResourceType resource, ShadowKindType kind, String intent) { if (resource == null) { throw new IllegalArgumentException("The resource is null"); } SchemaHandlingType schemaHandling = resource.getSchemaHandling(); if (schemaHandling == null) { return null; } if (kind == null) { kind = ShadowKindType.ACCOUNT; } for (ResourceObjectTypeDefinitionType objType: schemaHandling.getObjectType()) { if (objType.getKind() == kind || (objType.getKind() == null && kind == ShadowKindType.ACCOUNT)) { if (intent == null && objType.isDefault()) { return objType; } if (objType.getIntent() != null && objType.getIntent().equals(intent)) { return objType; } if (objType.getIntent() == null && objType.isDefault() && intent != null && intent.equals(SchemaConstants.INTENT_DEFAULT)) { return objType; } } } return null; }
private void checkSchemaHandlingDefaults(ResourceValidationContext ctx, SchemaHandlingType schemaHandling) { int defAccount = 0, defEntitlement = 0, defGeneric = 0; int totalAccount = 0; for (ResourceObjectTypeDefinitionType def : schemaHandling.getObjectType()) { if (Boolean.TRUE.equals(def.isDefault())) { switch (fillDefault(def.getKind())) {
public static RefinedResourceSchema parse(ResourceType resourceType, PrismContext prismContext) throws SchemaException { ResourceSchema originalResourceSchema = getResourceSchema(resourceType, prismContext); if (originalResourceSchema == null) { return null; } String contextDescription = "definition of "+resourceType; RefinedResourceSchemaImpl rSchema = new RefinedResourceSchemaImpl(originalResourceSchema); SchemaHandlingType schemaHandling = resourceType.getSchemaHandling(); if (schemaHandling != null) { parseObjectTypeDefsFromSchemaHandling(rSchema, resourceType, schemaHandling, schemaHandling.getObjectType(), null, prismContext, contextDescription); } parseObjectTypesFromSchema(rSchema, resourceType, prismContext, contextDescription); // We need to parse associations and auxiliary object classes in a second pass. We need to have all object classes parsed before correctly setting association // targets for (RefinedObjectClassDefinition rOcDef: rSchema.getRefinedDefinitions()) { ((RefinedObjectClassDefinitionImpl) rOcDef).parseAssociations(rSchema); ((RefinedObjectClassDefinitionImpl) rOcDef).parseAuxiliaryObjectClasses(rSchema); } // We can parse attributes only after we have all the object class info parsed (including auxiliary object classes) for (RefinedObjectClassDefinition rOcDef: rSchema.getRefinedDefinitions()) { ((RefinedObjectClassDefinitionImpl) rOcDef).parseAttributes(rSchema, contextDescription); } return rSchema; }
iterationSpecificationType.setMaxIterations(100); objectTypeDef.setIteration(iterationSpecificationType); schemaHandling.getObjectType().add(objectTypeDef); resource.asObjectable().setSchemaHandling(schemaHandling); resource.asObjectable().getSchemaHandling().getObjectType().get(0).setDefault(false); AssertJUnit.fail("Value of schemaHandling/[1]/default was changed when immutable!"); } catch (RuntimeException e) {
private void checkOpenDjSchemaHandling(ResourceType resource, String source) { SchemaHandlingType schemaHandling = resource.getSchemaHandling(); for (ResourceObjectTypeDefinitionType resObjectTypeDef: schemaHandling.getObjectType()) { if (resObjectTypeDef.getKind() == ShadowKindType.ACCOUNT) { String name = resObjectTypeDef.getIntent(); assertNotNull("Resource "+resource+" from "+source+" has an schemaHandlig account definition without intent", name); assertNotNull("Account type "+name+" in "+resource+" from "+source+" does not have object class", resObjectTypeDef.getObjectClass()); } if (resObjectTypeDef.getKind() == ShadowKindType.ENTITLEMENT) { String name = resObjectTypeDef.getIntent(); assertNotNull("Resource "+resource+" from "+source+" has an schemaHandlig entitlement definition without intent", name); assertNotNull("Entitlement type "+name+" in "+resource+" from "+source+" does not have object class", resObjectTypeDef.getObjectClass()); } } }
for(ResourceObjectTypeDefinitionType accountType: schemaHandling.getObjectType()) { String name = accountType.getIntent(); assertNotNull("Account type without a name", name);