Skip to content

Commit

Permalink
EA-68 Fix update of Datatable
Browse files Browse the repository at this point in the history
  • Loading branch information
hero78 committed Jan 2, 2025
1 parent 2376f37 commit e525a28
Showing 1 changed file with 0 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,6 @@ public void updateDatatable(final String datatableName, final JsonCommand comman
final Map<String, Long> codeMappings = new HashMap<>();
for (final JsonElement column : addColumns) {

// Insert table mask if existent
RegisteredDatatableFieldMask curr = RegisteredDatatableFieldMask.builder().datatableName(datatableName)
.columnName(column.getAsJsonObject().get("name").getAsString())
.columnMask(column.getAsJsonObject().get("fieldMask").getAsString()).build();

registeredDatatableFieldMaskRepository.save(curr);

JsonObject columnAsJson = column.getAsJsonObject();
if (rowCount > 0 && columnAsJson.has(API_FIELD_MANDATORY) && columnAsJson.get(API_FIELD_MANDATORY).getAsBoolean()) {
throw new GeneralPlatformDomainRuleException("error.msg.non.empty.datatable.mandatory.column.cannot.be.added",
Expand All @@ -801,18 +794,6 @@ public void updateDatatable(final String datatableName, final JsonCommand comman
final Map<String, Long> codeMappings = new HashMap<>();
final List<String> removeMappings = new ArrayList<>();
for (final JsonElement column : changeColumns) {

// Update table mask if existent
Optional<RegisteredDatatableFieldMask> fieldMaskOpt = registeredDatatableFieldMaskRepository
.findByDatatableNameAndColumnName(datatableName, column.getAsJsonObject().get("name").getAsString());

if (fieldMaskOpt.isPresent()) {
RegisteredDatatableFieldMask curr = fieldMaskOpt.get();
curr.setColumnMask(column.getAsJsonObject().get("fieldMask").getAsString());
curr.setColumnName(column.getAsJsonObject().get("newName").getAsString());
registeredDatatableFieldMaskRepository.save(curr);
}

// remove NULL values from column where mandatory is true
removeNullValuesFromStringColumn(datatableName, column.getAsJsonObject(), mapColumnNameDefinition);
parseDatatableColumnForUpdate(column.getAsJsonObject(), mapColumnNameDefinition, datatableName, renameBuilder,
Expand Down

0 comments on commit e525a28

Please sign in to comment.