Package org.openmetadata.service.util
Class EntityUtil
- java.lang.Object
-
- org.openmetadata.service.util.EntityUtil
-
public final class EntityUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEntityUtil.Fields
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringaddField(String fields, String newField)static EntityReferencecopy(EntityReference from, EntityReference to)static MetadataOperationcreateOrUpdateOperation(ResourceContext resourceContext)static voidfieldAdded(ChangeDescription change, String fieldName, Object newValue)static voidfieldDeleted(ChangeDescription change, String fieldName, Object oldValue)static voidfieldUpdated(ChangeDescription change, String fieldName, Object oldValue, Object newValue)static ColumngetColumn(Table table, String columnName)static StringgetColumnField(Column column, String columnField)Return column field name of format "columns".columnName.columnFieldNamestatic StringgetCustomField(CustomProperty property, String propertyFieldName)Return customer property field name of format "customProperties".propertyNamestatic EntityReferencegetEntityReference(String entityType, String fqn)static EntityReferencegetEntityReference(EntityInterface entity)static List<EntityReference>getEntityReferences(String entityType, List<String> fqns)static List<EntityReference>getEntityReferences(List<EntityReference> entities, Include include)This method is used to populate the entity with all details of EntityReference Users/Tools can send minimum details required to set relationship as id, type are the only required fields in entity reference, whereas we need to send fully populated object such that ElasticSearch index has all the details.static List<EntityReference>getEntityReferences(List<CollectionDAO.EntityRelationshipRecord> list)static StringgetExtensionField(String key)Return extension field name of format "extension".fieldNamestatic StringgetFieldName(String... strings)static StringgetFqn(EntityInterface entity)static StringgetFqn(EntityReference ref)static List<String>getFqns(List<EntityReference> refs)static UUIDgetId(EntityReference ref)static List<String>getJsonDataResources(String path)static UsageDetailsgetLatestUsage(CollectionDAO.UsageDAO usageDAO, UUID entityId)static StringgetLocalColumnName(String tableFqn, String columnFqn)static StringgetRuleField(Rule rule, String ruleField)Return rule field name of format "rules".ruleName.ruleFieldNamestatic StringgetSchemaField(Topic topic, Field field, String fieldName)Return schema field name of format "schemaFields".fieldName.fieldNamestatic DoublegetVersion(String extension)static StringgetVersionExtension(String entityType, Double version)Entity version extension name formed by entityType.version.versionNumber.static StringgetVersionExtensionPrefix(String entityType)Entity version extension name prefix formed by `entityType.version`.static Stringhash(String input)static <T> booleanisDescriptionRequired(Class<T> clz)static booleanisDescriptionTask(TaskType taskType)static booleanisTagTask(TaskType taskType)static voidmergeTags(List<TagLabel> mergeTo, List<TagLabel> mergeFrom)Merge two sets of tagsstatic DoublenextMajorVersion(Double version)static DoublenextVersion(Double version)static List<EntityReference>populateEntityReferences(List<EntityReference> list)static List<EntityReference>populateEntityReferencesById(List<UUID> list, String entityType)static List<UUID>refToIds(List<EntityReference> refs)static voidsortByTagHierarchy(List<Tag> tags)static List<UUID>strToIds(List<String> list)static List<EntityReference>toEntityReferences(List<UUID> ids, String entityType)static <T extends EntityInterface>
List<String>toFQNs(List<T> entities)static TagLabeltoTagLabel(Tag tag)static TagLabeltoTagLabel(GlossaryTerm term)static List<TagLabel>toTagLabels(Tag... tags)static List<TagLabel>toTagLabels(GlossaryTerm... terms)static <T> Tvalidate(String identity, String json, Class<T> clz)Validate that JSON payload can be turned into POJO objectstatic EntityReferencevalidateEntityLink(MessageParser.EntityLink entityLink)static voidvalidateProfileSample(String profileSampleType, double profileSampleValue)
-
-
-
Field Detail
-
compareEntityReference
public static final Comparator<EntityReference> compareEntityReference
-
compareVersion
public static final Comparator<CollectionDAO.EntityVersionPair> compareVersion
-
compareTagLabel
public static final Comparator<TagLabel> compareTagLabel
-
compareFieldChange
public static final Comparator<FieldChange> compareFieldChange
-
compareTableConstraint
public static final Comparator<TableConstraint> compareTableConstraint
-
compareChangeEvent
public static final Comparator<ChangeEvent> compareChangeEvent
-
compareGlossaryTerm
public static final Comparator<GlossaryTerm> compareGlossaryTerm
-
compareCustomProperty
public static final Comparator<CustomProperty> compareCustomProperty
-
objectMatch
public static final BiPredicate<Object,Object> objectMatch
-
entityReferenceMatch
public static final BiPredicate<EntityReference,EntityReference> entityReferenceMatch
-
tagLabelMatch
public static final BiPredicate<TagLabel,TagLabel> tagLabelMatch
-
taskMatch
public static final BiPredicate<Task,Task> taskMatch
-
stringMatch
public static final BiPredicate<String,String> stringMatch
-
columnMatch
public static final BiPredicate<Column,Column> columnMatch
-
columnNameMatch
public static final BiPredicate<Column,Column> columnNameMatch
-
tableConstraintMatch
public static final BiPredicate<TableConstraint,TableConstraint> tableConstraintMatch
-
mlFeatureMatch
public static final BiPredicate<MlFeature,MlFeature> mlFeatureMatch
-
mlHyperParameterMatch
public static final BiPredicate<MlHyperParameter,MlHyperParameter> mlHyperParameterMatch
-
glossaryTermMatch
public static final BiPredicate<GlossaryTerm,GlossaryTerm> glossaryTermMatch
-
containerFileFormatMatch
public static final BiPredicate<ContainerFileFormat,ContainerFileFormat> containerFileFormatMatch
-
termReferenceMatch
public static final BiPredicate<TermReference,TermReference> termReferenceMatch
-
customFieldMatch
public static final BiPredicate<CustomProperty,CustomProperty> customFieldMatch
-
ruleMatch
public static final BiPredicate<Rule,Rule> ruleMatch
-
schemaFieldMatch
public static final BiPredicate<Field,Field> schemaFieldMatch
-
-
Method Detail
-
validate
public static <T> T validate(String identity, String json, Class<T> clz) throws javax.ws.rs.WebApplicationException
Validate that JSON payload can be turned into POJO object- Throws:
javax.ws.rs.WebApplicationException
-
populateEntityReferences
public static List<EntityReference> populateEntityReferences(List<EntityReference> list)
-
getEntityReferences
public static List<EntityReference> getEntityReferences(List<CollectionDAO.EntityRelationshipRecord> list)
-
populateEntityReferencesById
public static List<EntityReference> populateEntityReferencesById(List<UUID> list, String entityType)
-
validateEntityLink
public static EntityReference validateEntityLink(MessageParser.EntityLink entityLink)
-
getLatestUsage
public static UsageDetails getLatestUsage(CollectionDAO.UsageDAO usageDAO, UUID entityId)
-
mergeTags
public static void mergeTags(List<TagLabel> mergeTo, List<TagLabel> mergeFrom)
Merge two sets of tags
-
getJsonDataResources
public static List<String> getJsonDataResources(String path) throws IOException
- Throws:
IOException
-
toFQNs
public static <T extends EntityInterface> List<String> toFQNs(List<T> entities)
-
toEntityReferences
public static List<EntityReference> toEntityReferences(List<UUID> ids, String entityType)
-
refToIds
public static List<UUID> refToIds(List<EntityReference> refs)
-
isDescriptionRequired
public static <T> boolean isDescriptionRequired(Class<T> clz)
-
getVersionExtension
public static String getVersionExtension(String entityType, Double version)
Entity version extension name formed by entityType.version.versionNumber. Example - `table.version.0.1`
-
getVersionExtensionPrefix
public static String getVersionExtensionPrefix(String entityType)
Entity version extension name prefix formed by `entityType.version`. Example - `table.version`
-
getColumnField
public static String getColumnField(Column column, String columnField)
Return column field name of format "columns".columnName.columnFieldName
-
getSchemaField
public static String getSchemaField(Topic topic, Field field, String fieldName)
Return schema field name of format "schemaFields".fieldName.fieldName
-
getRuleField
public static String getRuleField(Rule rule, String ruleField)
Return rule field name of format "rules".ruleName.ruleFieldName
-
getCustomField
public static String getCustomField(CustomProperty property, String propertyFieldName)
Return customer property field name of format "customProperties".propertyName
-
getExtensionField
public static String getExtensionField(String key)
Return extension field name of format "extension".fieldName
-
copy
public static EntityReference copy(EntityReference from, EntityReference to)
-
toTagLabels
public static List<TagLabel> toTagLabels(GlossaryTerm... terms)
-
toTagLabel
public static TagLabel toTagLabel(GlossaryTerm term)
-
fieldAdded
public static void fieldAdded(ChangeDescription change, String fieldName, Object newValue)
-
fieldDeleted
public static void fieldDeleted(ChangeDescription change, String fieldName, Object oldValue)
-
fieldUpdated
public static void fieldUpdated(ChangeDescription change, String fieldName, Object oldValue, Object newValue)
-
createOrUpdateOperation
public static MetadataOperation createOrUpdateOperation(ResourceContext resourceContext)
-
getId
public static UUID getId(EntityReference ref)
-
getFqn
public static String getFqn(EntityReference ref)
-
getFqn
public static String getFqn(EntityInterface entity)
-
getFqns
public static List<String> getFqns(List<EntityReference> refs)
-
getEntityReference
public static EntityReference getEntityReference(EntityInterface entity)
-
getEntityReference
public static EntityReference getEntityReference(String entityType, String fqn)
-
getEntityReferences
public static List<EntityReference> getEntityReferences(String entityType, List<String> fqns)
-
getEntityReferences
public static List<EntityReference> getEntityReferences(List<EntityReference> entities, Include include)
This method is used to populate the entity with all details of EntityReference Users/Tools can send minimum details required to set relationship as id, type are the only required fields in entity reference, whereas we need to send fully populated object such that ElasticSearch index has all the details.
-
validateProfileSample
public static void validateProfileSample(String profileSampleType, double profileSampleValue)
-
isDescriptionTask
public static boolean isDescriptionTask(TaskType taskType)
-
isTagTask
public static boolean isTagTask(TaskType taskType)
-
-