Commit 11936eac authored by Piotr Gawron's avatar Piotr Gawron
Browse files

information about deprecated columns is available for overlays with source

parent 0a7b2d9d
......@@ -108,7 +108,6 @@ public class OverlayRestImpl extends BaseRestImpl {
for (ColorSchemaColumn column : new ColorSchemaReader().getDeprecatedColumns(overlay)) {
result.add(column.name());
}
logger.debug(result);
return result;
} catch (IOException | InvalidColorSchemaException e) {
throw new InvalidStateException(e);
......
......@@ -810,25 +810,27 @@ public class ColorSchemaReader {
public List<ColorSchemaColumn> getDeprecatedColumns(Layout overlay)
throws IOException, InvalidColorSchemaException {
List<ColorSchemaColumn> result = new ArrayList<>();
BufferedReader br = new BufferedReader(
new InputStreamReader(new ByteArrayInputStream(overlay.getInputData().getFileContent())));
if (overlay.getInputData() != null) {
BufferedReader br = new BufferedReader(
new InputStreamReader(new ByteArrayInputStream(overlay.getInputData().getFileContent())));
String line = br.readLine();
while (line != null && line.startsWith("#")) {
line = br.readLine();
}
String[] columns = line.split("\t");
String line = br.readLine();
while (line != null && line.startsWith("#")) {
line = br.readLine();
}
String[] columns = line.split("\t");
Map<ColorSchemaColumn, Integer> schemaColumns = new HashMap<>();
parseColumns(columns, schemaColumns, ColorSchemaType.GENERIC);
for (ColorSchemaColumn column : schemaColumns.keySet()) {
try {
Field f = ColorSchemaColumn.class.getField(column.name());
if (column.getDepractedColumnName() != null || f.isAnnotationPresent(Deprecated.class)) {
result.add(column);
Map<ColorSchemaColumn, Integer> schemaColumns = new HashMap<>();
parseColumns(columns, schemaColumns, ColorSchemaType.GENERIC);
for (ColorSchemaColumn column : schemaColumns.keySet()) {
try {
Field f = ColorSchemaColumn.class.getField(column.name());
if (column.getDepractedColumnName() != null || f.isAnnotationPresent(Deprecated.class)) {
result.add(column);
}
} catch (NoSuchFieldException | SecurityException e) {
throw new InvalidStateException(e);
}
} catch (NoSuchFieldException | SecurityException e) {
throw new InvalidStateException(e);
}
}
return result;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment