Class NormalizationAwareResourceAttributeDefinition<T>

java.lang.Object
com.evolveum.midpoint.schema.processor.NormalizationAwareResourceAttributeDefinition<T>
All Implemented Interfaces:
Definition, Freezable, ItemDefinition<PrismProperty<T>>, LivePrismItemDefinition, PrismItemAccessDefinition, PrismItemBasicDefinition, PrismItemInstantiableDefinition<T,PrismPropertyValue<T>,PrismProperty<T>,PrismPropertyDefinition<T>,PropertyDelta<T>>, PrismItemMatchingDefinition<T>, PrismItemStorageDefinition, PrismItemValuesDefinition<T>, PrismLifecycleDefinition, PrismPresentationDefinition, PrismPropertyDefinition<T>, Revivable, SmartVisitable<Definition>, Visitable<Definition>, DebugDumpable, Serializable, Cloneable

public class NormalizationAwareResourceAttributeDefinition<T> extends Object implements PrismPropertyDefinition<T>
An alternative representation of a ShadowSimpleAttributeDefinition that describes a normalization-aware resource attribute: one that has both original and normalized values. Such attributes are to be stored in the repository, to facilitate searching by normalized values. The current implementation is such that String properties with a non-trivial normalizer are represented as PolyString instances. [NOTE] ==== This class intentionally does not implement ShadowSimpleAttributeDefinition interface. It should not be used in place of attribute definition. ====
See Also:
  • Method Details

    • isDynamic

      public boolean isDynamic()
      Description copied from interface: ItemDefinition
      Returns true if definition was created during the runtime based on a dynamic information such as xsi:type attributes in XML. This means that the definition needs to be stored alongside the data to have a successful serialization "roundtrip". The definition is not part of any schema and therefore cannot be determined. It may even be different for every instance of the associated item (element name).
      Specified by:
      isDynamic in interface ItemDefinition<T>
    • getTypeName

      @NotNull public @NotNull QName getTypeName()
      Description copied from interface: Definition
      Returns a name of the type for this definition. The type can be part of the compile-time schema or it can be defined at run time. Examples of the former case are types like c:UserType, xsd:string, or even flexible ones like c:ExtensionType or c:ShadowAttributesType. Examples of the latter case are types used in - custom extensions, like ext:LocationsType (where ext = e.g. http://example.com/extension), - resource schema, like ri:inetOrgPerson (ri = http://.../resource/instance-3), - connector schema, like TODO In XML representation that corresponds to the name of the XSD type. Although beware, the run-time types do not have statically defined structure. And the resource and connector-related types may even represent different kinds of objects within different contexts (e.g. two distinct resources both with ri:AccountObjectClass types). Also note that for complex type definitions, the type name serves as a unique identifier. On the other hand, for item definitions, it is just one of its attributes; primary key is item name in that case. The type name should be fully qualified. (TODO reconsider this)
      Specified by:
      getTypeName in interface Definition
      Specified by:
      getTypeName in interface PrismItemBasicDefinition
      Specified by:
      getTypeName in interface PrismItemMatchingDefinition<T>
      Returns:
      the type name
    • getTypeClass

      public Class<T> getTypeClass()
      Description copied from interface: Definition
      Returns a compile-time class that is used to represent items. E.g. returns String, Integer, subclasses of Objectable and Containerable and so on.
      Specified by:
      getTypeClass in interface Definition
      Specified by:
      getTypeClass in interface PrismItemMatchingDefinition<T>
      Specified by:
      getTypeClass in interface PrismPropertyDefinition<T>
    • isRuntimeSchema

      public boolean isRuntimeSchema()
      Description copied from interface: Definition
      This means that this particular definition (of an item or of a type) is part of the runtime schema, e.g. extension schema, resource schema or connector schema or something like that. I.e. it is not defined statically.
      Specified by:
      isRuntimeSchema in interface Definition
    • getProcessing

      public ItemProcessing getProcessing()
      Specified by:
      getProcessing in interface ItemDefinition<T>
    • isAbstract

      public boolean isAbstract()
      Description copied from interface: Definition
      For types: is the type abstract so that it should not be instantiated directly? For items: TODO
      Specified by:
      isAbstract in interface Definition
    • isDeprecated

      public boolean isDeprecated()
      Specified by:
      isDeprecated in interface PrismLifecycleDefinition
    • isRemoved

      public boolean isRemoved()
      Specified by:
      isRemoved in interface PrismLifecycleDefinition
    • getRemovedSince

      public String getRemovedSince()
      Specified by:
      getRemovedSince in interface PrismLifecycleDefinition
    • isExperimental

      public boolean isExperimental()
      Description copied from interface: PrismLifecycleDefinition
      Experimental functionality is not stable and it may be changed in any future release without any warning. Use at your own risk.
      Specified by:
      isExperimental in interface PrismLifecycleDefinition
    • getPlannedRemoval

      public String getPlannedRemoval()
      Description copied from interface: PrismLifecycleDefinition
      Version of data model in which the item is likely to be removed. This annotation is used for deprecated item to indicate imminent incompatibility in future versions of data model.
      Specified by:
      getPlannedRemoval in interface PrismLifecycleDefinition
    • isElaborate

      public boolean isElaborate()
      Description copied from interface: Definition
      Elaborate items are complicated data structure that may deviate from normal principles of the system. For example elaborate items may not be supported in user interface and may only be manageable by raw edits or a special-purpose tools. Elaborate items may be not fully supported by authorizations, schema tools and so on.
      Specified by:
      isElaborate in interface Definition
    • getDeprecatedSince

      public String getDeprecatedSince()
      Specified by:
      getDeprecatedSince in interface PrismLifecycleDefinition
    • isEmphasized

      public boolean isEmphasized()
      Description copied from interface: PrismPresentationDefinition
      True for definitions that are more important than others and that should be emphasized during presentation. E.g. the emphasized definitions will always be displayed in the user interfaces (even if they are empty), they will always be included in the dumps, etc. TODO probably deprecated, isn't it?
      Specified by:
      isEmphasized in interface PrismPresentationDefinition
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: PrismPresentationDefinition
      Returns display name. Specifies the printable name of the object class or attribute. It must contain a printable string. It may also contain a key to catalog file. Returns null if no display name is set. Corresponds to "displayName" XSD annotation.
      Specified by:
      getDisplayName in interface PrismPresentationDefinition
      Returns:
      display name string or catalog key
    • getDisplayOrder

      public Integer getDisplayOrder()
      Description copied from interface: PrismPresentationDefinition
      Specifies an order in which the item should be displayed relative to other items at the same level. The items will be displayed by sorting them by the values of displayOrder annotation (ascending). Items that do not have any displayOrder annotation will be displayed last. The ordering of values with the same displayOrder is undefined and it may be arbitrary.
      Specified by:
      getDisplayOrder in interface PrismPresentationDefinition
    • getHelp

      public String getHelp()
      Description copied from interface: PrismPresentationDefinition
      Returns help string. Specifies the help text or a key to catalog file for a help text. The help text may be displayed in any suitable way by the GUI. It should explain the meaning of an attribute or object class. Returns null if no help string is set. Corresponds to "help" XSD annotation.
      Specified by:
      getHelp in interface PrismPresentationDefinition
      Returns:
      help string or catalog key
    • getDocumentation

      public String getDocumentation()
      Description copied from interface: PrismPresentationDefinition
      Must contains tag because of html tags used in text.
      Specified by:
      getDocumentation in interface PrismPresentationDefinition
    • getDocumentationPreview

      public String getDocumentationPreview()
      Description copied from interface: PrismPresentationDefinition
      Returns only a first sentence of documentation.
      Specified by:
      getDocumentationPreview in interface PrismPresentationDefinition
    • getAnnotation

      public <A> A getAnnotation(QName qname)
      Description copied from interface: Definition
      Returns generic definition annotation. Annotations are a method to extend schema definitions. This may be annotation stored in the schema definition file (e.g. XSD) or it may be a dynamic annotation determined at run-time. Annotation value should be a prism-supported object. E.g. a prims "bean" (JAXB annotated class), prism item, prism value or something like that. EXPERIMENTAL. Hic sunt leones. This may change at any moment. Note: annotations are only partially supported now (3.8). They are somehow transient. E.g. they are not serialized to XSD schema definitions (yet).
      Specified by:
      getAnnotation in interface Definition
    • getAnnotations

      @Nullable public @Nullable Map<QName,Object> getAnnotations()
      Description copied from interface: Definition
      Returns all annotations, as unmodifiable map. Nullable by design, to avoid creating lots of empty maps.
      Specified by:
      getAnnotations in interface Definition
    • getSchemaMigrations

      @Nullable public @Nullable List<SchemaMigration> getSchemaMigrations()
      Specified by:
      getSchemaMigrations in interface PrismLifecycleDefinition
    • getDiagrams

      public List<ItemDiagramSpecification> getDiagrams()
      Specified by:
      getDiagrams in interface PrismPresentationDefinition
    • isImmutable

      public boolean isImmutable()
      Specified by:
      isImmutable in interface Freezable
    • freeze

      public void freeze()
      Specified by:
      freeze in interface Freezable
    • getItemName

      @NotNull public @NotNull ItemName getItemName()
      Description copied from interface: PrismItemBasicDefinition
      Gets the "canonical" name of the item for the definition. Should be qualified, if at all possible.
      Specified by:
      getItemName in interface PrismItemBasicDefinition
    • getMinOccurs

      public int getMinOccurs()
      Description copied from interface: PrismItemBasicDefinition
      Returns the number of minimal value occurrences.
      Specified by:
      getMinOccurs in interface PrismItemBasicDefinition
    • getMaxOccurs

      public int getMaxOccurs()
      Description copied from interface: PrismItemBasicDefinition
      Returns the number of maximal value occurrences. Any negative number means "unbounded".
      Specified by:
      getMaxOccurs in interface PrismItemBasicDefinition
    • isOperational

      public boolean isOperational()
      Description copied from interface: ItemDefinition
      Marks operational item. Operational properties are auxiliary data (or meta-data) that are usually not modifiable by the end user. They are generated and maintained by the system. Operational items are also not usually displayed unless it is explicitly requested. The example of operational items are modification timestamps, create timestamps, user that made the last change, etc. They are also treated in a special way when comparing values. See ParameterizedEquivalenceStrategy.
      Specified by:
      isOperational in interface ItemDefinition<T>
    • isAlwaysUseForEquals

      public boolean isAlwaysUseForEquals()
      Description copied from interface: ItemDefinition
      Item which should always be used for equals even if it is operational and strategy does not consider operational items. EXPERIMENTAL
      Specified by:
      isAlwaysUseForEquals in interface ItemDefinition<T>
    • isOptionalCleanup

      public boolean isOptionalCleanup()
      Description copied from interface: Definition
      Marks item that could be ignored by SCM tools (e.g. Git), or removed before commit.
      Specified by:
      isOptionalCleanup in interface Definition
    • getDisplayHint

      public DisplayHint getDisplayHint()
      Description copied from interface: PrismPresentationDefinition
      Enumeration annotation that specifies how/whether the item should be displayed. It is also a replacement for the old "emphasized" annotation.
      Specified by:
      getDisplayHint in interface PrismPresentationDefinition
    • getMergerIdentifier

      @Nullable public @Nullable String getMergerIdentifier()
      Specified by:
      getMergerIdentifier in interface Definition
    • getNaturalKeyConstituents

      @Nullable public @Nullable List<QName> getNaturalKeyConstituents()
      Specified by:
      getNaturalKeyConstituents in interface Definition
    • getMergerInstance

      @Nullable public @Nullable ItemMerger getMergerInstance(@NotNull @NotNull MergeStrategy strategy, @Nullable @Nullable OriginMarker originMarker)
      Specified by:
      getMergerInstance in interface Definition
    • getNaturalKeyInstance

      @Nullable public @Nullable NaturalKeyDefinition getNaturalKeyInstance()
      Specified by:
      getNaturalKeyInstance in interface Definition
    • isIndexOnly

      public boolean isIndexOnly()
      Description copied from interface: PrismItemStorageDefinition
      If true, this item is not stored in XML representation in repo. TODO better name
      Specified by:
      isIndexOnly in interface PrismItemStorageDefinition
    • isInherited

      public boolean isInherited()
      Description copied from interface: ItemDefinition
      Whether the item is inherited from a supertype.
      Specified by:
      isInherited in interface ItemDefinition<T>
    • getSubstitutionHead

      public QName getSubstitutionHead()
      Description copied from interface: ItemDefinition
      Returns the name of an element this one can be substituted for (e.g. c:user -> c:object, s:pipeline -> s:expression, etc). EXPERIMENTAL
      Specified by:
      getSubstitutionHead in interface ItemDefinition<T>
    • isHeterogeneousListItem

      public boolean isHeterogeneousListItem()
      Description copied from interface: ItemDefinition
      Can be used in heterogeneous lists as a list item. EXPERIMENTAL.
      Specified by:
      isHeterogeneousListItem in interface ItemDefinition<T>
    • getValueEnumerationRef

      public PrismReferenceValue getValueEnumerationRef()
      Description copied from interface: ItemDefinition
      Reference to an object that directly or indirectly represents possible values for this item. We do not define here what exactly the object has to be. It can be a lookup table, script that dynamically produces the values or anything similar. The object must produce the values of the correct type for this item otherwise an error occurs.
      Specified by:
      getValueEnumerationRef in interface ItemDefinition<T>
      Specified by:
      getValueEnumerationRef in interface PrismItemValuesDefinition<T>
    • isValidFor

      public boolean isValidFor(@NotNull @NotNull QName elementQName, @NotNull @NotNull Class<? extends ItemDefinition<?>> clazz, boolean caseInsensitive)
      Description copied from interface: LivePrismItemDefinition
      Returns true if this definition is valid for given element name and definition class, in either case-sensitive (the default) or case-insensitive way. Used e.g. for "slow" path lookup where we iterate over all definitions in a complex type.
      Specified by:
      isValidFor in interface LivePrismItemDefinition
    • findItemDefinition

      public <T1 extends ItemDefinition<?>> T1 findItemDefinition(@NotNull @NotNull ItemPath path, @NotNull @NotNull Class<T1> clazz)
      Description copied from interface: LivePrismItemDefinition
      Used to find a matching item definition _within_ this definition. Treats e.g. de-referencing in prism references.
      Specified by:
      findItemDefinition in interface LivePrismItemDefinition
    • deepClone

      public ItemDefinition<PrismProperty<T>> deepClone(@NotNull @NotNull DeepCloneOperation operation)
      Description copied from interface: ItemDefinition
      TODO document
      Specified by:
      deepClone in interface ItemDefinition<T>
    • getDebugDumpClassName

      public String getDebugDumpClassName()
      Return a human readable name of this class suitable for logs.
    • debugDumpShortToString

      public void debugDumpShortToString(StringBuilder sb)
      Description copied from interface: ItemDefinition
      Used in debugDumping items. Does not need to have name in it as item already has it. Does not need to have class as that is just too much info that is almost anytime pretty obvious anyway.
      Specified by:
      debugDumpShortToString in interface ItemDefinition<T>
    • structuredType

      public Optional<ComplexTypeDefinition> structuredType()
      Description copied from interface: ItemDefinition
      Returns complex type definition of item, if underlying value is possible structured. NOTE: This seems weird, since properties and references are simple values, but actually object reference is serialized as structured value and some of properties are also.
      Specified by:
      structuredType in interface ItemDefinition<T>
    • canRead

      public boolean canRead()
      Description copied from interface: PrismItemAccessDefinition
      Returns true if this item can be read (displayed). In case of containers this flag is, strictly speaking, not applicable. Container is an empty shell. What matters is access to individual sub-item. However, for containers this value has a "hint" meaning. It means that the container itself contains something that is readable. Which can be used as a hint by the presentation to display container label or block. This usually happens if the container contains at least one readable item. This does NOT mean that also all the container items can be displayed. The sub-item permissions are controlled by similar properties on the items. This property only applies to the container itself: the "shell" of the container.

      Note: It was considered to use a different meaning for this flag - a meaning that would allow canRead()=false containers to have readable items. However, this was found not to be very useful. Therefore the "something readable inside" meaning was confirmed instead.

      Specified by:
      canRead in interface PrismItemAccessDefinition
    • canModify

      public boolean canModify()
      Description copied from interface: PrismItemAccessDefinition
      Returns true if this item can be modified (updated). In case of containers this means that the container itself should be displayed in modification forms E.g. that the container label or block should be displayed. This usually happens if the container contains at least one modifiable item. This does NOT mean that also all the container items can be modified. The sub-item permissions are controlled by similar properties on the items. This property only applies to the container itself: the "shell" of the container.
      Specified by:
      canModify in interface PrismItemAccessDefinition
    • canAdd

      public boolean canAdd()
      Description copied from interface: PrismItemAccessDefinition
      Returns true if this item can be added: it can be part of an object that is created. In case of containers this means that the container itself should be displayed in creation forms E.g. that the container label or block should be displayed. This usually happens if the container contains at least one createable item. This does NOT mean that also all the container items can be created. The sub-item permissions are controlled by similar properties on the items. This property only applies to the container itself: the "shell" of the container.
      Specified by:
      canAdd in interface PrismItemAccessDefinition
    • getAllowedValues

      @Nullable public @Nullable Collection<? extends DisplayableValue<T>> getAllowedValues()
      Description copied from interface: PrismItemValuesDefinition
      Returns allowed values for this property.
      Specified by:
      getAllowedValues in interface PrismItemValuesDefinition<T>
    • getSuggestedValues

      @Nullable public @Nullable Collection<? extends DisplayableValue<T>> getSuggestedValues()
      Description copied from interface: PrismItemValuesDefinition
      Returns suggested values for this property.
      Specified by:
      getSuggestedValues in interface PrismItemValuesDefinition<T>
    • defaultValue

      @Nullable public T defaultValue()
      Specified by:
      defaultValue in interface PrismItemValuesDefinition<T>
    • isIndexed

      public Boolean isIndexed()
      Description copied from interface: PrismItemStorageDefinition
      This is XSD annotation that specifies whether a property should be indexed in the storage. It can only apply to properties. It has following meaning: true: the property must be indexed. If the storage is not able to index the value, it should indicate an error. false: the property should not be indexed. null: data store decides whether to index the property or not.
      Specified by:
      isIndexed in interface PrismItemStorageDefinition
    • getMatchingRuleQName

      public QName getMatchingRuleQName()
      Description copied from interface: PrismItemMatchingDefinition
      Returns matching rule name. Matching rules are algorithms that specify how to compare, normalize and/or order the values. E.g. there are matching rules for case insensitive string comparison, for LDAP DNs, etc. TODO describe the semantics where special normalizations are to be used Use with care until this description is complete.
      Specified by:
      getMatchingRuleQName in interface PrismItemMatchingDefinition<T>
      Returns:
      matching rule name
    • getMatchingRule

      @NotNull public @NotNull MatchingRule<T> getMatchingRule()
      Description copied from interface: PrismItemMatchingDefinition
      Returns the resolved MatchingRule for this property.
      Specified by:
      getMatchingRule in interface PrismItemMatchingDefinition<T>
    • createEmptyDelta

      @NotNull public @NotNull PropertyDelta<T> createEmptyDelta(ItemPath path)
      Description copied from interface: ItemDefinition
      Creates an empty delta (with appropriate implementation class), pointing to this item definition, with a given path.
      Specified by:
      createEmptyDelta in interface ItemDefinition<T>
      Specified by:
      createEmptyDelta in interface PrismItemInstantiableDefinition<T,PrismPropertyValue<T>,PrismProperty<T>,PrismPropertyDefinition<T>,PropertyDelta<T>>
    • createEmptyDelta

      @NotNull public @NotNull PropertyDelta<T> createEmptyDelta()
    • getStandardPath

      @NotNull public @NotNull ItemPath getStandardPath()
    • adoptRealValuesAndInstantiate

      @NotNull public @NotNull PrismProperty<T> adoptRealValuesAndInstantiate(@NotNull @NotNull Collection<?> realValues) throws SchemaException
      TODO name
      Throws:
      SchemaException
    • instantiateFromUniqueRealValues

      @NotNull public @NotNull PrismProperty<T> instantiateFromUniqueRealValues(@NotNull @NotNull Collection<T> realValues)
    • instantiate

      @NotNull public @NotNull PrismProperty<T> instantiate()
      Description copied from interface: ItemDefinition
      Create an item instance. Definition name or default name will be used as an element name for the instance. The instance will otherwise be empty.
      Specified by:
      instantiate in interface ItemDefinition<T>
      Specified by:
      instantiate in interface PrismItemInstantiableDefinition<T,PrismPropertyValue<T>,PrismProperty<T>,PrismPropertyDefinition<T>,PropertyDelta<T>>
    • instantiate

      @NotNull public @NotNull PrismProperty<T> instantiate(QName name)
      Description copied from interface: ItemDefinition
      Create an item instance. Definition name will use provided name. for the instance. The instance will otherwise be empty.
      Specified by:
      instantiate in interface ItemDefinition<T>
      Specified by:
      instantiate in interface PrismItemInstantiableDefinition<T,PrismPropertyValue<T>,PrismProperty<T>,PrismPropertyDefinition<T>,PropertyDelta<T>>
    • mutator

      Description copied from interface: Definition
      Returns an interface to mutate this definition.
      Specified by:
      mutator in interface Definition
      Specified by:
      mutator in interface ItemDefinition<T>
      Specified by:
      mutator in interface PrismPropertyDefinition<T>
    • revive

      public void revive(PrismContext prismContext)
      Description copied from interface: Revivable
      TODO: Is revive necessary if prism context is static? TODO document (if it's found to be necessary)
      Specified by:
      revive in interface Revivable
    • accept

      public boolean accept(Visitor<Definition> visitor, SmartVisitation<Definition> visitation)
      Specified by:
      accept in interface SmartVisitable<T>
      Returns:
      false if we already was here
    • accept

      public void accept(Visitor<Definition> visitor)
      Specified by:
      accept in interface Visitable<T>
    • isSwitchedFromStringToPolyString

      public boolean isSwitchedFromStringToPolyString()
    • getStringNormalizerForPolyStringProperty

      @NotNull public @NotNull Normalizer<String> getStringNormalizerForPolyStringProperty()
      Description copied from interface: PrismItemMatchingDefinition
      Returns the normalizer that is to be applied for PolyString properties. Throws an exception if not applicable.
      Specified by:
      getStringNormalizerForPolyStringProperty in interface PrismItemMatchingDefinition<T>
    • isCustomPolyString

      public boolean isCustomPolyString()
      Description copied from interface: PrismItemMatchingDefinition
      TODO
      Specified by:
      isCustomPolyString in interface PrismItemMatchingDefinition<T>
    • adoptRealValues

      @NotNull public @NotNull List<T> adoptRealValues(@NotNull @NotNull Collection<?> realValues) throws SchemaException
      Description copied from interface: PrismPropertyDefinition
      TEMPORARY! Used only for normalization-aware resource attribute storage. FIXME as part of MID-2119.
      Specified by:
      adoptRealValues in interface PrismPropertyDefinition<T>
      Throws:
      SchemaException
    • wrap

      @VisibleForTesting public static PolyString wrap(String orig, String norm)
    • debugDump

      public String debugDump(int indent)
      Specified by:
      debugDump in interface DebugDumpable
    • clone

      @NotNull public @NotNull NormalizationAwareResourceAttributeDefinition<T> clone()
      Specified by:
      clone in interface Definition
      Specified by:
      clone in interface ItemDefinition<T>
      Specified by:
      clone in interface PrismPropertyDefinition<T>
      Overrides:
      clone in class Object
    • cloneWithNewName

      @NotNull public @NotNull ItemDefinition<PrismProperty<T>> cloneWithNewName(@NotNull @NotNull ItemName itemName)
      Description copied from interface: ItemDefinition
      Returns a clone of this definition, but with name changed to the provided one.
      Specified by:
      cloneWithNewName in interface ItemDefinition<T>
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object