Commit 2fd3cd82 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '29-add-aegis-flag' into 'master'

Resolve "Add AEGIS flag"

Closes #29

See merge request !23
parents cd1273af 7654c623
...@@ -87,6 +87,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -87,6 +87,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import swing2swt.layout.BorderLayout; import swing2swt.layout.BorderLayout;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
public class PushDialog extends Dialog { public class PushDialog extends Dialog {
private static final Logger _log = Logger.getLogger(PushDialog.class); private static final Logger _log = Logger.getLogger(PushDialog.class);
...@@ -212,6 +214,14 @@ public class PushDialog extends Dialog { ...@@ -212,6 +214,14 @@ public class PushDialog extends Dialog {
createContents(); createContents();
logAppender = new SwtLogAppender(this.txtJson); logAppender = new SwtLogAppender(this.txtJson);
txtJson.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.character == 'k' && (e.stateMask == SWT.COMMAND || e.stateMask == SWT.CTRL)) {
logAppender.clearBuffer();
}
}
});
Composite composite = new Composite(shell, SWT.NO_FOCUS); Composite composite = new Composite(shell, SWT.NO_FOCUS);
composite.setLayoutData(BorderLayout.SOUTH); composite.setLayoutData(BorderLayout.SOUTH);
...@@ -297,6 +307,9 @@ public class PushDialog extends Dialog { ...@@ -297,6 +307,9 @@ public class PushDialog extends Dialog {
for (int i = futures.size() - 1; i >= 0; i--) { for (int i = futures.size() - 1; i >= 0; i--) {
Future<?> future = futures.get(i); Future<?> future = futures.get(i);
if (future == null) {
continue;
}
if (future.isDone() || future.isCancelled()) { if (future.isDone() || future.isCancelled()) {
futures.remove(future); futures.remove(future);
} else { } else {
...@@ -512,9 +525,12 @@ public class PushDialog extends Dialog { ...@@ -512,9 +525,12 @@ public class PushDialog extends Dialog {
long lastTime = 0; long lastTime = 0;
do { do {
for (int i = futures.size() - 1; i >= 0; i--) { for (int i = futures.size() - 1; i >= 0; i--) {
Future<?> f = futures.get(i); Future<?> future = futures.get(i);
if (f.isDone()) { if (future == null) {
futures.remove(f); continue;
}
if (future.isDone()) {
futures.remove(future);
} }
} }
...@@ -676,7 +692,7 @@ public class PushDialog extends Dialog { ...@@ -676,7 +692,7 @@ public class PushDialog extends Dialog {
// If filtering, check INSTCODE is listed // If filtering, check INSTCODE is listed
if (instCodesFilter.size() > 0 && !(isBlackList ^ instCodesFilter.contains(accessionInstCode))) { if (instCodesFilter.size() > 0 && !(isBlackList ^ instCodesFilter.contains(accessionInstCode))) {
_log.info("Ignoring accessions with inst code : " + accessionInstCode); _log.debug("Ignoring accessions with inst code : " + accessionInstCode);
continue; continue;
} }
......
...@@ -47,6 +47,17 @@ public class SwtLogAppender extends WriterAppender { ...@@ -47,6 +47,17 @@ public class SwtLogAppender extends WriterAppender {
patternLayout.setConversionPattern(DEFAULT_LAYOUT_PATTERN); patternLayout.setConversionPattern(DEFAULT_LAYOUT_PATTERN);
setLayout(patternLayout); setLayout(patternLayout);
} }
public void clearBuffer() {
synchronized (logBuffer) {
display.asyncExec(() -> {
if (text != null) {
text.setText("");
}
});
logBuffer.delete(0, logBuffer.length());
}
}
public void setConversionPattern(String conversionPattern) { public void setConversionPattern(String conversionPattern) {
PatternLayout patternLayout = (PatternLayout) getLayout(); PatternLayout patternLayout = (PatternLayout) getLayout();
...@@ -75,14 +86,16 @@ public class SwtLogAppender extends WriterAppender { ...@@ -75,14 +86,16 @@ public class SwtLogAppender extends WriterAppender {
} }
} }
final String mes = layout.format(loggingEvent) + (throwableStr == null ? "" : sb.toString()); final String mes = layout.format(loggingEvent) + (throwableStr == null ? "" : sb.toString());
logBuffer.append(mes); synchronized (logBuffer) {
if (logBuffer.length() > maxBufferSize && text.getSelectionCount() == 0) { logBuffer.append(mes);
// System.err.println("CLEARING POOL len=" + logBuffer.length() + if (logBuffer.length() > maxBufferSize) {
// " removing=" + (logBuffer.length() - maxBufferSize)); // System.err.println("CLEARING POOL len=" + logBuffer.length() +
logBuffer.replace(0, logBuffer.length() - maxBufferSize, ""); // " removing=" + (logBuffer.length() - maxBufferSize));
int pos = logBuffer.indexOf("\n"); logBuffer.replace(0, logBuffer.length() - maxBufferSize, "");
if (pos >= 0) { int pos = logBuffer.indexOf("\n");
logBuffer.replace(0, pos + 1, ""); if (pos >= 0) {
logBuffer.replace(0, pos + 1, "");
}
} }
} }
......
...@@ -225,6 +225,9 @@ public class GenesysJSON { ...@@ -225,6 +225,9 @@ public class GenesysJSON {
columnDef = new JsonField(Api1Constants.Accession.MLSSTAT, RdfMCPD.MLSSTAT).setType(boolean.class); columnDef = new JsonField(Api1Constants.Accession.MLSSTAT, RdfMCPD.MLSSTAT).setType(boolean.class);
columns.add(columnDef); columns.add(columnDef);
columnDef = new JsonField(Api1Constants.Accession.AEGIS, RdfMCPD.AEGIS).setType(boolean.class);
columns.add(columnDef);
columnDef = new JsonField(Api1Constants.Accession.INTRUST, RdfMCPD.FAOINTRUST).setType(boolean.class); columnDef = new JsonField(Api1Constants.Accession.INTRUST, RdfMCPD.FAOINTRUST).setType(boolean.class);
columns.add(columnDef); columns.add(columnDef);
......
...@@ -164,6 +164,9 @@ public class MCPD { ...@@ -164,6 +164,9 @@ public class MCPD {
columnDef = new ColumnDef("MLSSTAT", "MLS status of the accession", ColumnDataType.BOOLEAN, false, RdfMCPD.MLSSTAT).setIncludeNull(false); 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("AEGIS", "Aegis status of the accession", ColumnDataType.BOOLEAN, false, RdfMCPD.AEGIS).setIncludeNull(false);
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);
......
...@@ -23,6 +23,7 @@ public class RdfMCPD { ...@@ -23,6 +23,7 @@ public class RdfMCPD {
public static final String ACCENUMB = "http://purl.org/germplasm/germplasmTerm#germplasmID"; public static final String ACCENUMB = "http://purl.org/germplasm/germplasmTerm#germplasmID";
public static final String ACCENUMB_NEW = "https://www.genesys-pgr.org/rdf/mcpd#newAcceNumb"; public static final String ACCENUMB_NEW = "https://www.genesys-pgr.org/rdf/mcpd#newAcceNumb";
public static final String AEGIS = "https://www.genesys-pgr.org/rdf/mcpd#aegis";
public static final String GENUS = "http://rs.tdwg.org/dwc/terms/genus"; public static final String GENUS = "http://rs.tdwg.org/dwc/terms/genus";
public static final String GENUS_NEW = "https://www.genesys-pgr.org/rdf/mcpd#newGenus"; public static final String GENUS_NEW = "https://www.genesys-pgr.org/rdf/mcpd#newGenus";
......
Supports Markdown
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