Commit 295e3216 authored by rwm's avatar rwm

jaxb classes updated

parent e82b941c
......@@ -65,11 +65,14 @@ Query exchange
<received>XXXtimestamp</received>
<confirmation method="single|double|automatic">xxx</confirmation>
<!-- confirmation or rejection -->
<rejected></rejected>
<rejected></rejected><!-- manually rejected -->
<!-- may also automatically reject requests:
reject all because of vacation,
reject specific recurring query -->
<comment></comment>
<last-execution>
<completed>XXXtimestamp</completed>
<failed></failed>
<failed></failed><!-- may fail due to technical reasons -->
</last-execution>
<last-contact>
......@@ -79,4 +82,9 @@ Query exchange
<query-result id-ref="">
</query-result>
<nodeStatus>
<module artifact="dwh-api" version="0.1-SNAPSHOT"/>
</nodeStatus>
```
package org.aktin.exchange;
/**
* Status for a data warehouse node
*
* @author R.W.Majeed
*
*/
public class NodeStatus {
public NodeStatus(){
apiVersion = getClass().getPackage().getImplementationVersion();
}
/**
* Version of the dwh-api component
*/
String apiVersion;
}
......@@ -4,10 +4,13 @@ import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import org.w3c.dom.Element;
/**
* Query which can be executed in an i2b2
* data warehouse by the AKTIN remote query
......@@ -53,4 +56,7 @@ public class Query {
@XmlElementWrapper(name="concepts",required=true)
@XmlElement(name="concept",required=true)
public List<AbstractConcept> concepts;
@XmlAnyElement
public Element definition;
}
......@@ -15,7 +15,7 @@ public abstract class QuerySchedule {
/**
* Duration for the query. The duration is relative
* to the {@link #reference} timestamp and might also be negative.
* to a reference timestamp and might also be negative.
*/
@XmlElement(required=true)
public Period duration;
......
......@@ -71,20 +71,22 @@ public class TestUnmarshallDocuments {
@Test
public void unmarshallQuery() throws IOException, SAXException{
Source xml = getResource("/query.xml");
Query query = JAXB.unmarshal(xml, Query.class);
Assert.assertEquals(query.schedule.getClass(), SingleExecution.class);
SingleExecution se = (SingleExecution)query.schedule;
Assert.assertNotNull(se.duration);
Assert.assertNotNull(se.reference);
//System.out.println("Duration:"+se.duration);
//System.out.println("Reference:"+se.reference);
// print XML output
//se.duration = Period.ofMonths(1);
//se.reference = Instant.now();
//JAXB.marshal(query, System.out);
Query query = JAXB.unmarshal(xml, Query.class);
Assert.assertEquals(query.schedule.getClass(), SingleExecution.class);
SingleExecution se = (SingleExecution)query.schedule;
Assert.assertNotNull(se.duration);
Assert.assertNotNull(se.reference);
//System.out.println("Duration:"+se.duration);
//System.out.println("Reference:"+se.reference);
// print XML output
//se.duration = Period.ofMonths(1);
//se.reference = Instant.now();
//JAXB.marshal(query, System.out);
System.out.println("Query definition ns: "+query.definition.getNamespaceURI());
System.out.println("Query definition elem: "+query.definition.getLocalName());
}
@Test
public void validateQueryRequest() throws IOException, SAXException, TransformerException{
......
<query xmlns="http://aktin.org/ns/exchange"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dwh="http://aktin.org/ns/dwh">
<id>123</id>
<description>Lala</description>
<principal>
......@@ -15,4 +16,7 @@
<concepts>
<concept id="birthdate" xsi:type="raw"/>
</concepts>
<dwh:sql xsi:type="dwh:sqlt">
SELECT a, b;
</dwh:sql>
</query>
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