← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11947: web-api for persons, wip

 

------------------------------------------------------------
revno: 11947
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-09-06 11:34:21 +0200
message:
  web-api for persons, wip
added:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/AbstractPersonService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/JacksonPersonService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Person.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/PersonService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Persons.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Event.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.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-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2013-09-06 09:34:21 +0000
@@ -492,6 +492,9 @@
         this.domainType = domainType;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
     public String getTextType()
     {
         return textType;
@@ -691,6 +694,7 @@
             domainType = dataElement.getDomainType() == null ? domainType : dataElement.getDomainType();
             type = dataElement.getType() == null ? type : dataElement.getType();
             numberType = dataElement.getNumberType() == null ? numberType : dataElement.getNumberType();
+            textType = dataElement.getTextType() == null ? textType : dataElement.getTextType();
             aggregationOperator = dataElement.getAggregationOperator() == null ? aggregationOperator : dataElement
                 .getAggregationOperator();
             categoryCombo = dataElement.getCategoryCombo() == null ? categoryCombo : dataElement.getCategoryCombo();

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java	2013-09-06 09:06:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java	2013-09-06 09:34:21 +0000
@@ -28,7 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.view.DetailedView;
+import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.user.User;
@@ -41,6 +50,7 @@
 /**
  * @author Abyot Asalefew Gizaw
  */
+@JacksonXmlRootElement( localName = "person", namespace = DxfNamespaces.DXF_2_0 )
 public class Patient
     extends BaseIdentifiableObject
 {
@@ -55,7 +65,7 @@
 
     public static final char DOB_TYPE_VERIFIED = 'V';
     public static final char DOB_TYPE_DECLARED = 'D';
-    public static final char DOB_TYPE_APPROXIATED = 'A';
+    public static final char DOB_TYPE_APPROXIMATED = 'A';
 
     public static final char AGE_TYPE_YEAR = 'Y';
     public static final char AGE_TYPE_MONTH = 'M';
@@ -70,7 +80,7 @@
 
     public static String FIXED_ATTR_BIRTH_DATE = "birthDate";
     public static String FIXED_ATTR_AGE = "age";
-    public static String FIXED_ATTR_INTERGER_AGE = "integerValueOfAge";
+    public static String FIXED_ATTR_INTEGER_AGE = "integerValueOfAge";
     public static String FIXED_ATTR_REGISTRATION_DATE = "registrationDate";
 
     private String firstName;
@@ -225,6 +235,15 @@
         return attributes;
     }
 
+    public void setAttributes( Set<PatientAttribute> attributes )
+    {
+        this.attributes = attributes;
+    }
+
+    @JsonProperty
+    @JsonSerialize( as = BaseIdentifiableObject.class )
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public OrganisationUnit getOrganisationUnit()
     {
         return organisationUnit;
@@ -235,11 +254,9 @@
         this.organisationUnit = organisationUnit;
     }
 
-    public void setAttributes( Set<PatientAttribute> attributes )
-    {
-        this.attributes = attributes;
-    }
-
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getFirstName()
     {
         return firstName;
@@ -250,6 +267,9 @@
         this.firstName = firstName;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getMiddleName()
     {
         return middleName;
@@ -260,6 +280,9 @@
         this.middleName = middleName;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getLastName()
     {
         return lastName;
@@ -270,6 +293,9 @@
         this.lastName = lastName;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getGender()
     {
         return gender;
@@ -280,6 +306,9 @@
         this.gender = gender;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public Date getBirthDate()
     {
         return birthDate;
@@ -290,6 +319,9 @@
         this.birthDate = birthDate;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public Date getDeathDate()
     {
         return deathDate;
@@ -300,6 +332,9 @@
         this.deathDate = deathDate;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public Boolean getIsDead()
     {
         return isDead;
@@ -320,6 +355,10 @@
         this.identifiers = identifiers;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlElementWrapper( localName = "programs", namespace = DxfNamespaces.DXF_2_0)
+    @JacksonXmlProperty( localName = "program", namespace = DxfNamespaces.DXF_2_0)
     public Set<Program> getPrograms()
     {
         return programs;
@@ -330,6 +369,10 @@
         this.programs = programs;
     }
 
+    @JsonProperty
+    @JsonSerialize( as = BaseIdentifiableObject.class )
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public User getHealthWorker()
     {
         return healthWorker;
@@ -340,14 +383,26 @@
         this.healthWorker = healthWorker;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public Date getRegistrationDate()
+    {
+        return registrationDate;
+    }
+
     public void setRegistrationDate( Date registrationDate )
     {
         this.registrationDate = registrationDate;
     }
 
-    public Date getRegistrationDate()
+    @JsonProperty
+    @JsonSerialize( as = BaseIdentifiableObject.class )
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public Patient getRepresentative()
     {
-        return registrationDate;
+        return representative;
     }
 
     public void setRepresentative( Patient representative )
@@ -355,11 +410,6 @@
         this.representative = representative;
     }
 
-    public Patient getRepresentative()
-    {
-        return representative;
-    }
-
     // -------------------------------------------------------------------------
     // Convenience method
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java	2013-09-06 09:34:21 +0000
@@ -28,10 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
@@ -39,6 +35,10 @@
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.hisp.dhis.program.Program;
 
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
 /**
  * @author Abyot Asalefew Gizaw
  * @version $Id$
@@ -56,11 +56,13 @@
 
     Patient getPatient( int id );
 
+    Patient getPatient( String uid );
+
     Collection<Patient> getAllPatients();
 
     /**
      * Search Patient base on firstname/middlename/lastname/birthDate/gender
-     * 
+     *
      * @param firstName
      * @param middleName
      * @param lastName
@@ -72,7 +74,7 @@
 
     /**
      * Search Patient base on gender
-     * 
+     *
      * @param gender
      * @return Patient List
      */
@@ -80,7 +82,7 @@
 
     /**
      * Search Patient base on birthDate
-     * 
+     *
      * @param birthdate
      * @return Patient List
      */
@@ -88,7 +90,7 @@
 
     /**
      * Search Patient base on fullName
-     * 
+     *
      * @param name fullName
      * @return Patient List
      */
@@ -96,7 +98,7 @@
 
     /**
      * Search Patient base on full-name or identifier value
-     * 
+     *
      * @param searchText value
      * @return Patient List
      */
@@ -104,7 +106,7 @@
 
     /**
      * Search Patient for mobile base on identifier value
-     * 
+     *
      * @param searchText value
      * @param orgUnitId
      * @return Patient List
@@ -113,7 +115,7 @@
 
     /**
      * Search Patient base on organization unit with result limited
-     * 
+     *
      * @param organisationUnit organisationUnit
      * @return Patient List
      */
@@ -122,7 +124,7 @@
     /**
      * Search Patient base on organization unit and sort the result by
      * PatientAttribute
-     * 
+     *
      * @param organisationUnit organisationUnit
      * @param patientAttribute
      * @param min
@@ -134,9 +136,9 @@
 
     /**
      * Search Patient base on organisationUnit and identifier value name
-     * 
+     *
      * @param organisationUnit
-     * @param searchText identifier value
+     * @param searchText       identifier value
      * @param min
      * @param max
      * @return
@@ -146,7 +148,7 @@
     /**
      * Search Patient base on PatientIdentifierType or Attribute or Patient's
      * name
-     * 
+     *
      * @param identifierTypeId
      * @param attributeId
      * @param value
@@ -157,7 +159,7 @@
     /**
      * Search Patient base on OrganisationUnit and Program with result limited
      * name
-     * 
+     *
      * @param organisationUnit
      * @param program
      * @param min
@@ -168,7 +170,7 @@
 
     /**
      * Sort the result by PatientAttribute
-     * 
+     *
      * @param patients
      * @param patientAttribute
      * @return Patient List
@@ -179,7 +181,7 @@
 
     /**
      * Search Patient base on identifier value and get number of result
-     * 
+     *
      * @param searchText
      * @return number of patients
      */
@@ -188,7 +190,7 @@
     /**
      * Search Patient base on firstname/middlename/lastname and get number of
      * result
-     * 
+     *
      * @param name
      * @return number of patients
      */

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-09-06 08:24:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java	2013-09-06 09:34:21 +0000
@@ -28,7 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.program.Program;
@@ -42,7 +42,7 @@
  * @version $Id$
  */
 public interface PatientStore
-    extends GenericStore<Patient>
+    extends GenericIdentifiableObjectStore<Patient>
 {
     String ID = PatientStore.class.getName();
 

=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/AbstractPersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/AbstractPersonService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/AbstractPersonService.java	2013-09-06 09:34:21 +0000
@@ -0,0 +1,125 @@
+package org.hisp.dhis.dxf2.event;
+
+/*
+ * 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.i18n.I18nFormat;
+import org.hisp.dhis.i18n.I18nManager;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Transactional
+public abstract class AbstractPersonService implements PersonService
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    @Autowired
+    private PatientService patientService;
+
+    @Autowired
+    private I18nManager i18nManager;
+
+    private I18nFormat format;
+
+    // -------------------------------------------------------------------------
+    // Implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public Persons getPersons()
+    {
+        Persons persons = new Persons();
+
+        // TODO replace with sql, will be very bad performance when identifiers, attributes etc are included
+        List<Patient> patients = new ArrayList<Patient>( patientService.getAllPatients() );
+
+        for ( Patient patient : patients )
+        {
+            Person person = new Person();
+            person.setPatient( patient.getUid() );
+
+            persons.getPersons().add( person );
+        }
+
+        return persons;
+    }
+
+    @Override
+    public Persons getPersons( Collection<Patient> patients )
+    {
+        Persons persons = new Persons();
+
+        for ( Patient patient : patients )
+        {
+            persons.getPersons().add( getPerson( patient ) );
+        }
+
+        return persons;
+    }
+
+    @Override
+    public Person getPerson( String uid )
+    {
+        Person person = new Person();
+        Patient patient = patientService.getPatient( uid );
+
+        person.setPatient( patient.getUid() );
+
+        return person;
+    }
+
+    @Override
+    public Person getPerson( Patient patient )
+    {
+        Person person = new Person();
+        person.setPatient( patient.getUid() );
+
+        return person;
+    }
+
+    @Override
+    public void updatePerson( Person person )
+    {
+    }
+
+    @Override
+    public void deletePerson( Person person )
+    {
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Event.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Event.java	2013-09-05 14:06:15 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Event.java	2013-09-06 09:34:21 +0000
@@ -190,6 +190,44 @@
     }
 
     @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o ) return true;
+        if ( o == null || getClass() != o.getClass() ) return false;
+
+        Event event1 = (Event) o;
+
+        if ( completed != null ? !completed.equals( event1.completed ) : event1.completed != null ) return false;
+        if ( coordinate != null ? !coordinate.equals( event1.coordinate ) : event1.coordinate != null ) return false;
+        if ( dataValues != null ? !dataValues.equals( event1.dataValues ) : event1.dataValues != null ) return false;
+        if ( event != null ? !event.equals( event1.event ) : event1.event != null ) return false;
+        if ( eventDate != null ? !eventDate.equals( event1.eventDate ) : event1.eventDate != null ) return false;
+        if ( orgUnit != null ? !orgUnit.equals( event1.orgUnit ) : event1.orgUnit != null ) return false;
+        if ( person != null ? !person.equals( event1.person ) : event1.person != null ) return false;
+        if ( program != null ? !program.equals( event1.program ) : event1.program != null ) return false;
+        if ( programStage != null ? !programStage.equals( event1.programStage ) : event1.programStage != null ) return false;
+        if ( storedBy != null ? !storedBy.equals( event1.storedBy ) : event1.storedBy != null ) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = program != null ? program.hashCode() : 0;
+        result = 31 * result + (programStage != null ? programStage.hashCode() : 0);
+        result = 31 * result + (event != null ? event.hashCode() : 0);
+        result = 31 * result + (orgUnit != null ? orgUnit.hashCode() : 0);
+        result = 31 * result + (person != null ? person.hashCode() : 0);
+        result = 31 * result + (eventDate != null ? eventDate.hashCode() : 0);
+        result = 31 * result + (completed != null ? completed.hashCode() : 0);
+        result = 31 * result + (storedBy != null ? storedBy.hashCode() : 0);
+        result = 31 * result + (coordinate != null ? coordinate.hashCode() : 0);
+        result = 31 * result + (dataValues != null ? dataValues.hashCode() : 0);
+        return result;
+    }
+
+    @Override
     public String toString()
     {
         return "Event{" +

=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/JacksonPersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/JacksonPersonService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/JacksonPersonService.java	2013-09-06 09:34:21 +0000
@@ -0,0 +1,88 @@
+package org.hisp.dhis.dxf2.event;
+
+/*
+ * 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 com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import org.hisp.dhis.system.notification.Notifier;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class JacksonPersonService extends AbstractPersonService
+{
+    @Autowired
+    private Notifier notifier;
+
+    // -------------------------------------------------------------------------
+    // Implementation
+    // -------------------------------------------------------------------------
+
+    private static ObjectMapper xmlMapper = new XmlMapper();
+    private static ObjectMapper jsonMapper = new ObjectMapper();
+
+    @SuppressWarnings( "unchecked" )
+    private static <T> T fromXml( InputStream inputStream, Class<?> clazz ) throws IOException
+    {
+        return (T) xmlMapper.readValue( inputStream, clazz );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    private static <T> T fromXml( String input, Class<?> clazz ) throws IOException
+    {
+        return (T) xmlMapper.readValue( input, clazz );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    private static <T> T fromJson( InputStream inputStream, Class<?> clazz ) throws IOException
+    {
+        return (T) jsonMapper.readValue( inputStream, clazz );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    private static <T> T fromJson( String input, Class<?> clazz ) throws IOException
+    {
+        return (T) jsonMapper.readValue( input, clazz );
+    }
+
+    static
+    {
+        xmlMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
+        xmlMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
+        xmlMapper.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
+        jsonMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
+        jsonMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
+        jsonMapper.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
+    }
+}

=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Person.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Person.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Person.java	2013-09-06 09:34:21 +0000
@@ -0,0 +1,86 @@
+package org.hisp.dhis.dxf2.event;
+
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.common.DxfNamespaces;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@JacksonXmlRootElement( localName = "person", namespace = DxfNamespaces.DXF_2_0 )
+public class Person
+{
+    private String patient;
+
+    public Person()
+    {
+    }
+
+    @JsonProperty( required = true )
+    @JacksonXmlProperty( isAttribute = true )
+    public String getPatient()
+    {
+        return patient;
+    }
+
+    public void setPatient( String patient )
+    {
+        this.patient = patient;
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o ) return true;
+        if ( o == null || getClass() != o.getClass() ) return false;
+
+        Person person = (Person) o;
+
+        if ( patient != null ? !patient.equals( person.patient ) : person.patient != null ) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return patient != null ? patient.hashCode() : 0;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "Person{" +
+            "patient='" + patient + '\'' +
+            '}';
+    }
+}

=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/PersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/PersonService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/PersonService.java	2013-09-06 09:34:21 +0000
@@ -0,0 +1,51 @@
+package org.hisp.dhis.dxf2.event;
+
+/*
+ * 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.patient.Patient;
+
+import java.util.Collection;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public interface PersonService
+{
+    Persons getPersons();
+
+    Persons getPersons( Collection<Patient> patients );
+
+    Person getPerson( String uid );
+
+    Person getPerson( Patient patient );
+
+    void updatePerson( Person person );
+
+    void deletePerson( Person person );
+}

=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Persons.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Persons.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/event/Persons.java	2013-09-06 09:34:21 +0000
@@ -0,0 +1,72 @@
+package org.hisp.dhis.dxf2.event;
+
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.common.DxfNamespaces;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@JacksonXmlRootElement( localName = "persons", namespace = DxfNamespaces.DXF_2_0 )
+public class Persons
+{
+    private List<Person> persons = new ArrayList<Person>();
+
+    public Persons()
+    {
+    }
+
+    @JsonProperty( "personList" )
+    @JacksonXmlElementWrapper( localName = "personList", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "person", namespace = DxfNamespaces.DXF_2_0 )
+    public List<Person> getPersons()
+    {
+        return persons;
+    }
+
+    public void setPersons( List<Person> persons )
+    {
+        this.persons = persons;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "Persons{" +
+            "persons=" + persons +
+            '}';
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml	2013-09-02 17:02:33 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml	2013-09-06 09:34:21 +0000
@@ -18,6 +18,8 @@
 
   <bean id="org.hisp.dhis.dxf2.event.EventService" class="org.hisp.dhis.dxf2.event.JacksonEventService" />
 
+  <bean id="org.hisp.dhis.dxf2.event.PersonService" class="org.hisp.dhis.dxf2.event.JacksonPersonService" />
+
   <bean id="org.hisp.dhis.dxf2.InputValidationService" class="org.hisp.dhis.dxf2.DefaultInputValidationService" />
 
   <!-- register idObject handlers -->
@@ -197,7 +199,7 @@
     class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.datadictionary.DataDictionary" />
   </bean>
-  
+
   <bean id="pdfDataEntryFormService" class="org.hisp.dhis.dxf2.pdfform.DefaultPdfDataEntryFormService" scope="prototype">
   </bean>
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java	2013-09-06 05:27:42 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientRegistrationFormService.java	2013-09-06 09:34:21 +0000
@@ -490,7 +490,7 @@
                 inputHtml += "<option value=\"D\" selected >" + i18n.getString( "declared" ) + "</option>";
                 inputHtml += "<option value=\"A\">" + i18n.getString( "approximated" ) + "</option>";
             }
-            else if ( value.equals( Patient.DOB_TYPE_APPROXIATED + "" ) )
+            else if ( value.equals( Patient.DOB_TYPE_APPROXIMATED + "" ) )
             {
                 inputHtml += "<option value=\"V\">" + i18n.getString( "verified" ) + "</option>";
                 inputHtml += "<option value=\"D\">" + i18n.getString( "declared" ) + "</option>";
@@ -538,7 +538,7 @@
     {
         if ( property.equals( Patient.FIXED_ATTR_AGE ) )
         {
-            property = Patient.FIXED_ATTR_INTERGER_AGE;
+            property = Patient.FIXED_ATTR_INTEGER_AGE;
         }
         property = StringUtils.capitalize( property );
 

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-09-06 08:24:36 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java	2013-09-06 09:34:21 +0000
@@ -186,6 +186,12 @@
     }
 
     @Override
+    public Patient getPatient( String uid )
+    {
+        return patientStore.getByUid( uid );
+    }
+
+    @Override
     public Collection<Patient> getAllPatients()
     {
         return patientStore.getAll();

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2013-09-06 09:34:21 +0000
@@ -0,0 +1,67 @@
+package org.hisp.dhis.api.controller.event;
+
+/*
+ * 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.api.controller.WebOptions;
+import org.hisp.dhis.dxf2.event.PersonService;
+import org.hisp.dhis.dxf2.event.Persons;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Controller
+@RequestMapping( value = PersonController.RESOURCE_PATH )
+public class PersonController
+{
+    public static final String RESOURCE_PATH = "/persons";
+
+    @Autowired
+    private PersonService personService;
+
+    @RequestMapping( value = "", method = RequestMethod.GET )
+    public String getPersons( @RequestParam Map<String, String> parameters, Model model, HttpServletRequest request ) throws Exception
+    {
+        WebOptions options = new WebOptions( parameters );
+        Persons persons = personService.getPersons();
+
+        model.addAttribute( "model", persons );
+        model.addAttribute( "viewClass", options.getViewClass( "detailed" ) );
+
+        return "persons";
+    }
+}