public ResourceObjectTypeDefinitionType attribute(ResourceAttributeDefinitionType value) { getAttribute().add(value); return this; }
/** * Create an instance of {@link ResourceObjectTypeDefinitionType } * */ public ResourceObjectTypeDefinitionType createResourceObjectTypeDefinitionType() { return new ResourceObjectTypeDefinitionType(); }
@Override protected ResourceObjectTypeDefinitionType createItem(PrismContainerValue value) { ResourceObjectTypeDefinitionType objectType = new ResourceObjectTypeDefinitionType(); objectType.setupContainerValue(value); return objectType; }
public ResourceObjectTypeDefinitionType clone() { ResourceObjectTypeDefinitionType object = new ResourceObjectTypeDefinitionType(); PrismContainerValue value = asPrismContainerValue().clone(); object.setupContainerValue(value); return object; }
if (schemaHandlingObjDefType.getObjectClass() != null) { QName objectClass = schemaHandlingObjDefType.getObjectClass(); objectClassDef = rSchema.getOriginalResourceSchema().findObjectClassDefinition(objectClass); if (objectClassDef == null) { throw new SchemaException("Definition of "+typeDesc+" type " + schemaHandlingObjDefType.getIntent() + " does not have objectclass, in " + contextDescription); rOcDef.schemaHandlingObjectTypeDefinitionType = schemaHandlingObjDefType.clone(); if (rOcDef.schemaHandlingObjectTypeDefinitionType.getDisplayName() != null) { rOcDef.setDisplayName(rOcDef.schemaHandlingObjectTypeDefinitionType.getDisplayName()); } else { if (objectClassDef.getDisplayName() != null) { if (rOcDef.schemaHandlingObjectTypeDefinitionType.getDescription() != null) { rOcDef.setDescription(rOcDef.schemaHandlingObjectTypeDefinitionType.getDescription()); if (rOcDef.schemaHandlingObjectTypeDefinitionType.isDefault() != null) { rOcDef.setDefault(rOcDef.schemaHandlingObjectTypeDefinitionType.isDefault()); } else { rOcDef.setDefault(objectClassDef.isDefaultInAKind()); if (rOcDef.schemaHandlingObjectTypeDefinitionType.getBaseContext() != null) { rOcDef.setBaseContext(rOcDef.schemaHandlingObjectTypeDefinitionType.getBaseContext());
checkObjectClass(ctx, path, objectType); ObjectClassComplexTypeDefinition ocdef = null; if (ctx.resourceSchema != null && objectType.getObjectClass() != null) { ocdef = ctx.resourceSchema.findObjectClassDefinition(objectType.getObjectClass()); checkObjectClassDefinition(ctx, path, objectType, ocdef); for (ResourceAttributeDefinitionType attributeDef : objectType.getAttribute()) { checkSchemaHandlingAttribute(ctx, ocdef, path.append(ItemPath.create(ResourceObjectTypeDefinitionType.F_ATTRIBUTE, i)), objectType, attributeDef); i++; for (ResourceObjectAssociationType associationDef : objectType.getAssociation()) { checkSchemaHandlingAssociation(ctx, ocdef, path.append(ItemPath.create(ResourceObjectTypeDefinitionType.F_ATTRIBUTE, i)), objectType, associationDef); i++; if (objectType.getActivation() != null) { ItemPath actPath = path.append(ResourceObjectTypeDefinitionType.F_ACTIVATION); checkBidirectionalMapping(ctx, actPath, ResourceActivationDefinitionType.F_ADMINISTRATIVE_STATUS, objectType, objectType.getActivation().getAdministrativeStatus()); checkBidirectionalMapping(ctx, actPath, ResourceActivationDefinitionType.F_EXISTENCE, objectType, objectType.getActivation().getExistence()); checkBidirectionalMapping(ctx, actPath, ResourceActivationDefinitionType.F_LOCKOUT_STATUS, objectType, objectType.getActivation().getLockoutStatus()); checkBidirectionalMapping(ctx, actPath, ResourceActivationDefinitionType.F_VALID_FROM, objectType, objectType.getActivation().getValidFrom()); checkBidirectionalMapping(ctx, actPath, ResourceActivationDefinitionType.F_VALID_TO, objectType, objectType.getActivation().getValidTo()); if (objectType.getCredentials() != null) { ItemPath credPath = path.append(ResourceObjectTypeDefinitionType.F_CREDENTIALS); checkPasswordMapping(ctx, credPath, ResourceCredentialsDefinitionType.F_PASSWORD, objectType, objectType.getCredentials().getPassword());
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 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()); } } }
String name = accountType.getIntent(); assertNotNull("Account type without a name", name); assertNotNull("Account type "+name+" does not have an objectClass", accountType.getObjectClass()); boolean foundDescription = false; boolean foundDepartmentNumber = false; for (ResourceAttributeDefinitionType attributeDefinitionType : accountType.getAttribute()) { if ("description".equals(ItemPathTypeUtil.asSingleNameOrFail(attributeDefinitionType.getRef()).getLocalPart())) { foundDescription = true;
private String getName(ResourceObjectTypeDefinitionType objectType) { StringBuilder sb = new StringBuilder(); if (objectType.getDisplayName() != null) { sb.append(objectType.getDisplayName()); sb.append(" ("); } sb.append("kind: "); sb.append(fillDefault(objectType.getKind())); sb.append(", intent: "); sb.append(fillDefault(objectType.getIntent())); if (objectType.getDisplayName() != null) { sb.append(")"); } return sb.toString(); }
static RefinedObjectClassDefinition parse(ResourceObjectTypeDefinitionType entTypeDefType, ResourceType resourceType, RefinedResourceSchema rSchema, ShadowKindType impliedKind, PrismContext prismContext, String contextDescription) throws SchemaException { ShadowKindType kind = entTypeDefType.getKind(); if (kind == null) { kind = impliedKind; } if (kind == null) { kind = ShadowKindType.ACCOUNT; } String intent = entTypeDefType.getIntent(); if (intent == null) { intent = SchemaConstants.INTENT_DEFAULT; } RefinedObjectClassDefinition rObjectClassDef = parseRefinedObjectClass(entTypeDefType, resourceType, rSchema, prismContext, kind, intent, kind.value(), kind.value() + " type definition '"+intent+"' in " + contextDescription); if (entTypeDefType.getPagedSearches() != null) { LOGGER.warn("PagedSearches element is no more supported and is ignored. Use PagedSearchCapabilityType instead. In {}", resourceType); } return rObjectClassDef; }
private ResourceAttributeDefinitionType findAttributeDefinitionType(QName attrName, ResourceObjectTypeDefinitionType rOcDefType, String contextDescription) throws SchemaException { ResourceAttributeDefinitionType foundAttrDefType = null; for (ResourceAttributeDefinitionType attrDefType : rOcDefType.getAttribute()) { if (attrDefType.getRef() != null) { QName ref = ItemPathTypeUtil.asSingleNameOrFail(attrDefType.getRef()); if (QNameUtil.match(ref, attrName)) { if (foundAttrDefType == null) { foundAttrDefType = attrDefType; } else { throw new SchemaException("Duplicate definition of attribute " + ref + " in "+kind+" type " + rOcDefType.getIntent() + ", in " + contextDescription); } } } else { throw new SchemaException("Missing reference to the attribute schema definition in definition " + SchemaDebugUtil.prettyPrint(attrDefType) + " during processing of " + contextDescription); } } return foundAttrDefType; }
private void checkDuplicateItems(ResourceValidationContext ctx, ItemPath path, ResourceObjectTypeDefinitionType objectType) { Set<QName> existingNames = new HashSet<>(); Set<QName> duplicates = new HashSet<>(); for (ItemRefinedDefinitionType def : objectType.getAttribute()) { registerName(ctx, existingNames, duplicates, def.getRef()); } for (ItemRefinedDefinitionType def : objectType.getAssociation()) { registerName(ctx, existingNames, duplicates, def.getRef()); } if (!duplicates.isEmpty()) { ctx.validationResult.add(Issue.Severity.ERROR, CAT_SCHEMA_HANDLING, C_MULTIPLE_ITEMS, getString(CLASS_DOT + C_MULTIPLE_ITEMS, getName(objectType), prettyPrintUsingStandardPrefix(duplicates)), ctx.resourceRef, path); } }
ResourceObjectTypeDefinitionType objectTypeDef = new ResourceObjectTypeDefinitionType(prismContext); objectTypeDef.setDefault(true); IterationSpecificationType iterationSpecificationType = new IterationSpecificationType(); 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) {
public List<ResourceAttributeDefinitionType> createAttributeList() { PrismForJAXBUtil.createContainer(asPrismContainerValue(), F_ATTRIBUTE); return getAttribute(); }
for (QName auxOcName : objectType.getAuxiliaryObjectClass()) { ObjectClassComplexTypeDefinition auxOcDef = ctx.resourceSchema.findObjectClassDefinition(auxOcName); if (auxOcDef != null) { ctx.validationResult.add(Issue.Severity.ERROR, CAT_SCHEMA_HANDLING, C_UNKNOWN_ATTRIBUTE_NAME, getString(CLASS_DOT + C_UNKNOWN_ATTRIBUTE_NAME, getName(objectType), ref, objectType.getObjectClass()), ctx.resourceRef, path.append(ResourceItemDefinitionType.F_REF));
public ResourceObjectTypeDefinitionType dependency(ResourceObjectTypeDependencyType value) { getDependency().add(value); return this; }
private void checkObjectClass(ResourceValidationContext ctx, ItemPath path, ResourceObjectTypeDefinitionType objectType) { if (objectType.getObjectClass() == null) { ctx.validationResult.add(Issue.Severity.ERROR, CAT_SCHEMA_HANDLING, C_MISSING_OBJECT_CLASS, getString(CLASS_DOT + C_MISSING_OBJECT_CLASS, getName(objectType)), ctx.resourceRef, path.append(ResourceObjectTypeDefinitionType.F_OBJECT_CLASS)); } }