com.evolveum.midpoint.schema.processor
Class ResourceObjectDefinition

java.lang.Object
  extended by com.evolveum.midpoint.schema.processor.Definition
      extended by com.evolveum.midpoint.schema.processor.ItemDefinition
          extended by com.evolveum.midpoint.schema.processor.PropertyContainerDefinition
              extended by com.evolveum.midpoint.schema.processor.ResourceObjectDefinition
All Implemented Interfaces:
Dumpable, java.io.Serializable

public class ResourceObjectDefinition
extends PropertyContainerDefinition

Resource Object Definition (Object Class). Object Class refers to a type of object on the Resource. Unix account, Active Directory group, inetOrgPerson LDAP objectclass or a schema of USERS database table are all Object Classes from the midPoint point of view. Object class defines a set of attribute names, types for each attributes and few additional properties. This class represents schema definition for resource object (object class). See Definition for more details. Resource Object Definition is immutable. TODO: This will probably need to be changed to a mutable object.

Author:
Radovan Semancik
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.evolveum.midpoint.schema.processor.PropertyContainerDefinition
complexTypeDefinition, schema
 
Fields inherited from class com.evolveum.midpoint.schema.processor.ItemDefinition
name
 
Fields inherited from class com.evolveum.midpoint.schema.processor.Definition
defaultName, displayName, help, ignored, typeName
 
Constructor Summary
ResourceObjectDefinition(Schema schema, javax.xml.namespace.QName name, ComplexTypeDefinition complexTypeDefinition)
           
 
Method Summary
 ResourceObjectAttributeDefinition createAttributeDefinition(javax.xml.namespace.QName name, javax.xml.namespace.QName typeName)
           
 ResourceObjectAttributeDefinition createAttributeDefinition(java.lang.String localName, javax.xml.namespace.QName typeName)
           
 ResourceObjectAttributeDefinition createAttributeDefinition(java.lang.String localName, java.lang.String localTypeName)
           
 java.lang.String dump(int indent)
           
 ResourceObjectAttributeDefinition findAttributeDefinition(javax.xml.namespace.QName elementQName)
           
 ResourceObjectAttributeDefinition findAttributeDefinition(java.lang.String elementLocalname)
           
 ResourceObjectAttributeDefinition getDescriptionAttribute()
          Returns the definition of description attribute of a resource object.
 ResourceObjectAttributeDefinition getDisplayNameAttribute()
          Returns the definition of display name attribute.
 java.util.Set<ResourceObjectAttributeDefinition> getIdentifiers()
          Returns the definition of identifier attributes of a resource object.
 ResourceObjectAttributeDefinition getNamingAttribute()
          Specifies which resource attribute should be used as a "technical" name for the account.
 java.lang.String getNativeObjectClass()
          Returns the native object class string for the resource object.
 java.util.Set<ResourceObjectAttributeDefinition> getSecondaryIdentifiers()
          Returns the definition of secondary identifier attributes of a resource object.
 ResourceObject instantiate()
          Create property container instance with a default name.
 PropertyContainer instantiate(javax.xml.namespace.QName name)
          Create property container instance with a specified name.
 PropertyContainer instantiate(javax.xml.namespace.QName name, java.lang.Object element)
          Create property container instance with a specified name and element.
 boolean isAccountType()
          Indicates whether definition is should be used as account type.
 boolean isDefaultAccountType()
          Indicates whether definition is should be used as default account type.
 java.util.Set<ResourceObjectAttribute> parseAttributes(java.util.List<java.lang.Object> elements)
           
 java.util.Set<ResourceObjectAttribute> parseIdentifiers(java.util.List<java.lang.Object> elements)
           
 void setAccountType(boolean accountType)
           
 void setDefaultAccountType(boolean defaultAccountType)
           
 void setDescriptionAttribute(ResourceObjectAttributeDefinition descriptionAttribute)
           
 void setDisplayNameAttribute(javax.xml.namespace.QName displayName)
          TODO Convenience method.
 void setDisplayNameAttribute(ResourceObjectAttributeDefinition displayName)
           
 void setNamingAttribute(javax.xml.namespace.QName namingAttribute)
           
 void setNamingAttribute(ResourceObjectAttributeDefinition namingAttribute)
           
 void setNativeObjectClass(java.lang.String nativeObjectClass)
           
 java.lang.String toString()
           
 
Methods inherited from class com.evolveum.midpoint.schema.processor.PropertyContainerDefinition
createPropertyDefinition, createPropertyDefinition, createPropertyDefinition, createPropertyDefinition, createPropertyDefinition, createPropertyDefinition, findItemDefinition, findItemDefinition, findPropertyContainerDefinition, findPropertyDefinition, getDefinitions, getPropertyDefinitions, getSchemaNamespace, isEmpty, parseAsContent, parseAsContent, parseItem, parseItem, parseItem, parseItems, parseItems
 
Methods inherited from class com.evolveum.midpoint.schema.processor.ItemDefinition
getName, getNameOrDefaultName
 
Methods inherited from class com.evolveum.midpoint.schema.processor.Definition
dump, getDefaultName, getDisplayName, getHelp, getTypeName, isIgnored, setDisplayName, setHelp, setIgnored
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceObjectDefinition

public ResourceObjectDefinition(Schema schema,
                                javax.xml.namespace.QName name,
                                ComplexTypeDefinition complexTypeDefinition)
Method Detail

getIdentifiers

public java.util.Set<ResourceObjectAttributeDefinition> getIdentifiers()
Returns the definition of identifier attributes of a resource object. May return empty set if there are no identifier attributes. Must not return null. 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.

Returns:
definition of identifier attributes
Throws:
java.lang.IllegalStateException - if there is no definition for the referenced attributed

getSecondaryIdentifiers

public java.util.Set<ResourceObjectAttributeDefinition> getSecondaryIdentifiers()
Returns the definition of secondary identifier attributes of a resource object. May return empty set if there are no secondary identifier attributes. Must not return null. 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.

Returns:
definition of secondary identifier attributes
Throws:
java.lang.IllegalStateException - if there is no definition for the referenced attributed

getDescriptionAttribute

public ResourceObjectAttributeDefinition getDescriptionAttribute()
Returns the definition of description attribute of a resource object. Returns null if there is no description attribute. 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.

Returns:
definition of secondary identifier attributes
Throws:
java.lang.IllegalStateException - if there is more than one description attribute. But this should never happen.
java.lang.IllegalStateException - if there is no definition for the referenced attributed

setDescriptionAttribute

public void setDescriptionAttribute(ResourceObjectAttributeDefinition descriptionAttribute)

getNamingAttribute

public ResourceObjectAttributeDefinition getNamingAttribute()
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.

Returns:
resource attribute definition that should be used as a "technical" name for the account.

setNamingAttribute

public void setNamingAttribute(ResourceObjectAttributeDefinition namingAttribute)

setNamingAttribute

public void setNamingAttribute(javax.xml.namespace.QName namingAttribute)

getNativeObjectClass

public java.lang.String getNativeObjectClass()
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 native object class value will contain unmangled name (if available). Returns null if there is no native object class. 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.

Returns:
native object class
Throws:
java.lang.IllegalStateException - if there is more than one description attribute.

setNativeObjectClass

public void setNativeObjectClass(java.lang.String nativeObjectClass)

isAccountType

public boolean isAccountType()
Indicates whether definition is should be used as account type. If true value is returned then the definition should be used as an 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.

Returns:
true if the definition should be used as account type.

setAccountType

public void setAccountType(boolean accountType)

isDefaultAccountType

public boolean isDefaultAccountType()
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.

Returns:
true if the definition should be used as account type.
Throws:
java.lang.IllegalStateException - if more than one default account is suggested in the schema.

setDefaultAccountType

public void setDefaultAccountType(boolean defaultAccountType)

getDisplayNameAttribute

public ResourceObjectAttributeDefinition getDisplayNameAttribute()
Returns the definition of display name attribute. Display name attribute specifies which resource attribute should be used as title when displaying objects of a specific resource object class. It must point to an attribute of String type. If not present, primary identifier should be used instead (but this method does not handle this default behavior). Returns null if there is no display name attribute. 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.

Returns:
native object class
Throws:
java.lang.IllegalStateException - if there is more than one display name attribute or the definition of the referenced attribute does not exist.

setDisplayNameAttribute

public void setDisplayNameAttribute(ResourceObjectAttributeDefinition displayName)

setDisplayNameAttribute

public void setDisplayNameAttribute(javax.xml.namespace.QName displayName)
TODO Convenience method. It will internally look up the correct definition.

Parameters:
displayName -

instantiate

public ResourceObject instantiate()
Description copied from class: PropertyContainerDefinition
Create property container instance with a default name. This is a preferred way how to create property container.

Overrides:
instantiate in class PropertyContainerDefinition
Returns:
created item instance

parseAttributes

public java.util.Set<ResourceObjectAttribute> parseAttributes(java.util.List<java.lang.Object> elements)
                                                       throws SchemaException
Throws:
SchemaException

parseIdentifiers

public java.util.Set<ResourceObjectAttribute> parseIdentifiers(java.util.List<java.lang.Object> elements)
                                                        throws SchemaException
Throws:
SchemaException

findAttributeDefinition

public ResourceObjectAttributeDefinition findAttributeDefinition(javax.xml.namespace.QName elementQName)

findAttributeDefinition

public ResourceObjectAttributeDefinition findAttributeDefinition(java.lang.String elementLocalname)

createAttributeDefinition

public ResourceObjectAttributeDefinition createAttributeDefinition(javax.xml.namespace.QName name,
                                                                   javax.xml.namespace.QName typeName)

createAttributeDefinition

public ResourceObjectAttributeDefinition createAttributeDefinition(java.lang.String localName,
                                                                   javax.xml.namespace.QName typeName)

createAttributeDefinition

public ResourceObjectAttributeDefinition createAttributeDefinition(java.lang.String localName,
                                                                   java.lang.String localTypeName)

instantiate

public PropertyContainer instantiate(javax.xml.namespace.QName name)
Description copied from class: PropertyContainerDefinition
Create property container instance with a specified name. This is a preferred way how to create property container.

Overrides:
instantiate in class PropertyContainerDefinition
Returns:
created item instance

instantiate

public PropertyContainer instantiate(javax.xml.namespace.QName name,
                                     java.lang.Object element)
Description copied from class: PropertyContainerDefinition
Create property container instance with a specified name and element. This is a preferred way how to create property container.

Overrides:
instantiate in class PropertyContainerDefinition
Returns:
created item instance

dump

public java.lang.String dump(int indent)
Overrides:
dump in class PropertyContainerDefinition

toString

public java.lang.String toString()
Overrides:
toString in class ItemDefinition


Copyright © 2011 evolveum. All Rights Reserved.