Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

419 lines
15 KiB
Java
Raw Normal View History

/*
* Copyright 2021 Collate
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openmetadata.csv;
import static org.openmetadata.common.utils.CommonUtil.listOf;
import static org.openmetadata.common.utils.CommonUtil.listOrEmpty;
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
import java.util.Collections;
import java.util.List;
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
import java.util.Map;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVFormat.Builder;
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.csv.CSVRecord;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.schema.type.TagLabel;
import org.openmetadata.schema.type.csv.CsvFile;
import org.openmetadata.schema.type.csv.CsvHeader;
public final class CsvUtil {
public static final String SEPARATOR = ",";
public static final String FIELD_SEPARATOR = ";";
Issue #17012: Multi User/Team Ownership (#17013) * Add multiple owners * Multi Ownership * Issue #17012: Multi User/Team Ownership * Issue #17012: Multi User/Team Ownership * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 1 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 2 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 3 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 4 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 5 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 6 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 7 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 8 * Add Migrations for Owner Thread * update ingestion for multi owner * fix pytests * fixed checkstyle * Add Alert Name to Publishers (#17108) * Add Alert Name to Publishers * Fix Test * Add Bound to Setuptools (#17105) * Minor: fixed testSummaryGraph issue (#17115) * feat: updated multi pipeline ui as per new mock (#17106) * feat: updated multi pipeline ui as per new mock * translation sync * fixed failing unit test * fixed playwright test * fixed viewService click issue * sorted pipeline based on test case length * Added domo federated dataset support (#17061) * fix usernames (#17122) * Doc: Updated Doris & Redshift Docs (#17123) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * Fix #12677: Added Synapse Connector - docs and side docs (#17041) * Fix #17098: Fixed case sensitive partition column name in Bigquery (#17104) * Fixed case sensitive partiion col name bigquery * update test * #13876: change placement of comment and close button in task approval workflow (#17044) * change placment of comment and close button in task approval workflow * minor change * playwright test for the close and comment function * supported ref in activityFeedEditor * fix playwright test * added playwright test for data steward * fix the test for the data streward user * fix the close button not showing if task has no suggestions and icon fixes * fix sonar issue * change glossary and add suggestion button to dropdown button * fix the glossary failure due to button change * icon change for add tag and description * fix glossary cypress failure due to button chnages * changes as per comments * MINOR: docs links fix (#17125) * alation link fix * dbt yaml config source link fix * bigquery doc fix * Explore tree feedbacks (#17078) * fix explore design * update switcher icon * show menu when search query exists * fix selection of active service * fix type error * fix tests * fix tests * fix tests * MINOR: Databricks view TableType fix (#17124) * Minor: fixed AUT test (#17128) * Fix #16692: Override Lineage Support for View & Dashboard Lineage (#17064) * #17065: fix the tags not rendering in selector after selection in edit tags task (#17107) * fix the tags not rendering in selector after selection in edit tags taks * added playwright test * minor changes * minor fix * fix the tags not updating in edit and accept tag * fix explore type changes for collate (#17131) * MINOR: changed log level to debug (#17126) * changed log level to debug * fixed type * changed type to optional * Get feed and count data of soft deleted user (#17135) * Doc: Adding OIDC Docs (#17139) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * Doc: Updating Profiler Workflow Docs URL (#17140) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * fix playwright and cypress (#17138) * Minor: fixed edit modal issue for sql test case (#17132) * Minor: fixed edit modal issue for sql test case * fixed test * Minor: Added whats new content for 1.4.6 release (#17148) * MINOR [GEN-799]: add option to disable manual trigger using scheduleType (#17031) * fix: raise for triggering system app * added scheduleType ScheduledOrManual * minor: remove "service" field from required properties in createAPIEndpoint schema (#17147) * initial commit multi ownership * update glossary and other entities * update owners * fix version pages * fix tests * Update entity_extension to move owner to array (#17200) * fix tests * fix api page errors * fix owner label design * locales * fix owners in elastic search source * fix types * fix tests * fix tests * Updated CustomMetric owner to entityReferenceList. (#17211) * Fix owners field in search mappings * fix search aggregates * fix inherited label * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 9 * Fix QUeries * Fix Mysql Queries * Typo * fix tests * fix tests * fix tests * fix advanced search constants * fix service ingestion tests * fix tests --------- Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com> Co-authored-by: Ayush Shah <ayush@getcollate.io> Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com> Co-authored-by: k.nakagaki <141020064+nakaken-churadata@users.noreply.github.com> Co-authored-by: Prajwal214 <167504578+Prajwal214@users.noreply.github.com> Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> Co-authored-by: Suman Maharana <sumanmaharana786@gmail.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: harshsoni2024 <64592571+harshsoni2024@users.noreply.github.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com> Co-authored-by: Mayur Singal <39544459+ulixius9@users.noreply.github.com> Co-authored-by: Imri Paran <imri.paran@gmail.com> Co-authored-by: sonika-shah <58761340+sonika-shah@users.noreply.github.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com> Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Siddhant <86899184+Siddhanttimeline@users.noreply.github.com>
2024-07-29 23:06:39 -07:00
public static final String ENTITY_TYPE_SEPARATOR = ":";
public static final String LINE_SEPARATOR = "\r\n";
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
public static final String INTERNAL_ARRAY_SEPARATOR = "|";
private CsvUtil() {
// Utility class hides the constructor
}
public static String formatCsv(CsvFile csvFile) throws IOException {
// CSV file is generated by the backend and the data exported is expected to be correct. Hence,
// no validation
StringWriter writer = new StringWriter();
List<String> headers = getHeaders(csvFile.getHeaders());
CSVFormat csvFormat =
Builder.create(CSVFormat.DEFAULT).setHeader(headers.toArray(new String[0])).build();
try (CSVPrinter printer = new CSVPrinter(writer, csvFormat)) {
for (List<String> csvRecord : listOrEmpty(csvFile.getRecords())) {
printer.printRecord(csvRecord);
}
}
return writer.toString();
}
2023-04-11 20:00:45 -07:00
/** Get headers from CsvHeaders */
public static List<String> getHeaders(List<CsvHeader> csvHeaders) {
List<String> headers = new ArrayList<>();
for (CsvHeader header : csvHeaders) {
String headerString = header.getName();
if (Boolean.TRUE.equals(header.getRequired()))
headerString = String.format("%s*", header.getName());
headers.add(headerString);
}
return headers;
}
public static String recordToString(CSVRecord csvRecord) {
return recordToString(csvRecord.toList());
}
public static String recordToString(List<String> fields) {
return nullOrEmpty(fields)
? ""
: fields.stream().map(CsvUtil::quoteCsvField).collect(Collectors.joining(SEPARATOR));
}
public static String recordToString(String[] fields) {
return recordToString(Arrays.asList(fields));
}
public static List<String> fieldToStrings(String field) {
// Split a field that contains multiple strings separated by FIELD_SEPARATOR
return field == null || field.isBlank() ? null : listOf(field.split(FIELD_SEPARATOR));
}
Issue #17012: Multi User/Team Ownership (#17013) * Add multiple owners * Multi Ownership * Issue #17012: Multi User/Team Ownership * Issue #17012: Multi User/Team Ownership * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 1 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 2 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 3 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 4 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 5 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 6 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 7 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 8 * Add Migrations for Owner Thread * update ingestion for multi owner * fix pytests * fixed checkstyle * Add Alert Name to Publishers (#17108) * Add Alert Name to Publishers * Fix Test * Add Bound to Setuptools (#17105) * Minor: fixed testSummaryGraph issue (#17115) * feat: updated multi pipeline ui as per new mock (#17106) * feat: updated multi pipeline ui as per new mock * translation sync * fixed failing unit test * fixed playwright test * fixed viewService click issue * sorted pipeline based on test case length * Added domo federated dataset support (#17061) * fix usernames (#17122) * Doc: Updated Doris & Redshift Docs (#17123) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * Fix #12677: Added Synapse Connector - docs and side docs (#17041) * Fix #17098: Fixed case sensitive partition column name in Bigquery (#17104) * Fixed case sensitive partiion col name bigquery * update test * #13876: change placement of comment and close button in task approval workflow (#17044) * change placment of comment and close button in task approval workflow * minor change * playwright test for the close and comment function * supported ref in activityFeedEditor * fix playwright test * added playwright test for data steward * fix the test for the data streward user * fix the close button not showing if task has no suggestions and icon fixes * fix sonar issue * change glossary and add suggestion button to dropdown button * fix the glossary failure due to button change * icon change for add tag and description * fix glossary cypress failure due to button chnages * changes as per comments * MINOR: docs links fix (#17125) * alation link fix * dbt yaml config source link fix * bigquery doc fix * Explore tree feedbacks (#17078) * fix explore design * update switcher icon * show menu when search query exists * fix selection of active service * fix type error * fix tests * fix tests * fix tests * MINOR: Databricks view TableType fix (#17124) * Minor: fixed AUT test (#17128) * Fix #16692: Override Lineage Support for View & Dashboard Lineage (#17064) * #17065: fix the tags not rendering in selector after selection in edit tags task (#17107) * fix the tags not rendering in selector after selection in edit tags taks * added playwright test * minor changes * minor fix * fix the tags not updating in edit and accept tag * fix explore type changes for collate (#17131) * MINOR: changed log level to debug (#17126) * changed log level to debug * fixed type * changed type to optional * Get feed and count data of soft deleted user (#17135) * Doc: Adding OIDC Docs (#17139) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * Doc: Updating Profiler Workflow Docs URL (#17140) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * fix playwright and cypress (#17138) * Minor: fixed edit modal issue for sql test case (#17132) * Minor: fixed edit modal issue for sql test case * fixed test * Minor: Added whats new content for 1.4.6 release (#17148) * MINOR [GEN-799]: add option to disable manual trigger using scheduleType (#17031) * fix: raise for triggering system app * added scheduleType ScheduledOrManual * minor: remove "service" field from required properties in createAPIEndpoint schema (#17147) * initial commit multi ownership * update glossary and other entities * update owners * fix version pages * fix tests * Update entity_extension to move owner to array (#17200) * fix tests * fix api page errors * fix owner label design * locales * fix owners in elastic search source * fix types * fix tests * fix tests * Updated CustomMetric owner to entityReferenceList. (#17211) * Fix owners field in search mappings * fix search aggregates * fix inherited label * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 9 * Fix QUeries * Fix Mysql Queries * Typo * fix tests * fix tests * fix tests * fix advanced search constants * fix service ingestion tests * fix tests --------- Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com> Co-authored-by: Ayush Shah <ayush@getcollate.io> Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com> Co-authored-by: k.nakagaki <141020064+nakaken-churadata@users.noreply.github.com> Co-authored-by: Prajwal214 <167504578+Prajwal214@users.noreply.github.com> Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> Co-authored-by: Suman Maharana <sumanmaharana786@gmail.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: harshsoni2024 <64592571+harshsoni2024@users.noreply.github.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com> Co-authored-by: Mayur Singal <39544459+ulixius9@users.noreply.github.com> Co-authored-by: Imri Paran <imri.paran@gmail.com> Co-authored-by: sonika-shah <58761340+sonika-shah@users.noreply.github.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com> Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Siddhant <86899184+Siddhanttimeline@users.noreply.github.com>
2024-07-29 23:06:39 -07:00
public static List<String> fieldToEntities(String field) {
// Split a field that contains multiple strings separated by FIELD_SEPARATOR
return field == null ? null : listOf(field.split(ENTITY_TYPE_SEPARATOR));
}
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
public static List<String> fieldToInternalArray(String field) {
// Split a fieldValue that contains multiple elements of an array separated by
// INTERNAL_ARRAY_SEPARATOR
if (field == null || field.isBlank()) {
return Collections.emptyList();
}
return listOf(field.split(Pattern.quote(INTERNAL_ARRAY_SEPARATOR)));
}
/**
* Parses a field containing key-value pairs separated by FIELD_SEPARATOR, correctly handling quotes.
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
* Each key-value pair may also be enclosed in quotes, especially if it contains delimiter like (SEPARATOR , FIELD_SEPARATOR).
* Input Example:
* "key1:value1;key2:value2;\"key3:value;with;semicolon\""
* Output: [key1:value1, key2:value2, key3:value;with;semicolon]
*
*/
public static List<String> fieldToExtensionStrings(String field) throws IOException {
if (field == null || field.isBlank()) {
return List.of();
}
// Case when semicolon is part of the fieldValue - Replace semicolons within quoted strings with
// a placeholder
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
String preprocessedField =
Pattern.compile("\"([^\"]*)\"") // Matches content inside double quotes
.matcher(field)
.replaceAll(mr -> "\"" + mr.group(1).replace(";", "__SEMICOLON__") + "\"");
preprocessedField = preprocessedField.replace("\n", "\\n").replace("\"", "\\\"");
CSVFormat format =
CSVFormat.DEFAULT
.withDelimiter(';')
.withQuote('"')
.withRecordSeparator(null)
.withIgnoreSurroundingSpaces(true)
.withIgnoreEmptyLines(true)
.withEscape('\\'); // Use backslash for escaping special characters
try (CSVParser parser = CSVParser.parse(new StringReader(preprocessedField), format)) {
return parser.getRecords().stream()
.flatMap(CSVRecord::stream)
.map(
value ->
value.replace("__SEMICOLON__", ";")) // Restore original semicolons and newlines
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
.map(
value ->
value.startsWith("\"") && value.endsWith("\"") // Remove outer quotes if present
? value.substring(1, value.length() - 1)
: value)
.toList();
}
}
/**
* Parses a field containing column values separated by SEPARATOR, correctly handling quotes.
* Each value enclosed in quotes, especially if it contains delimiter like SEPARATOR.
* Input Example:
* "value1,value2,\"value,with,comma\""
* Output: [value1, value2, value,with,comma]
*
*/
public static List<String> fieldToColumns(String field) throws IOException {
if (field == null || field.isBlank()) {
return Collections.emptyList();
}
// Case when comma is part of the columnValue - Replace commas within quoted strings with a
// placeholder
String preprocessedField =
Pattern.compile("\"([^\"]*)\"")
.matcher(field)
.replaceAll(mr -> "\"" + mr.group(1).replace(",", "__COMMA__") + "\"");
preprocessedField = preprocessedField.replace("\n", "\\n").replace("\"", "\\\"");
CSVFormat format = CSVFormat.DEFAULT.withDelimiter(',').withQuote('"').withEscape('\\');
List<String> columns;
try (CSVParser parser = CSVParser.parse(new StringReader(preprocessedField), format)) {
columns =
parser.getRecords().stream()
.flatMap(CSVRecord::stream)
.map(value -> value.replace("__COMMA__", ","))
.map(
value ->
value.startsWith("\"")
&& value.endsWith("\"") // Remove outer quotes if present
? value.substring(1, value.length() - 1)
: value)
.collect(Collectors.toList());
}
return columns;
}
public static String quote(String field) {
return String.format("\"%s\"", field);
}
/** Quote a CSV field made of multiple strings that has SEPARATOR or FIELD_SEPARATOR with " " */
public static String quoteField(List<String> field) {
return nullOrEmpty(field)
? ""
: field.stream().map(CsvUtil::quoteCsvField).collect(Collectors.joining(FIELD_SEPARATOR));
}
public static void addField(List<String> csvRecord, Boolean field) {
csvRecord.add(field == null ? "" : field.toString());
}
public static List<String> addField(List<String> csvRecord, String field) {
csvRecord.add(field);
return csvRecord;
}
public static List<String> addFieldList(List<String> csvRecord, List<String> field) {
csvRecord.add(quoteField(field));
return csvRecord;
}
public static List<String> addEntityReferences(
List<String> csvRecord, List<EntityReference> refs) {
csvRecord.add(
nullOrEmpty(refs)
? null
: refs.stream()
.map(EntityReference::getFullyQualifiedName)
.collect(Collectors.joining(FIELD_SEPARATOR)));
return csvRecord;
}
public static List<String> addEntityReference(List<String> csvRecord, EntityReference ref) {
csvRecord.add(nullOrEmpty(ref) ? null : ref.getFullyQualifiedName());
return csvRecord;
}
public static List<String> addTagLabels(List<String> csvRecord, List<TagLabel> tags) {
csvRecord.add(
nullOrEmpty(tags)
? null
: tags.stream()
.filter(
tagLabel ->
tagLabel.getSource().equals(TagLabel.TagSource.CLASSIFICATION)
&& !tagLabel.getTagFQN().split("\\.")[0].equals("Tier")
&& !tagLabel.getLabelType().equals(TagLabel.LabelType.DERIVED))
.map(TagLabel::getTagFQN)
.collect(Collectors.joining(FIELD_SEPARATOR)));
return csvRecord;
}
public static List<String> addGlossaryTerms(List<String> csvRecord, List<TagLabel> tags) {
csvRecord.add(
nullOrEmpty(tags)
? null
: tags.stream()
.filter(
tagLabel ->
tagLabel.getSource().equals(TagLabel.TagSource.GLOSSARY)
&& !tagLabel.getTagFQN().split("\\.")[0].equals("Tier"))
.map(TagLabel::getTagFQN)
.collect(Collectors.joining(FIELD_SEPARATOR)));
return csvRecord;
}
public static List<String> addTagTiers(List<String> csvRecord, List<TagLabel> tags) {
csvRecord.add(
nullOrEmpty(tags)
? null
: tags.stream()
.filter(
tagLabel ->
tagLabel.getSource().equals(TagLabel.TagSource.CLASSIFICATION)
&& tagLabel.getTagFQN().split("\\.")[0].equals("Tier"))
.map(TagLabel::getTagFQN)
.collect(Collectors.joining(FIELD_SEPARATOR)));
return csvRecord;
}
Issue #17012: Multi User/Team Ownership (#17013) * Add multiple owners * Multi Ownership * Issue #17012: Multi User/Team Ownership * Issue #17012: Multi User/Team Ownership * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 1 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 2 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 3 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 4 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 5 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 6 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 7 * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 8 * Add Migrations for Owner Thread * update ingestion for multi owner * fix pytests * fixed checkstyle * Add Alert Name to Publishers (#17108) * Add Alert Name to Publishers * Fix Test * Add Bound to Setuptools (#17105) * Minor: fixed testSummaryGraph issue (#17115) * feat: updated multi pipeline ui as per new mock (#17106) * feat: updated multi pipeline ui as per new mock * translation sync * fixed failing unit test * fixed playwright test * fixed viewService click issue * sorted pipeline based on test case length * Added domo federated dataset support (#17061) * fix usernames (#17122) * Doc: Updated Doris & Redshift Docs (#17123) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * Fix #12677: Added Synapse Connector - docs and side docs (#17041) * Fix #17098: Fixed case sensitive partition column name in Bigquery (#17104) * Fixed case sensitive partiion col name bigquery * update test * #13876: change placement of comment and close button in task approval workflow (#17044) * change placment of comment and close button in task approval workflow * minor change * playwright test for the close and comment function * supported ref in activityFeedEditor * fix playwright test * added playwright test for data steward * fix the test for the data streward user * fix the close button not showing if task has no suggestions and icon fixes * fix sonar issue * change glossary and add suggestion button to dropdown button * fix the glossary failure due to button change * icon change for add tag and description * fix glossary cypress failure due to button chnages * changes as per comments * MINOR: docs links fix (#17125) * alation link fix * dbt yaml config source link fix * bigquery doc fix * Explore tree feedbacks (#17078) * fix explore design * update switcher icon * show menu when search query exists * fix selection of active service * fix type error * fix tests * fix tests * fix tests * MINOR: Databricks view TableType fix (#17124) * Minor: fixed AUT test (#17128) * Fix #16692: Override Lineage Support for View & Dashboard Lineage (#17064) * #17065: fix the tags not rendering in selector after selection in edit tags task (#17107) * fix the tags not rendering in selector after selection in edit tags taks * added playwright test * minor changes * minor fix * fix the tags not updating in edit and accept tag * fix explore type changes for collate (#17131) * MINOR: changed log level to debug (#17126) * changed log level to debug * fixed type * changed type to optional * Get feed and count data of soft deleted user (#17135) * Doc: Adding OIDC Docs (#17139) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * Doc: Updating Profiler Workflow Docs URL (#17140) Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> * fix playwright and cypress (#17138) * Minor: fixed edit modal issue for sql test case (#17132) * Minor: fixed edit modal issue for sql test case * fixed test * Minor: Added whats new content for 1.4.6 release (#17148) * MINOR [GEN-799]: add option to disable manual trigger using scheduleType (#17031) * fix: raise for triggering system app * added scheduleType ScheduledOrManual * minor: remove "service" field from required properties in createAPIEndpoint schema (#17147) * initial commit multi ownership * update glossary and other entities * update owners * fix version pages * fix tests * Update entity_extension to move owner to array (#17200) * fix tests * fix api page errors * fix owner label design * locales * fix owners in elastic search source * fix types * fix tests * fix tests * Updated CustomMetric owner to entityReferenceList. (#17211) * Fix owners field in search mappings * fix search aggregates * fix inherited label * Issue #17012: Multi User/Team Ownership - Fix Tests - Part 9 * Fix QUeries * Fix Mysql Queries * Typo * fix tests * fix tests * fix tests * fix advanced search constants * fix service ingestion tests * fix tests --------- Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Onkar Ravgan <onkar.10r@gmail.com> Co-authored-by: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com> Co-authored-by: Ayush Shah <ayush@getcollate.io> Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com> Co-authored-by: k.nakagaki <141020064+nakaken-churadata@users.noreply.github.com> Co-authored-by: Prajwal214 <167504578+Prajwal214@users.noreply.github.com> Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local> Co-authored-by: Suman Maharana <sumanmaharana786@gmail.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: harshsoni2024 <64592571+harshsoni2024@users.noreply.github.com> Co-authored-by: Karan Hotchandani <33024356+karanh37@users.noreply.github.com> Co-authored-by: Mayur Singal <39544459+ulixius9@users.noreply.github.com> Co-authored-by: Imri Paran <imri.paran@gmail.com> Co-authored-by: sonika-shah <58761340+sonika-shah@users.noreply.github.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com> Co-authored-by: karanh37 <karanh37@gmail.com> Co-authored-by: Siddhant <86899184+Siddhanttimeline@users.noreply.github.com>
2024-07-29 23:06:39 -07:00
public static void addOwners(List<String> csvRecord, List<EntityReference> owners) {
csvRecord.add(
nullOrEmpty(owners)
? null
: owners.stream()
.map(owner -> (owner.getType() + ENTITY_TYPE_SEPARATOR + owner.getName()))
.collect(Collectors.joining(FIELD_SEPARATOR)));
}
public static void addReviewers(List<String> csvRecord, List<EntityReference> reviewers) {
csvRecord.add(
nullOrEmpty(reviewers)
? null
: reviewers.stream()
.map(reviewer -> (reviewer.getType() + ENTITY_TYPE_SEPARATOR + reviewer.getName()))
.collect(Collectors.joining(FIELD_SEPARATOR)));
}
private static String quoteCsvField(String str) {
if (str.contains(SEPARATOR) || str.contains(FIELD_SEPARATOR)) {
return quote(str);
}
return str;
}
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
private static String quoteCsvFieldForSeparator(String str) {
if (str.contains(SEPARATOR)) {
return quote(str);
}
return str;
}
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
public static List<String> addExtension(List<String> csvRecord, Object extension) {
if (extension == null) {
csvRecord.add(null);
return csvRecord;
}
ObjectMapper objectMapper = new ObjectMapper();
Map<String, Object> extensionMap = objectMapper.convertValue(extension, Map.class);
String extensionString =
extensionMap.entrySet().stream()
.map(
entry -> {
String key = entry.getKey();
Object value = entry.getValue();
return CsvUtil.quoteCsvField(key + ENTITY_TYPE_SEPARATOR + formatValue(value));
})
.collect(Collectors.joining(FIELD_SEPARATOR));
csvRecord.add(extensionString);
return csvRecord;
}
private static String formatValue(Object value) {
if (value instanceof Map) {
return formatMapValue((Map<String, Object>) value);
}
if (value instanceof List) {
return formatListValue((List<?>) value);
}
return value != null ? value.toString() : "";
}
private static String formatMapValue(Map<String, Object> valueMap) {
if (isEntityReference(valueMap)) {
return formatEntityReference(valueMap);
} else if (isTimeInterval(valueMap)) {
return formatTimeInterval(valueMap);
} else if (isTableType(valueMap)) {
return formatTableRows(valueMap);
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
}
return valueMap.toString();
}
private static String formatListValue(List<?> list) {
if (list.isEmpty()) {
return "";
}
if (list.get(0) instanceof Map) {
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
return list.stream()
.map(item -> formatMapValue((Map<String, Object>) item))
.collect(Collectors.joining(INTERNAL_ARRAY_SEPARATOR));
} else {
return list.stream()
.map(Object::toString)
.collect(Collectors.joining(INTERNAL_ARRAY_SEPARATOR));
}
}
private static boolean isEntityReference(Map<String, Object> valueMap) {
return valueMap.containsKey("type") && valueMap.containsKey("fullyQualifiedName");
}
private static boolean isTimeInterval(Map<String, Object> valueMap) {
return valueMap.containsKey("start") && valueMap.containsKey("end");
}
private static boolean isTableType(Map<String, Object> valueMap) {
return valueMap.containsKey("rows") && valueMap.containsKey("columns");
}
Feature: Allow Custom Property Update in Glossary Bulk Import/export (#17919) * fix import issue * Feat : Allow Custom Property Update in Bulk Upload * Feat : Allow Custom Property Update in Bulk Upload * supported editable imports in glossary page * added remaning localizaion keys * update logic of fieldToExtensionStrings to use csvparser * update json and partialStatus condition * fix tests for partialSuccess status change * supported customProperty editable field * fix error in custom property edit modal on new line empty custom property * added entity type from root to support other bulk import entity as well * fix the quote removing due to the regex in the string type * Add backend tests , and error msg improvements * GlossaryStatus header change * fix unit test and dry run in case of synonyms having quotes in it * Remove extension column in CSVs for all entities except glossaryTerm * added editor for reviewers * unit test around csv utils * added escape for string too, in case of semicolon comes * added playwright test without extension and supported relatedTerm as editable * added unit test around csv util logic * resolve conflicts * Backend - add support for enumWithDescriptions in bulk import * add tests and other error handling improvements related to enumWithDescriptions * fix the custom property modal header and render the layout as per right panel in entities * parese enumWithDescription for the customProperty modal while editable * fix description data in enumWithDescription one * fix: Handle NullPointerException when adding custom properties to ensure loop continues for other schemas of the same type for addToRegistry * added extension playwrigth test and fix enumWithDescription object failure * descrease the size of extension modal * remove additional comments * fix the escape in parent key * improve custom property layout * improve ui for inline properties * fix description, glossary and relatedTerm escape char issue * fix some customProperty ui changes * fix sonar issue * minor layout changes * minor label improvements for entity ref and list --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Co-authored-by: Ashish Gupta <ashish@getcollate.io> Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com> Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
2024-10-01 00:12:43 +05:30
private static String formatEntityReference(Map<String, Object> valueMap) {
return valueMap.get("type") + ENTITY_TYPE_SEPARATOR + valueMap.get("fullyQualifiedName");
}
private static String formatTimeInterval(Map<String, Object> valueMap) {
return valueMap.get("start") + ENTITY_TYPE_SEPARATOR + valueMap.get("end");
}
private static String formatTableRows(Map<String, Object> valueMap) {
List<String> columns = (List<String>) valueMap.get("columns");
List<Map<String, Object>> rows = (List<Map<String, Object>>) valueMap.get("rows");
return rows.stream()
.map(
row ->
columns.stream()
.map(
column ->
quoteCsvFieldForSeparator(row.getOrDefault(column, "").toString()))
.collect(Collectors.joining(SEPARATOR)))
.collect(Collectors.joining(INTERNAL_ARRAY_SEPARATOR));
}
}