mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-30 01:23:08 +00:00
Merge pull request #1449 from open-metadata/issue1447
This commit is contained in:
commit
b5f3952843
@ -442,7 +442,7 @@ public abstract class EntityRepository<T> {
|
||||
entitySpecificUpdate();
|
||||
|
||||
// Store the updated entity
|
||||
store();
|
||||
storeUpdate();
|
||||
}
|
||||
|
||||
public void entitySpecificUpdate() throws IOException {
|
||||
@ -588,7 +588,7 @@ public abstract class EntityRepository<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public final void store() throws IOException, ParseException {
|
||||
public final void storeUpdate() throws IOException, ParseException {
|
||||
if (updateVersion(original.getVersion())) {
|
||||
// Store the old version
|
||||
String extensionName = EntityUtil.getVersionExtension(entityName, original.getVersion());
|
||||
|
||||
@ -349,7 +349,6 @@ public class TableRepository extends EntityRepository<Table> {
|
||||
// Add column level tags by adding tag to column relationship
|
||||
for (Column column : columns) {
|
||||
EntityUtil.applyTags(dao.tagDAO(), column.getTags(), column.getFullyQualifiedName());
|
||||
column.setTags(getTags(column.getFullyQualifiedName())); // Update tag list to handle derived tags
|
||||
if (column.getChildren() != null) {
|
||||
applyTags(column.getChildren());
|
||||
}
|
||||
@ -359,7 +358,6 @@ public class TableRepository extends EntityRepository<Table> {
|
||||
private void applyTags(Table table) throws IOException {
|
||||
// Add table level tags by adding tag to table relationship
|
||||
EntityUtil.applyTags(dao.tagDAO(), table.getTags(), table.getFullyQualifiedName());
|
||||
table.setTags(getTags(table.getFullyQualifiedName())); // Update tag to handle additional derived tags
|
||||
applyTags(table.getColumns());
|
||||
}
|
||||
|
||||
@ -741,7 +739,7 @@ public class TableRepository extends EntityRepository<Table> {
|
||||
// Delete tags related to deleted columns
|
||||
deletedColumns.forEach(deleted -> EntityUtil.removeTags(dao.tagDAO(), deleted.getFullyQualifiedName()));
|
||||
|
||||
// Add tags related to deleted columns
|
||||
// Add tags related to newly added columns
|
||||
for (Column added : addedColumns) {
|
||||
EntityUtil.applyTags(dao.tagDAO(), added.getTags(), added.getFullyQualifiedName());
|
||||
}
|
||||
@ -755,8 +753,8 @@ public class TableRepository extends EntityRepository<Table> {
|
||||
}
|
||||
|
||||
updateColumnDescription(stored, updated);
|
||||
updateTags(stored.getFullyQualifiedName(), fieldName + "." + updated.getName() + ".tags", stored.getTags(),
|
||||
updated.getTags());
|
||||
updateTags(stored.getFullyQualifiedName(), fieldName + "." + updated.getName() + ".tags",
|
||||
stored.getTags(), updated.getTags());
|
||||
updateColumnConstraint(stored, updated);
|
||||
|
||||
if (updated.getChildren() != null && stored.getChildren() != null) {
|
||||
@ -765,9 +763,7 @@ public class TableRepository extends EntityRepository<Table> {
|
||||
}
|
||||
}
|
||||
|
||||
if (!deletedColumns.isEmpty()) {
|
||||
majorVersionChange = true;
|
||||
}
|
||||
majorVersionChange = !deletedColumns.isEmpty();
|
||||
}
|
||||
|
||||
private void updateColumnDescription(Column origColumn, Column updatedColumn) throws JsonProcessingException {
|
||||
|
||||
@ -91,8 +91,7 @@ public final class EntityUtil {
|
||||
public static BiPredicate<Task, Task> taskMatch = (task1, task2) ->
|
||||
task1.getName().equals(task2.getName());
|
||||
|
||||
public static BiPredicate<String, String> stringMatch = (string1, string2) ->
|
||||
string1.equals(string2);
|
||||
public static BiPredicate<String, String> stringMatch = String::equals;
|
||||
|
||||
public static BiPredicate<Column, Column> columnMatch = (column1, column2) ->
|
||||
column1.getName().equals(column2.getName()) &&
|
||||
@ -285,10 +284,6 @@ public final class EntityUtil {
|
||||
// Apply tagLabel to targetFQN that identifies an entity or field
|
||||
tagDAO.applyTag(tagLabel.getTagFQN(), targetFQN, tagLabel.getLabelType().ordinal(),
|
||||
tagLabel.getState().ordinal());
|
||||
|
||||
// Apply derived tags
|
||||
List<TagLabel> derivedTags = getDerivedTags(tagDAO, tagLabel, tag);
|
||||
applyTags(tagDAO, derivedTags, targetFQN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -646,7 +646,6 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest {
|
||||
protected final T createAndCheckEntity(Object create, Map<String, String> authHeaders) throws IOException {
|
||||
// Validate an entity that is created has all the information set in create request
|
||||
String updatedBy = TestUtils.getPrincipal(authHeaders);
|
||||
// aqui si que tenim HREF
|
||||
T entity = createEntity(create, authHeaders);
|
||||
EntityInterface<T> entityInterface = getEntityInterface(entity);
|
||||
|
||||
|
||||
@ -119,11 +119,7 @@ public class TableResourceTest extends EntityResourceTest<Table> {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TableResourceTest.class);
|
||||
public static Database DATABASE;
|
||||
|
||||
public static final List<Column> COLUMNS = Arrays.asList(
|
||||
getColumn("c1", BIGINT, USER_ADDRESS_TAG_LABEL),
|
||||
getColumn("c2", ColumnDataType.VARCHAR, USER_ADDRESS_TAG_LABEL).withDataLength(10),
|
||||
getColumn("c3", BIGINT, USER_BANK_ACCOUNT_TAG_LABEL));
|
||||
|
||||
public static List<Column> COLUMNS;
|
||||
|
||||
public TableResourceTest() {
|
||||
super(Entity.TABLE, Table.class, TableList.class, "tables", TableResource.FIELDS,
|
||||
@ -135,6 +131,11 @@ public class TableResourceTest extends EntityResourceTest<Table> {
|
||||
EntityResourceTest.setup(test);
|
||||
CreateDatabase create = DatabaseResourceTest.create(test).withService(SNOWFLAKE_REFERENCE);
|
||||
DATABASE = createAndCheckDatabase(create, adminAuthHeaders());
|
||||
|
||||
COLUMNS = Arrays.asList(
|
||||
getColumn("c1", BIGINT, USER_ADDRESS_TAG_LABEL),
|
||||
getColumn("c2", ColumnDataType.VARCHAR, USER_ADDRESS_TAG_LABEL).withDataLength(10),
|
||||
getColumn("c3", BIGINT, USER_BANK_ACCOUNT_TAG_LABEL));
|
||||
}
|
||||
|
||||
public static Table createTable(TestInfo test, int i) throws IOException {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user