@Override public ResourceAttributeContainerImpl cloneComplex(CloneStrategy strategy) { ResourceAttributeContainerImpl clone = new ResourceAttributeContainerImpl(getElementName(), getDefinition(), getPrismContext()); copyValues(strategy, clone); return clone; }
@Override public ResourceAttributeContainer clone() { return cloneComplex(CloneStrategy.LITERAL); }
@Override public Collection<ResourceAttribute<?>> getAllIdentifiers() { return extractAttributesByDefinitions(getDefinition().getAllIdentifiers()); }
/** * Returns display name attribute of a resource object. * * Returns null if there is no display name attribute or the attribute is * not known. * * The exception should be never thrown unless there is some bug in the * code. The validation of model consistency should be done at the time of * schema parsing. * * @return display name attribute of a resource object. * @throws IllegalStateException * if there is no definition for the referenced attributed */ @Override public ResourceAttribute getDisplayNameAttribute() { if (getDefinition() == null) { return null; } return findAttribute(getDefinition().getDisplayNameAttribute()); }
public static ResourceAttributeContainer createResourceAttributeContainer(QName name, ResourceAttributeContainerDefinition definition, PrismContext prismContext) { return new ResourceAttributeContainerImpl(name, definition, prismContext); }
@Override public ShadowKindType getKind() { ResourceAttributeContainerDefinition definition = getDefinition(); return (definition != null ? definition.getKind() : null); }
/** * Returns a (single) primary identifier. * * This method returns a property that acts as an (primary) identifier for * the resource object. Primary identifiers are used to access the resource * objects, retrieve them from resource, identify objects for modifications, * etc. * * Returns null if no identifier is defined. * * Resource objects may have multiple (composite) identifiers, but this * method assumes that there is only a single identifier. The method will * throw exception if that assumption is not satisfied. * * @return identifier property * @throws IllegalStateException * if resource object has multiple identifiers */ @Override public PrismProperty<?> getPrimaryIdentifier() { Collection<ResourceAttribute<?>> attrDefs = getPrimaryIdentifiers(); if (attrDefs.size() > 1){ throw new IllegalStateException("Resource object has more than one identifier."); } for (PrismProperty<?> p : attrDefs){ return p; } return null; }
@Override public Collection<ResourceAttribute<?>> extractAttributesByDefinitions( Collection<? extends ResourceAttributeDefinition> definitions) { Collection<ResourceAttribute<?>> attributes = new ArrayList<>(definitions.size()); for (ResourceAttributeDefinition attrDef : definitions) { for (ResourceAttribute<?> property : getAttributes()){ if (attrDef.getName().equals(property.getElementName())){ property.setDefinition(attrDef); attributes.add(property); } } } return attributes; }
/** * Returns description attribute of a resource object. * * Returns null if there is no description attribute or the attribute is not * known. * * The exception should be never thrown unless there is some bug in the * code. The validation of model consistency should be done at the time of * schema parsing. * * @return description attribute of a resource object. * @throws IllegalStateException * if there is no definition for the referenced attributed */ @Override public ResourceAttribute<String> getDescriptionAttribute() { if (getDefinition() == null) { return null; } return findAttribute(getDefinition().getDisplayNameAttribute()); }
@NotNull @Override public ResourceAttributeContainer instantiate(QName name) { name = DefinitionUtil.addNamespaceIfApplicable(name, this.name); return new ResourceAttributeContainerImpl(name, this, prismContext); }
/** * Returns the native object class string for the resource object. * * Native object class is the name of the Resource Object Definition (Object * Class) as it is seen by the resource itself. The name of the Resource * Object Definition may be constrained by XSD or other syntax and therefore * may be "mangled" to conform to such syntax. The <i>native object * class</i> value will contain unmangled name (if available). * * Returns null if there is no native object class or the native object * class is not known. * * The exception should be never thrown unless there is some bug in the * code. The validation of model consistency should be done at the time of * schema parsing. * * @return native object class * @throws IllegalStateException * if there is more than one description attribute. */ @Override public String getNativeObjectClass() { return getDefinition() == null ? null : getDefinition().getNativeObjectClass(); }
/** * Returns secondary identifiers. * * This method returns properties that act as secondary identifiers for the * resource object. Secondary identifiers are used to confirm primary * identification of resource object. * * Returns empty set if no identifier is defined. Must not return null. * * Resource objects may have multiple (composite) identifiers, all of them * are returned. * * @return set of secondary identifier properties */ @Override public Collection<ResourceAttribute<?>> getSecondaryIdentifiers() { return extractAttributesByDefinitions(getDefinition().getSecondaryIdentifiers()); }
/** * Specifies which resource attribute should be used as a "technical" name * for the account. This name will appear in log files and other troubleshooting * tools. The name should be a form of unique identifier that can be used to * locate the resource object for diagnostics. It should not contain white chars and * special chars if that can be avoided and it should be reasonable short. * It is different from a display name attribute. Display name is intended for a * common user or non-technical administrator (such as role administrator). The * naming attribute is intended for technical IDM administrators and developers. * * @return attribute that should be used as a "technical" name * for the account. */ @Override public ResourceAttribute<String> getNamingAttribute() { if (getDefinition() == null) { return null; } if (getDefinition().getNamingAttribute()==null) { return null; } return findAttribute(getDefinition().getNamingAttribute()); }
public static ResourceAttributeContainer instantiate(QName elementName, ObjectClassComplexTypeDefinition ocdef) { ResourceAttributeContainerDefinition racDef = ocdef.toResourceAttributeContainerDefinition(elementName); return new ResourceAttributeContainerImpl(elementName, racDef, ocdef.getPrismContext()); }
/** * Indicates whether definition is should be used as default account type. * * If true value is returned then the definition should be used as a default * account type definition. This is a way how a resource connector may * suggest applicable object classes (resource object definitions) for * accounts. * * If no information about account type is present, false should be * returned. This method must return true only if isAccountType() returns * true. * * The exception should be never thrown unless there is some bug in the * code. The validation of at-most-one value should be done at the time of * schema parsing. The exception may not even be thrown at all if the * implementation is not able to determine duplicity. * * @return true if the definition should be used as account type. * @throws IllegalStateException * if more than one default account is suggested in the schema. */ @Override public boolean isDefaultInAKind() { ResourceAttributeContainerDefinition definition = getDefinition(); return (definition != null ? definition.isDefaultInAKind() : null); }
/** * Returns primary identifiers. * * This method returns properties that act as (primary) identifiers for the * resource object. Primary identifiers are used to access the resource * objects, retrieve them from resource, identify objects for modifications, * etc. * * Returns empty set if no identifier is defined. Must not return null. * * Resource objects may have multiple (composite) identifiers, all of them * are returned. * * The returned set it immutable! Any modifications will be lost. * * @return set of identifier properties */ @Override public Collection<ResourceAttribute<?>> getPrimaryIdentifiers() { return extractAttributesByDefinitions(getDefinition().getPrimaryIdentifiers()); }
static ResourceAttributeContainerImpl createEmptyContainer(QName elementName, ObjectClassComplexTypeDefinition objectClassDefinition) { ResourceAttributeContainerDefinition attributesContainerDefinition = new ResourceAttributeContainerDefinitionImpl(elementName, objectClassDefinition, objectClassDefinition.getPrismContext()); return new ResourceAttributeContainerImpl(elementName, attributesContainerDefinition , objectClassDefinition.getPrismContext()); }