Class ShadowUtil
java.lang.Object
com.evolveum.midpoint.schema.util.ShadowUtil
Methods that would belong to the
ShadowType
class but cannot go there because of JAXB.- Author:
- Radovan Semancik
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAssociation
(ShadowType shadow, ShadowReferenceAttribute association) static void
addAttribute
(ShadowType shadow, ShadowSimpleAttribute<?> attribute) static void
addPrimaryIdentifierValue
(ShadowType shadow, Object primaryIdentifierValue) Adds primary identifier value to the shadow.static void
addShadowAttribute
(ShadowType shadow, ShadowAttribute<?, ?> item) static PrismObjectDefinition<ShadowType>
applyObjectDefinition
(PrismObjectDefinition<ShadowType> shadowDefinition, ResourceObjectDefinition objectClassDefinition) static void
applyResourceSchema
(PrismObject<? extends ShadowType> shadow, ResourceSchema resourceSchema) This is not supposed to be used in production code! It is just for the tests.static void
checkConsistence
(PrismObject<? extends ShadowType> shadow, String desc) static void
checkConsistency
(PrismContainerDefinition<ShadowAttributesType> attributesDefinition, String desc) static PolyString
determineShadowName
(PrismObject<ShadowType> shadow) static PolyString
determineShadowName
(ShadowType shadow) static PolyStringType
static @NotNull Collection<? extends ShadowAssociationValue>
getAdoptedAssociationValues
(@NotNull PrismObject<ShadowType> shadow, QName assocName) TODO better name ...static @NotNull Collection<ShadowSimpleAttribute<?>>
getAllIdentifiers
(PrismObject<? extends ShadowType> shadow) static @NotNull Collection<ShadowSimpleAttribute<?>>
getAllIdentifiers
(ShadowType shadow) static ShadowReferenceAttribute
getAssociation
(PrismObject<ShadowType> shadow, QName associationName) static @NotNull Collection<ShadowReferenceAttribute>
getAssociations
(@NotNull PrismObject<ShadowType> shadow) static @NotNull Collection<ShadowReferenceAttribute>
getAssociations
(@NotNull ShadowType shadow) Similar togetAssociationsContainer(ShadowType)
but has the advantage of never returning `null`.static @NotNull ShadowAssociationsCollection
getAssociationsCollection
(@NotNull ShadowType shadowBean) static ShadowAssociationsContainer
getAssociationsContainer
(@NotNull PrismObject<ShadowType> shadow) Similar togetAttributesContainer(ShadowType)
.static ShadowAssociationsContainer
getAssociationsContainer
(@NotNull ShadowType shadow) Similar togetAttributesContainer(ShadowType)
.static ShadowAssociationsContainer
getAssociationsContainerRequired
(@NotNull ShadowType shadow) static @NotNull Collection<ShadowAssociationValueType>
getAssociationValues
(@NotNull PrismObject<ShadowType> shadow, QName assocName) Returns the values of given association.static <T> ShadowSimpleAttribute<T>
getAttribute
(PrismObject<? extends ShadowType> shadow, QName attrName) static <T> ShadowSimpleAttribute<T>
getAttribute
(ShadowType shadow, QName attrName) static ItemName
getAttributeName
(ItemPath attributePath, String message) static @NotNull Collection<ShadowSimpleAttribute<?>>
getAttributes
(PrismObject<? extends ShadowType> shadow) static @NotNull Collection<ShadowSimpleAttribute<?>>
getAttributes
(ShadowType shadowType) static ShadowAttributesContainer
getAttributesContainer
(PrismObject<? extends ShadowType> shadow) static ShadowAttributesContainer
getAttributesContainer
(ShadowType shadowType) static @NotNull ShadowAttributesContainer
static @NotNull ShadowAttributesContainer
static @NotNull Collection<Item<?,
?>> getAttributesRaw
(@NotNull ShadowType shadow) Here we assume that the definition may not be applied yet.static @NotNull Collection<? extends Item<?,
?>> getAttributesTolerant
(ShadowType shadowType) static <T> T
getAttributeValue
(PrismObject<? extends ShadowType> shadow, QName attrName) static <T> T
getAttributeValue
(ShadowType shadowType, QName attrName) static <T> @NotNull List<T>
getAttributeValues
(PrismObject<? extends ShadowType> shadow, QName attrName) static <T> List<T>
getAttributeValues
(ShadowType shadowType, QName attrName) static <T> Collection<T>
getAttributeValues
(ShadowType shadow, QName attributeQname, Class<T> type) static ShadowCorrelationStateType
getCorrelationStateRequired
(@NotNull ShadowType shadow) static <T extends AbstractCorrelatorStateType>
TgetCorrelatorStateRequired
(@NotNull ShadowType shadow, Class<T> clazz) static String
getHumanReadableName
(PrismObject<? extends ShadowType> shadow) static String
getHumanReadableName
(ShadowType shadowType) static Object
getHumanReadableNameLazily
(PrismObject<? extends ShadowType> shadow) static String
getIntent
(PrismObject<ShadowType> shadow) static String
getIntent
(ShadowType shadow) Returns intent from the shadow.static ShadowKindType
getKind
(PrismObject<ShadowType> shadow) static ShadowKindType
getKind
(ShadowType shadow) static @Nullable SynchronizationSituationDescriptionType
getLastSyncSituationDescription
(@NotNull ShadowType shadow) static ShadowSimpleAttribute<String>
getNamingAttribute
(PrismObject<? extends ShadowType> shadow) static ShadowSimpleAttribute<String>
getNamingAttribute
(ShadowType shadow) static @NotNull ResourceObjectClassDefinition
getObjectClassDefinition
(@NotNull ShadowType shadow) static @NotNull QName
getObjectClassRequired
(@NotNull ShadowType shadow) static ActivationType
getOrCreateActivation
(ShadowType shadowType) static ShadowAssociationsContainer
Assuming the shadow has the correct definition.static ShadowAttributesContainer
getOrCreateAttributesContainer
(PrismObject<? extends ShadowType> shadow, ResourceObjectDefinition definition) static @NotNull ShadowAttributesContainer
static @NotNull ShadowAttributesContainer
Assuming the shadow has the correct definition.static ShadowAttributesContainer
getOrCreateAttributesContainer
(ShadowType shadow, ResourceObjectDefinition definition) static @NotNull PasswordType
getOrCreateShadowPassword
(ShadowType shadow) static ProtectedStringType
getPasswordValue
(ShadowType shadowType) static ResourceObjectIdentifier.Primary<?>
getPrimaryIdentifier
(@NotNull ShadowType shadow) The shadow must have definitions applied.static Collection<ShadowSimpleAttribute<?>>
getPrimaryIdentifiers
(PrismObject<? extends ShadowType> shadow) static Collection<ShadowSimpleAttribute<?>>
getPrimaryIdentifiers
(ShadowType shadowType) static @Nullable Object
getPrimaryIdentifierValue
(@NotNull ShadowType shadow, @NotNull ResourceObjectDefinition objectDefinition) getResourceModifications
(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) static PolyString
getResourceName
(PrismObject<ShadowType> shadow) static PolyString
getResourceName
(ShadowType shadowType) static @NotNull ResourceObjectDefinition
getResourceObjectDefinition
(@NotNull ShadowType shadow) The shadow must have the attributes container and a definition.static String
getResourceOid
(PrismObject<ShadowType> shadow) static String
getResourceOid
(ShadowType shadowType) static @NotNull String
getResourceOidRequired
(@NotNull ShadowType shadow) static Collection<ShadowSimpleAttribute<?>>
getSecondaryIdentifiers
(PrismObject<? extends ShadowType> shadow) static Collection<ShadowSimpleAttribute<?>>
getSecondaryIdentifiers
(ShadowType shadowType) static String
getSingleStringAttributeValue
(ShadowType shadow, QName attrName) static <T> @Nullable PrismPropertyValue<T>
getSingleValue
(ShadowType shadow, QName attrName, Object errorCtx) static <T> @NotNull PrismPropertyValue<T>
getSingleValueRequired
(ShadowType shadow, QName attrName, Object errorCtx) getTypeIdentification
(ShadowType shadow) static boolean
hasAttributeModifications
(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) static boolean
hasResourceModifications
(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) static boolean
isAttributeModification
(QName firstPathName) static boolean
isClassified
(ShadowKindType kind, String intent) static boolean
isClassified
(ShadowType shadow) static boolean
isConflicting
(ShadowType shadow1, ShadowType shadow2) static boolean
isDead
(@NotNull PrismObject<ShadowType> shadow) static boolean
isDead
(ObjectReferenceType projectionRef) static boolean
isDead
(ShadowType shadow) static boolean
isExists
(PrismObject<ShadowType> shadow) static boolean
isExists
(ShadowType shadow) static boolean
isFullShadow
(ShadowType shadow) static boolean
isGone
(@NotNull ShadowType shadow) Returns true if the shadow state indicates that it is 'gone', i.e.static boolean
isGoneApproximate
(@NotNull ShadowType shadow) AsisGone(ShadowType)
but with possibly incomplete information.static boolean
isKnown
(ShadowKindType kind) static boolean
static boolean
isNonAttributeResourceModification
(QName firstPathName) static boolean
isNotDead
(PrismObject<ShadowType> shadow) static boolean
isNotDead
(ObjectReferenceType projectionRef) static boolean
isNotDead
(ShadowType shadow) static boolean
isNotKnown
(ShadowKindType kind) static boolean
isNotKnown
(String intent) static boolean
isProtected
(@Nullable ShadowType shadow) static boolean
isProtected
(PrismObject<? extends ShadowType> shadow) static boolean
isRaw
(@NotNull ShadowType shadowBean) static boolean
isResourceModification
(ItemDelta<?, ?> modification) static boolean
matches
(@NotNull ShadowType shadow, @NotNull ShadowDiscriminatorType discriminator) static boolean
matches
(@NotNull ShadowType shadow, @Nullable String resourceOid, @Nullable ShadowKindType kind, @Nullable String intent) Null values mean "any" here.static boolean
matchesAttribute
(ItemPath path, QName attributeName) static boolean
matchesPattern
(ShadowType shadowType, ShadowDiscriminatorType discr) InterpretsShadowDiscriminatorType
as a pattern.static @NotNull ShadowKindType
resolveDefault
(ShadowKindType kind) static @NotNull String
resolveDefault
(String intent) static void
setCorrelatorState
(@NotNull ShadowType shadow, @Nullable AbstractCorrelatorStateType state) static void
setPassword
(ShadowType shadow, ProtectedStringType passwordValue) static void
setPasswordIncomplete
(ShadowType shadow) static @NotNull ShadowAttributesContainer
setupAttributesContainer
(@NotNull ShadowType shadowBean, @NotNull ResourceObjectDefinition objectDefinition) Creates the resource attributes container with a proper definition.static String
shortDumpShadow
(PrismObject<ShadowType> shadow) static String
shortDumpShadow
(ShadowType shadow) static Object
shortDumpShadowLazily
(PrismObject<ShadowType> shadow) static Object
shortDumpShadowLazily
(ShadowType shadow) static List<PendingOperationType>
sortPendingOperations
(List<PendingOperationType> pendingOperations) static void
validateAttributeSchema
(ShadowType shadow, ResourceObjectDefinition objectDefinition) static boolean
wasSynchronizedAfterDeath
(ShadowType shadow)
-
Constructor Details
-
ShadowUtil
public ShadowUtil()
-
-
Method Details
-
getPrimaryIdentifiers
-
getPrimaryIdentifiers
public static Collection<ShadowSimpleAttribute<?>> getPrimaryIdentifiers(PrismObject<? extends ShadowType> shadow) -
getSecondaryIdentifiers
-
getSecondaryIdentifiers
public static Collection<ShadowSimpleAttribute<?>> getSecondaryIdentifiers(PrismObject<? extends ShadowType> shadow) -
getAllIdentifiers
@NotNull public static @NotNull Collection<ShadowSimpleAttribute<?>> getAllIdentifiers(PrismObject<? extends ShadowType> shadow) -
getAllIdentifiers
@NotNull public static @NotNull Collection<ShadowSimpleAttribute<?>> getAllIdentifiers(ShadowType shadow) -
getNamingAttribute
-
getNamingAttribute
public static ShadowSimpleAttribute<String> getNamingAttribute(PrismObject<? extends ShadowType> shadow) -
getAttributes
@NotNull public static @NotNull Collection<ShadowSimpleAttribute<?>> getAttributes(ShadowType shadowType) -
getAttributesTolerant
@NotNull public static @NotNull Collection<? extends Item<?,?>> getAttributesTolerant(ShadowType shadowType) -
getAttributes
@NotNull public static @NotNull Collection<ShadowSimpleAttribute<?>> getAttributes(PrismObject<? extends ShadowType> shadow) -
getAttributesRaw
@NotNull public static @NotNull Collection<Item<?,?>> getAttributesRaw(@NotNull @NotNull ShadowType shadow) Here we assume that the definition may not be applied yet. -
getAttribute
-
getAttribute
public static <T> ShadowSimpleAttribute<T> getAttribute(PrismObject<? extends ShadowType> shadow, QName attrName) -
getAttributesContainer
-
getAttributesContainerRequired
@NotNull public static @NotNull ShadowAttributesContainer getAttributesContainerRequired(ShadowType shadow) -
getAttributesContainerRequired
@NotNull public static @NotNull ShadowAttributesContainer getAttributesContainerRequired(PrismObject<ShadowType> shadow) -
getAttributesContainer
public static ShadowAttributesContainer getAttributesContainer(PrismObject<? extends ShadowType> shadow) -
getAssociationsContainer
public static ShadowAssociationsContainer getAssociationsContainer(@NotNull @NotNull ShadowType shadow) Similar togetAttributesContainer(ShadowType)
. -
getAssociationsContainerRequired
public static ShadowAssociationsContainer getAssociationsContainerRequired(@NotNull @NotNull ShadowType shadow) -
getOrCreateAssociationsContainer
Assuming the shadow has the correct definition. -
getAssociationsContainer
public static ShadowAssociationsContainer getAssociationsContainer(@NotNull @NotNull PrismObject<ShadowType> shadow) Similar togetAttributesContainer(ShadowType)
. -
getOrCreateAttributesContainer
@NotNull public static @NotNull ShadowAttributesContainer getOrCreateAttributesContainer(ShadowType shadow) Assuming the shadow has the correct definition. -
getOrCreateAttributesContainer
@NotNull public static @NotNull ShadowAttributesContainer getOrCreateAttributesContainer(PrismObject<ShadowType> shadow) -
getOrCreateAttributesContainer
public static ShadowAttributesContainer getOrCreateAttributesContainer(ShadowType shadow, ResourceObjectDefinition definition) -
getOrCreateAttributesContainer
public static ShadowAttributesContainer getOrCreateAttributesContainer(PrismObject<? extends ShadowType> shadow, ResourceObjectDefinition definition) -
getObjectClassDefinition
@NotNull public static @NotNull ResourceObjectClassDefinition getObjectClassDefinition(@NotNull @NotNull ShadowType shadow) -
getResourceObjectDefinition
@NotNull public static @NotNull ResourceObjectDefinition getResourceObjectDefinition(@NotNull @NotNull ShadowType shadow) The shadow must have the attributes container and a definition. -
getResourceOid
-
getResourceOidRequired
-
getResourceOid
-
getResourceName
-
getResourceName
-
getSingleStringAttributeValue
-
getSingleValueRequired
@NotNull public static <T> @NotNull PrismPropertyValue<T> getSingleValueRequired(ShadowType shadow, QName attrName, Object errorCtx) throws SchemaException - Throws:
SchemaException
-
getSingleValue
@Nullable public static <T> @Nullable PrismPropertyValue<T> getSingleValue(ShadowType shadow, QName attrName, Object errorCtx) throws SchemaException - Throws:
SchemaException
-
getAttributeValues
-
getAttributeValues
@NotNull public static <T> @NotNull List<T> getAttributeValues(PrismObject<? extends ShadowType> shadow, QName attrName) -
getAttributeValue
- Throws:
SchemaException
-
getAttributeValue
public static <T> T getAttributeValue(PrismObject<? extends ShadowType> shadow, QName attrName) throws SchemaException - Throws:
SchemaException
-
setPassword
-
setPasswordIncomplete
- Throws:
SchemaException
-
getOrCreateShadowPassword
-
getOrCreateActivation
-
applyResourceSchema
@VisibleForTesting public static void applyResourceSchema(PrismObject<? extends ShadowType> shadow, ResourceSchema resourceSchema) throws SchemaException This is not supposed to be used in production code! It is just for the tests.- Throws:
SchemaException
-
applyObjectDefinition
public static PrismObjectDefinition<ShadowType> applyObjectDefinition(PrismObjectDefinition<ShadowType> shadowDefinition, ResourceObjectDefinition objectClassDefinition) throws SchemaException - Throws:
SchemaException
-
getIntent
-
getIntent
Returns intent from the shadow. Backwards compatible with older accountType. May also adjust for default intent if necessary. -
getKind
-
getKind
-
getAttributeValues
public static <T> Collection<T> getAttributeValues(ShadowType shadow, QName attributeQname, Class<T> type) -
getAttributeName
public static ItemName getAttributeName(ItemPath attributePath, String message) throws SchemaException - Throws:
SchemaException
-
checkConsistence
-
checkConsistency
public static void checkConsistency(PrismContainerDefinition<ShadowAttributesType> attributesDefinition, String desc) -
isProtected
-
isProtected
-
isDead
-
isDead
-
isNotDead
-
isNotDead
-
isDead
-
isNotDead
-
wasSynchronizedAfterDeath
-
isExists
-
isExists
-
matches
public static boolean matches(@NotNull @NotNull ShadowType shadow, @Nullable @Nullable String resourceOid, @Nullable @Nullable ShadowKindType kind, @Nullable @Nullable String intent) Null values mean "any" here. -
matches
public static boolean matches(@NotNull @NotNull ShadowType shadow, @NotNull @NotNull ShadowDiscriminatorType discriminator) -
matchesPattern
InterpretsShadowDiscriminatorType
as a pattern. E.g. null discriminator kind is interpreted to match any shadow kind. -
isConflicting
-
getHumanReadableNameLazily
-
getHumanReadableName
-
getHumanReadableName
-
isFullShadow
-
determineShadowName
- Throws:
SchemaException
-
determineShadowName
- Throws:
SchemaException
-
determineShadowNameRequired
public static PolyStringType determineShadowNameRequired(AbstractShadow shadow) throws SchemaException - Throws:
SchemaException
-
matchesAttribute
-
getPrimaryIdentifier
@Nullable public static ResourceObjectIdentifier.Primary<?> getPrimaryIdentifier(@NotNull @NotNull ShadowType shadow) throws SchemaException The shadow must have definitions applied.- Throws:
SchemaException
-
getPrimaryIdentifierValue
@Nullable public static @Nullable Object getPrimaryIdentifierValue(@NotNull @NotNull ShadowType shadow, @NotNull @NotNull ResourceObjectDefinition objectDefinition) throws SchemaException - Throws:
SchemaException
-
validateAttributeSchema
public static void validateAttributeSchema(ShadowType shadow, ResourceObjectDefinition objectDefinition) throws SchemaException - Throws:
SchemaException
-
getPasswordValue
-
shortDumpShadowLazily
-
shortDumpShadowLazily
-
shortDumpShadow
-
shortDumpShadow
-
isKnown
-
isNotKnown
-
isKnown
-
isNotKnown
-
isClassified
-
isClassified
-
getTypeIdentification
@Contract("null -> null") public static ResourceObjectTypeIdentification getTypeIdentification(ShadowType shadow) -
isGone
Returns true if the shadow state indicates that it is 'gone', i.e. no longer on the resource. This could be determined from the `dead` property or from the `shadowLifecycleState`. The latter is more precise for shadows that have been fetched with the future point-in-time. PRECONDITION: shadow lifecycle state must be set up. -
isGoneApproximate
AsisGone(ShadowType)
but with possibly incomplete information. -
getCorrelationStateRequired
public static ShadowCorrelationStateType getCorrelationStateRequired(@NotNull @NotNull ShadowType shadow) -
getCorrelatorStateRequired
public static <T extends AbstractCorrelatorStateType> T getCorrelatorStateRequired(@NotNull @NotNull ShadowType shadow, Class<T> clazz) throws SchemaException - Throws:
SchemaException
-
setCorrelatorState
public static void setCorrelatorState(@NotNull @NotNull ShadowType shadow, @Nullable @Nullable AbstractCorrelatorStateType state) -
getObjectClassRequired
@NotNull public static @NotNull QName getObjectClassRequired(@NotNull @NotNull ShadowType shadow) throws SchemaException - Throws:
SchemaException
-
resolveDefault
-
resolveDefault
-
hasResourceModifications
public static boolean hasResourceModifications(@NotNull @NotNull Collection<? extends ItemDelta<?, ?>> modifications) -
hasAttributeModifications
public static boolean hasAttributeModifications(@NotNull @NotNull Collection<? extends ItemDelta<?, ?>> modifications) -
getResourceModifications
@NotNull public static @NotNull List<ItemDelta<?,?>> getResourceModifications(@NotNull @NotNull Collection<? extends ItemDelta<?, ?>> modifications) -
isResourceModification
-
isAttributeModification
-
isNonAttributeResourceModification
-
getLastSyncSituationDescription
@Nullable public static @Nullable SynchronizationSituationDescriptionType getLastSyncSituationDescription(@NotNull @NotNull ShadowType shadow) -
sortPendingOperations
public static List<PendingOperationType> sortPendingOperations(List<PendingOperationType> pendingOperations) -
setupAttributesContainer
@VisibleForTesting @NotNull public static @NotNull ShadowAttributesContainer setupAttributesContainer(@NotNull @NotNull ShadowType shadowBean, @NotNull @NotNull ResourceObjectDefinition objectDefinition) throws SchemaException Creates the resource attributes container with a proper definition.- Throws:
SchemaException
-
getAssociationValues
@NotNull public static @NotNull Collection<ShadowAssociationValueType> getAssociationValues(@NotNull @NotNull PrismObject<ShadowType> shadow, QName assocName) Returns the values of given association. The values are connected to the shadow. The list itself is not. Does not assume that shadow has a definition. -
getAdoptedAssociationValues
@NotNull public static @NotNull Collection<? extends ShadowAssociationValue> getAdoptedAssociationValues(@NotNull @NotNull PrismObject<ShadowType> shadow, QName assocName) TODO better name ... the idea is that the shadow has the correct definition, but currently we cannot use AbstractShadow, because there are some differences in definitions ... to be researched. It seems that the wrong definition came from primary delta fed to the model. Unlike in provisioning, we don't apply definitions to such deltas thoroughly. TEMPORARY -
getAssociations
@NotNull public static @NotNull Collection<ShadowReferenceAttribute> getAssociations(@NotNull @NotNull ShadowType shadow) Similar togetAssociationsContainer(ShadowType)
but has the advantage of never returning `null`. The collection itself is immutable. The values, however, are connected to ones in the shadow, so can be changed if needed. -
getAssociations
@NotNull public static @NotNull Collection<ShadowReferenceAttribute> getAssociations(@NotNull @NotNull PrismObject<ShadowType> shadow) -
addPrimaryIdentifierValue
public static void addPrimaryIdentifierValue(ShadowType shadow, Object primaryIdentifierValue) throws SchemaException Adds primary identifier value to the shadow. Assumes there's no primary identifier yet.- Throws:
SchemaException
-
getAssociation
public static ShadowReferenceAttribute getAssociation(PrismObject<ShadowType> shadow, QName associationName) -
addAttribute
public static void addAttribute(ShadowType shadow, ShadowSimpleAttribute<?> attribute) throws SchemaException - Throws:
SchemaException
-
addAssociation
public static void addAssociation(ShadowType shadow, ShadowReferenceAttribute association) throws SchemaException - Throws:
SchemaException
-
addShadowAttribute
public static void addShadowAttribute(ShadowType shadow, ShadowAttribute<?, ?> item) throws SchemaException- Throws:
SchemaException
-
getAssociationsCollection
@NotNull public static @NotNull ShadowAssociationsCollection getAssociationsCollection(@NotNull @NotNull ShadowType shadowBean) -
isRaw
-