Class ProjectionContextKey

java.lang.Object
com.evolveum.midpoint.model.api.context.ProjectionContextKey
All Implemented Interfaces:
DebugDumpable, HumanReadableDescribable, ShortDumpable, Serializable, Cloneable
Direct Known Subclasses:
ProjectionContextKey.WithResource

public abstract class ProjectionContextKey extends Object implements Serializable, DebugDumpable, ShortDumpable, HumanReadableDescribable, Cloneable
Uniquely identifies ModelProjectionContext. (Originally, `ResourceShadowDiscriminator` was used as a key. However, it was overloaded with other duties, so it was better to create a specialized class for this.) There are three flavors of these objects: 1. ProjectionContextKey.Classified: this is the most wanted state - we have resource and object type information; 2. ProjectionContextKey.Unclassified: knowing the resource, but not the type (kind/intent) - should be avoided if at all possible; 3. ProjectionContextKey.WithoutResource: almost no information; such a context is basically just a placeholder for broken links. == Construction === When you exactly know the flavor You can then use methods like: . classified(String, ResourceObjectTypeIdentification, String, int, boolean) . missing() === When uncertain about the flavor (classified/unclassified) Then there are "dispatching" creation methods like forKnownResource(String, ResourceObjectTypeIdentification, String, int, boolean) that create both classified and unclassified instances. === When using specific source Use custom methods like - fromBean(ShadowDiscriminatorType), - fromCoordinates(ResourceShadowCoordinates), - fromClassifiedShadow(ShadowType). === For potentially unclassified shadows Because keys for unclassified shadows are so dangerous, the best approach here is to use ProjectionContextKeyFactory.createKey(ShadowType, Task, OperationResult) method that tries regular or emergency classification before creating the key.
See Also:
  • Constructor Details

  • Method Details

    • classified

      public static ProjectionContextKey.Classified classified(@NotNull @NotNull String resourceOid, @NotNull @NotNull ResourceObjectTypeIdentification typeIdentification, @Nullable @Nullable String tag, int order, boolean gone)
    • classified

      public static ProjectionContextKey classified(@NotNull @NotNull String resourceOid, @NotNull @NotNull ShadowKindType kind, @NotNull @NotNull String intent, @Nullable @Nullable String tag)
      Kind and intent must not be "unknown".
    • classified

      public static ProjectionContextKey classified(@NotNull @NotNull String resourceOid, @NotNull @NotNull ShadowKindType kind, @NotNull @NotNull String intent, @Nullable @Nullable String tag, int order, boolean gone)
      Kind and intent must not be "unknown".
    • forKnownResource

      @VisibleForTesting public static ProjectionContextKey forKnownResource(@NotNull @NotNull String resourceOid, @Nullable @Nullable ResourceObjectTypeIdentification typeIdentification, @Nullable @Nullable String tag)
    • forKnownResource

      public static ProjectionContextKey forKnownResource(@NotNull @NotNull String resourceOid, @Nullable @Nullable ResourceObjectTypeIdentification typeIdentification, @Nullable @Nullable String tag, int order, boolean gone)
    • missing

      public static ProjectionContextKey missing()
    • fromCoordinates

      public static ProjectionContextKey fromCoordinates(@NotNull @NotNull ResourceShadowCoordinates coordinates)
    • fromBean

      public static ProjectionContextKey fromBean(ShadowDiscriminatorType bean)
    • fromClassifiedShadow

      public static ProjectionContextKey fromClassifiedShadow(@NotNull @NotNull ShadowType shadow)
    • fromShadow

      public static ProjectionContextKey fromShadow(@NotNull @NotNull ShadowType shadow, @Nullable @Nullable ResourceObjectTypeIdentification typeIdentification)
    • getResourceOid

      public String getResourceOid()
    • getTypeIdentification

      public ResourceObjectTypeIdentification getTypeIdentification()
    • getKind

      @Nullable public @Nullable ShadowKindType getKind()
    • getIntent

      @Nullable public @Nullable String getIntent()
    • getTag

      public String getTag()
    • getOrder

      public int getOrder()
    • isGone

      public boolean isGone()
      "Gone" flag is true: the account no longer exists. The data we have are the latest metadata we were able to get. The projection will be marked as gone if we discover that the associated resource object is gone. Or the shadow is gone and we can no longer associate the resource object. In any way the "gone" projection is marked for removal. It will be eventually unlinked and the shadow will be deleted. The shadow may stay around in the "dead" state for some time for reporting purposes. In the terms of shadow lifecycle state, this covers corpse and tombstone states.
    • toResourceShadowDiscriminatorType

      public ShadowDiscriminatorType toResourceShadowDiscriminatorType()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equivalent

      public boolean equivalent(ProjectionContextKey other)
      Similar to equals(Object) but ignores the order. TODO what about comparing irregular keys (no resource? no kind/intent?)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • shortDump

      public void shortDump(StringBuilder sb)
      Description copied from interface: ShortDumpable
      Show the content of the object intended for diagnostics. This method is supposed to append a compact, human-readable output in a single line. Unlike toString() method, there is no requirement to identify the actual class or type of the object. It is assumed that the class/type will be obvious from the context in which the output is used.
      Specified by:
      shortDump in interface ShortDumpable
      Parameters:
      sb - StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
    • toHumanReadableDescription

      public String toHumanReadableDescription()
      Specified by:
      toHumanReadableDescription in interface HumanReadableDescribable
    • toHumanReadableDescription

      public String toHumanReadableDescription(boolean writeOid)
    • debugDump

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

      public ProjectionContextKey clone()
      Overrides:
      clone in class Object
    • withResourceOid

      public ProjectionContextKey withResourceOid(@NotNull @NotNull String resourceOid)
    • checkOrUpdateResourceOid

      public ProjectionContextKey checkOrUpdateResourceOid(@NotNull @NotNull String newValue)
    • checkOrUpdateTypeIdentification

      public ProjectionContextKey checkOrUpdateTypeIdentification(@NotNull @NotNull ResourceObjectTypeIdentification newValue)
    • updateTagIfChanged

      public ProjectionContextKey updateTagIfChanged(String newValue)
      The usefulness of this method is not obvious; but - in fact - it is used e.g. in `TestMultiAccount.test350`, when tag is changed from `Ix` to `ix`, when treating conflicting accounts in `ProjectionValuesProcessor`. Maybe we should reconsider if/when the tag should be updated.
    • withOrder

      public ProjectionContextKey withOrder(int order)
    • gone

      public ProjectionContextKey gone()
    • isClassified

      public boolean isClassified()