public ResourceObjectTypeDefinitionType attribute(ResourceAttributeDefinitionType value) { getAttribute().add(value); return this; }
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; }
public List<ResourceAttributeDefinitionType> createAttributeList() { PrismForJAXBUtil.createContainer(asPrismContainerValue(), F_ATTRIBUTE); return getAttribute(); }
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); } }
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; }
void parseAttributes(RefinedResourceSchema rSchema, String contextDescription) throws SchemaException { if (schemaHandlingObjectTypeDefinitionType == null) { // this is definition from schema. We already have all we need. return; } parseAttributesFrom(rSchema, getObjectClassDefinition(), false, contextDescription); for (RefinedObjectClassDefinition auxiliaryObjectClassDefinition: auxiliaryObjectClassDefinitions) { parseAttributesFrom(rSchema, auxiliaryObjectClassDefinition, true, contextDescription); } // Check for extra attribute definitions in the account type for (ResourceAttributeDefinitionType attrDefType : schemaHandlingObjectTypeDefinitionType.getAttribute()) { if (!containsAttributeDefinition(attrDefType.getRef()) && !RefinedAttributeDefinitionImpl.isIgnored(attrDefType)) { throw new SchemaException("Definition of attribute " + attrDefType.getRef() + " not found in object class " + originalObjectClassDefinition .getTypeName() + " as defined in " + contextDescription); } } parseProtected(this, schemaHandlingObjectTypeDefinitionType, getPrismContext()); }
boolean foundDescription = false; boolean foundDepartmentNumber = false; for (ResourceAttributeDefinitionType attributeDefinitionType : accountType.getAttribute()) { if ("description".equals(ItemPathTypeUtil.asSingleNameOrFail(attributeDefinitionType.getRef()).getLocalPart())) { foundDescription = true;
for (ResourceAttributeDefinitionType attributeDef : objectType.getAttribute()) { checkSchemaHandlingAttribute(ctx, ocdef, path.append(ItemPath.create(ResourceObjectTypeDefinitionType.F_ATTRIBUTE, i)), objectType, attributeDef); i++;