dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27534
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13708: csd: start of csd domain model, controller now returns very a very primitive csd model (primaryNa...
------------------------------------------------------------
revno: 13708
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-14 11:30:06 +0700
message:
csd: start of csd domain model, controller now returns very a very primitive csd model (primaryName, record). Oid mapped as Uid for now.
added:
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Csd.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Facility.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/FacilityDirectory.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/OrganizationDirectory.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Record.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/ServiceDirectory.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/package-info.java
modified:
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/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
=== added directory 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd'
=== added file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Csd.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Csd.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Csd.java 2014-01-14 04:30:06 +0000
@@ -0,0 +1,85 @@
+package org.hisp.dhis.web.csd.domain.csd;
+
+/*
+ * 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.XmlRootElement;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlRootElement( name = "CSD", namespace = "urn:ihe:iti:csd:2013" )
+public class Csd
+{
+ @XmlElement( name = "organizationDirectory", namespace = "urn:ihe:iti:csd:2013" )
+ private OrganizationDirectory organizationDirectory = new OrganizationDirectory();
+
+ @XmlElement( name = "serviceDirectory", namespace = "urn:ihe:iti:csd:2013" )
+ private ServiceDirectory serviceDirectory = new ServiceDirectory();
+
+ @XmlElement( name = "facilityDirectory", namespace = "urn:ihe:iti:csd:2013" )
+ private FacilityDirectory facilityDirectory = new FacilityDirectory();
+
+ public Csd()
+ {
+ }
+
+ public OrganizationDirectory getOrganizationDirectory()
+ {
+ return organizationDirectory;
+ }
+
+ public void setOrganizationDirectory( OrganizationDirectory organizationDirectory )
+ {
+ this.organizationDirectory = organizationDirectory;
+ }
+
+ public ServiceDirectory getServiceDirectory()
+ {
+ return serviceDirectory;
+ }
+
+ public void setServiceDirectory( ServiceDirectory serviceDirectory )
+ {
+ this.serviceDirectory = serviceDirectory;
+ }
+
+ public FacilityDirectory getFacilityDirectory()
+ {
+ return facilityDirectory;
+ }
+
+ public void setFacilityDirectory( FacilityDirectory facilityDirectory )
+ {
+ this.facilityDirectory = facilityDirectory;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Facility.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Facility.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Facility.java 2014-01-14 04:30:06 +0000
@@ -0,0 +1,86 @@
+package org.hisp.dhis.web.csd.domain.csd;
+
+/*
+ * 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.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlRootElement( name = "facility", namespace = "urn:ihe:iti:csd:2013" )
+public class Facility
+{
+ @XmlAttribute( name = "oid" )
+ private String oid;
+
+ @XmlElement( name = "primaryName", namespace = "urn:ihe:iti:csd:2013" )
+ private String primaryName;
+
+ @XmlElement( name = "record", namespace = "urn:ihe:iti:csd:2013" )
+ private Record record;
+
+ public Facility()
+ {
+ }
+
+ public String getOid()
+ {
+ return oid;
+ }
+
+ public void setOid( String oid )
+ {
+ this.oid = oid;
+ }
+
+ public String getPrimaryName()
+ {
+ return primaryName;
+ }
+
+ public void setPrimaryName( String primaryName )
+ {
+ this.primaryName = primaryName;
+ }
+
+ public Record getRecord()
+ {
+ return record;
+ }
+
+ public void setRecord( Record record )
+ {
+ this.record = record;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/FacilityDirectory.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/FacilityDirectory.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/FacilityDirectory.java 2014-01-14 04:30:06 +0000
@@ -0,0 +1,60 @@
+package org.hisp.dhis.web.csd.domain.csd;
+
+/*
+ * 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.XmlRootElement;
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlRootElement( name = "facilityDirectory", namespace = "urn:ihe:iti:csd:2013" )
+public class FacilityDirectory
+{
+ @XmlElement( name = "facility", namespace = "urn:ihe:iti:csd:2013" )
+ private List<Facility> facilities;
+
+ public FacilityDirectory()
+ {
+ }
+
+ public List<Facility> getFacilities()
+ {
+ return facilities;
+ }
+
+ public void setFacilities( List<Facility> facilities )
+ {
+ this.facilities = facilities;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/OrganizationDirectory.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/OrganizationDirectory.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/OrganizationDirectory.java 2014-01-14 04:30:06 +0000
@@ -0,0 +1,42 @@
+package org.hisp.dhis.web.csd.domain.csd;
+
+/*
+ * 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.XmlRootElement;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlRootElement( name = "organizationDirectory", namespace = "urn:ihe:iti:csd:2013" )
+public class OrganizationDirectory
+{
+}
=== added file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Record.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Record.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/Record.java 2014-01-14 04:30:06 +0000
@@ -0,0 +1,99 @@
+package org.hisp.dhis.web.csd.domain.csd;
+
+/*
+ * 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.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Date;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlRootElement( name = "record", namespace = "urn:ihe:iti:csd:2013" )
+public class Record
+{
+ @XmlAttribute( name = "created" )
+ private Date created;
+
+ @XmlAttribute( name = "updated" )
+ private Date updated;
+
+ @XmlAttribute( name = "status" )
+ private String status;
+
+ @XmlAttribute( name = "sourceDirectory" )
+ private String sourceDirectory = "http://dhis2.org";
+
+ public Record()
+ {
+ }
+
+ public Date getCreated()
+ {
+ return created;
+ }
+
+ public void setCreated( Date created )
+ {
+ this.created = created;
+ }
+
+ public Date getUpdated()
+ {
+ return updated;
+ }
+
+ public void setUpdated( Date updated )
+ {
+ this.updated = updated;
+ }
+
+ public String getStatus()
+ {
+ return status;
+ }
+
+ public void setStatus( String status )
+ {
+ this.status = status;
+ }
+
+ public String getSourceDirectory()
+ {
+ return sourceDirectory;
+ }
+
+ public void setSourceDirectory( String sourceDirectory )
+ {
+ this.sourceDirectory = sourceDirectory;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/ServiceDirectory.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/ServiceDirectory.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/ServiceDirectory.java 2014-01-14 04:30:06 +0000
@@ -0,0 +1,42 @@
+package org.hisp.dhis.web.csd.domain.csd;
+
+/*
+ * 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.XmlRootElement;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlAccessorType( XmlAccessType.FIELD )
+@XmlRootElement( name = "serviceDirectory", namespace = "urn:ihe:iti:csd:2013" )
+public class ServiceDirectory
+{
+}
=== added file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/package-info.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/package-info.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/domain/csd/package-info.java 2014-01-14 04:30:06 +0000
@@ -0,0 +1,10 @@
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@XmlSchema( xmlns = {
+ @XmlNs( prefix = "", namespaceURI = "urn:ihe:iti:csd:2013" )
+} )
+package org.hisp.dhis.web.csd.domain.csd;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlSchema;
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/webapi/CsdController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/webapi/CsdController.java 2014-01-14 04:04:20 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/csd/webapi/CsdController.java 2014-01-14 04:30:06 +0000
@@ -28,20 +28,21 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.dxf2.metadata.MetaData;
-import org.hisp.dhis.dxf2.utils.JacksonUtils;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.web.csd.domain.Envelope;
+import org.hisp.dhis.web.csd.domain.csd.Csd;
+import org.hisp.dhis.web.csd.domain.csd.Facility;
+import org.hisp.dhis.web.csd.domain.csd.Record;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.HttpClientErrorException;
-import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
@@ -59,7 +60,7 @@
private OrganisationUnitService organisationUnitService;
@RequestMapping( value = "", method = RequestMethod.POST )
- public void csdRequest( @RequestBody Envelope envelope, HttpServletResponse response ) throws IOException
+ public @ResponseBody Csd csdRequest( @RequestBody Envelope envelope, HttpServletResponse response ) throws IOException
{
Date lastModified = null;
@@ -75,9 +76,36 @@
List<OrganisationUnit> byLastUpdated = new ArrayList<OrganisationUnit>(
organisationUnitService.getAllOrganisationUnitsByLastUpdated( lastModified ) );
- MetaData metaData = new MetaData();
- metaData.setOrganisationUnits( byLastUpdated );
-
- JacksonUtils.toXml( response.getOutputStream(), metaData );
+ Csd csd = convertToCsd( byLastUpdated );
+
+ return csd;
+ }
+
+ private Csd convertToCsd( Iterable<OrganisationUnit> organisationUnits )
+ {
+ Csd csd = new Csd();
+ csd.getFacilityDirectory().setFacilities( new ArrayList<Facility>() );
+
+ for ( OrganisationUnit organisationUnit : organisationUnits )
+ {
+ Facility facility = new Facility();
+ facility.setOid( organisationUnit.getUid() );
+ facility.setPrimaryName( organisationUnit.getDisplayName() );
+
+ Record record = new Record();
+ record.setCreated( organisationUnit.getCreated() );
+ record.setUpdated( organisationUnit.getLastUpdated() );
+
+ if ( organisationUnit.isActive() )
+ {
+ record.setStatus( "Active" );
+ }
+
+ facility.setRecord( record );
+
+ csd.getFacilityDirectory().getFacilities().add( facility );
+ }
+
+ return csd;
}
}