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 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 void
checkForPartialClassification
(@NotNull ShadowType shadow) static PolyString
determineShadowName
(PrismObject<ShadowType> shadow) static PolyString
determineShadowName
(ShadowType shadow) static PolyStringType
static ResourceAttribute<?>
fixAttributePath
(ResourceAttribute<?> attribute) static Collection<ResourceAttribute<?>>
getAllIdentifiers
(PrismObject<? extends ShadowType> shadow) static Collection<ResourceAttribute<?>>
getAllIdentifiers
(ShadowType shadow) static <T> ResourceAttribute<T>
getAttribute
(PrismObject<? extends ShadowType> shadow, QName attrName) static <T> ResourceAttribute<T>
getAttribute
(ShadowType shadow, QName attrName) static ItemName
getAttributeName
(ItemPath attributePath, String message) static @NotNull Collection<ResourceAttribute<?>>
getAttributes
(PrismObject<? extends ShadowType> shadow) static @NotNull Collection<ResourceAttribute<?>>
getAttributes
(ShadowType shadowType) static ResourceAttributeContainer
getAttributesContainer
(PrismContainerValue<?> cval, QName containerName) static ResourceAttributeContainer
getAttributesContainer
(PrismObject<? extends ShadowType> shadow) static ResourceAttributeContainer
getAttributesContainer
(PrismObject<? extends ShadowType> shadow, QName containerName) static ResourceAttributeContainer
getAttributesContainer
(ShadowType shadowType) static @NotNull Collection<Item<?,
?>> getAttributesRaw
(PrismObject<? extends ShadowType> shadow) Here we assume that the definition may not be applied yet.static <T> T
getAttributeValue
(PrismObject<? extends ShadowType> shadow, QName attrName) static <T> T
getAttributeValue
(ShadowType shadowType, QName attrName) static <T> 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 String
getMultiStringAttributeValueAsSingle
(ShadowType shadow, QName attrName) static ResourceAttribute<String>
getNamingAttribute
(PrismObject<? extends ShadowType> shadow) static ResourceAttribute<String>
getNamingAttribute
(ShadowType shadow) getObjectClassDefinition
(ShadowType shadow) static @NotNull QName
getObjectClassRequired
(@NotNull ShadowType shadow) static ActivationType
getOrCreateActivation
(ShadowType shadowType) static ResourceAttributeContainer
getOrCreateAttributesContainer
(PrismObject<? extends ShadowType> shadow, ResourceObjectDefinition definition) static ResourceAttributeContainer
getOrCreateAttributesContainer
(ShadowType shadow, ResourceObjectDefinition definition) static @NotNull PasswordType
getOrCreateShadowPassword
(ShadowType shadow) static ProtectedStringType
getPasswordValue
(ShadowType shadowType) static Collection<ResourceAttribute<?>>
getPrimaryIdentifiers
(PrismObject<? extends ShadowType> shadow) static Collection<ResourceAttribute<?>>
getPrimaryIdentifiers
(ShadowType shadowType) getResourceModifications
(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) static PolyString
getResourceName
(PrismObject<ShadowType> shadow) static PolyString
getResourceName
(ShadowType shadowType) static @NotNull ResourceObjectIdentification
getResourceObjectIdentification
(PrismObject<ShadowType> shadow, ResourceObjectDefinition objectDefinition) static String
getResourceOid
(PrismObject<ShadowType> shadow) static String
getResourceOid
(ShadowType shadowType) static @NotNull String
getResourceOidRequired
(@NotNull ShadowType shadow) static ResourceAttribute<String>
getSecondaryIdentifier
(PrismObject<? extends ShadowType> shadow) static String
getSecondaryIdentifierRealValue
(PrismObject<? extends ShadowType> shadow) static Collection<ResourceAttribute<?>>
getSecondaryIdentifiers
(@Nullable Collection<? extends ResourceAttribute<?>> identifiers, @NotNull ResourceObjectDefinition objectClassDefinition) static Collection<ResourceAttribute<?>>
getSecondaryIdentifiers
(PrismObject<? extends ShadowType> shadow) static Collection<ResourceAttribute<?>>
getSecondaryIdentifiers
(ShadowType shadowType) static String
getSingleStringAttributeValue
(PrismObject<ShadowType> shadow, QName attrName) static String
getSingleStringAttributeValue
(ShadowType shadow, QName attrName) getTypeIdentification
(ShadowType shadow) static boolean
hasAttributeModifications
(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) static boolean
hasPrimaryIdentifier
(ShadowType shadow, ResourceObjectDefinition objectDefinition) static boolean
hasPrimaryIdentifier
(Collection<? extends ResourceAttribute<?>> identifiers, ResourceObjectDefinition objectDefinition) static boolean
hasResourceModifications
(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) static boolean
hasSecondaryIdentifier
(Collection<? extends ResourceAttribute<?>> identifiers, ResourceObjectClassDefinition objectClassDefinition) static boolean
isAccount
(ShadowType shadowType) static boolean
isAttributeModification
(QName firstPathName) static boolean
isAttributesContainerRaw
(ShadowType shadow) 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
isPartiallyClassified
(@NotNull ShadowType shadow) static boolean
isProtected
(@Nullable ShadowType shadow) static boolean
isProtected
(PrismObject<? extends ShadowType> shadow) 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 void
static @NotNull ShadowKindType
resolveDefault
(ShadowKindType kind) static @NotNull String
resolveDefault
(String intent) static List<ObjectReferenceType>
static void
setCorrelatorState
(@NotNull ShadowType shadow, @Nullable AbstractCorrelatorStateType state) static void
setPassword
(ShadowType shadow, ProtectedStringType passwordValue) static void
setPasswordIncomplete
(ShadowType shadow) static String
shortDumpShadow
(PrismObject<ShadowType> shadow) static String
shortDumpShadow
(ShadowType shadow) static Object
shortDumpShadowLazily
(PrismObject<ShadowType> shadow) static Object
shortDumpShadowLazily
(ShadowType shadow) static void
validateAttributeSchema
(ShadowType shadow, ResourceObjectDefinition objectDefinition) static boolean
wasSynchronizedAfterDeath
(ShadowType shadow)
-
Constructor Details
-
ShadowUtil
public ShadowUtil()
-
-
Method Details
-
getPrimaryIdentifiers
-
getPrimaryIdentifiers
public static Collection<ResourceAttribute<?>> getPrimaryIdentifiers(PrismObject<? extends ShadowType> shadow) -
getSecondaryIdentifiers
-
getSecondaryIdentifiers
public static Collection<ResourceAttribute<?>> getSecondaryIdentifiers(PrismObject<? extends ShadowType> shadow) -
getSecondaryIdentifier
public static ResourceAttribute<String> getSecondaryIdentifier(PrismObject<? extends ShadowType> shadow) throws SchemaException - Throws:
SchemaException
-
getSecondaryIdentifiers
public static Collection<ResourceAttribute<?>> getSecondaryIdentifiers(@Nullable @Nullable Collection<? extends ResourceAttribute<?>> identifiers, @NotNull @NotNull ResourceObjectDefinition objectClassDefinition) throws SchemaException - Throws:
SchemaException
-
getSecondaryIdentifierRealValue
public static String getSecondaryIdentifierRealValue(PrismObject<? extends ShadowType> shadow) throws SchemaException - Throws:
SchemaException
-
getAllIdentifiers
public static Collection<ResourceAttribute<?>> getAllIdentifiers(PrismObject<? extends ShadowType> shadow) -
getAllIdentifiers
-
getNamingAttribute
-
getNamingAttribute
public static ResourceAttribute<String> getNamingAttribute(PrismObject<? extends ShadowType> shadow) -
getAttributes
@NotNull public static @NotNull Collection<ResourceAttribute<?>> getAttributes(ShadowType shadowType) -
getAttributes
@NotNull public static @NotNull Collection<ResourceAttribute<?>> getAttributes(PrismObject<? extends ShadowType> shadow) -
getAttributesRaw
@NotNull public static @NotNull Collection<Item<?,?>> getAttributesRaw(PrismObject<? extends ShadowType> shadow) Here we assume that the definition may not be applied yet. -
getAttribute
-
getAttribute
public static <T> ResourceAttribute<T> getAttribute(PrismObject<? extends ShadowType> shadow, QName attrName) -
getAttributesContainer
-
getAttributesContainer
public static ResourceAttributeContainer getAttributesContainer(PrismObject<? extends ShadowType> shadow) -
getAttributesContainer
public static ResourceAttributeContainer getAttributesContainer(PrismObject<? extends ShadowType> shadow, QName containerName) -
isAttributesContainerRaw
-
getAttributesContainer
public static ResourceAttributeContainer getAttributesContainer(PrismContainerValue<?> cval, QName containerName) -
getOrCreateAttributesContainer
public static ResourceAttributeContainer getOrCreateAttributesContainer(ShadowType shadow, ResourceObjectDefinition definition) -
getOrCreateAttributesContainer
public static ResourceAttributeContainer getOrCreateAttributesContainer(PrismObject<? extends ShadowType> shadow, ResourceObjectDefinition definition) -
getObjectClassDefinition
-
getResourceOid
-
getResourceOidRequired
-
getResourceOid
-
getResourceName
-
getResourceName
-
getSingleStringAttributeValue
-
getSingleStringAttributeValue
-
getMultiStringAttributeValueAsSingle
-
getAttributeValues
-
getAttributeValues
public static <T> 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) -
isAccount
-
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
- Throws:
SchemaException
-
getResourceObjectIdentification
@NotNull public static @NotNull ResourceObjectIdentification getResourceObjectIdentification(PrismObject<ShadowType> shadow, ResourceObjectDefinition objectDefinition) -
matchesAttribute
-
hasPrimaryIdentifier
public static boolean hasPrimaryIdentifier(ShadowType shadow, ResourceObjectDefinition objectDefinition) -
hasPrimaryIdentifier
public static boolean hasPrimaryIdentifier(Collection<? extends ResourceAttribute<?>> identifiers, ResourceObjectDefinition objectDefinition) -
hasSecondaryIdentifier
public static boolean hasSecondaryIdentifier(Collection<? extends ResourceAttribute<?>> identifiers, ResourceObjectClassDefinition objectClassDefinition) -
fixAttributePath
public static ResourceAttribute<?> fixAttributePath(ResourceAttribute<?> attribute) 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) -
removeAllAttributesExceptPrimaryIdentifier
public static void removeAllAttributesExceptPrimaryIdentifier(ShadowType shadow, ResourceObjectDefinition objDef) -
selectLiveLinks
-
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
-
isPartiallyClassified
-
checkForPartialClassification
-
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)
-