Commit db7edf6f authored by Matija Obreza's avatar Matija Obreza
Browse files

Set "Include null" to true by default

- Except CROPNAME and booleans
parent 9f7eb593
...@@ -203,6 +203,7 @@ public class DataSourceSheet extends AbstractModelObject implements IDataSourceS ...@@ -203,6 +203,7 @@ public class DataSourceSheet extends AbstractModelObject implements IDataSourceS
column.setRdfTerm(columnDef.getRdfTerm()); column.setRdfTerm(columnDef.getRdfTerm());
column.setMultiple(columnDef.hasAllowMultiple()); column.setMultiple(columnDef.hasAllowMultiple());
column.setDescription(columnDef.getTitle()); column.setDescription(columnDef.getTitle());
column.setIncludeNull(columnDef.hasIncludeNull());
} }
} }
} }
......
...@@ -154,6 +154,7 @@ public class DwcaBuilder extends AbstractModelObject { ...@@ -154,6 +154,7 @@ public class DwcaBuilder extends AbstractModelObject {
column.put("pattern", sourceColumn.getPattern()); column.put("pattern", sourceColumn.getPattern());
column.put("separator", sourceColumn.getSeparator()); column.put("separator", sourceColumn.getSeparator());
column.put("groupPattern", sourceColumn.getGroupPattern()); column.put("groupPattern", sourceColumn.getGroupPattern());
column.put("includeNull", sourceColumn.isIncludeNull());
columns.put(column); columns.put(column);
} }
} }
...@@ -273,6 +274,8 @@ public class DwcaBuilder extends AbstractModelObject { ...@@ -273,6 +274,8 @@ public class DwcaBuilder extends AbstractModelObject {
sourceColumn.setDataType(ColumnDataType.valueOf(column.getString("dataType"))); sourceColumn.setDataType(ColumnDataType.valueOf(column.getString("dataType")));
if (column.has("multiple")) if (column.has("multiple"))
sourceColumn.setMultiple(column.getBoolean("multiple")); sourceColumn.setMultiple(column.getBoolean("multiple"));
if (column.has("includeNull"))
sourceColumn.setIncludeNull(column.getBoolean("includeNull"));
if (loadedColumns.contains(sourceColumn)) { if (loadedColumns.contains(sourceColumn)) {
columnList.add(sourceColumn); columnList.add(sourceColumn);
......
...@@ -28,11 +28,6 @@ import java.util.concurrent.ThreadPoolExecutor; ...@@ -28,11 +28,6 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Consumer; import java.util.function.Consumer;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.LogManager; import org.apache.log4j.LogManager;
...@@ -66,6 +61,11 @@ import org.genesys2.client.oauth.PleaseRetryException; ...@@ -66,6 +61,11 @@ import org.genesys2.client.oauth.PleaseRetryException;
import org.genesys2.client.oauth.api.accession.Api1Constants; import org.genesys2.client.oauth.api.accession.Api1Constants;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import swing2swt.layout.BorderLayout; import swing2swt.layout.BorderLayout;
public class PushDialog extends Dialog { public class PushDialog extends Dialog {
...@@ -89,7 +89,7 @@ public class PushDialog extends Dialog { ...@@ -89,7 +89,7 @@ public class PushDialog extends Dialog {
protected DataSourceLoader dataSourceLoader; protected DataSourceLoader dataSourceLoader;
BlockingQueue<Runnable> linkedBlockingDeque = new LinkedBlockingDeque<Runnable>(4); BlockingQueue<Runnable> linkedBlockingDeque = new LinkedBlockingDeque<Runnable>(4);
private ThreadPoolExecutor executorService = new ThreadPoolExecutor(1, 2, 30, TimeUnit.SECONDS, linkedBlockingDeque, new ThreadPoolExecutor.CallerRunsPolicy()); private ThreadPoolExecutor executorService = new ThreadPoolExecutor(1, 4, 30, TimeUnit.SECONDS, linkedBlockingDeque, new ThreadPoolExecutor.CallerRunsPolicy());
protected Object result; protected Object result;
protected Shell shell; protected Shell shell;
...@@ -482,8 +482,6 @@ public class PushDialog extends Dialog { ...@@ -482,8 +482,6 @@ public class PushDialog extends Dialog {
if (_log.isDebugEnabled()) if (_log.isDebugEnabled())
_log.debug(serverResponse); _log.debug(serverResponse);
_log.info("Push done.");
try { try {
JsonNode ri = objectMapper.readTree(serverResponse); JsonNode ri = objectMapper.readTree(serverResponse);
ri.forEach(new Consumer<JsonNode>() { ri.forEach(new Consumer<JsonNode>() {
...@@ -497,6 +495,8 @@ public class PushDialog extends Dialog { ...@@ -497,6 +495,8 @@ public class PushDialog extends Dialog {
} }
}); });
_log.info("Push done.");
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
......
...@@ -28,17 +28,18 @@ public class Column extends AbstractModelObject { ...@@ -28,17 +28,18 @@ public class Column extends AbstractModelObject {
private String separator = ";"; private String separator = ";";
private String pattern; private String pattern;
private String groupPattern; private String groupPattern;
private boolean includeNull = false; private boolean includeNull = true;
public Column() { public Column() {
} }
public Column(String preferredName, ColumnDataType dataType, boolean multiple, boolean unique, String rdfTerm) { public Column(String preferredName, ColumnDataType dataType, boolean multiple, boolean unique, String rdfTerm, boolean includeNull) {
this.preferredName = preferredName; this.preferredName = preferredName;
this.dataType = dataType; this.dataType = dataType;
this.multiple = multiple; this.multiple = multiple;
this.unique = unique; this.unique = unique;
this.rdfTerm = rdfTerm; this.rdfTerm = rdfTerm;
this.includeNull = includeNull;
} }
public String getPreferredName() { public String getPreferredName() {
......
...@@ -28,6 +28,7 @@ public class ColumnDef extends AbstractModelObject { ...@@ -28,6 +28,7 @@ public class ColumnDef extends AbstractModelObject {
private Set<ColumnValidator> validators = new HashSet<ColumnValidator>(); private Set<ColumnValidator> validators = new HashSet<ColumnValidator>();
private String title; private String title;
private boolean allowMultiple = false; private boolean allowMultiple = false;
private boolean includeNull = true;
public ColumnDef() { public ColumnDef() {
} }
...@@ -96,4 +97,13 @@ public class ColumnDef extends AbstractModelObject { ...@@ -96,4 +97,13 @@ public class ColumnDef extends AbstractModelObject {
this.allowMultiple = allowMultiple; this.allowMultiple = allowMultiple;
return this; return this;
} }
public boolean hasIncludeNull() {
return this.includeNull;
}
public ColumnDef setIncludeNull(boolean includeNull) {
this.includeNull = includeNull;
return this;
}
} }
...@@ -74,7 +74,7 @@ public class MCPD { ...@@ -74,7 +74,7 @@ public class MCPD {
columnDef = new ColumnDef("SUBTAUTHOR", "Subtaxon authority", ColumnDataType.TEXT, false, RdfMCPD.SUBTAUTHOR); columnDef = new ColumnDef("SUBTAUTHOR", "Subtaxon authority", ColumnDataType.TEXT, false, RdfMCPD.SUBTAUTHOR);
columns.add(columnDef); columns.add(columnDef);
columnDef = new ColumnDef("CROPNAME", "Common crop name", ColumnDataType.TEXT, false, RdfMCPD.CROPNAME); columnDef = new ColumnDef("CROPNAME", "Common crop name", ColumnDataType.TEXT, false, RdfMCPD.CROPNAME).setIncludeNull(false);
columns.add(columnDef); columns.add(columnDef);
columnDef = new ColumnDef("ACCENAME", "Accession name", ColumnDataType.TEXT, false, RdfMCPD.ACCENAME).setAllowMultiple(true); columnDef = new ColumnDef("ACCENAME", "Accession name", ColumnDataType.TEXT, false, RdfMCPD.ACCENAME).setAllowMultiple(true);
...@@ -158,20 +158,20 @@ public class MCPD { ...@@ -158,20 +158,20 @@ public class MCPD {
columnDef = new ColumnDef("STORAGE", "Type of germplasm storage", ColumnDataType.TEXT, false, RdfMCPD.STORAGE).setAllowMultiple(true); columnDef = new ColumnDef("STORAGE", "Type of germplasm storage", ColumnDataType.TEXT, false, RdfMCPD.STORAGE).setAllowMultiple(true);
columns.add(columnDef); columns.add(columnDef);
columnDef = new ColumnDef("MLSSTAT", "MLS status of the accession", ColumnDataType.BOOLEAN, false, RdfMCPD.MLSSTAT); columnDef = new ColumnDef("MLSSTAT", "MLS status of the accession", ColumnDataType.BOOLEAN, false, RdfMCPD.MLSSTAT).setIncludeNull(false);
columns.add(columnDef); columns.add(columnDef);
columnDef = new ColumnDef("REMARKS", "Remarks", ColumnDataType.TEXT, false, RdfMCPD.REMARKS).setAllowMultiple(true); columnDef = new ColumnDef("REMARKS", "Remarks", ColumnDataType.TEXT, false, RdfMCPD.REMARKS).setAllowMultiple(true);
columns.add(columnDef); columns.add(columnDef);
// Genesys specific // Genesys specific
columnDef = new ColumnDef("INTRUST", "FAO in Trust", ColumnDataType.BOOLEAN, false, RdfMCPD.FAOINTRUST); columnDef = new ColumnDef("INTRUST", "FAO in Trust", ColumnDataType.BOOLEAN, false, RdfMCPD.FAOINTRUST).setIncludeNull(false);
columns.add(columnDef); columns.add(columnDef);
columnDef = new ColumnDef("AVAILABLE", "Accession is available for distribution", ColumnDataType.BOOLEAN, false, RdfMCPD.AVAILABLE); columnDef = new ColumnDef("AVAILABLE", "Accession is available for distribution", ColumnDataType.BOOLEAN, false, RdfMCPD.AVAILABLE).setIncludeNull(false);
columns.add(columnDef); columns.add(columnDef);
columnDef = new ColumnDef("HISTORIC", "Historic entry", ColumnDataType.BOOLEAN, false, RdfMCPD.HISTORIC); columnDef = new ColumnDef("HISTORIC", "Historic entry", ColumnDataType.BOOLEAN, false, RdfMCPD.HISTORIC).setIncludeNull(false);
columns.add(columnDef); columns.add(columnDef);
columnDef = new ColumnDef("ACCEURL", "Accession URL", ColumnDataType.TEXT, false, RdfMCPD.ACCEURL); columnDef = new ColumnDef("ACCEURL", "Accession URL", ColumnDataType.TEXT, false, RdfMCPD.ACCEURL);
......
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