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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Field Summary
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
Constructor Summary
ModifierConstructorDescriptionprotected
ProjectionContextKey
(String resourceOid, ResourceObjectTypeIdentification typeIdentification, String tag, int order, boolean gone) -
Method Summary
Modifier and TypeMethodDescriptioncheckOrUpdateResourceOid
(@NotNull String newValue) checkOrUpdateTypeIdentification
(@NotNull ResourceObjectTypeIdentification newValue) classified
(@NotNull String resourceOid, @NotNull ResourceObjectTypeIdentification typeIdentification, @Nullable String tag, int order, boolean gone) static ProjectionContextKey
classified
(@NotNull String resourceOid, @NotNull ShadowKindType kind, @NotNull String intent, @Nullable String tag) Kind and intent must not be "unknown".static ProjectionContextKey
classified
(@NotNull String resourceOid, @NotNull ShadowKindType kind, @NotNull String intent, @Nullable String tag, int order, boolean gone) Kind and intent must not be "unknown".clone()
debugDump
(int indent) boolean
boolean
equivalent
(ProjectionContextKey other) Similar toequals(Object)
but ignores the order.static ProjectionContextKey
forKnownResource
(@NotNull String resourceOid, @Nullable ResourceObjectTypeIdentification typeIdentification, @Nullable String tag) static ProjectionContextKey
forKnownResource
(@NotNull String resourceOid, @Nullable ResourceObjectTypeIdentification typeIdentification, @Nullable String tag, int order, boolean gone) static ProjectionContextKey
static ProjectionContextKey
fromClassifiedShadow
(@NotNull ShadowType shadow) static ProjectionContextKey
fromCoordinates
(@NotNull ResourceShadowCoordinates coordinates) static ProjectionContextKey
fromShadow
(@NotNull ShadowType shadow, @Nullable ResourceObjectTypeIdentification typeIdentification) @Nullable String
@Nullable ShadowKindType
getKind()
int
getOrder()
getTag()
gone()
int
hashCode()
boolean
boolean
isGone()
"Gone" flag is true: the account no longer exists.static ProjectionContextKey
missing()
void
Show the content of the object intended for diagnostics.toHumanReadableDescription
(boolean writeOid) toString()
updateTagIfChanged
(String newValue) The usefulness of this method is not obvious; but - in fact - it is used e.g.withOrder
(int order) withResourceOid
(@NotNull String resourceOid) Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
Methods inherited from interface com.evolveum.midpoint.util.ShortDumpable
shortDump, shortDumpLazily
-
Constructor Details
-
ProjectionContextKey
protected ProjectionContextKey(String resourceOid, ResourceObjectTypeIdentification typeIdentification, String tag, int order, boolean gone)
-
-
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
-
fromCoordinates
public static ProjectionContextKey fromCoordinates(@NotNull @NotNull ResourceShadowCoordinates coordinates) -
fromBean
-
fromClassifiedShadow
-
fromShadow
public static ProjectionContextKey fromShadow(@NotNull @NotNull ShadowType shadow, @Nullable @Nullable ResourceObjectTypeIdentification typeIdentification) -
getResourceOid
-
getTypeIdentification
-
getKind
-
getIntent
-
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
-
equals
-
hashCode
public int hashCode() -
equivalent
Similar toequals(Object)
but ignores the order. TODO what about comparing irregular keys (no resource? no kind/intent?) -
toString
-
shortDump
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 interfaceShortDumpable
- Parameters:
sb
- StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
-
toHumanReadableDescription
- Specified by:
toHumanReadableDescription
in interfaceHumanReadableDescribable
-
toHumanReadableDescription
-
debugDump
- Specified by:
debugDump
in interfaceDebugDumpable
-
clone
-
withResourceOid
-
checkOrUpdateResourceOid
-
checkOrUpdateTypeIdentification
public ProjectionContextKey checkOrUpdateTypeIdentification(@NotNull @NotNull ResourceObjectTypeIdentification newValue) -
updateTagIfChanged
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
-
gone
-
isClassified
public boolean isClassified()
-