=== removed directory 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message' === removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/AbstractMessageResponse.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/AbstractMessageResponse.java 2014-10-14 07:01:10 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/AbstractMessageResponse.java 1970-01-01 00:00:00 +0000 @@ -1,67 +0,0 @@ -package org.hisp.dhis.dxf2.message; - -/* - * Copyright (c) 2004-2014, 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 com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -/** - * @author Morten Olav Hansen - */ -public class AbstractMessageResponse implements MessageResponse -{ - /** - * Optional type property. Since we are using the somewhat generic name 'response' for the data - * part of the message, this can be used to signal what kind of response this is. - *

- * Some examples might be 'importCount', 'importSummary', etc. - */ - private String type; - - public AbstractMessageResponse() - { - } - - public AbstractMessageResponse( String type ) - { - this.type = type; - } - - @JsonProperty - @JacksonXmlProperty( isAttribute = true ) - public String getType() - { - return type; - } - - public void setType( String type ) - { - this.type = type; - } -} === removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/HttpMessage.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/HttpMessage.java 2014-10-14 07:01:10 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/HttpMessage.java 1970-01-01 00:00:00 +0000 @@ -1,90 +0,0 @@ -package org.hisp.dhis.dxf2.message; - -/* - * Copyright (c) 2004-2014, 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 com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.google.common.base.Objects; - -/** - * @author Morten Olav Hansen - */ -@JsonPropertyOrder( { - "status", "code", "httpStatusCode", "message", "devMessage", "response" -} ) -public class HttpMessage extends Message -{ - /** - * HTTP status code. - */ - protected Integer httpStatusCode; - - public HttpMessage( MessageStatus status ) - { - super( status ); - } - - public HttpMessage( MessageStatus status, Integer httpStatusCode ) - { - super( status ); - this.httpStatusCode = httpStatusCode; - } - - public HttpMessage( MessageStatus status, Integer httpStatusCode, String message ) - { - this( status, httpStatusCode ); - this.message = message; - } - - @JsonProperty - @JacksonXmlProperty( isAttribute = true ) - public Integer getHttpStatusCode() - { - return httpStatusCode; - } - - public void setHttpStatusCode( Integer httpStatusCode ) - { - this.httpStatusCode = httpStatusCode; - } - - @Override - public String toString() - { - return Objects.toStringHelper( this ) - .add( "status", status ) - .add( "code", code ) - .add( "httpStatusCode", httpStatusCode ) - .add( "message", message ) - .add( "devMessage", devMessage ) - .add( "response", response ) - .toString(); - } -} === removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/Message.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/Message.java 2014-10-14 08:09:22 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/Message.java 1970-01-01 00:00:00 +0000 @@ -1,167 +0,0 @@ -package org.hisp.dhis.dxf2.message; - -/* - * Copyright (c) 2004-2014, 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 com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import com.google.common.base.Objects; -import org.hisp.dhis.common.DxfNamespaces; - -/** - * @author Morten Olav Hansen - */ -@JacksonXmlRootElement( localName = "message", namespace = DxfNamespaces.DXF_2_0 ) -@JsonPropertyOrder( { - "status", "code", "message", "devMessage", "response" -} ) -public class Message -{ - /** - * Message status, currently two statuses are available: OK, ERROR. - * - * @see org.hisp.dhis.dxf2.message.MessageStatus - */ - protected MessageStatus status; - - /** - * Internal code for this message. Should be used to help with third party clients which - * should not have to resort to string parsing of message to know what is happening. - */ - protected Integer code; - - /** - * Non-technical message, should be simple and could possibly be used to display message - * to an end-user. - */ - protected String message; - - /** - * Technical message that should explain as much details as possible, mainly to be used - * for debugging. - */ - protected String devMessage; - - /** - * When a simple text feedback is not enough, you can use this interface to implement your - * own message responses. - * - * @see org.hisp.dhis.dxf2.message.MessageResponse - */ - protected MessageResponse response; - - public Message() - { - this.status = MessageStatus.OK; - } - - public Message( MessageStatus status ) - { - this.status = status; - } - - public Message( MessageStatus status, String message ) - { - this.status = status; - this.message = message; - } - - @JsonProperty - @JacksonXmlProperty( isAttribute = true ) - public MessageStatus getStatus() - { - return status; - } - - public void setStatus( MessageStatus status ) - { - this.status = status; - } - - @JsonProperty - @JacksonXmlProperty( isAttribute = true ) - public Integer getCode() - { - return code; - } - - public void setCode( Integer code ) - { - this.code = code; - } - - @JsonProperty - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getMessage() - { - return message; - } - - public void setMessage( String message ) - { - this.message = message; - } - - @JsonProperty - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getDevMessage() - { - return devMessage; - } - - public void setDevMessage( String devMessage ) - { - this.devMessage = devMessage; - } - - @JsonProperty - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public MessageResponse getResponse() - { - return response; - } - - public void setResponse( MessageResponse response ) - { - this.response = response; - } - - @Override - public String toString() - { - return Objects.toStringHelper( this ) - .add( "status", status ) - .add( "code", code ) - .add( "message", message ) - .add( "devMessage", devMessage ) - .add( "response", response ) - .toString(); - } -} === removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/MessageResponse.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/MessageResponse.java 2014-10-14 07:01:10 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/MessageResponse.java 1970-01-01 00:00:00 +0000 @@ -1,36 +0,0 @@ -package org.hisp.dhis.dxf2.message; - -/* - * Copyright (c) 2004-2014, 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 - */ -public interface MessageResponse -{ -} === removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/MessageStatus.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/MessageStatus.java 2014-10-14 07:01:10 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/MessageStatus.java 1970-01-01 00:00:00 +0000 @@ -1,37 +0,0 @@ -package org.hisp.dhis.dxf2.message; - -/* - * Copyright (c) 2004-2014, 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 - */ -public enum MessageStatus -{ - OK, ERROR -} === removed directory 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/responses' === removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/responses/ImportCountResponse.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/responses/ImportCountResponse.java 2014-10-14 07:01:10 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/message/responses/ImportCountResponse.java 1970-01-01 00:00:00 +0000 @@ -1,95 +0,0 @@ -package org.hisp.dhis.dxf2.message.responses; - -/* - * Copyright (c) 2004-2014, 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 com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import org.hisp.dhis.common.DxfNamespaces; -import org.hisp.dhis.dxf2.message.AbstractMessageResponse; - -/** - * @author Morten Olav Hansen - */ -@JsonPropertyOrder( { - "type", "created", "updated", "deleted" -} ) -public class ImportCountResponse extends AbstractMessageResponse -{ - private int created; - - private int updated; - - private int deleted; - - public ImportCountResponse( int created, int updated, int deleted ) - { - setType( "importCount" ); - this.created = created; - this.updated = updated; - this.deleted = deleted; - } - - @JsonProperty - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public int getCreated() - { - return created; - } - - public void setCreated( int created ) - { - this.created = created; - } - - @JsonProperty - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public int getUpdated() - { - return updated; - } - - public void setUpdated( int updated ) - { - this.updated = updated; - } - - @JsonProperty - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public int getDeleted() - { - return deleted; - } - - public void setDeleted( int deleted ) - { - this.deleted = deleted; - } -} === added directory 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage' === added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/AbstractWebMessageResponse.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/AbstractWebMessageResponse.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/AbstractWebMessageResponse.java 2014-10-14 10:55:25 +0000 @@ -0,0 +1,68 @@ +package org.hisp.dhis.dxf2.webmessage; + +/* + * Copyright (c) 2004-2014, 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 com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; + +/** + * @author Morten Olav Hansen + */ +public class AbstractWebMessageResponse implements WebMessageResponse +{ + /** + * Optional type property. Since we are using the somewhat generic name 'response' for the data + * part of the message, this can be used to signal what kind of response this is. + *

+ * Some examples might be 'ImportCount', 'ImportSummary', etc. + */ + private String type; + + public AbstractWebMessageResponse() + { + this.type = getClass().getSimpleName().replaceFirst( "WebMessageResponse", "" ); + } + + public AbstractWebMessageResponse( String type ) + { + this.type = type; + } + + @JsonProperty + @JacksonXmlProperty( isAttribute = true ) + public String getType() + { + return type; + } + + public void setType( String type ) + { + this.type = type; + } +} === added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessage.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessage.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessage.java 2014-10-14 10:55:25 +0000 @@ -0,0 +1,185 @@ +package org.hisp.dhis.dxf2.webmessage; + +/* + * Copyright (c) 2004-2014, 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 com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import com.google.common.base.Objects; +import org.hisp.dhis.common.DxfNamespaces; + +/** + * @author Morten Olav Hansen + */ +@JacksonXmlRootElement( localName = "webMessage", namespace = DxfNamespaces.DXF_2_0 ) +@JsonPropertyOrder( { + "status", "code", "httpStatusCode", "message", "devMessage", "response" +} ) +public class WebMessage +{ + /** + * Message status, currently two statuses are available: OK, ERROR. + * + * @see WebMessageStatus + */ + protected WebMessageStatus status; + + /** + * Internal code for this message. Should be used to help with third party clients which + * should not have to resort to string parsing of message to know what is happening. + */ + protected Integer code; + + /** + * HTTP status code. + */ + protected Integer httpStatusCode; + + /** + * Non-technical message, should be simple and could possibly be used to display message + * to an end-user. + */ + protected String message; + + /** + * Technical message that should explain as much details as possible, mainly to be used + * for debugging. + */ + protected String devMessage; + + /** + * When a simple text feedback is not enough, you can use this interface to implement your + * own message responses. + * + * @see WebMessageResponse + */ + protected WebMessageResponse response; + + public WebMessage() + { + this.status = WebMessageStatus.OK; + } + + public WebMessage( WebMessageStatus status ) + { + this.status = status; + } + + public WebMessage( WebMessageStatus status, Integer httpStatusCode ) + { + this.status = status; + this.httpStatusCode = httpStatusCode; + } + + @JsonProperty + @JacksonXmlProperty( isAttribute = true ) + public WebMessageStatus getStatus() + { + return status; + } + + public void setStatus( WebMessageStatus status ) + { + this.status = status; + } + + @JsonProperty + @JacksonXmlProperty( isAttribute = true ) + public Integer getCode() + { + return code; + } + + public void setCode( Integer code ) + { + this.code = code; + } + + @JsonProperty + @JacksonXmlProperty( isAttribute = true ) + public Integer getHttpStatusCode() + { + return httpStatusCode; + } + + public void setHttpStatusCode( Integer httpStatusCode ) + { + this.httpStatusCode = httpStatusCode; + } + + @JsonProperty + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getMessage() + { + return message; + } + + public void setMessage( String message ) + { + this.message = message; + } + + @JsonProperty + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getDevMessage() + { + return devMessage; + } + + public void setDevMessage( String devMessage ) + { + this.devMessage = devMessage; + } + + @JsonProperty + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public WebMessageResponse getResponse() + { + return response; + } + + public void setResponse( WebMessageResponse response ) + { + this.response = response; + } + + @Override + public String toString() + { + return Objects.toStringHelper( this ) + .add( "status", status ) + .add( "code", code ) + .add( "httpStatusCode", httpStatusCode ) + .add( "message", message ) + .add( "devMessage", devMessage ) + .add( "response", response ) + .toString(); + } +} === added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessageResponse.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessageResponse.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessageResponse.java 2014-10-14 10:55:25 +0000 @@ -0,0 +1,36 @@ +package org.hisp.dhis.dxf2.webmessage; + +/* + * Copyright (c) 2004-2014, 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 + */ +public interface WebMessageResponse +{ +} === added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessageStatus.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessageStatus.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/WebMessageStatus.java 2014-10-14 10:55:25 +0000 @@ -0,0 +1,37 @@ +package org.hisp.dhis.dxf2.webmessage; + +/* + * Copyright (c) 2004-2014, 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 + */ +public enum WebMessageStatus +{ + OK, ERROR +} === added directory 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/responses' === added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/responses/ImportCountWebMessageResponse.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/responses/ImportCountWebMessageResponse.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/webmessage/responses/ImportCountWebMessageResponse.java 2014-10-14 10:55:25 +0000 @@ -0,0 +1,93 @@ +package org.hisp.dhis.dxf2.webmessage.responses; + +/* + * Copyright (c) 2004-2014, 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 com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import org.hisp.dhis.common.DxfNamespaces; +import org.hisp.dhis.dxf2.webmessage.AbstractWebMessageResponse; + +/** + * @author Morten Olav Hansen + */ +@JsonPropertyOrder( { + "type", "created", "updated", "deleted" +} ) +public class ImportCountWebMessageResponse extends AbstractWebMessageResponse +{ + private int created; + + private int updated; + + private int deleted; + + public ImportCountWebMessageResponse( int created, int updated, int deleted ) + { + this.created = created; + this.updated = updated; + this.deleted = deleted; + } + + @JsonProperty + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public int getCreated() + { + return created; + } + + public void setCreated( int created ) + { + this.created = created; + } + + @JsonProperty + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public int getUpdated() + { + return updated; + } + + public void setUpdated( int updated ) + { + this.updated = updated; + } + + @JsonProperty + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public int getDeleted() + { + return deleted; + } + + public void setDeleted( int deleted ) + { + this.deleted = deleted; + } +}