Class SmartMetadataUtil
java.lang.Object
com.evolveum.midpoint.schema.util.SmartMetadataUtil
Utility class for provenance- and validation-related metadata.
Supports: - AI-provided data provenance - System-provided data provenance - Validation error metadata
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumShared provenance selector. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsMatchingOriginRefMetadata(@NotNull ProvenanceMetadataType candidate, @NotNull ProvenanceMetadataType expected) Compares two provenance metadata instances by their originRef OIDs.static @Nullable StringgetFilterInvalidMessage(@Nullable PrismValue value) Returns a user-friendly message if the filter is marked as invalid.static booleanisMarkedAsAiProvided(@Nullable PrismValue value) static booleanisMarkedAsInvalid(@Nullable PrismValue value) Returnstrueif the value has validation metadata at the root level.static booleanisMarkedAsSystemProvided(@Nullable PrismValue value) static booleanisMarkedProvenanceProvided(@NotNull SmartMetadataUtil.ProvenanceKind kind, PrismValue value) static voidmarkAsAiProvided(@Nullable PrismValue value) Marks all leaf values (i.e. property and reference values) as provided by AI.static <C extends Containerable>
CmarkAsAiProvided(C containerable) Convenience variant ofmarkAsAiProvided(PrismValue).static <C extends Containerable>
CmarkAsAiProvided(C containerable, ItemPath... paths) Convenience variant ofmarkAsAiProvided(PrismValue).static voidmarkAsInvalid(@Nullable PrismValue value, @Nullable String validationError) Marks leaf values as invalid with an optional validationError.static <C extends Containerable>
CmarkAsInvalid(C containerable, @Nullable String error, ItemPath @NotNull ... paths) static voidmarkAsSystemProvided(@Nullable PrismValue value) static <C extends Containerable>
CmarkAsSystemProvided(C containerable) static <C extends Containerable>
CmarkAsSystemProvided(C containerable, ItemPath... paths) static voidmarkContainerProvenance(@Nullable PrismValue value, @NotNull SmartMetadataUtil.ProvenanceKind kind) static voidmarkContainerValueAsAiProvided(@Nullable PrismContainerValue<?> value) resolveProvenanceKind(@Nullable PrismValue value) static voidsyncAiProvenanceWithChangeIfApplied(@NotNull PrismValue newValue, @NotNull PrismValue oldValue) static voidsyncSystemProvenanceWithChangeIfApplied(@NotNull PrismValue newValue, @NotNull PrismValue oldValue) static voidunmarkAsAiProvided(@Nullable PrismValue value) static voidunmarkAsInvalid(@Nullable PrismValue value) static <C extends Containerable>
CunmarkAsInvalid(C containerable, ItemPath @NotNull ... paths) static voidunmarkAsSystemProvided(@Nullable PrismValue value)
-
Constructor Details
-
SmartMetadataUtil
public SmartMetadataUtil()
-
-
Method Details
-
isMarkedProvenanceProvided
public static boolean isMarkedProvenanceProvided(@NotNull @NotNull SmartMetadataUtil.ProvenanceKind kind, PrismValue value) -
markContainerProvenance
public static void markContainerProvenance(@Nullable @Nullable PrismValue value, @NotNull @NotNull SmartMetadataUtil.ProvenanceKind kind) -
markAsAiProvided
Convenience variant ofmarkAsAiProvided(PrismValue). Marks the leaf nodes in the whole value. -
markAsAiProvided
public static <C extends Containerable> C markAsAiProvided(@NotNull C containerable, ItemPath... paths) Convenience variant ofmarkAsAiProvided(PrismValue). Marks the leaf nodes in items in the value (if present). -
markAsAiProvided
Marks all leaf values (i.e. property and reference values) as provided by AI. Uses value metadata to indicate that. Does nothing if the value isnull.The values themselves must be mutable!
TODO The question is whether we should also mark the container values as AI-provided.
-
isMarkedAsAiProvided
-
resolveProvenanceKind
public static SmartMetadataUtil.ProvenanceKind resolveProvenanceKind(@Nullable @Nullable PrismValue value) -
unmarkAsAiProvided
-
markContainerValueAsAiProvided
-
syncAiProvenanceWithChangeIfApplied
public static void syncAiProvenanceWithChangeIfApplied(@NotNull @NotNull PrismValue newValue, @NotNull @NotNull PrismValue oldValue) -
markAsSystemProvided
-
markAsSystemProvided
public static <C extends Containerable> C markAsSystemProvided(@NotNull C containerable, ItemPath... paths) -
markAsSystemProvided
-
isMarkedAsSystemProvided
-
unmarkAsSystemProvided
-
syncSystemProvenanceWithChangeIfApplied
public static void syncSystemProvenanceWithChangeIfApplied(@NotNull @NotNull PrismValue newValue, @NotNull @NotNull PrismValue oldValue) -
markAsInvalid
public static void markAsInvalid(@Nullable @Nullable PrismValue value, @Nullable @Nullable String validationError) Marks leaf values as invalid with an optional validationError. -
markAsInvalid
public static <C extends Containerable> C markAsInvalid(@NotNull C containerable, @Nullable @Nullable String error, ItemPath @NotNull ... paths) -
unmarkAsInvalid
-
unmarkAsInvalid
public static <C extends Containerable> C unmarkAsInvalid(@NotNull C containerable, ItemPath @NotNull ... paths) -
isMarkedAsInvalid
Returnstrueif the value has validation metadata at the root level. -
getFilterInvalidMessage
@Nullable public static @Nullable String getFilterInvalidMessage(@Nullable @Nullable PrismValue value) Returns a user-friendly message if the filter is marked as invalid. -
containsMatchingOriginRefMetadata
public static boolean containsMatchingOriginRefMetadata(@NotNull @NotNull ProvenanceMetadataType candidate, @NotNull @NotNull ProvenanceMetadataType expected) Compares two provenance metadata instances by their originRef OIDs.
-