dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27648
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13762: csd: soap error handling, only for missing getModificationRequest element for now
------------------------------------------------------------
revno: 13762
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-01-17 13:14:44 +0700
message:
csd: soap error handling, only for missing getModificationRequest element for now
added:
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Code.java
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Fault.java
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Reason.java
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Subcode.java
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Text.java
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Value.java
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/exception/
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/exception/SoapException.java
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/exception/
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/exception/MissingGetModificationsRequestElement.java
modified:
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Body.java
dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Body.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Body.java 2014-01-16 15:26:39 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Body.java 2014-01-17 06:14:44 +0000
@@ -49,6 +49,9 @@
@XmlElement( name = "getModificationsResponse", namespace = "urn:ihe:iti:csd:2013" )
private GetModificationsResponse getModificationsResponse;
+ @XmlElement( name = "Fault", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+ private Fault fault;
+
public Body()
{
}
@@ -72,4 +75,14 @@
{
this.getModificationsResponse = getModificationsResponse;
}
+
+ public Fault getFault()
+ {
+ return fault;
+ }
+
+ public void setFault( Fault fault )
+ {
+ this.fault = fault;
+ }
}
=== added file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Code.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Code.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Code.java 2014-01-17 06:14:44 +0000
@@ -0,0 +1,79 @@
+package org.hisp.dhis.web.ohie.common.domain.soap;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlType( name = "Code", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+public class Code
+{
+ @XmlElement( name = "Value", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+ private Value value = new Value();
+
+ @XmlElement( name = "Subcode", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+ private List<Subcode> subcodes = new ArrayList<Subcode>();
+
+ public Code()
+ {
+ }
+
+ public Code( String value )
+ {
+ this.value = new Value( value );
+ }
+
+ public Value getValue()
+ {
+ return value;
+ }
+
+ public void setValue( Value value )
+ {
+ this.value = value;
+ }
+
+ public List<Subcode> getSubcodes()
+ {
+ return subcodes;
+ }
+
+ public void setSubcodes( List<Subcode> subcodes )
+ {
+ this.subcodes = subcodes;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Fault.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Fault.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Fault.java 2014-01-17 06:14:44 +0000
@@ -0,0 +1,72 @@
+package org.hisp.dhis.web.ohie.common.domain.soap;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlType( name = "Fault", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+public class Fault
+{
+ @XmlElement( name = "Code", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+ private Code code = new Code();
+
+ @XmlElement( name = "Reason", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+ private Reason reason = new Reason();
+
+ public Fault()
+ {
+ }
+
+ public Code getCode()
+ {
+ return code;
+ }
+
+ public void setCode( Code code )
+ {
+ this.code = code;
+ }
+
+ public Reason getReason()
+ {
+ return reason;
+ }
+
+ public void setReason( Reason reason )
+ {
+ this.reason = reason;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Reason.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Reason.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Reason.java 2014-01-17 06:14:44 +0000
@@ -0,0 +1,64 @@
+package org.hisp.dhis.web.ohie.common.domain.soap;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlType( name = "Reason", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+public class Reason
+{
+ @XmlElement( name = "Text", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+ private Text text = new Text();
+
+ public Reason()
+ {
+ }
+
+ public Reason( String text )
+ {
+ this.text = new Text( text );
+ }
+
+ public Text getText()
+ {
+ return text;
+ }
+
+ public void setText( Text text )
+ {
+ this.text = text;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Subcode.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Subcode.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Subcode.java 2014-01-17 06:14:44 +0000
@@ -0,0 +1,64 @@
+package org.hisp.dhis.web.ohie.common.domain.soap;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlType( name = "Subcode", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+public class Subcode
+{
+ @XmlElement( name = "Value", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+ private Value value = new Value();
+
+ public Subcode()
+ {
+ }
+
+ public Subcode( String value )
+ {
+ this.value = new Value( value );
+ }
+
+ public Value getValue()
+ {
+ return value;
+ }
+
+ public void setValue( Value value )
+ {
+ this.value = value;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Text.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Text.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Text.java 2014-01-17 06:14:44 +0000
@@ -0,0 +1,64 @@
+package org.hisp.dhis.web.ohie.common.domain.soap;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlType( name = "Text", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+public class Text
+{
+ @XmlValue
+ private String value;
+
+ public Text()
+ {
+ }
+
+ public Text( String value )
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue( String value )
+ {
+ this.value = value;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Value.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Value.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/domain/soap/Value.java 2014-01-17 06:14:44 +0000
@@ -0,0 +1,64 @@
+package org.hisp.dhis.web.ohie.common.domain.soap;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlType( name = "Value", namespace = "http://www.w3.org/2003/05/soap-envelope" )
+public class Value
+{
+ @XmlValue
+ private String value;
+
+ public Value()
+ {
+ }
+
+ public Value( String value )
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue( String value )
+ {
+ this.value = value;
+ }
+}
=== added directory 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/exception'
=== added file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/exception/SoapException.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/exception/SoapException.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/common/exception/SoapException.java 2014-01-17 06:14:44 +0000
@@ -0,0 +1,58 @@
+package org.hisp.dhis.web.ohie.common.exception;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public abstract class SoapException extends RuntimeException
+{
+ private String faultCode = "env:Sender";
+
+ public SoapException()
+ {
+ super( "Request not valid SOAP 1.2" );
+ }
+
+ public SoapException( String message )
+ {
+ super( message );
+ }
+
+ public SoapException( String faultCode, String message )
+ {
+ super( message );
+ this.faultCode = faultCode;
+ }
+
+ public String getFaultCode()
+ {
+ return faultCode;
+ }
+}
=== added directory 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/exception'
=== added file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/exception/MissingGetModificationsRequestElement.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/exception/MissingGetModificationsRequestElement.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/exception/MissingGetModificationsRequestElement.java 2014-01-17 06:14:44 +0000
@@ -0,0 +1,42 @@
+package org.hisp.dhis.web.ohie.csd.exception;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.web.ohie.common.exception.SoapException;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class MissingGetModificationsRequestElement extends SoapException
+{
+ public MissingGetModificationsRequestElement()
+ {
+ super( "Missing urn:ihe:iti:csd:2013:GetModificationsRequest element." );
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java'
--- dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java 2014-01-16 15:26:39 +0000
+++ dhis-2/dhis-web/dhis-web-ohie/src/main/java/org/hisp/dhis/web/ohie/csd/webapi/CsdController.java 2014-01-17 06:14:44 +0000
@@ -33,7 +33,9 @@
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.web.ohie.common.domain.soap.Envelope;
+import org.hisp.dhis.web.ohie.common.domain.soap.Fault;
import org.hisp.dhis.web.ohie.common.domain.wsa.RelatesTo;
+import org.hisp.dhis.web.ohie.common.exception.SoapException;
import org.hisp.dhis.web.ohie.csd.domain.CodedType;
import org.hisp.dhis.web.ohie.csd.domain.CommonName;
import org.hisp.dhis.web.ohie.csd.domain.Contact;
@@ -47,19 +49,21 @@
import org.hisp.dhis.web.ohie.csd.domain.Person;
import org.hisp.dhis.web.ohie.csd.domain.Record;
import org.hisp.dhis.web.ohie.csd.domain.Service;
+import org.hisp.dhis.web.ohie.csd.exception.MissingGetModificationsRequestElement;
import org.hisp.dhis.web.ohie.fred.webapi.v1.utils.GeoUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.client.HttpClientErrorException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
@@ -72,10 +76,16 @@
@RequestMapping( value = "/csd" )
public class CsdController
{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
@Autowired
private OrganisationUnitService organisationUnitService;
- private static JAXBContext jaxbContext;
+ private static Marshaller marshaller;
+
+ private static Unmarshaller unmarshaller;
static
{
@@ -86,7 +96,10 @@
};
// TODO: switch Eclipse MOXy?
- jaxbContext = JAXBContext.newInstance( classes );
+ JAXBContext jaxbContext = JAXBContext.newInstance( classes );
+
+ marshaller = jaxbContext.createMarshaller();
+ unmarshaller = jaxbContext.createUnmarshaller();
}
catch ( JAXBException ex )
{
@@ -94,10 +107,14 @@
}
}
+ // -------------------------------------------------------------------------
+ // POST
+ // -------------------------------------------------------------------------
+
@RequestMapping( value = "", method = RequestMethod.POST, consumes = MediaType.ALL_VALUE, produces = MediaType.ALL_VALUE )
public void careServicesRequest( HttpServletRequest request, HttpServletResponse response ) throws IOException, JAXBException
{
- Object o = jaxbContext.createUnmarshaller().unmarshal( request.getInputStream() );
+ Object o = unmarshaller.unmarshal( request.getInputStream() );
Envelope env = (Envelope) o;
List<OrganisationUnit> organisationUnits = getOrganisationUnits( env );
@@ -106,10 +123,28 @@
Envelope envelope = createResponse( csd, env.getHeader().getMessageID().getValue() );
response.setContentType( "application/soap+xml" );
- jaxbContext.createMarshaller().marshal( envelope, response.getOutputStream() );
- }
-
- private List<OrganisationUnit> getOrganisationUnits( Envelope envelope )
+ marshaller.marshal( envelope, response.getOutputStream() );
+ }
+
+ @ExceptionHandler
+ public void soapError( SoapException ex, HttpServletResponse response ) throws JAXBException, IOException
+ {
+ Envelope envelope = new Envelope();
+ envelope.setHeader( null );
+ envelope.getBody().setFault( new Fault() );
+ envelope.getBody().getFault().getCode().getValue().setValue( ex.getFaultCode() );
+ envelope.getBody().getFault().getReason().getText().setValue( ex.getMessage() );
+
+ response.setContentType( "application/soap+xml" );
+ marshaller.marshal( envelope, response.getOutputStream() );
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Helpers
+ // -------------------------------------------------------------------------
+
+ private List<OrganisationUnit> getOrganisationUnits( Envelope envelope ) throws MissingGetModificationsRequestElement
{
Date lastModified;
@@ -119,7 +154,7 @@
}
catch ( NullPointerException ex )
{
- throw new HttpClientErrorException( HttpStatus.BAD_REQUEST );
+ throw new MissingGetModificationsRequestElement();
}
return new ArrayList<OrganisationUnit>(