Class ObjectTypeUtil
java.lang.Object
com.evolveum.midpoint.schema.util.ObjectTypeUtil
Methods that would belong to the ObjectType class but cannot go there because
of JAXB.
There are also useful methods that would belong to other classes. But we
don't want to create new class for every method ... if this goes beyond a
reasonable degree, please refactor accordingly.
- Author:
- Radovan Semancik
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Objectable>
TasObjectable
(PrismObject<T> prismObject) static <T extends Objectable>
List<T>asObjectables
(Collection<PrismObject<T>> objects) static @Nullable ObjectType
asObjectTypeIfPossible
(@Nullable PrismValue value) static <T extends Objectable>
PrismObject<T>asPrismObject
(T objectable) static void
assertConcreteType
(Class<? extends Objectable> type) static Collection<ObjectDelta<? extends ObjectType>>
cast
(Collection<ObjectDelta<?>> deltas) static void
checkIn
(@NotNull Containerable c, @NotNull Class<?> expectedRootType) static boolean
containsOid
(Collection<ObjectReferenceType> values, @NotNull String oid) static <T extends ObjectType>
@NotNull AssignmentTypecreateAssignmentTo
(@NotNull PrismObject<T> object) static <T extends ObjectType>
@NotNull AssignmentTypecreateAssignmentTo
(@NotNull PrismObject<T> object, PrismContext prismContext) static <T extends ObjectType>
@NotNull AssignmentTypecreateAssignmentTo
(@NotNull PrismObject<T> object, QName relation) static <T extends ObjectType>
@NotNull AssignmentTypecreateAssignmentTo
(@NotNull PrismReferenceValue ref) static <T extends ObjectType>
AssignmentTypecreateAssignmentTo
(@NotNull PrismReferenceValue ref, @Nullable PrismContext ignored) Deprecated.static @NotNull AssignmentType
createAssignmentTo
(@NotNull ObjectReferenceType ref) static AssignmentType
createAssignmentTo
(@NotNull ObjectReferenceType ref, @Nullable PrismContext prismContext) Deprecated.static <T extends ObjectType>
@NotNull AssignmentTypecreateAssignmentTo
(@NotNull String oid, @NotNull ObjectTypes type) static <T extends ObjectType>
AssignmentTypecreateAssignmentTo
(@NotNull String oid, @NotNull ObjectTypes type, @Nullable PrismContext ignored) Deprecated.static <T extends ObjectType>
@NotNull AssignmentTypecreateAssignmentTo
(T objectType, QName relation) static AssignmentType
static @NotNull AssignmentType
createAssignmentWithConstruction
(@NotNull PrismObject<ResourceType> object, ShadowKindType kind, String intent) static LocalizableMessage
createDisplayInformation
(PrismObject<?> object, boolean startsWithUppercase) Creates a localizable designation of an object - its type and name.static LocalizableMessage
createDisplayInformationWithPath
(PrismObject<?> object, boolean startsWithUppercase, String path) static @NotNull ObjectQuery
createManagerQuery
(Class<? extends ObjectType> objectTypeClass, String orgOid, RelationRegistry relationRegistry, PrismContext prismContext) static ObjectReferenceType
createObjectRef
(@NotNull String oid, @NotNull ObjectTypes type) static ObjectReferenceType
createObjectRef
(PrismObject<?> object) static ObjectReferenceType
createObjectRef
(PrismObject<?> object, PrismContext ignored) Deprecated.static ObjectReferenceType
createObjectRef
(PrismObject<?> object, QName relation) static <T extends ObjectType>
ObjectReferenceTypecreateObjectRef
(PrismObject<T> object, boolean nameAsDescription) static ObjectReferenceType
static <T extends ObjectType>
ObjectReferenceTypecreateObjectRef
(PrismReferenceValue refVal, boolean nameAsDescription) static ObjectReferenceType
createObjectRef
(ObjectType object) static ObjectReferenceType
createObjectRef
(ObjectType object, PrismContext prismContext) static ObjectReferenceType
createObjectRef
(ObjectType objectType, QName relation) static ObjectReferenceType
createObjectRef
(String oid) static ObjectReferenceType
createObjectRef
(String oid, PolyStringType name, ObjectTypes type) static ObjectReferenceType
This is to create reference clone without actually cloning.static ObjectReferenceType
createObjectRefNullSafe
(@Nullable String oid, @NotNull ObjectTypes type) static Collection<ObjectReferenceType>
static ObjectReferenceType
createObjectRefWithFullObject
(PrismObject<?> object) static ObjectReferenceType
createObjectRefWithFullObject
(PrismObject<?> object, PrismContext ignored) Deprecated.static ObjectReferenceType
static ObjectReferenceType
createObjectRefWithFullObject
(ObjectType object, PrismContext prismContext) Deprecated.static ObjectReferenceType
createOidOnlyObjectRef
(ObjectType object) Creates a very basic (OID-only) reference for a given object.static LocalizableMessage
createTechnicalDisplayInformation
(PrismObject<?> object, boolean startsWithUppercase) static LocalizableMessage
createTypeDisplayInformation
(String objectClassName, boolean startsWithUppercase) static LocalizableMessage
createTypeDisplayInformation
(QName type, boolean startsWithUppercase) static String
dump
(ObjectType object) static ObjectReferenceType
findRef
(String oid, List<ObjectReferenceType> refs) static RelationDefinitionType
findRelationDefinition
(List<RelationDefinitionType> relationDefinitions, QName qname) static Element
findXsdElement
(PrismContainer<XmlSchemaType> xmlSchemaContainer) static Element
findXsdElement
(PrismContainerValue<XmlSchemaType> xmlSchemaContainerValue) static Element
findXsdElement
(XmlSchemaType xmlSchemaType) Returns the <xsd:schema> element from the XmlSchemaType.static ObjectType
fix
(ObjectType objectable) static List<ObjectReferenceType>
getAsObjectReferenceTypeList
(PrismReference prismReference) getAssignedArchetypeOids
(@NotNull AssignmentHolderType object) static List<ObjectReferenceType>
getAssignedArchetypeRefs
(@NotNull AssignmentHolderType object) static <C extends Containerable>
@NotNull List<C>getDetachedContainerables
(@NotNull Collection<C> containerables) Returns containerables that are not rooted in aPrismObject
.static String
getDetailedDisplayName
(Objectable objectable) static String
getDetailedDisplayName
(PrismObject<?> object) Returns display name for given object, e.g.static PolyStringType
getDisplayName
(PrismObject<?> object) static PolyStringType
static PolyStringType
getDisplayName
(ObjectType object) static PrismContainerValue<ExtensionType>
getExtensionContainerValue
(Containerable containerable) static <T> T
getExtensionItemRealValue
(@NotNull PrismObject<? extends ObjectType> object, @NotNull QName itemName) static <T> T
getExtensionItemRealValue
(@Nullable ExtensionType extension, @NotNull QName itemName) static <T> T
getExtensionItemRealValue
(PrismContainerValue<?> parent, ItemPath path) static <T> Collection<T>
getExtensionPropertyValues
(Containerable containerable, QName propertyQname) static <T> @NotNull Collection<T>
getExtensionPropertyValuesNotNull
(Containerable containerable, @NotNull QName propertyQname) Never returns null.static Collection<Referencable>
getExtensionReferenceValues
(Containerable containerable, QName propertyQname) static <O extends ObjectType>
XMLGregorianCalendargetLastTouchTimestamp
(PrismObject<O> object) static PolyStringType
getName
(Referencable ref) static Objectable
static QName
getObjectType
(ObjectType object, PrismContext prismContext) Returns the type name for an object.static String
getOid
(ObjectType object) getOids
(List<? extends Objectable> objectables) getOidsFromPrismObjects
(List<? extends PrismObject<?>> prismObjects) getOidsFromRefs
(Collection<? extends Referencable> refs) static <O extends Objectable>
OgetParentObject
(@NotNull Containerable containerable) Returns parent object, potentially traversing multiple parent links to get there.static <O extends Objectable>
PrismObject<O>getParentObjectOld
(Containerable containerable) Deprecated.static PrismObject<?>
static <C extends Containerable>
Collection<PrismObject<? extends ObjectType>>getRootsForContainerables
(@NotNull Collection<C> containerables) Returns "identity collection" i.e.static Collection<PrismObject<? extends ObjectType>>
getRootsForReferences
(@NotNull Collection<ObjectReferenceType> references) AsgetRootsForContainerables(Collection)
but forObjectReferenceType
values.static Collection<PrismObject<? extends ObjectType>>
getRootsForValues
(@NotNull Collection<PrismValue> values) AsgetRootsForContainerables(Collection)
but for arbitrary prism values.static String
getShortTypeName
(ObjectType object) static String
getShortTypeName
(Class<? extends ObjectType> type) static Class<? extends ObjectType>
getTargetClassFromReference
(@NotNull ObjectReferenceType ref) static <O extends ObjectType>
PrismObjectValue<O>getValue
(PrismObject<O> object) static <AH extends AssignmentHolderType>
booleanhasArchetypeRef
(AH objectable, String oid) static <AH extends AssignmentHolderType>
booleanhasArchetypeRef
(PrismObject<AH> object, String oid) static boolean
hasAssignedArchetype
(@NotNull AssignmentHolderType object) static boolean
hasFetchError
(@NotNull PrismObject<? extends ObjectType> object) static boolean
isIndestructible
(@NotNull PrismObject<? extends ObjectType> object) static boolean
isIndestructible
(@NotNull ObjectType object) static boolean
isObjectable
(@NotNull Class<?> type) static <T extends Objectable>
List<PrismObject<T>>keepDistinctObjects
(Collection<PrismObject<T>> objects) static List<ObjectReferenceType>
keepDistinctReferences
(Collection<ObjectReferenceType> references) mapToExtensionItems
(Map<QName, Object> values, PrismContainerDefinition<?> extensionDefinition, PrismContext prismContext) static boolean
matchOnOid
(ObjectReferenceType ref1, ObjectReferenceType ref2) static void
mergeExtension
(PrismContainerValue<?> dstExtensionContainerValue, PrismContainerValue<?> srcExtensionContainerValue) static void
normalizeAllRelations
(Item<?, ?> item, RelationRegistry relationRegistry) static void
normalizeAllRelations
(PrismValue value, RelationRegistry relationRegistry) static void
normalizeFilter
(ObjectFilter filter, RelationRegistry relationRegistry) static void
normalizeRelation
(PrismReferenceValue reference, RelationRegistry relationRegistry) static void
normalizeRelation
(ObjectReferenceType reference, RelationRegistry relationRegistry) static <O extends ObjectType>
List<ObjectReferenceType>objectListToReferences
(Collection<PrismObject<O>> objects) static List<PrismReferenceValue>
static List<GuiObjectColumnType>
orderCustomColumns
(List<GuiObjectColumnType> customColumns) static void
recordFetchError
(ObjectType object, OperationResult result) static boolean
referenceMatches
(ObjectReferenceType ref, String targetOid, QName targetType, QName relation, PrismContext prismContext) referenceValueListToOidList
(Collection<PrismReferenceValue> referenceValues) static void
setExtensionContainerRealValues
(PrismContext prismContext, PrismContainerValue<?> parent, ItemName containerName, Object... values) static void
setExtensionPropertyRealValues
(PrismContainerValue<?> parent, ItemName propertyName, Object... values) static void
setExtensionPropertyRealValues
(PrismContext ignored, PrismContainerValue<?> parent, ItemName propertyName, Object... values) static void
setXsdSchemaDefinition
(PrismProperty<SchemaDefinitionType> definitionProperty, Element xsdElement) static List<ObjectDelta<? extends ObjectType>>
toDeltaList
(ObjectDelta<?> delta) static ObjectType
toObjectable
(PrismObject object) static String
toShortString
(PrismObject<? extends ObjectType> object) static Object
toShortString
(PrismReferenceValue objectRef) static String
toShortString
(AssignmentType assignment) static Object
toShortString
(ObjectReferenceType objectRef) static Object
toShortString
(ObjectReferenceType objectRef, boolean withName) static String
toShortString
(ObjectType object) static Object
toShortStringLazy
(ObjectType object)
-
Constructor Details
-
ObjectTypeUtil
public ObjectTypeUtil()
-
-
Method Details
-
getExtensionPropertyValuesNotNull
@NotNull public static <T> @NotNull Collection<T> getExtensionPropertyValuesNotNull(Containerable containerable, @NotNull @NotNull QName propertyQname) Never returns null. Returns empty collection instead. -
getExtensionPropertyValues
public static <T> Collection<T> getExtensionPropertyValues(Containerable containerable, QName propertyQname) -
getExtensionReferenceValues
public static Collection<Referencable> getExtensionReferenceValues(Containerable containerable, QName propertyQname) -
findRef
-
toShortString
-
toShortString
-
toShortStringLazy
-
toShortString
-
dump
-
toShortString
-
toShortString
-
toShortString
-
getShortTypeName
-
getShortTypeName
-
createAssignmentTo
@Deprecated public static AssignmentType createAssignmentTo(@NotNull @NotNull ObjectReferenceType ref, @Nullable @Nullable PrismContext prismContext) Deprecated. -
createAssignmentToNullSafe
@Contract("null -> null; !null -> !null") public static AssignmentType createAssignmentToNullSafe(ObjectReferenceType ref) -
createAssignmentTo
@NotNull public static @NotNull AssignmentType createAssignmentTo(@NotNull @NotNull ObjectReferenceType ref) -
createAssignmentTo
@Deprecated public static <T extends ObjectType> AssignmentType createAssignmentTo(@NotNull @NotNull PrismReferenceValue ref, @Nullable @Nullable PrismContext ignored) Deprecated. -
createAssignmentTo
@NotNull public static <T extends ObjectType> @NotNull AssignmentType createAssignmentTo(@NotNull @NotNull PrismReferenceValue ref) -
createAssignmentTo
@Deprecated public static <T extends ObjectType> AssignmentType createAssignmentTo(@NotNull @NotNull String oid, @NotNull @NotNull ObjectTypes type, @Nullable @Nullable PrismContext ignored) Deprecated. -
createAssignmentTo
@NotNull public static <T extends ObjectType> @NotNull AssignmentType createAssignmentTo(@NotNull @NotNull String oid, @NotNull @NotNull ObjectTypes type) -
createAssignmentTo
@NotNull public static <T extends ObjectType> @NotNull AssignmentType createAssignmentTo(@NotNull @NotNull PrismObject<T> object, PrismContext prismContext) -
createAssignmentTo
@NotNull public static <T extends ObjectType> @NotNull AssignmentType createAssignmentTo(@NotNull @NotNull PrismObject<T> object) -
createAssignmentTo
@NotNull public static <T extends ObjectType> @NotNull AssignmentType createAssignmentTo(@NotNull @NotNull PrismObject<T> object, QName relation) -
createAssignmentWithConstruction
@NotNull public static @NotNull AssignmentType createAssignmentWithConstruction(@NotNull @NotNull PrismObject<ResourceType> object, ShadowKindType kind, String intent) -
createAssignmentTo
@NotNull public static <T extends ObjectType> @NotNull AssignmentType createAssignmentTo(@NotNull T objectType, QName relation) -
createObjectRef
-
createObjectRefWithFullObject
@Deprecated public static ObjectReferenceType createObjectRefWithFullObject(ObjectType object, PrismContext prismContext) Deprecated. -
createObjectRef
-
createObjectRef
-
createOidOnlyObjectRef
Creates a very basic (OID-only) reference for a given object. Useful e.g. to create references to be used in search filters. -
createObjectRef
- Returns:
- OID-only object ref. Useful for search filters.
-
createObjectRef
-
createObjectRef
-
createObjectRef
@Deprecated public static ObjectReferenceType createObjectRef(PrismObject<?> object, PrismContext ignored) Deprecated. -
createObjectRef
-
createObjectRefWithFullObject
-
createObjectRefWithFullObject
-
createObjectRefWithFullObject
@Deprecated public static ObjectReferenceType createObjectRefWithFullObject(PrismObject<?> object, PrismContext ignored) Deprecated. -
createObjectRef
public static <T extends ObjectType> ObjectReferenceType createObjectRef(PrismObject<T> object, boolean nameAsDescription) -
createObjectRef
public static <T extends ObjectType> ObjectReferenceType createObjectRef(PrismReferenceValue refVal, boolean nameAsDescription) -
createObjectRefCopy
This is to create reference clone without actually cloning. (Because the cloning copies also the embedded object.) -
createObjectRef
public static ObjectReferenceType createObjectRef(@NotNull @NotNull String oid, @NotNull @NotNull ObjectTypes type) -
createObjectRefNullSafe
@Contract("null, _ -> null; !null, _ -> !null") public static ObjectReferenceType createObjectRefNullSafe(@Nullable @Nullable String oid, @NotNull @NotNull ObjectTypes type) -
createObjectRef
public static ObjectReferenceType createObjectRef(String oid, PolyStringType name, ObjectTypes type) -
findXsdElement
Returns the <xsd:schema> element from the XmlSchemaType. -
findXsdElement
-
findXsdElement
-
setXsdSchemaDefinition
public static void setXsdSchemaDefinition(PrismProperty<SchemaDefinitionType> definitionProperty, Element xsdElement) -
assertConcreteType
-
getParentObject
@Nullable public static <O extends Objectable> O getParentObject(@NotNull @NotNull Containerable containerable) Returns parent object, potentially traversing multiple parent links to get there. -
getParentObjectOld
@Deprecated public static <O extends Objectable> PrismObject<O> getParentObjectOld(Containerable containerable) Deprecated. -
objectReferenceListToPrismReferenceValues
public static List<PrismReferenceValue> objectReferenceListToPrismReferenceValues(Collection<ObjectReferenceType> refList) -
objectReferenceListToOids
-
objectListToReferences
public static <O extends ObjectType> List<ObjectReferenceType> objectListToReferences(Collection<PrismObject<O>> objects) -
getAsObjectReferenceTypeList
public static List<ObjectReferenceType> getAsObjectReferenceTypeList(PrismReference prismReference) throws SchemaException - Throws:
SchemaException
-
referenceValueListToOidList
public static List<String> referenceValueListToOidList(Collection<PrismReferenceValue> referenceValues) -
getObjectFromReference
-
getPrismObjectFromReference
-
toDeltaList
-
cast
-
getDisplayName
-
getDisplayName
-
getDisplayName
-
getName
-
toObjectable
-
asPrismObject
-
containsOid
public static boolean containsOid(Collection<ObjectReferenceType> values, @NotNull @NotNull String oid) -
getExtensionItemRealValue
public static <T> T getExtensionItemRealValue(@Nullable @Nullable ExtensionType extension, @NotNull @NotNull QName itemName) -
getExtensionItemRealValue
public static <T> T getExtensionItemRealValue(@NotNull @NotNull PrismObject<? extends ObjectType> object, @NotNull @NotNull QName itemName) -
normalizeRelation
public static void normalizeRelation(ObjectReferenceType reference, RelationRegistry relationRegistry) -
normalizeRelation
public static void normalizeRelation(PrismReferenceValue reference, RelationRegistry relationRegistry) -
normalizeAllRelations
-
normalizeAllRelations
-
normalizeFilter
-
findRelationDefinition
public static RelationDefinitionType findRelationDefinition(List<RelationDefinitionType> relationDefinitions, QName qname) -
referenceMatches
public static boolean referenceMatches(ObjectReferenceType ref, String targetOid, QName targetType, QName relation, PrismContext prismContext) -
asObjectable
-
asObjectables
-
matchOnOid
-
mergeExtension
public static void mergeExtension(PrismContainerValue<?> dstExtensionContainerValue, PrismContainerValue<?> srcExtensionContainerValue) throws SchemaException - Throws:
SchemaException
-
createTechnicalDisplayInformation
public static LocalizableMessage createTechnicalDisplayInformation(PrismObject<?> object, boolean startsWithUppercase) -
createDisplayInformation
public static LocalizableMessage createDisplayInformation(PrismObject<?> object, boolean startsWithUppercase) Creates a localizable designation of an object - its type and name. SeegetDescriptiveName(Objectable)
. -
createDisplayInformationWithPath
public static LocalizableMessage createDisplayInformationWithPath(PrismObject<?> object, boolean startsWithUppercase, String path) -
createTypeDisplayInformation
public static LocalizableMessage createTypeDisplayInformation(QName type, boolean startsWithUppercase) -
createTypeDisplayInformation
public static LocalizableMessage createTypeDisplayInformation(String objectClassName, boolean startsWithUppercase) -
getLastTouchTimestamp
public static <O extends ObjectType> XMLGregorianCalendar getLastTouchTimestamp(PrismObject<O> object) -
mapToExtensionItems
@NotNull public static @NotNull List<Item<?,?>> mapToExtensionItems(Map<QName, Object> values, PrismContainerDefinition<?> extensionDefinition, PrismContext prismContext) throws SchemaException- Throws:
SchemaException
-
createManagerQuery
@NotNull public static @NotNull ObjectQuery createManagerQuery(Class<? extends ObjectType> objectTypeClass, String orgOid, RelationRegistry relationRegistry, PrismContext prismContext) -
keepDistinctObjects
public static <T extends Objectable> List<PrismObject<T>> keepDistinctObjects(Collection<PrismObject<T>> objects) -
keepDistinctReferences
public static List<ObjectReferenceType> keepDistinctReferences(Collection<ObjectReferenceType> references) -
hasArchetypeRef
public static <AH extends AssignmentHolderType> boolean hasArchetypeRef(PrismObject<AH> object, String oid) -
hasArchetypeRef
-
orderCustomColumns
-
getExtensionContainerValue
public static PrismContainerValue<ExtensionType> getExtensionContainerValue(Containerable containerable) -
hasFetchError
-
recordFetchError
-
createObjectRefs
public static Collection<ObjectReferenceType> createObjectRefs(Collection<PrismReferenceValue> values) -
getDetailedDisplayName
Returns display name for given object, e.g. fullName for a user, displayName for a role, and more detailed description for a shadow. TODO where exactly does this method belong? -
getDetailedDisplayName
-
getObjectType
Returns the type name for an object. (This really belongs somewhere else, not here.) -
isIndestructible
-
isIndestructible
-
getTargetClassFromReference
public static Class<? extends ObjectType> getTargetClassFromReference(@NotNull @NotNull ObjectReferenceType ref) -
getOid
-
fix
ConvertsPrismContainerValue
toPrismObjectValue
basedObjectType
as a workaround for MID-8522. TEMPORARY CODE -
asObjectTypeIfPossible
@Nullable public static @Nullable ObjectType asObjectTypeIfPossible(@Nullable @Nullable PrismValue value) -
getRootsForContainerables
public static <C extends Containerable> Collection<PrismObject<? extends ObjectType>> getRootsForContainerables(@NotNull @NotNull Collection<C> containerables) Returns "identity collection" i.e. equivalent objects can be present there, differing in their identity. Throws an exception when a root object cannot be determined. -
getDetachedContainerables
@NotNull public static <C extends Containerable> @NotNull List<C> getDetachedContainerables(@NotNull @NotNull Collection<C> containerables) Returns containerables that are not rooted in aPrismObject
. -
getRootsForReferences
public static Collection<PrismObject<? extends ObjectType>> getRootsForReferences(@NotNull @NotNull Collection<ObjectReferenceType> references) AsgetRootsForContainerables(Collection)
but forObjectReferenceType
values. -
getRootsForValues
public static Collection<PrismObject<? extends ObjectType>> getRootsForValues(@NotNull @NotNull Collection<PrismValue> values) AsgetRootsForContainerables(Collection)
but for arbitrary prism values. -
isObjectable
-
getValue
-
checkIn
public static void checkIn(@NotNull @NotNull Containerable c, @NotNull @NotNull Class<?> expectedRootType) -
getAssignedArchetypeRefs
public static List<ObjectReferenceType> getAssignedArchetypeRefs(@NotNull @NotNull AssignmentHolderType object) -
hasAssignedArchetype
-
getAssignedArchetypeOids
-
setExtensionPropertyRealValues
public static void setExtensionPropertyRealValues(PrismContext ignored, PrismContainerValue<?> parent, ItemName propertyName, Object... values) throws SchemaException - Throws:
SchemaException
-
setExtensionPropertyRealValues
public static void setExtensionPropertyRealValues(PrismContainerValue<?> parent, ItemName propertyName, Object... values) throws SchemaException - Throws:
SchemaException
-
setExtensionContainerRealValues
public static void setExtensionContainerRealValues(PrismContext prismContext, PrismContainerValue<?> parent, ItemName containerName, Object... values) throws SchemaException - Throws:
SchemaException
-
getExtensionItemRealValue
-
getOids
-
getOidsFromPrismObjects
-
getOidsFromRefs
-