Commit 09e82815 authored by igoshin's avatar igoshin
Browse files

#14050 Seems finished

parent f0f18312
......@@ -34,6 +34,9 @@ import org.springframework.beans.factory.annotation.Autowired;
public class DwcaBuilder extends AbstractModelObject {
@Autowired
private DataSourceLoader dataSourceLoader;
private List<IDataSource> fileRoots = new ArrayList<IDataSource>();
private String workspaceFilename = null;
......@@ -236,6 +239,17 @@ public class DwcaBuilder extends AbstractModelObject {
JSONArray columns = sheetJ.getJSONArray("columns");
List<Column> columnList = new ArrayList<Column>();
List<Object[]> rows=null;
try {
rows = dataSourceLoader.loadRows(sourceSheet, 200);
} catch (UnsupportedDataFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
sourceSheet.updateData(rows);
List<Column> loadedColumns = sourceSheet.getColumns();
for (int x = 0; x < columns.length(); x++) {
JSONObject column = columns.getJSONObject(x);
......@@ -258,8 +272,17 @@ public class DwcaBuilder extends AbstractModelObject {
if (column.has("multiple"))
sourceColumn.setMultiple(column.getBoolean("multiple"));
if (loadedColumns.contains(sourceColumn)){
columnList.add(sourceColumn);
}
}
for (Column loadedColumn:loadedColumns){
if (!columnList.contains(loadedColumn)){
columnList.add(loadedColumns.indexOf(loadedColumn),loadedColumn);
}
}
sourceSheet.setColumns(columnList);
sourceSheetList.add(sourceSheet);
}
......
......@@ -120,4 +120,18 @@ public class Column extends AbstractModelObject {
this.groupPattern = groupPattern;
firePropertyChange("groupPattern", null, this.groupPattern);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Column column = (Column) o;
if (preferredName != null ? !preferredName.equals(column.preferredName) : column.preferredName != null)
return false;
return true;
}
}
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