From 13cda164f615686ed192efe71a28974d32190810 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Tue, 24 Sep 2019 18:32:31 +0200 Subject: [PATCH 1/8] next snapshot version --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 86d634322..c3824eb18 100644 --- a/pom.xml +++ b/pom.xml @@ -5,10 +5,10 @@ life.qbic parent-pom - 1.5.0-SNAPSHOT + 1.5.0 data-model-lib - 1.5.0-SNAPSHOT + 1.6.0-SNAPSHOT Data Model Library http://github.com/qbicsoftware/data-model-lib A collection of QBiC data models. From 82b4c8440957bbea61ab0853e8e8de36a4303f81 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 4 Nov 2019 14:56:46 +0100 Subject: [PATCH 2/8] fix: barcode matching --- .../life/qbic/datamodel/identifiers/SampleCodeFunctions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/life/qbic/datamodel/identifiers/SampleCodeFunctions.java b/src/main/java/life/qbic/datamodel/identifiers/SampleCodeFunctions.java index 001e41475..87e4dc966 100644 --- a/src/main/java/life/qbic/datamodel/identifiers/SampleCodeFunctions.java +++ b/src/main/java/life/qbic/datamodel/identifiers/SampleCodeFunctions.java @@ -49,7 +49,7 @@ public static boolean isQbicBarcode(String code) { Pattern codePattern = Pattern.compile("Q[A-X0-9]{4}[0-9]{3}[A-X0-9]{2}", Pattern.CASE_INSENSITIVE); Matcher matcher = codePattern.matcher(code); - if (matcher.find()) { + if (matcher.matches()) { String base = code.substring(0, 9); return checksum(base) == code.charAt(9); } From bb8439d7f0dbc12ead782c2e078927ed54885dba Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Wed, 13 Nov 2019 14:21:16 +0100 Subject: [PATCH 3/8] hotfix: correct entity regex --- .../life/qbic/datamodel/identifiers/SampleCodeFunctions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/life/qbic/datamodel/identifiers/SampleCodeFunctions.java b/src/main/java/life/qbic/datamodel/identifiers/SampleCodeFunctions.java index b6568346e..337b475c7 100644 --- a/src/main/java/life/qbic/datamodel/identifiers/SampleCodeFunctions.java +++ b/src/main/java/life/qbic/datamodel/identifiers/SampleCodeFunctions.java @@ -61,7 +61,7 @@ public static boolean isQbicBarcode(String code) { * @return true if String is a QBiC entity code, false if not */ public static boolean isQbicEntityCode(String code) { - Pattern entityPattern = Pattern.compile("Q[A-X0-9]{4}ENTITY-[0-9]*$", Pattern.CASE_INSENSITIVE); + Pattern entityPattern = Pattern.compile("Q[A-X0-9]{4}ENTITY-[1-9][0-9]*", Pattern.CASE_INSENSITIVE); Matcher matcher = entityPattern.matcher(code); return matcher.find(); } From 566109b6556c9dbbcd46c4e9d54f74ca23eb5ada Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Wed, 13 Nov 2019 14:30:55 +0100 Subject: [PATCH 4/8] support for notes xml --- .../qbic/datamodel/notes/HistoryReader.java | 93 +++++++++++ .../java/life/qbic/datamodel/notes/Note.java | 144 ++++++++++++++++++ .../java/life/qbic/datamodel/notes/Notes.java | 95 ++++++++++++ .../qbic/datamodel/notes/ObjectFactory.java | 72 +++++++++ .../life/qbic/datamodel/notes/jaxb.properties | 1 + 5 files changed, 405 insertions(+) create mode 100644 src/main/java/life/qbic/datamodel/notes/HistoryReader.java create mode 100644 src/main/java/life/qbic/datamodel/notes/Note.java create mode 100644 src/main/java/life/qbic/datamodel/notes/Notes.java create mode 100644 src/main/java/life/qbic/datamodel/notes/ObjectFactory.java create mode 100644 src/main/java/life/qbic/datamodel/notes/jaxb.properties diff --git a/src/main/java/life/qbic/datamodel/notes/HistoryReader.java b/src/main/java/life/qbic/datamodel/notes/HistoryReader.java new file mode 100644 index 000000000..7438086cb --- /dev/null +++ b/src/main/java/life/qbic/datamodel/notes/HistoryReader.java @@ -0,0 +1,93 @@ +package life.qbic.datamodel.notes; + +import java.io.File; +import java.io.OutputStream; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.transform.stream.StreamSource; + +public class HistoryReader { + + private static final String MODEL_NOTES_CONTEXT_PATH = "life.qbic.datamodel.model.notes"; + + public static List parseXMLNotes(String value) { + List notes = new ArrayList(); + try { + JAXBElement jaxbelem = HistoryReader.parseNotes(value); + notes = jaxbelem.getValue().getNote(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return notes; + } + + /** + * returns a {@link historybeans.Notes} instance. + * + * @param notes a xml file that contains notes. + * @return historybeans.Notes which is a bean representation of the notes saved in openbis + * @throws JAXBException + */ + public static JAXBElement parseNotes(File notes) throws JAXBException { + JAXBContext jaxbContext; + jaxbContext = JAXBContext.newInstance(MODEL_NOTES_CONTEXT_PATH); + javax.xml.bind.Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + StreamSource source = new StreamSource(notes); + JAXBElement customerElement = unmarshaller.unmarshal(source, Notes.class); + return customerElement; + } + + /** + * returns a {@link historybeans.Notes} instance. + * + * @param notes a xml string that contains notes. + * @return historybeans.Notes which is a bean representation of the notes saved in openbis + * @throws JAXBException + */ + public static JAXBElement parseNotes(String notes) throws JAXBException { + JAXBContext jaxbContext; + jaxbContext = JAXBContext.newInstance(MODEL_NOTES_CONTEXT_PATH); + javax.xml.bind.Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + + StreamSource source = new StreamSource(new StringReader(notes)); + JAXBElement customerElement = unmarshaller.unmarshal(source, Notes.class); + return customerElement; + } + + /** + * Write the jaxbelem (contains the notes as beans) back as xml into the outputstream + * + * @param jaxbelem + * @param os + * @throws JAXBException + */ + public static void writeNotes(JAXBElement jaxbelem, OutputStream os) throws JAXBException { + JAXBContext jaxbContext; + jaxbContext = JAXBContext.newInstance(MODEL_NOTES_CONTEXT_PATH); + javax.xml.bind.Marshaller marshaller = jaxbContext.createMarshaller(); + marshaller.marshal(jaxbelem, os); + } + + /** + * writes notes as a xml into the stringwriter. After that method the string can be retrieved with + * stringwriter.tostring + * + * @param jaxbelem + * @param sw + * @throws JAXBException + */ + public static void writeNotes(JAXBElement jaxbelem, StringWriter sw) throws JAXBException { + JAXBContext jaxbContext; + jaxbContext = JAXBContext.newInstance(MODEL_NOTES_CONTEXT_PATH); + javax.xml.bind.Marshaller marshaller = jaxbContext.createMarshaller(); + marshaller.marshal(jaxbelem, sw); + } + + +} diff --git a/src/main/java/life/qbic/datamodel/notes/Note.java b/src/main/java/life/qbic/datamodel/notes/Note.java new file mode 100644 index 000000000..145aa5043 --- /dev/null +++ b/src/main/java/life/qbic/datamodel/notes/Note.java @@ -0,0 +1,144 @@ +/******************************************************************************* + * QBiC Project qNavigator enables users to manage their projects. + * Copyright (C) "2016” Christopher Mohr, David Wojnar, Andreas Friedrich + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *******************************************************************************/ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.06.25 at 04:13:23 PM CEST +// + + +package life.qbic.datamodel.notes; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="comment" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="time" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="username" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "comment", + "time", + "username" +}) +@XmlRootElement(name = "note") +public class Note { + + @XmlElement(required = true) + protected String comment; + @XmlElement(required = true) + protected String time; + @XmlElement(required = true) + protected String username; + + /** + * Gets the value of the comment property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getComment() { + return comment; + } + + /** + * Sets the value of the comment property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setComment(String value) { + this.comment = value; + } + + /** + * Gets the value of the time property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTime() { + return time; + } + + /** + * Sets the value of the time property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTime(String value) { + this.time = value; + } + + /** + * Gets the value of the username property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUsername() { + return username; + } + + /** + * Sets the value of the username property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUsername(String value) { + this.username = value; + } + +} diff --git a/src/main/java/life/qbic/datamodel/notes/Notes.java b/src/main/java/life/qbic/datamodel/notes/Notes.java new file mode 100644 index 000000000..4d3912412 --- /dev/null +++ b/src/main/java/life/qbic/datamodel/notes/Notes.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * QBiC Project qNavigator enables users to manage their projects. + * Copyright (C) "2016” Christopher Mohr, David Wojnar, Andreas Friedrich + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *******************************************************************************/ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.06.25 at 04:13:23 PM CEST +// + + +package life.qbic.datamodel.notes; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element ref="{}note" maxOccurs="unbounded"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "note" +}) +@XmlRootElement(name = "notes") +public class Notes { + + @XmlElement(required = true) + protected List note; + + /** + * Gets the value of the note property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the note property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getNote().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Note } + * + * + */ + public List getNote() { + if (note == null) { + note = new ArrayList(); + } + return this.note; + } + +} diff --git a/src/main/java/life/qbic/datamodel/notes/ObjectFactory.java b/src/main/java/life/qbic/datamodel/notes/ObjectFactory.java new file mode 100644 index 000000000..c1708a424 --- /dev/null +++ b/src/main/java/life/qbic/datamodel/notes/ObjectFactory.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * QBiC Project qNavigator enables users to manage their projects. + * Copyright (C) "2016” Christopher Mohr, David Wojnar, Andreas Friedrich + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *******************************************************************************/ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.06.25 at 04:13:23 PM CEST +// + + +package life.qbic.datamodel.notes; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the generated package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link Note } + * + */ + public Note createNote() { + return new Note(); + } + + /** + * Create an instance of {@link Notes } + * + */ + public Notes createNotes() { + return new Notes(); + } + +} diff --git a/src/main/java/life/qbic/datamodel/notes/jaxb.properties b/src/main/java/life/qbic/datamodel/notes/jaxb.properties new file mode 100644 index 000000000..5837a4c25 --- /dev/null +++ b/src/main/java/life/qbic/datamodel/notes/jaxb.properties @@ -0,0 +1 @@ +javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file From 80c92a4cbf826ec18e4f3fddeca3cd28593b16de Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Wed, 13 Nov 2019 14:32:53 +0100 Subject: [PATCH 5/8] was already part of xml manager lib --- .../qbic/datamodel/notes/HistoryReader.java | 93 ----------- .../java/life/qbic/datamodel/notes/Note.java | 144 ------------------ .../java/life/qbic/datamodel/notes/Notes.java | 95 ------------ .../qbic/datamodel/notes/ObjectFactory.java | 72 --------- .../life/qbic/datamodel/notes/jaxb.properties | 1 - 5 files changed, 405 deletions(-) delete mode 100644 src/main/java/life/qbic/datamodel/notes/HistoryReader.java delete mode 100644 src/main/java/life/qbic/datamodel/notes/Note.java delete mode 100644 src/main/java/life/qbic/datamodel/notes/Notes.java delete mode 100644 src/main/java/life/qbic/datamodel/notes/ObjectFactory.java delete mode 100644 src/main/java/life/qbic/datamodel/notes/jaxb.properties diff --git a/src/main/java/life/qbic/datamodel/notes/HistoryReader.java b/src/main/java/life/qbic/datamodel/notes/HistoryReader.java deleted file mode 100644 index 7438086cb..000000000 --- a/src/main/java/life/qbic/datamodel/notes/HistoryReader.java +++ /dev/null @@ -1,93 +0,0 @@ -package life.qbic.datamodel.notes; - -import java.io.File; -import java.io.OutputStream; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.transform.stream.StreamSource; - -public class HistoryReader { - - private static final String MODEL_NOTES_CONTEXT_PATH = "life.qbic.datamodel.model.notes"; - - public static List parseXMLNotes(String value) { - List notes = new ArrayList(); - try { - JAXBElement jaxbelem = HistoryReader.parseNotes(value); - notes = jaxbelem.getValue().getNote(); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return notes; - } - - /** - * returns a {@link historybeans.Notes} instance. - * - * @param notes a xml file that contains notes. - * @return historybeans.Notes which is a bean representation of the notes saved in openbis - * @throws JAXBException - */ - public static JAXBElement parseNotes(File notes) throws JAXBException { - JAXBContext jaxbContext; - jaxbContext = JAXBContext.newInstance(MODEL_NOTES_CONTEXT_PATH); - javax.xml.bind.Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - StreamSource source = new StreamSource(notes); - JAXBElement customerElement = unmarshaller.unmarshal(source, Notes.class); - return customerElement; - } - - /** - * returns a {@link historybeans.Notes} instance. - * - * @param notes a xml string that contains notes. - * @return historybeans.Notes which is a bean representation of the notes saved in openbis - * @throws JAXBException - */ - public static JAXBElement parseNotes(String notes) throws JAXBException { - JAXBContext jaxbContext; - jaxbContext = JAXBContext.newInstance(MODEL_NOTES_CONTEXT_PATH); - javax.xml.bind.Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - - StreamSource source = new StreamSource(new StringReader(notes)); - JAXBElement customerElement = unmarshaller.unmarshal(source, Notes.class); - return customerElement; - } - - /** - * Write the jaxbelem (contains the notes as beans) back as xml into the outputstream - * - * @param jaxbelem - * @param os - * @throws JAXBException - */ - public static void writeNotes(JAXBElement jaxbelem, OutputStream os) throws JAXBException { - JAXBContext jaxbContext; - jaxbContext = JAXBContext.newInstance(MODEL_NOTES_CONTEXT_PATH); - javax.xml.bind.Marshaller marshaller = jaxbContext.createMarshaller(); - marshaller.marshal(jaxbelem, os); - } - - /** - * writes notes as a xml into the stringwriter. After that method the string can be retrieved with - * stringwriter.tostring - * - * @param jaxbelem - * @param sw - * @throws JAXBException - */ - public static void writeNotes(JAXBElement jaxbelem, StringWriter sw) throws JAXBException { - JAXBContext jaxbContext; - jaxbContext = JAXBContext.newInstance(MODEL_NOTES_CONTEXT_PATH); - javax.xml.bind.Marshaller marshaller = jaxbContext.createMarshaller(); - marshaller.marshal(jaxbelem, sw); - } - - -} diff --git a/src/main/java/life/qbic/datamodel/notes/Note.java b/src/main/java/life/qbic/datamodel/notes/Note.java deleted file mode 100644 index 145aa5043..000000000 --- a/src/main/java/life/qbic/datamodel/notes/Note.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * QBiC Project qNavigator enables users to manage their projects. - * Copyright (C) "2016” Christopher Mohr, David Wojnar, Andreas Friedrich - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - *******************************************************************************/ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.06.25 at 04:13:23 PM CEST -// - - -package life.qbic.datamodel.notes; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="comment" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="time" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="username" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "comment", - "time", - "username" -}) -@XmlRootElement(name = "note") -public class Note { - - @XmlElement(required = true) - protected String comment; - @XmlElement(required = true) - protected String time; - @XmlElement(required = true) - protected String username; - - /** - * Gets the value of the comment property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getComment() { - return comment; - } - - /** - * Sets the value of the comment property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setComment(String value) { - this.comment = value; - } - - /** - * Gets the value of the time property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTime() { - return time; - } - - /** - * Sets the value of the time property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTime(String value) { - this.time = value; - } - - /** - * Gets the value of the username property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUsername() { - return username; - } - - /** - * Sets the value of the username property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUsername(String value) { - this.username = value; - } - -} diff --git a/src/main/java/life/qbic/datamodel/notes/Notes.java b/src/main/java/life/qbic/datamodel/notes/Notes.java deleted file mode 100644 index 4d3912412..000000000 --- a/src/main/java/life/qbic/datamodel/notes/Notes.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * QBiC Project qNavigator enables users to manage their projects. - * Copyright (C) "2016” Christopher Mohr, David Wojnar, Andreas Friedrich - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - *******************************************************************************/ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.06.25 at 04:13:23 PM CEST -// - - -package life.qbic.datamodel.notes; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{}note" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "note" -}) -@XmlRootElement(name = "notes") -public class Notes { - - @XmlElement(required = true) - protected List note; - - /** - * Gets the value of the note property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the note property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getNote().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Note } - * - * - */ - public List getNote() { - if (note == null) { - note = new ArrayList(); - } - return this.note; - } - -} diff --git a/src/main/java/life/qbic/datamodel/notes/ObjectFactory.java b/src/main/java/life/qbic/datamodel/notes/ObjectFactory.java deleted file mode 100644 index c1708a424..000000000 --- a/src/main/java/life/qbic/datamodel/notes/ObjectFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * QBiC Project qNavigator enables users to manage their projects. - * Copyright (C) "2016” Christopher Mohr, David Wojnar, Andreas Friedrich - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - *******************************************************************************/ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.06.25 at 04:13:23 PM CEST -// - - -package life.qbic.datamodel.notes; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the generated package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link Note } - * - */ - public Note createNote() { - return new Note(); - } - - /** - * Create an instance of {@link Notes } - * - */ - public Notes createNotes() { - return new Notes(); - } - -} diff --git a/src/main/java/life/qbic/datamodel/notes/jaxb.properties b/src/main/java/life/qbic/datamodel/notes/jaxb.properties deleted file mode 100644 index 5837a4c25..000000000 --- a/src/main/java/life/qbic/datamodel/notes/jaxb.properties +++ /dev/null @@ -1 +0,0 @@ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file From 3b5a0ca35d43aff390dcfe5839fd53c4e57b313a Mon Sep 17 00:00:00 2001 From: Sven F Date: Tue, 19 Nov 2019 15:02:47 +0100 Subject: [PATCH 6/8] Add meta data registered status enum --- src/main/groovy/life/qbic/datamodel/services/Status.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/life/qbic/datamodel/services/Status.groovy b/src/main/groovy/life/qbic/datamodel/services/Status.groovy index ca75c3f74..99a781d9a 100644 --- a/src/main/groovy/life/qbic/datamodel/services/Status.groovy +++ b/src/main/groovy/life/qbic/datamodel/services/Status.groovy @@ -1,5 +1,5 @@ package life.qbic.datamodel.services; public enum Status { - WAITING, PROCESSING, PROCESSED, FAILED_QC, DATA_AT_QBIC -} \ No newline at end of file + WAITING, PROCESSING, PROCESSED, FAILED_QC, DATA_AT_QBIC, METADATA_REGISTERED +} From 17a9040fec36a377c2f3ee9695a42a090613ccd9 Mon Sep 17 00:00:00 2001 From: Tobias Koch Date: Wed, 20 Nov 2019 13:43:33 +0100 Subject: [PATCH 7/8] import classes from https://github.com/qbicsoftware/nextflow-logger-service --- .../life/qbic/datamodel/Constants.groovy | 7 ++ .../qbic/datamodel/workflows/MetaData.groovy | 40 ++++++++++++ .../qbic/datamodel/workflows/RunInfo.groovy | 64 +++++++++++++++++++ .../qbic/datamodel/workflows/Trace.groovy | 39 +++++++++++ 4 files changed, 150 insertions(+) create mode 100644 src/main/groovy/life/qbic/datamodel/Constants.groovy create mode 100644 src/main/groovy/life/qbic/datamodel/workflows/MetaData.groovy create mode 100644 src/main/groovy/life/qbic/datamodel/workflows/RunInfo.groovy create mode 100644 src/main/groovy/life/qbic/datamodel/workflows/Trace.groovy diff --git a/src/main/groovy/life/qbic/datamodel/Constants.groovy b/src/main/groovy/life/qbic/datamodel/Constants.groovy new file mode 100644 index 000000000..20dfa33a1 --- /dev/null +++ b/src/main/groovy/life/qbic/datamodel/Constants.groovy @@ -0,0 +1,7 @@ +package life.qbic.datamodel + +class Constants { + + static final public String ISO_8601_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'" + +} diff --git a/src/main/groovy/life/qbic/datamodel/workflows/MetaData.groovy b/src/main/groovy/life/qbic/datamodel/workflows/MetaData.groovy new file mode 100644 index 000000000..42e899161 --- /dev/null +++ b/src/main/groovy/life/qbic/datamodel/workflows/MetaData.groovy @@ -0,0 +1,40 @@ +package life.qbic.datamodel.workflows + +import com.fasterxml.jackson.annotation.JsonProperty +import groovy.transform.EqualsAndHashCode + +@EqualsAndHashCode() +class MetaData { + + @JsonProperty('metadata') + private final Map metadata + + MetaData() { + metadata = [:].asImmutable() + } + + MetaData(Map metadata){ + this.metadata = metadata.asImmutable() + } + + @Override + Object getProperty(String s) { + return this.metadata.get(s) + } + + @Override + boolean equals(Object o) { + if( !o instanceof MetaData ) { + return false + } + def trace = o as MetaData + for( String key in this.metadata.keySet() ) { + def thisProperty = this.getProperty(key) + def otherProperty = trace.getProperty(key) + if( ! otherProperty || ( otherProperty != thisProperty ) ) { + return false + } + } + return true + } +} diff --git a/src/main/groovy/life/qbic/datamodel/workflows/RunInfo.groovy b/src/main/groovy/life/qbic/datamodel/workflows/RunInfo.groovy new file mode 100644 index 000000000..e7b532143 --- /dev/null +++ b/src/main/groovy/life/qbic/datamodel/workflows/RunInfo.groovy @@ -0,0 +1,64 @@ +package life.qbic.datamodel.workflows + +import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.annotation.JsonProperty +import groovy.transform.EqualsAndHashCode +import life.qbic.datamodel.Constants + +import java.text.SimpleDateFormat + +enum NextflowEventType +{ + STARTED, PROCESS_SUBMITTED, PROCESS_STARTED, PROCESS_COMPLETED, ERROR, COMPLETED, UNKNOWN +} + +@EqualsAndHashCode() +class RunInfo { + + @JsonProperty("event") + private NextflowEventType event + + @JsonProperty("runName") + private String name + + @JsonProperty("runStatus") + private String status + + @JsonProperty("runId") + private String id + + @JsonProperty("utcTime") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = Constants.ISO_8601_DATETIME_FORMAT) + private Date time + + RunInfo() { + event = NextflowEventType.UNKNOWN + name = "" + status = "" + id = "" + time = new Date() + } + + RunInfo(Map weblogRunInformation) { + event = convertEventStringToEventType(weblogRunInformation.get('event') as String) + name = weblogRunInformation.get('runName') ?: "" + status = weblogRunInformation.get('runStatus') ?: "" + id = weblogRunInformation.get('runId') ?: "" + time = convertStringToDate(weblogRunInformation.get('utcTime') as String) + } + + private static Date convertStringToDate(String s) { + Date date = new SimpleDateFormat(Constants.ISO_8601_DATETIME_FORMAT).parse(s) + return date + } + + private static NextflowEventType convertEventStringToEventType(String event) { + try { + def eventType = event.toUpperCase() as NextflowEventType + return eventType + } catch (IllegalArgumentException e) { + return NextflowEventType.UNKNOWN + } + } + +} diff --git a/src/main/groovy/life/qbic/datamodel/workflows/Trace.groovy b/src/main/groovy/life/qbic/datamodel/workflows/Trace.groovy new file mode 100644 index 000000000..dded6dc28 --- /dev/null +++ b/src/main/groovy/life/qbic/datamodel/workflows/Trace.groovy @@ -0,0 +1,39 @@ +package life.qbic.datamodel.workflows + +import com.fasterxml.jackson.annotation.JsonProperty + + +class Trace { + + @JsonProperty("properties") + private final Map traceInformation + + Trace() { + traceInformation = [:].asImmutable() + } + + Trace(Map trace) { + traceInformation = trace.asImmutable() + } + + @Override + Object getProperty(String s) { + return traceInformation.get(s) + } + + @Override + boolean equals(Object o) { + if( !o instanceof Trace ) { + return false + } + def trace = o as Trace + for( String key in this.traceInformation.keySet() ) { + def thisProperty = this.getProperty(key) + def otherProperty = trace.getProperty(key) + if( ! otherProperty || ( otherProperty != thisProperty ) ) { + return false + } + } + return true + } +} From 9bbab5710d9b5d8c0acd7f39f9ea660284d6ee75 Mon Sep 17 00:00:00 2001 From: Sven Fillinger Date: Fri, 29 Nov 2019 13:55:49 +0100 Subject: [PATCH 8/8] Includes save release mode --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1bb1d4248..4061dc3dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,8 @@ before_script: if [ "$VAADIN_CHARTS_LICENSE_CODE" != "" ]; then fi; # as agreed in our SOP, build everything (don't deploy, just try to 'mvn install' locally, which covers all phases) -script: mvn --quiet --activate-profiles !development-build,!release-build --settings .travis.settings.xml clean cobertura:cobertura install +script: mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}-SNAPSHOT versions:update-child-modules && mvn versions:commit && + mvn --quiet --activate-profiles !development-build,!release-build --settings .travis.settings.xml clean cobertura:cobertura install # upload code coverage report, generate maven site (javadocs, documentation, static code analysis, etc.) after_success: - bash <(curl -s https://codecov.io/bash) @@ -54,7 +55,8 @@ deploy: # artifact will be installed in our testing instance if it is a .war file - skip_cleanup: true provider: script - script: mvn --quiet --activate-profiles !development-build,release-build --settings .travis.settings.xml deploy + script: mvn build-helper:parse-version versions:set -DnewVersion=$TRAVIS_TAG -DprocessAllModules && mvn versions:commit && + mvn --quiet --activate-profiles !development-build,release-build --settings .travis.settings.xml deploy on: branch: master condition: '"$TRAVIS_EVENT_TYPE" = "push"'