public static Collection<ResourceAttribute<?>> getSecondaryIdentifiers(Collection<? extends ResourceAttribute<?>> identifiers, ObjectClassComplexTypeDefinition objectClassDefinition) throws SchemaException { if (identifiers == null) { return null; } Collection<ResourceAttribute<?>> secondaryIdentifiers = new ArrayList<>(); for (ResourceAttribute<?> identifier: identifiers) { if (objectClassDefinition.isSecondaryIdentifier(identifier.getElementName())) { secondaryIdentifiers.add(identifier); } } return secondaryIdentifiers; }
public static ResourceObjectIdentification createFromAttributes(ObjectClassComplexTypeDefinition objectClassDefinition, Collection<? extends ResourceAttribute<?>> attributes) throws SchemaException { Collection<? extends ResourceAttribute<?>> primaryIdentifiers = null; Collection<? extends ResourceAttribute<?>> secondaryIdentifiers = null; for (ResourceAttribute<?> identifier: attributes) { if (objectClassDefinition.isPrimaryIdentifier(identifier.getElementName())) { if (primaryIdentifiers == null) { primaryIdentifiers = new ArrayList<>(); } ((Collection)primaryIdentifiers).add(identifier); } else if (objectClassDefinition.isSecondaryIdentifier(identifier.getElementName())) { if (secondaryIdentifiers == null) { secondaryIdentifiers = new ArrayList<>(); } ((Collection)secondaryIdentifiers).add(identifier); } } return new ResourceObjectIdentification(objectClassDefinition, primaryIdentifiers, secondaryIdentifiers); }
public static ResourceObjectIdentification create(ObjectClassComplexTypeDefinition objectClassDefinition, Collection<? extends ResourceAttribute<?>> allIdentifiers) throws SchemaException { if (allIdentifiers == null) { throw new IllegalArgumentException("Cannot create ResourceObjectIdentification with null identifiers"); } Collection<? extends ResourceAttribute<?>> primaryIdentifiers = null; Collection<? extends ResourceAttribute<?>> secondaryIdentifiers = null; for (ResourceAttribute<?> identifier: allIdentifiers) { if (objectClassDefinition.isPrimaryIdentifier(identifier.getElementName())) { if (primaryIdentifiers == null) { primaryIdentifiers = new ArrayList<>(); } ((Collection)primaryIdentifiers).add(identifier); } else if (objectClassDefinition.isSecondaryIdentifier(identifier.getElementName())) { if (secondaryIdentifiers == null) { secondaryIdentifiers = new ArrayList<>(); } ((Collection)secondaryIdentifiers).add(identifier); } else { throw new SchemaException("Attribute "+identifier+" is neither primary not secondary identifier in object class "+objectClassDefinition); } } return new ResourceObjectIdentification(objectClassDefinition, primaryIdentifiers, secondaryIdentifiers); }
private void processIdentifiers(RefinedAttributeDefinition rAttrDef, ObjectClassComplexTypeDefinition objectClassDef) { QName attrName = rAttrDef.getName(); if (objectClassDef.isPrimaryIdentifier(attrName)) { ((Collection)getPrimaryIdentifiers()).add(rAttrDef); } if (rAttrDef.isSecondaryIdentifierOverride() == null) { if (objectClassDef.isSecondaryIdentifier(attrName)) { ((Collection)getSecondaryIdentifiers()).add(rAttrDef); } } else if (rAttrDef.isSecondaryIdentifierOverride()) { ((Collection)getSecondaryIdentifiers()).add(rAttrDef); } }
uidValue = ((ResourceAttribute<String>) attr).getValue().getValue(); if (objectClass.isSecondaryIdentifier(attr.getElementName())) { ResourceAttributeDefinition<?> attrDef = objectClass.findAttributeDefinition(attr.getElementName()); String frameworkAttributeName = attrDef.getFrameworkAttributeName();