mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-12 09:18:20 +00:00
FIX 5712: make generate gives different results depending on OS (#6035)
FIX 5712: make generate gives different results depending on OS (#6035)
This commit is contained in:
parent
70bcfb34d2
commit
c2b15a4377
@ -1474,7 +1474,7 @@ public interface CollectionDAO {
|
|||||||
String description1 = r.getString("description1");
|
String description1 = r.getString("description1");
|
||||||
String description2 = r.getString("description2");
|
String description2 = r.getString("description2");
|
||||||
return new TagLabel()
|
return new TagLabel()
|
||||||
.withSource(TagLabel.Source.values()[r.getInt("source")])
|
.withSource(TagLabel.TagSource.values()[r.getInt("source")])
|
||||||
.withLabelType(TagLabel.LabelType.values()[r.getInt("labelType")])
|
.withLabelType(TagLabel.LabelType.values()[r.getInt("labelType")])
|
||||||
.withState(TagLabel.State.values()[r.getInt("state")])
|
.withState(TagLabel.State.values()[r.getInt("state")])
|
||||||
.withTagFQN(r.getString("tagFQN"))
|
.withTagFQN(r.getString("tagFQN"))
|
||||||
|
@ -81,7 +81,7 @@ import org.openmetadata.catalog.type.Include;
|
|||||||
import org.openmetadata.catalog.type.Relationship;
|
import org.openmetadata.catalog.type.Relationship;
|
||||||
import org.openmetadata.catalog.type.TagLabel;
|
import org.openmetadata.catalog.type.TagLabel;
|
||||||
import org.openmetadata.catalog.type.TagLabel.LabelType;
|
import org.openmetadata.catalog.type.TagLabel.LabelType;
|
||||||
import org.openmetadata.catalog.type.TagLabel.Source;
|
import org.openmetadata.catalog.type.TagLabel.TagSource;
|
||||||
import org.openmetadata.catalog.util.EntityUtil;
|
import org.openmetadata.catalog.util.EntityUtil;
|
||||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||||
import org.openmetadata.catalog.util.FullyQualifiedName;
|
import org.openmetadata.catalog.util.FullyQualifiedName;
|
||||||
@ -741,7 +741,7 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
|||||||
|
|
||||||
/** Get tags associated with a given set of tags */
|
/** Get tags associated with a given set of tags */
|
||||||
private List<TagLabel> getDerivedTags(TagLabel tagLabel) {
|
private List<TagLabel> getDerivedTags(TagLabel tagLabel) {
|
||||||
if (tagLabel.getSource() == Source.GLOSSARY) { // Related tags are only supported for Glossary
|
if (tagLabel.getSource() == TagSource.GLOSSARY) { // Related tags are only supported for Glossary
|
||||||
List<TagLabel> derivedTags = daoCollection.tagUsageDAO().getTags(tagLabel.getTagFQN());
|
List<TagLabel> derivedTags = daoCollection.tagUsageDAO().getTags(tagLabel.getTagFQN());
|
||||||
derivedTags.forEach(tag -> tag.setLabelType(LabelType.DERIVED));
|
derivedTags.forEach(tag -> tag.setLabelType(LabelType.DERIVED));
|
||||||
return derivedTags;
|
return derivedTags;
|
||||||
@ -759,14 +759,14 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
|||||||
/** Apply tags {@code tagLabels} to the entity or field identified by {@code targetFQN} */
|
/** Apply tags {@code tagLabels} to the entity or field identified by {@code targetFQN} */
|
||||||
public void applyTags(List<TagLabel> tagLabels, String targetFQN) {
|
public void applyTags(List<TagLabel> tagLabels, String targetFQN) {
|
||||||
for (TagLabel tagLabel : listOrEmpty(tagLabels)) {
|
for (TagLabel tagLabel : listOrEmpty(tagLabels)) {
|
||||||
if (tagLabel.getSource() == Source.TAG) {
|
if (tagLabel.getSource() == TagSource.TAG) {
|
||||||
Tag tag = daoCollection.tagDAO().findEntityByName(tagLabel.getTagFQN());
|
Tag tag = daoCollection.tagDAO().findEntityByName(tagLabel.getTagFQN());
|
||||||
tagLabel.withDescription(tag.getDescription());
|
tagLabel.withDescription(tag.getDescription());
|
||||||
tagLabel.setSource(Source.TAG);
|
tagLabel.setSource(TagSource.TAG);
|
||||||
} else if (tagLabel.getSource() == Source.GLOSSARY) {
|
} else if (tagLabel.getSource() == TagSource.GLOSSARY) {
|
||||||
GlossaryTerm term = daoCollection.glossaryTermDAO().findEntityByName(tagLabel.getTagFQN(), NON_DELETED);
|
GlossaryTerm term = daoCollection.glossaryTermDAO().findEntityByName(tagLabel.getTagFQN(), NON_DELETED);
|
||||||
tagLabel.withDescription(term.getDescription());
|
tagLabel.withDescription(term.getDescription());
|
||||||
tagLabel.setSource(Source.GLOSSARY);
|
tagLabel.setSource(TagSource.GLOSSARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply tagLabel to targetFQN that identifies an entity or field
|
// Apply tagLabel to targetFQN that identifies an entity or field
|
||||||
|
@ -30,7 +30,7 @@ import org.openmetadata.catalog.resources.glossary.GlossaryResource;
|
|||||||
import org.openmetadata.catalog.type.EntityReference;
|
import org.openmetadata.catalog.type.EntityReference;
|
||||||
import org.openmetadata.catalog.type.Relationship;
|
import org.openmetadata.catalog.type.Relationship;
|
||||||
import org.openmetadata.catalog.type.TagLabel;
|
import org.openmetadata.catalog.type.TagLabel;
|
||||||
import org.openmetadata.catalog.type.TagLabel.Source;
|
import org.openmetadata.catalog.type.TagLabel.TagSource;
|
||||||
import org.openmetadata.catalog.util.EntityUtil;
|
import org.openmetadata.catalog.util.EntityUtil;
|
||||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ public class GlossaryRepository extends EntityRepository<Glossary> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer getUsageCount(Glossary glossary) {
|
private Integer getUsageCount(Glossary glossary) {
|
||||||
return daoCollection.tagUsageDAO().getTagCount(Source.GLOSSARY.ordinal(), glossary.getName());
|
return daoCollection.tagUsageDAO().getTagCount(TagSource.GLOSSARY.ordinal(), glossary.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,7 +37,7 @@ import org.openmetadata.catalog.resources.glossary.GlossaryTermResource;
|
|||||||
import org.openmetadata.catalog.type.EntityReference;
|
import org.openmetadata.catalog.type.EntityReference;
|
||||||
import org.openmetadata.catalog.type.Relationship;
|
import org.openmetadata.catalog.type.Relationship;
|
||||||
import org.openmetadata.catalog.type.TagLabel;
|
import org.openmetadata.catalog.type.TagLabel;
|
||||||
import org.openmetadata.catalog.type.TagLabel.Source;
|
import org.openmetadata.catalog.type.TagLabel.TagSource;
|
||||||
import org.openmetadata.catalog.util.EntityUtil;
|
import org.openmetadata.catalog.util.EntityUtil;
|
||||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||||
import org.openmetadata.catalog.util.FullyQualifiedName;
|
import org.openmetadata.catalog.util.FullyQualifiedName;
|
||||||
@ -71,7 +71,7 @@ public class GlossaryTermRepository extends EntityRepository<GlossaryTerm> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer getUsageCount(GlossaryTerm term) {
|
private Integer getUsageCount(GlossaryTerm term) {
|
||||||
return daoCollection.tagUsageDAO().getTagCount(Source.GLOSSARY.ordinal(), term.getFullyQualifiedName());
|
return daoCollection.tagUsageDAO().getTagCount(TagSource.GLOSSARY.ordinal(), term.getFullyQualifiedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private EntityReference getParent(GlossaryTerm entity) throws IOException {
|
private EntityReference getParent(GlossaryTerm entity) throws IOException {
|
||||||
@ -197,7 +197,7 @@ public class GlossaryTermRepository extends EntityRepository<GlossaryTerm> {
|
|||||||
@Override
|
@Override
|
||||||
protected void postDelete(GlossaryTerm entity) {
|
protected void postDelete(GlossaryTerm entity) {
|
||||||
// Cleanup all the tag labels using this glossary term
|
// Cleanup all the tag labels using this glossary term
|
||||||
daoCollection.tagUsageDAO().deleteTagLabels(Source.GLOSSARY.ordinal(), entity.getFullyQualifiedName());
|
daoCollection.tagUsageDAO().deleteTagLabels(TagSource.GLOSSARY.ordinal(), entity.getFullyQualifiedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handles entity updated from PUT and POST operation. */
|
/** Handles entity updated from PUT and POST operation. */
|
||||||
|
@ -28,7 +28,7 @@ import org.openmetadata.catalog.resources.tags.TagResource;
|
|||||||
import org.openmetadata.catalog.type.Include;
|
import org.openmetadata.catalog.type.Include;
|
||||||
import org.openmetadata.catalog.type.TagCategory;
|
import org.openmetadata.catalog.type.TagCategory;
|
||||||
import org.openmetadata.catalog.type.TagLabel;
|
import org.openmetadata.catalog.type.TagLabel;
|
||||||
import org.openmetadata.catalog.type.TagLabel.Source;
|
import org.openmetadata.catalog.type.TagLabel.TagSource;
|
||||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||||
import org.openmetadata.catalog.util.FullyQualifiedName;
|
import org.openmetadata.catalog.util.FullyQualifiedName;
|
||||||
import org.openmetadata.catalog.util.JsonUtils;
|
import org.openmetadata.catalog.util.JsonUtils;
|
||||||
@ -103,7 +103,7 @@ public class TagCategoryRepository extends EntityRepository<TagCategory> {
|
|||||||
public void storeRelationships(TagCategory entity) {}
|
public void storeRelationships(TagCategory entity) {}
|
||||||
|
|
||||||
private Integer getUsageCount(TagCategory category) {
|
private Integer getUsageCount(TagCategory category) {
|
||||||
return daoCollection.tagUsageDAO().getTagCount(Source.TAG.ordinal(), category.getName());
|
return daoCollection.tagUsageDAO().getTagCount(TagSource.TAG.ordinal(), category.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transaction
|
@Transaction
|
||||||
@ -111,8 +111,8 @@ public class TagCategoryRepository extends EntityRepository<TagCategory> {
|
|||||||
TagCategory category = get(uriInfo, id, Fields.EMPTY_FIELDS, Include.NON_DELETED);
|
TagCategory category = get(uriInfo, id, Fields.EMPTY_FIELDS, Include.NON_DELETED);
|
||||||
dao.delete(id);
|
dao.delete(id);
|
||||||
daoCollection.tagDAO().deleteTagsByPrefix(category.getName());
|
daoCollection.tagDAO().deleteTagsByPrefix(category.getName());
|
||||||
daoCollection.tagUsageDAO().deleteTagLabels(Source.TAG.ordinal(), category.getName());
|
daoCollection.tagUsageDAO().deleteTagLabels(TagSource.TAG.ordinal(), category.getName());
|
||||||
daoCollection.tagUsageDAO().deleteTagLabelsByPrefix(Source.TAG.ordinal(), category.getName());
|
daoCollection.tagUsageDAO().deleteTagLabelsByPrefix(TagSource.TAG.ordinal(), category.getName());
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import org.openmetadata.catalog.Entity;
|
|||||||
import org.openmetadata.catalog.entity.tags.Tag;
|
import org.openmetadata.catalog.entity.tags.Tag;
|
||||||
import org.openmetadata.catalog.resources.tags.TagResource;
|
import org.openmetadata.catalog.resources.tags.TagResource;
|
||||||
import org.openmetadata.catalog.type.Include;
|
import org.openmetadata.catalog.type.Include;
|
||||||
import org.openmetadata.catalog.type.TagLabel.Source;
|
import org.openmetadata.catalog.type.TagLabel.TagSource;
|
||||||
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
import org.openmetadata.catalog.util.EntityUtil.Fields;
|
||||||
import org.openmetadata.catalog.util.FullyQualifiedName;
|
import org.openmetadata.catalog.util.FullyQualifiedName;
|
||||||
import org.openmetadata.catalog.util.JsonUtils;
|
import org.openmetadata.catalog.util.JsonUtils;
|
||||||
@ -113,7 +113,7 @@ public class TagRepository extends EntityRepository<Tag> {
|
|||||||
@Override
|
@Override
|
||||||
protected void postDelete(Tag entity) {
|
protected void postDelete(Tag entity) {
|
||||||
// Cleanup all the tag labels using this tag
|
// Cleanup all the tag labels using this tag
|
||||||
daoCollection.tagUsageDAO().deleteTagLabels(Source.TAG.ordinal(), entity.getFullyQualifiedName());
|
daoCollection.tagUsageDAO().deleteTagLabels(TagSource.TAG.ordinal(), entity.getFullyQualifiedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -123,7 +123,7 @@ public class TagRepository extends EntityRepository<Tag> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer getUsageCount(Tag tag) {
|
private Integer getUsageCount(Tag tag) {
|
||||||
return daoCollection.tagUsageDAO().getTagCount(Source.TAG.ordinal(), tag.getFullyQualifiedName());
|
return daoCollection.tagUsageDAO().getTagCount(TagSource.TAG.ordinal(), tag.getFullyQualifiedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transaction
|
@Transaction
|
||||||
@ -131,8 +131,8 @@ public class TagRepository extends EntityRepository<Tag> {
|
|||||||
Tag tag = get(uriInfo, id, Fields.EMPTY_FIELDS, Include.NON_DELETED);
|
Tag tag = get(uriInfo, id, Fields.EMPTY_FIELDS, Include.NON_DELETED);
|
||||||
dao.delete(id);
|
dao.delete(id);
|
||||||
daoCollection.tagDAO().deleteTagsByPrefix(tag.getFullyQualifiedName());
|
daoCollection.tagDAO().deleteTagsByPrefix(tag.getFullyQualifiedName());
|
||||||
daoCollection.tagUsageDAO().deleteTagLabels(Source.TAG.ordinal(), tag.getFullyQualifiedName());
|
daoCollection.tagUsageDAO().deleteTagLabels(TagSource.TAG.ordinal(), tag.getFullyQualifiedName());
|
||||||
daoCollection.tagUsageDAO().deleteTagLabelsByPrefix(Source.TAG.ordinal(), tag.getFullyQualifiedName());
|
daoCollection.tagUsageDAO().deleteTagLabelsByPrefix(TagSource.TAG.ordinal(), tag.getFullyQualifiedName());
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ import org.openmetadata.catalog.type.MlHyperParameter;
|
|||||||
import org.openmetadata.catalog.type.Schedule;
|
import org.openmetadata.catalog.type.Schedule;
|
||||||
import org.openmetadata.catalog.type.TableConstraint;
|
import org.openmetadata.catalog.type.TableConstraint;
|
||||||
import org.openmetadata.catalog.type.TagLabel;
|
import org.openmetadata.catalog.type.TagLabel;
|
||||||
import org.openmetadata.catalog.type.TagLabel.Source;
|
import org.openmetadata.catalog.type.TagLabel.TagSource;
|
||||||
import org.openmetadata.catalog.type.Task;
|
import org.openmetadata.catalog.type.Task;
|
||||||
import org.openmetadata.catalog.type.UsageDetails;
|
import org.openmetadata.catalog.type.UsageDetails;
|
||||||
import org.openmetadata.catalog.type.UsageStats;
|
import org.openmetadata.catalog.type.UsageStats;
|
||||||
@ -370,13 +370,13 @@ public final class EntityUtil {
|
|||||||
return new TagLabel()
|
return new TagLabel()
|
||||||
.withTagFQN(term.getFullyQualifiedName())
|
.withTagFQN(term.getFullyQualifiedName())
|
||||||
.withDescription(term.getDescription())
|
.withDescription(term.getDescription())
|
||||||
.withSource(Source.GLOSSARY);
|
.withSource(TagSource.GLOSSARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TagLabel getTagLabel(Tag tag) throws HttpResponseException {
|
public static TagLabel getTagLabel(Tag tag) throws HttpResponseException {
|
||||||
return new TagLabel()
|
return new TagLabel()
|
||||||
.withTagFQN(tag.getFullyQualifiedName())
|
.withTagFQN(tag.getFullyQualifiedName())
|
||||||
.withDescription(tag.getDescription())
|
.withDescription(tag.getDescription())
|
||||||
.withSource(Source.TAG);
|
.withSource(TagSource.TAG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
"tagFQN": {
|
"tagFQN": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"maxLength": 45
|
"maxLength": 45
|
||||||
|
},
|
||||||
|
"TagSource": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "Tag",
|
||||||
|
"enum": ["Tag", "Glossary"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -21,9 +26,7 @@
|
|||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"description": "Label is from Tags or Glossary.",
|
"description": "Label is from Tags or Glossary.",
|
||||||
"type": "string",
|
"$ref": "#/definitions/TagSource"
|
||||||
"enum": ["Tag", "Glossary"],
|
|
||||||
"default": "Tag"
|
|
||||||
},
|
},
|
||||||
"labelType": {
|
"labelType": {
|
||||||
"description": "Label type describes how a tag label was applied. 'Manual' indicates the tag label was applied by a person. 'Derived' indicates a tag label was derived using the associated tag relationship (see TagCategory.json for more details). 'Propagated` indicates a tag label was propagated from upstream based on lineage. 'Automated' is used when a tool was used to determine the tag label.",
|
"description": "Label type describes how a tag label was applied. 'Manual' indicates the tag label was applied by a person. 'Derived' indicates a tag label was derived using the associated tag relationship (see TagCategory.json for more details). 'Propagated` indicates a tag label was propagated from upstream based on lineage. 'Automated' is used when a tool was used to determine the tag label.",
|
||||||
|
@ -19,8 +19,8 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.openmetadata.catalog.type.Relationship;
|
import org.openmetadata.catalog.type.Relationship;
|
||||||
import org.openmetadata.catalog.type.TagLabel;
|
import org.openmetadata.catalog.type.TagLabel;
|
||||||
import org.openmetadata.catalog.type.TagLabel.LabelType;
|
import org.openmetadata.catalog.type.TagLabel.LabelType;
|
||||||
import org.openmetadata.catalog.type.TagLabel.Source;
|
|
||||||
import org.openmetadata.catalog.type.TagLabel.State;
|
import org.openmetadata.catalog.type.TagLabel.State;
|
||||||
|
import org.openmetadata.catalog.type.TagLabel.TagSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum ordinal number is stored in the database. New enums must be added at the end to ensure backward compatibility
|
* Enum ordinal number is stored in the database. New enums must be added at the end to ensure backward compatibility
|
||||||
@ -64,7 +64,7 @@ class EnumBackwardCompatibilityTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
void testTagSourceEnumBackwardCompatible() {
|
void testTagSourceEnumBackwardCompatible() {
|
||||||
assertEquals(0, Source.TAG.ordinal());
|
assertEquals(0, TagSource.TAG.ordinal());
|
||||||
assertEquals(1, Source.GLOSSARY.ordinal());
|
assertEquals(1, TagSource.GLOSSARY.ordinal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ import org.openmetadata.catalog.type.MessagingConnection;
|
|||||||
import org.openmetadata.catalog.type.MlModelConnection;
|
import org.openmetadata.catalog.type.MlModelConnection;
|
||||||
import org.openmetadata.catalog.type.PipelineConnection;
|
import org.openmetadata.catalog.type.PipelineConnection;
|
||||||
import org.openmetadata.catalog.type.TagLabel;
|
import org.openmetadata.catalog.type.TagLabel;
|
||||||
import org.openmetadata.catalog.type.TagLabel.Source;
|
import org.openmetadata.catalog.type.TagLabel.TagSource;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public final class TestUtils {
|
public final class TestUtils {
|
||||||
@ -337,7 +337,7 @@ public final class TestUtils {
|
|||||||
EntityUtil.mergeTags(updatedExpectedList, expectedList);
|
EntityUtil.mergeTags(updatedExpectedList, expectedList);
|
||||||
|
|
||||||
for (TagLabel expected : expectedList) {
|
for (TagLabel expected : expectedList) {
|
||||||
if (expected.getSource() == Source.GLOSSARY) {
|
if (expected.getSource() == TagSource.GLOSSARY) {
|
||||||
GlossaryTerm glossaryTerm =
|
GlossaryTerm glossaryTerm =
|
||||||
new GlossaryTermResourceTest().getEntityByName(expected.getTagFQN(), null, "tags", ADMIN_AUTH_HEADERS);
|
new GlossaryTermResourceTest().getEntityByName(expected.getTagFQN(), null, "tags", ADMIN_AUTH_HEADERS);
|
||||||
List<TagLabel> derived = new ArrayList<>();
|
List<TagLabel> derived = new ArrayList<>();
|
||||||
|
@ -41,7 +41,12 @@ from metadata.generated.schema.metadataIngestion.workflow import (
|
|||||||
Source as WorkflowSource,
|
Source as WorkflowSource,
|
||||||
)
|
)
|
||||||
from metadata.generated.schema.type.entityReference import EntityReference
|
from metadata.generated.schema.type.entityReference import EntityReference
|
||||||
from metadata.generated.schema.type.tagLabel import LabelType, Source1, State, TagLabel
|
from metadata.generated.schema.type.tagLabel import (
|
||||||
|
LabelType,
|
||||||
|
State,
|
||||||
|
TagLabel,
|
||||||
|
TagSource,
|
||||||
|
)
|
||||||
from metadata.ingestion.models.ometa_tag_category import OMetaTagAndCategory
|
from metadata.ingestion.models.ometa_tag_category import OMetaTagAndCategory
|
||||||
from metadata.ingestion.ometa.ometa_api import OpenMetadata
|
from metadata.ingestion.ometa.ometa_api import OpenMetadata
|
||||||
from metadata.ingestion.source.database.database_service import (
|
from metadata.ingestion.source.database.database_service import (
|
||||||
|
@ -40,7 +40,12 @@ from metadata.generated.schema.metadataIngestion.workflow import (
|
|||||||
)
|
)
|
||||||
from metadata.generated.schema.type import basic
|
from metadata.generated.schema.type import basic
|
||||||
from metadata.generated.schema.type.basic import EntityName, FullyQualifiedEntityName
|
from metadata.generated.schema.type.basic import EntityName, FullyQualifiedEntityName
|
||||||
from metadata.generated.schema.type.tagLabel import LabelType, Source1, State, TagLabel
|
from metadata.generated.schema.type.tagLabel import (
|
||||||
|
LabelType,
|
||||||
|
State,
|
||||||
|
TagLabel,
|
||||||
|
TagSource,
|
||||||
|
)
|
||||||
from metadata.ingestion.api.source import Source, SourceStatus
|
from metadata.ingestion.api.source import Source, SourceStatus
|
||||||
from metadata.ingestion.api.topology_runner import TopologyRunnerMixin
|
from metadata.ingestion.api.topology_runner import TopologyRunnerMixin
|
||||||
from metadata.ingestion.models.ometa_tag_category import OMetaTagAndCategory
|
from metadata.ingestion.models.ometa_tag_category import OMetaTagAndCategory
|
||||||
@ -314,7 +319,7 @@ class DatabaseServiceSource(DBTMixin, TopologyRunnerMixin, Source, ABC):
|
|||||||
),
|
),
|
||||||
labelType=LabelType.Automated,
|
labelType=LabelType.Automated,
|
||||||
state=State.Suggested,
|
state=State.Suggested,
|
||||||
source=Source1.Tag,
|
source=TagSource.Tag,
|
||||||
)
|
)
|
||||||
for tag_and_category in self.context.tags or []
|
for tag_and_category in self.context.tags or []
|
||||||
if tag_and_category.fqn.__root__ == entity_fqn
|
if tag_and_category.fqn.__root__ == entity_fqn
|
||||||
|
@ -69,7 +69,7 @@ import org.openmetadata.catalog.type.Include;
|
|||||||
import org.openmetadata.catalog.type.Relationship;
|
import org.openmetadata.catalog.type.Relationship;
|
||||||
import org.openmetadata.catalog.type.TagLabel;
|
import org.openmetadata.catalog.type.TagLabel;
|
||||||
import org.openmetadata.catalog.type.TagLabel.LabelType;
|
import org.openmetadata.catalog.type.TagLabel.LabelType;
|
||||||
import org.openmetadata.catalog.type.TagLabel.Source;
|
import org.openmetadata.catalog.type.TagLabel.TagSource;
|
||||||
import org.openmetadata.core.TypeRegistry;
|
import org.openmetadata.core.TypeRegistry;
|
||||||
import org.openmetadata.core.entity.Entity;
|
import org.openmetadata.core.entity.Entity;
|
||||||
import org.openmetadata.core.entity.interfaces.EntityDAO;
|
import org.openmetadata.core.entity.interfaces.EntityDAO;
|
||||||
@ -737,7 +737,7 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
|||||||
|
|
||||||
/** Get tags associated with a given set of tags */
|
/** Get tags associated with a given set of tags */
|
||||||
private List<TagLabel> getDerivedTags(TagLabel tagLabel) {
|
private List<TagLabel> getDerivedTags(TagLabel tagLabel) {
|
||||||
if (tagLabel.getSource() == Source.GLOSSARY) { // Related tags are only supported for Glossary
|
if (tagLabel.getSource() == TagSource.GLOSSARY) { // Related tags are only supported for Glossary
|
||||||
List<TagLabel> derivedTags = daoCollection.tagUsageDAO().getTags(tagLabel.getTagFQN());
|
List<TagLabel> derivedTags = daoCollection.tagUsageDAO().getTags(tagLabel.getTagFQN());
|
||||||
derivedTags.forEach(tag -> tag.setLabelType(LabelType.DERIVED));
|
derivedTags.forEach(tag -> tag.setLabelType(LabelType.DERIVED));
|
||||||
return derivedTags;
|
return derivedTags;
|
||||||
@ -755,14 +755,14 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
|||||||
/** Apply tags {@code tagLabels} to the entity or field identified by {@code targetFQN} */
|
/** Apply tags {@code tagLabels} to the entity or field identified by {@code targetFQN} */
|
||||||
public void applyTags(List<TagLabel> tagLabels, String targetFQN) {
|
public void applyTags(List<TagLabel> tagLabels, String targetFQN) {
|
||||||
for (TagLabel tagLabel : listOrEmpty(tagLabels)) {
|
for (TagLabel tagLabel : listOrEmpty(tagLabels)) {
|
||||||
if (tagLabel.getSource() == Source.TAG) {
|
if (tagLabel.getSource() == TagSource.TAG) {
|
||||||
Tag tag = daoCollection.tagDAO().findEntityByName(tagLabel.getTagFQN());
|
Tag tag = daoCollection.tagDAO().findEntityByName(tagLabel.getTagFQN());
|
||||||
tagLabel.withDescription(tag.getDescription());
|
tagLabel.withDescription(tag.getDescription());
|
||||||
tagLabel.setSource(Source.TAG);
|
tagLabel.setSource(TagSource.TAG);
|
||||||
} else if (tagLabel.getSource() == Source.GLOSSARY) {
|
} else if (tagLabel.getSource() == TagSource.GLOSSARY) {
|
||||||
GlossaryTerm term = daoCollection.glossaryTermDAO().findEntityByName(tagLabel.getTagFQN(), NON_DELETED);
|
GlossaryTerm term = daoCollection.glossaryTermDAO().findEntityByName(tagLabel.getTagFQN(), NON_DELETED);
|
||||||
tagLabel.withDescription(term.getDescription());
|
tagLabel.withDescription(term.getDescription());
|
||||||
tagLabel.setSource(Source.GLOSSARY);
|
tagLabel.setSource(TagSource.GLOSSARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply tagLabel to targetFQN that identifies an entity or field
|
// Apply tagLabel to targetFQN that identifies an entity or field
|
||||||
|
@ -1445,7 +1445,7 @@ public interface CollectionDAO {
|
|||||||
String description1 = r.getString("description1");
|
String description1 = r.getString("description1");
|
||||||
String description2 = r.getString("description2");
|
String description2 = r.getString("description2");
|
||||||
return new TagLabel()
|
return new TagLabel()
|
||||||
.withSource(TagLabel.Source.values()[r.getInt("source")])
|
.withSource(TagLabel.TagSource.values()[r.getInt("source")])
|
||||||
.withLabelType(TagLabel.LabelType.values()[r.getInt("labelType")])
|
.withLabelType(TagLabel.LabelType.values()[r.getInt("labelType")])
|
||||||
.withState(TagLabel.State.values()[r.getInt("state")])
|
.withState(TagLabel.State.values()[r.getInt("state")])
|
||||||
.withTagFQN(r.getString("tagFQN"))
|
.withTagFQN(r.getString("tagFQN"))
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
"tagFQN": {
|
"tagFQN": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"maxLength": 45
|
"maxLength": 45
|
||||||
|
},
|
||||||
|
"TagSource": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "Tag",
|
||||||
|
"enum": ["Tag", "Glossary"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
@ -21,9 +26,7 @@
|
|||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"description": "Label is from Tags or Glossary.",
|
"description": "Label is from Tags or Glossary.",
|
||||||
"type": "string",
|
"$ref": "#/definitions/TagSource"
|
||||||
"enum": ["Tag", "Glossary"],
|
|
||||||
"default": "Tag"
|
|
||||||
},
|
},
|
||||||
"labelType": {
|
"labelType": {
|
||||||
"description": "Label type describes how a tag label was applied. 'Manual' indicates the tag label was applied by a person. 'Derived' indicates a tag label was derived using the associated tag relationship (see TagCategory.json for more details). 'Propagated` indicates a tag label was propagated from upstream based on lineage. 'Automated' is used when a tool was used to determine the tag label.",
|
"description": "Label type describes how a tag label was applied. 'Manual' indicates the tag label was applied by a person. 'Derived' indicates a tag label was derived using the associated tag relationship (see TagCategory.json for more details). 'Propagated` indicates a tag label was propagated from upstream based on lineage. 'Automated' is used when a tool was used to determine the tag label.",
|
||||||
|
@ -27,7 +27,7 @@ import {
|
|||||||
import { Glossary } from '../../generated/entity/data/glossary';
|
import { Glossary } from '../../generated/entity/data/glossary';
|
||||||
import { Operation } from '../../generated/entity/policies/policy';
|
import { Operation } from '../../generated/entity/policies/policy';
|
||||||
import { EntityReference } from '../../generated/type/entityReference';
|
import { EntityReference } from '../../generated/type/entityReference';
|
||||||
import { LabelType, Source, State } from '../../generated/type/tagLabel';
|
import { LabelType, State, TagSource } from '../../generated/type/tagLabel';
|
||||||
import { useAuth } from '../../hooks/authHooks';
|
import { useAuth } from '../../hooks/authHooks';
|
||||||
import jsonData from '../../jsons/en';
|
import jsonData from '../../jsons/en';
|
||||||
import { getEntityName, hasEditAccess } from '../../utils/CommonUtils';
|
import { getEntityName, hasEditAccess } from '../../utils/CommonUtils';
|
||||||
@ -111,7 +111,7 @@ const GlossaryDetails = ({ isHasAccess, glossary, updateGlossary }: props) => {
|
|||||||
.map((tag) => ({
|
.map((tag) => ({
|
||||||
labelType: LabelType.Manual,
|
labelType: LabelType.Manual,
|
||||||
state: State.Confirmed,
|
state: State.Confirmed,
|
||||||
source: Source.Tag,
|
source: TagSource.Tag,
|
||||||
tagFQN: tag,
|
tagFQN: tag,
|
||||||
}));
|
}));
|
||||||
const updatedTags = [...prevTags, ...newTags];
|
const updatedTags = [...prevTags, ...newTags];
|
||||||
|
@ -31,7 +31,7 @@ import {
|
|||||||
TermReference,
|
TermReference,
|
||||||
} from '../../generated/entity/data/glossaryTerm';
|
} from '../../generated/entity/data/glossaryTerm';
|
||||||
import { EntityReference } from '../../generated/entity/type';
|
import { EntityReference } from '../../generated/entity/type';
|
||||||
import { LabelType, Source, State } from '../../generated/type/tagLabel';
|
import { LabelType, State, TagSource } from '../../generated/type/tagLabel';
|
||||||
import jsonData from '../../jsons/en';
|
import jsonData from '../../jsons/en';
|
||||||
import { getEntityName } from '../../utils/CommonUtils';
|
import { getEntityName } from '../../utils/CommonUtils';
|
||||||
import SVGIcons, { Icons } from '../../utils/SvgUtils';
|
import SVGIcons, { Icons } from '../../utils/SvgUtils';
|
||||||
@ -187,7 +187,7 @@ const GlossaryTermsV1 = ({
|
|||||||
.map((tag) => ({
|
.map((tag) => ({
|
||||||
labelType: LabelType.Manual,
|
labelType: LabelType.Manual,
|
||||||
state: State.Confirmed,
|
state: State.Confirmed,
|
||||||
source: Source.Tag,
|
source: TagSource.Tag,
|
||||||
tagFQN: tag,
|
tagFQN: tag,
|
||||||
}));
|
}));
|
||||||
const updatedTags = [...prevTags, ...newTags];
|
const updatedTags = [...prevTags, ...newTags];
|
||||||
|
@ -19,9 +19,9 @@ import {
|
|||||||
Column,
|
Column,
|
||||||
DataType,
|
DataType,
|
||||||
LabelType,
|
LabelType,
|
||||||
Source,
|
|
||||||
State,
|
State,
|
||||||
Table,
|
Table,
|
||||||
|
TagSource,
|
||||||
} from '../../generated/entity/data/table';
|
} from '../../generated/entity/data/table';
|
||||||
import SchemaTab from './SchemaTab.component';
|
import SchemaTab from './SchemaTab.component';
|
||||||
const mockColumns: Column[] = [
|
const mockColumns: Column[] = [
|
||||||
@ -34,13 +34,13 @@ const mockColumns: Column[] = [
|
|||||||
{
|
{
|
||||||
tagFQN: 'string',
|
tagFQN: 'string',
|
||||||
labelType: LabelType.Manual,
|
labelType: LabelType.Manual,
|
||||||
source: Source.Tag,
|
source: TagSource.Tag,
|
||||||
state: State.Confirmed,
|
state: State.Confirmed,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tagFQN: 'string2',
|
tagFQN: 'string2',
|
||||||
labelType: LabelType.Derived,
|
labelType: LabelType.Derived,
|
||||||
source: Source.Tag,
|
source: TagSource.Tag,
|
||||||
state: State.Confirmed,
|
state: State.Confirmed,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -18,7 +18,7 @@ import { EntityTags, TagOption } from 'Models';
|
|||||||
import React, { Fragment, FunctionComponent, useEffect, useState } from 'react';
|
import React, { Fragment, FunctionComponent, useEffect, useState } from 'react';
|
||||||
import AsyncSelect from 'react-select/async';
|
import AsyncSelect from 'react-select/async';
|
||||||
import { FQN_SEPARATOR_CHAR } from '../../constants/char.constants';
|
import { FQN_SEPARATOR_CHAR } from '../../constants/char.constants';
|
||||||
import { Source } from '../../generated/type/tagLabel';
|
import { TagSource } from '../../generated/type/tagLabel';
|
||||||
import { withLoader } from '../../hoc/withLoader';
|
import { withLoader } from '../../hoc/withLoader';
|
||||||
import { Button } from '../buttons/Button/Button';
|
import { Button } from '../buttons/Button/Button';
|
||||||
import Tags from '../tags/tags';
|
import Tags from '../tags/tags';
|
||||||
@ -109,7 +109,7 @@ const TagsContainer: FunctionComponent<TagsContainerProps> = ({
|
|||||||
removeTag={(_e, removedTag: string) => {
|
removeTag={(_e, removedTag: string) => {
|
||||||
handleTagRemoval(removedTag, index);
|
handleTagRemoval(removedTag, index);
|
||||||
}}
|
}}
|
||||||
showOnlyName={tag.source === Source.Glossary}
|
showOnlyName={tag.source === TagSource.Glossary}
|
||||||
tag={tag}
|
tag={tag}
|
||||||
type="border"
|
type="border"
|
||||||
/>
|
/>
|
||||||
|
@ -16,7 +16,7 @@ import { isNil } from 'lodash';
|
|||||||
import { EntityTags } from 'Models';
|
import { EntityTags } from 'Models';
|
||||||
import React, { Fragment, FunctionComponent } from 'react';
|
import React, { Fragment, FunctionComponent } from 'react';
|
||||||
import { LIST_SIZE } from '../../constants/constants';
|
import { LIST_SIZE } from '../../constants/constants';
|
||||||
import { Source } from '../../generated/type/tagLabel';
|
import { TagSource } from '../../generated/type/tagLabel';
|
||||||
import PopOver from '../common/popover/PopOver';
|
import PopOver from '../common/popover/PopOver';
|
||||||
import Tags from '../tags/tags';
|
import Tags from '../tags/tags';
|
||||||
import { TagsViewerProps } from './tags-viewer.interface';
|
import { TagsViewerProps } from './tags-viewer.interface';
|
||||||
@ -39,7 +39,7 @@ const TagsViewer: FunctionComponent<TagsViewerProps> = ({
|
|||||||
{ 'diff-added tw-mx-1': tag?.added },
|
{ 'diff-added tw-mx-1': tag?.added },
|
||||||
{ 'diff-removed': tag?.removed }
|
{ 'diff-removed': tag?.removed }
|
||||||
)}
|
)}
|
||||||
showOnlyName={tag.source === Source.Glossary}
|
showOnlyName={tag.source === TagSource.Glossary}
|
||||||
startWith={showStartWith ? '#' : undefined}
|
startWith={showStartWith ? '#' : undefined}
|
||||||
tag={tag}
|
tag={tag}
|
||||||
type={type}
|
type={type}
|
||||||
|
@ -18,9 +18,9 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { getTagSuggestions } from '../../../axiosAPIs/miscAPI';
|
import { getTagSuggestions } from '../../../axiosAPIs/miscAPI';
|
||||||
import {
|
import {
|
||||||
LabelType,
|
LabelType,
|
||||||
Source,
|
|
||||||
State,
|
State,
|
||||||
TagLabel,
|
TagLabel,
|
||||||
|
TagSource,
|
||||||
} from '../../../generated/type/tagLabel';
|
} from '../../../generated/type/tagLabel';
|
||||||
import { showErrorToast } from '../../../utils/ToastUtils';
|
import { showErrorToast } from '../../../utils/ToastUtils';
|
||||||
|
|
||||||
@ -84,8 +84,8 @@ const TagSuggestion: React.FC<Props> = ({ onChange, selectedTags }) => {
|
|||||||
labelType: LabelType.Manual,
|
labelType: LabelType.Manual,
|
||||||
state: State.Suggested,
|
state: State.Suggested,
|
||||||
source: isEqual(value['data-sourceType'], 'tag')
|
source: isEqual(value['data-sourceType'], 'tag')
|
||||||
? Source.Tag
|
? TagSource.Tag
|
||||||
: Source.Glossary,
|
: TagSource.Glossary,
|
||||||
tagFQN: value.value,
|
tagFQN: value.value,
|
||||||
}));
|
}));
|
||||||
onChange(newTags);
|
onChange(newTags);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user