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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PrismObjectDefinition<ShadowType>applyObjectDefinition(PrismObjectDefinition<ShadowType> shadowDefinition, ResourceObjectDefinition objectClassDefinition) static voidapplyResourceSchema(PrismObject<? extends ShadowType> shadow, ResourceSchema resourceSchema) This is not supposed to be used in production code! It is just for the tests.static voidcheckConsistence(PrismObject<? extends ShadowType> shadow, String desc) static voidcheckConsistency(PrismContainerDefinition<ShadowAttributesType> attributesDefinition, String desc) static voidcheckForPartialClassification(@NotNull ShadowType shadow) static PolyStringdetermineShadowName(PrismObject<ShadowType> shadow) static PolyStringdetermineShadowName(ShadowType shadow) static PolyStringTypestatic 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 ItemNamegetAttributeName(ItemPath attributePath, String message) static @NotNull Collection<ResourceAttribute<?>>getAttributes(PrismObject<? extends ShadowType> shadow) static @NotNull Collection<ResourceAttribute<?>>getAttributes(ShadowType shadowType) static ResourceAttributeContainergetAttributesContainer(PrismContainerValue<?> cval, QName containerName) static ResourceAttributeContainergetAttributesContainer(PrismObject<? extends ShadowType> shadow) static ResourceAttributeContainergetAttributesContainer(PrismObject<? extends ShadowType> shadow, QName containerName) static ResourceAttributeContainergetAttributesContainer(ShadowType shadowType) static @NotNull Collection<Item<?,?>> getAttributesRaw(PrismObject<? extends ShadowType> shadow) Here we assume that the definition may not be applied yet.static <T> TgetAttributeValue(PrismObject<? extends ShadowType> shadow, QName attrName) static <T> TgetAttributeValue(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 ShadowCorrelationStateTypegetCorrelationStateRequired(@NotNull ShadowType shadow) static <T extends AbstractCorrelatorStateType>
TgetCorrelatorStateRequired(@NotNull ShadowType shadow, Class<T> clazz) static StringgetHumanReadableName(PrismObject<? extends ShadowType> shadow) static StringgetHumanReadableName(ShadowType shadowType) static ObjectgetHumanReadableNameLazily(PrismObject<? extends ShadowType> shadow) static StringgetIntent(PrismObject<ShadowType> shadow) static StringgetIntent(ShadowType shadow) Returns intent from the shadow.static ShadowKindTypegetKind(PrismObject<ShadowType> shadow) static ShadowKindTypegetKind(ShadowType shadow) static @Nullable SynchronizationSituationDescriptionTypegetLastSyncSituationDescription(@NotNull ShadowType shadow) static StringgetMultiStringAttributeValueAsSingle(ShadowType shadow, QName attrName) static ResourceAttribute<String>getNamingAttribute(PrismObject<? extends ShadowType> shadow) static ResourceAttribute<String>getNamingAttribute(ShadowType shadow) getObjectClassDefinition(ShadowType shadow) static @NotNull QNamegetObjectClassRequired(@NotNull ShadowType shadow) static ActivationTypegetOrCreateActivation(ShadowType shadowType) static ResourceAttributeContainergetOrCreateAttributesContainer(PrismObject<? extends ShadowType> shadow, ResourceObjectDefinition definition) static ResourceAttributeContainergetOrCreateAttributesContainer(ShadowType shadow, ResourceObjectDefinition definition) static @NotNull PasswordTypegetOrCreateShadowPassword(ShadowType shadow) static ProtectedStringTypegetPasswordValue(ShadowType shadowType) static Collection<ResourceAttribute<?>>getPrimaryIdentifiers(PrismObject<? extends ShadowType> shadow) static Collection<ResourceAttribute<?>>getPrimaryIdentifiers(ShadowType shadowType) getResourceModifications(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) static PolyStringgetResourceName(PrismObject<ShadowType> shadow) static PolyStringgetResourceName(ShadowType shadowType) static @NotNull ResourceObjectIdentificationgetResourceObjectIdentification(PrismObject<ShadowType> shadow, ResourceObjectDefinition objectDefinition) static StringgetResourceOid(PrismObject<ShadowType> shadow) static StringgetResourceOid(ShadowType shadowType) static @NotNull StringgetResourceOidRequired(@NotNull ShadowType shadow) static ResourceAttribute<String>getSecondaryIdentifier(PrismObject<? extends ShadowType> shadow) static StringgetSecondaryIdentifierRealValue(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 StringgetSingleStringAttributeValue(PrismObject<ShadowType> shadow, QName attrName) static StringgetSingleStringAttributeValue(ShadowType shadow, QName attrName) getTypeIdentification(ShadowType shadow) static booleanhasAttributeModifications(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) static booleanhasPrimaryIdentifier(ShadowType shadow, ResourceObjectDefinition objectDefinition) static booleanhasPrimaryIdentifier(Collection<? extends ResourceAttribute<?>> identifiers, ResourceObjectDefinition objectDefinition) static booleanhasResourceModifications(@NotNull Collection<? extends ItemDelta<?, ?>> modifications) static booleanhasSecondaryIdentifier(Collection<? extends ResourceAttribute<?>> identifiers, ResourceObjectClassDefinition objectClassDefinition) static booleanisAccount(ShadowType shadowType) static booleanisAttributeModification(QName firstPathName) static booleanisAttributesContainerRaw(ShadowType shadow) static booleanisClassified(ShadowKindType kind, String intent) static booleanisClassified(ShadowType shadow) static booleanisConflicting(ShadowType shadow1, ShadowType shadow2) static booleanisDead(@NotNull PrismObject<ShadowType> shadow) static booleanisDead(ObjectReferenceType projectionRef) static booleanisDead(ShadowType shadow) static booleanisExists(PrismObject<ShadowType> shadow) static booleanisExists(ShadowType shadow) static booleanisFullShadow(ShadowType shadow) static booleanisGone(@NotNull ShadowType shadow) Returns true if the shadow state indicates that it is 'gone', i.e.static booleanisGoneApproximate(@NotNull ShadowType shadow) AsisGone(ShadowType)but with possibly incomplete information.static booleanisKnown(ShadowKindType kind) static booleanstatic booleanisNonAttributeResourceModification(QName firstPathName) static booleanisNotDead(PrismObject<ShadowType> shadow) static booleanisNotDead(ObjectReferenceType projectionRef) static booleanisNotDead(ShadowType shadow) static booleanisNotKnown(ShadowKindType kind) static booleanisNotKnown(String intent) static booleanisPartiallyClassified(@NotNull ShadowType shadow) static booleanisProtected(@Nullable ShadowType shadow) static booleanisProtected(PrismObject<? extends ShadowType> shadow) static booleanisResourceModification(ItemDelta<?, ?> modification) static booleanmatches(@NotNull ShadowType shadow, @NotNull ShadowDiscriminatorType discriminator) static booleanmatches(@NotNull ShadowType shadow, @Nullable String resourceOid, @Nullable ShadowKindType kind, @Nullable String intent) Null values mean "any" here.static booleanmatchesAttribute(ItemPath path, QName attributeName) static booleanmatchesPattern(ShadowType shadowType, ShadowDiscriminatorType discr) InterpretsShadowDiscriminatorTypeas a pattern.static voidstatic @NotNull ShadowKindTyperesolveDefault(ShadowKindType kind) static @NotNull StringresolveDefault(String intent) static List<ObjectReferenceType>static voidsetCorrelatorState(@NotNull ShadowType shadow, @Nullable AbstractCorrelatorStateType state) static voidsetPassword(ShadowType shadow, ProtectedStringType passwordValue) static voidsetPasswordIncomplete(ShadowType shadow) static StringshortDumpShadow(PrismObject<ShadowType> shadow) static StringshortDumpShadow(ShadowType shadow) static ObjectshortDumpShadowLazily(PrismObject<ShadowType> shadow) static ObjectshortDumpShadowLazily(ShadowType shadow) static voidvalidateAttributeSchema(ShadowType shadow, ResourceObjectDefinition objectDefinition) static booleanwasSynchronizedAfterDeath(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
InterpretsShadowDiscriminatorTypeas 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)
-