Skip to content
Snippets Groups Projects
Commit 57927d13 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

clear column names are used to report to the user

parent 27724aed
No related branches found
No related tags found
2 merge requests!933WIP: Resolve "restrict Version to 20 characters",!932Resolve "deprecacy information for data overlay"
Pipeline #13923 passed
......@@ -4,6 +4,8 @@ minerva (14.0.0~beta.2) unstable; urgency=low
* Bug fix: validation of project name length is provided (#950)
* Bug fix: after reducing privileges on himself interface is refreshed (#948)
* Bug fix: removing overlays as curator in admin panel fixed (#944)
* Bug fix: information about deprecated column is more clear about column
names (#958)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 16 Sep 2019 21:00:00 +0200
......
......@@ -106,8 +106,8 @@ public class OverlayRestImpl extends BaseRestImpl {
private List<String> getDeprecatedColumns(Layout overlay) {
try {
List<String> result = new ArrayList<>();
for (ColorSchemaColumn column : new ColorSchemaReader().getDeprecatedColumns(overlay)) {
result.add(column.name());
for (Pair<ColorSchemaColumn, String> entry : new ColorSchemaReader().getDeprecatedColumns(overlay)) {
result.add(entry.getRight());
}
return result;
} catch (IOException | InvalidColorSchemaException e) {
......
......@@ -814,9 +814,9 @@ public class ColorSchemaReader {
return readColorSchema(new ByteArrayInputStream(inputData), params);
}
public List<ColorSchemaColumn> getDeprecatedColumns(Layout overlay)
public List<Pair<ColorSchemaColumn, String>> getDeprecatedColumns(Layout overlay)
throws IOException, InvalidColorSchemaException {
List<ColorSchemaColumn> result = new ArrayList<>();
List<Pair<ColorSchemaColumn, String>> result = new ArrayList<>();
if (overlay.getInputData() != null) {
BufferedReader br = new BufferedReader(
new InputStreamReader(new ByteArrayInputStream(overlay.getInputData().getFileContent())));
......@@ -843,13 +843,14 @@ public class ColorSchemaReader {
Map<ColorSchemaColumn, Integer> schemaColumns = new HashMap<>();
parseColumns(columns, schemaColumns, type);
for (ColorSchemaColumn column : schemaColumns.keySet()) {
Pair<ColorSchemaColumn, String> entry = new Pair<>(column, columns[schemaColumns.get(column)]);
try {
Field f = ColorSchemaColumn.class.getField(column.name());
if (f.isAnnotationPresent(Deprecated.class)) {
result.add(column);
result.add(entry);
} else if (column.getDepractedColumnName() != null
&& column.getDepractedColumnName().equalsIgnoreCase(columns[schemaColumns.get(column)])) {
result.add(column);
result.add(entry);
}
} catch (NoSuchFieldException | SecurityException e) {
throw new InvalidStateException(e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment