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

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;
import com.fasterxml.jackson.databind.node.ObjectNode;
import swing2swt.layout.BorderLayout;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
public class PushDialog extends Dialog {
private static final Logger _log = Logger.getLogger(PushDialog.class);
......@@ -212,6 +214,14 @@ public class PushDialog extends Dialog {
createContents();
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.setLayoutData(BorderLayout.SOUTH);
......@@ -297,6 +307,9 @@ public class PushDialog extends Dialog {
for (int i = futures.size() - 1; i >= 0; i--) {
Future<?> future = futures.get(i);
if (future == null) {
continue;
}
if (future.isDone() || future.isCancelled()) {
futures.remove(future);
} else {
......@@ -512,9 +525,12 @@ public class PushDialog extends Dialog {
long lastTime = 0;
do {
for (int i = futures.size() - 1; i >= 0; i--) {
Future<?> f = futures.get(i);
if (f.isDone()) {
futures.remove(f);
Future<?> future = futures.get(i);
if (future == null) {
continue;
}
if (future.isDone()) {
futures.remove(future);
}
}
......@@ -676,7 +692,7 @@ public class PushDialog extends Dialog {
// If filtering, check INSTCODE is listed
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;
}
......
......@@ -47,6 +47,17 @@ public class SwtLogAppender extends WriterAppender {
patternLayout.setConversionPattern(DEFAULT_LAYOUT_PATTERN);
setLayout(patternLayout);
}
public void clearBuffer() {
synchronized (logBuffer) {
display.asyncExec(() -> {
if (text != null) {
text.setText("");
}
});
logBuffer.delete(0, logBuffer.length());
}
}
public void setConversionPattern(String conversionPattern) {
PatternLayout patternLayout = (PatternLayout) getLayout();
......@@ -75,14 +86,16 @@ public class SwtLogAppender extends WriterAppender {
}
}
final String mes = layout.format(loggingEvent) + (throwableStr == null ? "" : sb.toString());
logBuffer.append(mes);
if (logBuffer.length() > maxBufferSize && text.getSelectionCount() == 0) {
// System.err.println("CLEARING POOL len=" + logBuffer.length() +
// " removing=" + (logBuffer.length() - maxBufferSize));
logBuffer.replace(0, logBuffer.length() - maxBufferSize, "");
int pos = logBuffer.indexOf("\n");
if (pos >= 0) {
logBuffer.replace(0, pos + 1, "");
synchronized (logBuffer) {
logBuffer.append(mes);
if (logBuffer.length() > maxBufferSize) {
// System.err.println("CLEARING POOL len=" + logBuffer.length() +
// " removing=" + (logBuffer.length() - maxBufferSize));
logBuffer.replace(0, logBuffer.length() - maxBufferSize, "");
int pos = logBuffer.indexOf("\n");
if (pos >= 0) {
logBuffer.replace(0, pos + 1, "");
}
}
}
......
......@@ -225,6 +225,9 @@ public class GenesysJSON {
columnDef = new JsonField(Api1Constants.Accession.MLSSTAT, RdfMCPD.MLSSTAT).setType(boolean.class);
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);
columns.add(columnDef);
......
......@@ -164,6 +164,9 @@ public class MCPD {
columnDef = new ColumnDef("MLSSTAT", "MLS status of the accession", ColumnDataType.BOOLEAN, false, RdfMCPD.MLSSTAT).setIncludeNull(false);
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);
columns.add(columnDef);
......
......@@ -23,6 +23,7 @@ public class RdfMCPD {
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 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_NEW = "https://www.genesys-pgr.org/rdf/mcpd#newGenus";
......
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