← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12273: renamed personIdentifiers/personAttributes controllers, lots of other minor bugfixes

 

------------------------------------------------------------
revno: 12273
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-09-27 12:43:38 +0200
message:
  renamed personIdentifiers/personAttributes controllers, lots of other minor bugfixes
removed:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonIdentifierController.java
added:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeTypeController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonIdentifierTypeController.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.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/patient/PatientAttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java	2013-09-27 10:43:38 +0000
@@ -28,29 +28,28 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.common.GenericNameableObjectStore;
+
 import java.util.Collection;
 
-import org.hisp.dhis.common.GenericNameableObjectStore;
-
 /**
  * @author Abyot Asalefew Gizaw
- * @version $Id$
  */
 public interface PatientAttributeStore
     extends GenericNameableObjectStore<PatientAttribute>
 {
-    String ID = PatientAttributeStore.class.getName(); 
-    
+    String ID = PatientAttributeStore.class.getName();
+
     Collection<PatientAttribute> getByValueType( String valueType );
-    
+
     Collection<PatientAttribute> getOptionalPatientAttributesWithoutGroup();
-    
-    Collection<PatientAttribute> getByMandatory(boolean mandatory);
-    
+
+    Collection<PatientAttribute> getByMandatory( boolean mandatory );
+
     Collection<PatientAttribute> getWithoutGroup();
 
     PatientAttribute getByGroupBy( boolean groupBy );
-    
+
     Collection<PatientAttribute> getByDisplayOnVisitSchedule( boolean displayOnVisitSchedule );
-    
+
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java	2013-09-23 04:29:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierType.java	2013-09-27 10:43:38 +0000
@@ -36,8 +36,8 @@
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
 
-@XmlRootElement( name = "patientIdentifierType", namespace = DxfNamespaces.DXF_2_0 )
-@XmlAccessorType( value = XmlAccessType.NONE )
+@XmlRootElement(name = "patientIdentifierType", namespace = DxfNamespaces.DXF_2_0)
+@XmlAccessorType(value = XmlAccessType.NONE)
 public class PatientIdentifierType
     extends BaseIdentifiableObject
 {
@@ -66,13 +66,13 @@
 
     private String type;
 
-    private Boolean personDisplayName = false;;
+    private Boolean personDisplayName = false;
 
     // For Local ID type
 
     private Boolean orgunitScope = false;
 
-    private Boolean programScope = false;;
+    private Boolean programScope = false;
 
     private PeriodType periodType;
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeService.java	2013-09-27 10:43:38 +0000
@@ -47,13 +47,12 @@
     PatientIdentifierType getPatientIdentifierType( int id );
 
     Collection<PatientIdentifierType> getAllPatientIdentifierTypes();
-    
+
     PatientIdentifierType getPatientIdentifierType( String name );
-    
-    PatientIdentifierType  getPatientIdentifierTypeByUid ( String uid );
-    
+
+    PatientIdentifierType getPatientIdentifierTypeByUid( String uid );
+
     Collection<PatientIdentifierType> getPatientIdentifierTypes( boolean mandatory );
-    
+
     Collection<PatientIdentifierType> getDisplayedPatientIdentifierTypes( boolean personDisplayName );
-    
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java	2013-09-23 07:28:36 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/AbstractPersonService.java	2013-09-27 10:43:38 +0000
@@ -41,6 +41,7 @@
 import org.hisp.dhis.patient.PatientIdentifier;
 import org.hisp.dhis.patient.PatientIdentifierService;
 import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patient.util.PatientIdentifierGenerator;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
@@ -81,6 +82,9 @@
     private PatientIdentifierService patientIdentifierService;
 
     @Autowired
+    private PatientIdentifierTypeService patientIdentifierTypeService;
+
+    @Autowired
     private PatientAttributeValueService patientAttributeValueService;
 
     @Autowired
@@ -133,6 +137,14 @@
     }
 
     @Override
+    public Person getPerson( Identifier identifier )
+    {
+        PatientIdentifierType patientIdentifierType = patientIdentifierTypeService.getPatientIdentifierTypeByUid( identifier.getType() );
+        Patient patient = patientIdentifierService.getPatient( patientIdentifierType, identifier.getValue() );
+        return getPerson( patient );
+    }
+
+    @Override
     public Persons getPersons( OrganisationUnit organisationUnit )
     {
         List<Patient> patients = new ArrayList<Patient>( patientService.getPatients( organisationUnit ) );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java	2013-09-20 15:12:37 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/person/PersonService.java	2013-09-27 10:43:38 +0000
@@ -44,7 +44,7 @@
  */
 public interface PersonService
 {
-    public void setFormat(I18nFormat format);
+    public void setFormat( I18nFormat format );
 
     // -------------------------------------------------------------------------
     // READ
@@ -52,6 +52,8 @@
 
     Persons getPersons();
 
+    Person getPerson( Identifier identifier );
+
     Persons getPersons( OrganisationUnit organisationUnit );
 
     Persons getPersons( Gender gender );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java	2013-09-26 11:11:57 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java	2013-09-27 10:43:38 +0000
@@ -64,7 +64,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeGroup;
-import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.relationship.RelationshipType;
@@ -163,8 +163,8 @@
         allExportClasses.put( Program.class, "programs" );
         allExportClasses.put( ProgramStage.class, "programStages" );
         allExportClasses.put( RelationshipType.class, "relationshipTypes" );
-        allExportClasses.put( PatientIdentifier.class, "personIdentifiers" );
-        allExportClasses.put( PatientAttribute.class, "personAttributes" );
+        allExportClasses.put( PatientIdentifierType.class, "personIdentifierTypes" );
+        allExportClasses.put( PatientAttribute.class, "personAttributeTypes" );
         allExportClasses.put( PatientAttributeGroup.class, "personAttributeGroups" );
 
         allExportClasses.put( BaseDimensionalObject.class, "dimensions" );
@@ -190,13 +190,13 @@
         exportClasses.remove( Program.class );
         exportClasses.remove( ProgramStage.class );
         exportClasses.remove( RelationshipType.class );
-        exportClasses.remove( PatientIdentifier.class );
+        exportClasses.remove( PatientIdentifierType.class );
         exportClasses.remove( PatientAttribute.class );
         exportClasses.remove( PatientAttributeGroup.class );
         importClasses.remove( Program.class );
         importClasses.remove( ProgramStage.class );
         importClasses.remove( RelationshipType.class );
-        importClasses.remove( PatientIdentifier.class );
+        importClasses.remove( PatientIdentifierType.class );
         importClasses.remove( PatientAttribute.class );
         importClasses.remove( PatientAttributeGroup.class );
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java	2013-09-26 11:11:57 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java	2013-09-27 10:43:38 +0000
@@ -68,7 +68,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeGroup;
-import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.relationship.RelationshipType;
@@ -181,9 +181,9 @@
 
     private List<RelationshipType> relationshipTypes = new ArrayList<RelationshipType>();
 
-    private List<PatientIdentifier> personIdentifiers = new ArrayList<PatientIdentifier>();
+    private List<PatientIdentifierType> personIdentifierTypes = new ArrayList<PatientIdentifierType>();
 
-    private List<PatientAttribute> personAttributes = new ArrayList<PatientAttribute>();
+    private List<PatientAttribute> personAttributeTypes = new ArrayList<PatientAttribute>();
 
     private List<PatientAttributeGroup> personAttributeGroups = new ArrayList<PatientAttributeGroup>();
 
@@ -763,29 +763,29 @@
     }
 
     @JsonProperty
-    @JacksonXmlElementWrapper( localName = "personIdentifiers", namespace = DxfNamespaces.DXF_2_0 )
-    @JacksonXmlProperty( localName = "personIdentifier", namespace = DxfNamespaces.DXF_2_0 )
-    public List<PatientIdentifier> getPersonIdentifiers()
+    @JacksonXmlElementWrapper( localName = "personIdentifierTypes", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "personIdentifierType", namespace = DxfNamespaces.DXF_2_0 )
+    public List<PatientIdentifierType> getPersonIdentifierTypes()
     {
-        return personIdentifiers;
+        return personIdentifierTypes;
     }
 
-    public void setPersonIdentifiers( List<PatientIdentifier> personIdentifiers )
+    public void setPersonIdentifierTypes( List<PatientIdentifierType> personIdentifierTypes )
     {
-        this.personIdentifiers = personIdentifiers;
+        this.personIdentifierTypes = personIdentifierTypes;
     }
 
     @JsonProperty
-    @JacksonXmlElementWrapper( localName = "personAttributes", namespace = DxfNamespaces.DXF_2_0 )
-    @JacksonXmlProperty( localName = "personAttribute", namespace = DxfNamespaces.DXF_2_0 )
-    public List<PatientAttribute> getPersonAttributes()
+    @JacksonXmlElementWrapper( localName = "personAttributeTypes", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "personAttributeType", namespace = DxfNamespaces.DXF_2_0 )
+    public List<PatientAttribute> getPersonAttributeTypes()
     {
-        return personAttributes;
+        return personAttributeTypes;
     }
 
-    public void setPersonAttributes( List<PatientAttribute> personAttributes )
+    public void setPersonAttributeTypes( List<PatientAttribute> personAttributeTypes )
     {
-        this.personAttributes = personAttributes;
+        this.personAttributeTypes = personAttributeTypes;
     }
 
     @JsonProperty
@@ -863,8 +863,8 @@
             ", programs=" + programs +
             ", programStages=" + programStages +
             ", relationshipTypes=" + relationshipTypes +
-            ", personIdentifiers=" + personIdentifiers +
-            ", personAttributes=" + personAttributes +
+            ", personIdentifierTypes=" + personIdentifierTypes +
+            ", personAttributeTypes=" + personAttributeTypes +
             ", personAttributeGroups=" + personAttributeGroups +
             '}';
     }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeStore.java	2013-09-27 10:43:38 +0000
@@ -28,16 +28,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeStore;
 
+import java.util.Collection;
+
 /**
  * @author Abyot Asalefew Gizaw
- * @version $Id$
  */
 public class HibernatePatientAttributeStore
     extends HibernateIdentifiableObjectStore<PatientAttribute>
@@ -46,20 +45,20 @@
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
-    
-    @SuppressWarnings( "unchecked" )
+
+    @SuppressWarnings("unchecked")
     public Collection<PatientAttribute> getByValueType( String valueType )
     {
         return getCriteria( Restrictions.eq( "valueType", valueType ) ).list();
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public Collection<PatientAttribute> getByMandatory( boolean mandatory )
     {
         return getCriteria( Restrictions.eq( "mandatory", mandatory ) ).list();
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public Collection<PatientAttribute> getOptionalPatientAttributesWithoutGroup()
     {
         return getCriteria( Restrictions.isNull( "patientAttributeGroup" ) )
@@ -71,17 +70,15 @@
         return (PatientAttribute) getCriteria( Restrictions.eq( "groupBy", groupBy ) ).uniqueResult();
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public Collection<PatientAttribute> getWithoutGroup()
     {
         return getCriteria( Restrictions.isNull( "patientAttributeGroup" ) ).list();
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public Collection<PatientAttribute> getByDisplayOnVisitSchedule( boolean displayOnVisitSchedule )
     {
         return getCriteria( Restrictions.eq( "displayOnVisitSchedule", displayOnVisitSchedule ) ).list();
     }
-
-    
 }

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeController.java	2013-09-26 09:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeController.java	1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
-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.AbstractCrudController;
-import org.hisp.dhis.patient.PatientAttribute;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@Controller
-@RequestMapping( value = PersonAttributeController.RESOURCE_PATH )
-public class PersonAttributeController extends AbstractCrudController<PatientAttribute>
-{
-    public static final String RESOURCE_PATH = "/personAttributes";
-}

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeTypeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeTypeController.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeTypeController.java	2013-09-27 10:43:38 +0000
@@ -0,0 +1,44 @@
+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.AbstractCrudController;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Controller
+@RequestMapping( value = PersonAttributeTypeController.RESOURCE_PATH )
+public class PersonAttributeTypeController extends AbstractCrudController<PatientAttribute>
+{
+    public static final String RESOURCE_PATH = "/personAttributeTypes";
+}

=== modified 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	2013-09-26 11:25:19 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2013-09-27 10:43:38 +0000
@@ -32,13 +32,14 @@
 import org.hisp.dhis.api.controller.exception.NotFoundException;
 import org.hisp.dhis.api.utils.ContextUtils;
 import org.hisp.dhis.common.IdentifiableObjectManager;
-import org.hisp.dhis.dxf2.importsummary.ImportStatus;
-import org.hisp.dhis.dxf2.importsummary.ImportSummaries;
-import org.hisp.dhis.dxf2.importsummary.ImportSummary;
 import org.hisp.dhis.dxf2.events.person.Gender;
+import org.hisp.dhis.dxf2.events.person.Identifier;
 import org.hisp.dhis.dxf2.events.person.Person;
 import org.hisp.dhis.dxf2.events.person.PersonService;
 import org.hisp.dhis.dxf2.events.person.Persons;
+import org.hisp.dhis.dxf2.importsummary.ImportStatus;
+import org.hisp.dhis.dxf2.importsummary.ImportSummaries;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
 import org.hisp.dhis.dxf2.utils.JacksonUtils;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.program.Program;
@@ -65,7 +66,7 @@
  */
 @Controller
 @RequestMapping( value = PersonController.RESOURCE_PATH )
-@PreAuthorize("hasRole('ALL') or hasRole('F_PATIENT_LIST')")
+@PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_LIST')" )
 public class PersonController
 {
     public static final String RESOURCE_PATH = "/persons";
@@ -82,20 +83,22 @@
 
     @RequestMapping( value = "", method = RequestMethod.GET )
     public String getPersons(
-        @RequestParam( value = "orgUnit", required = false ) String orgUnitUid,
+        @RequestParam( value = "orgUnit" ) String orgUnitUid,
         @RequestParam( required = false ) Gender gender,
         @RequestParam( value = "program", required = false ) String programUid,
+        @RequestParam( required = false ) String identifierType,
+        @RequestParam( required = false ) String identifier,
         @RequestParam Map<String, String> parameters, Model model, HttpServletRequest request ) throws Exception
     {
         WebOptions options = new WebOptions( parameters );
-        Persons persons;
+        Persons persons = new Persons();
 
-        // it will be required in the future to have at least orgUnitUid, but for now, we allow no parameters
-        if ( gender == null && orgUnitUid == null && programUid == null )
+        if ( identifier != null )
         {
-            persons = personService.getPersons();
+            Identifier id = new Identifier( identifierType, identifier );
+            persons.getPersons().add( personService.getPerson( id ) );
         }
-        else if ( orgUnitUid != null && programUid != null && gender != null )
+        if ( programUid != null && gender != null )
         {
             OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
             Program program = getProgram( programUid );
@@ -113,16 +116,6 @@
 
             persons = personService.getPersons( organisationUnit, program );
         }
-        else if ( programUid != null && gender != null )
-        {
-            Program program = getProgram( programUid );
-            persons = personService.getPersons( program, gender );
-        }
-        else if ( orgUnitUid != null )
-        {
-            OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
-            persons = personService.getPersons( organisationUnit );
-        }
         else if ( programUid != null )
         {
             Program program = getProgram( programUid );
@@ -130,7 +123,8 @@
         }
         else
         {
-            persons = new Persons();
+            OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
+            persons = personService.getPersons( organisationUnit );
         }
 
         model.addAttribute( "model", persons );
@@ -156,7 +150,7 @@
     // -------------------------------------------------------------------------
 
     @RequestMapping( value = "", method = RequestMethod.POST, consumes = MediaType.APPLICATION_XML_VALUE )
-    @PreAuthorize("hasRole('ALL') or hasRole('F_PATIENT_ADD')")
+    @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_ADD')" )
     public void postPersonXml( HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         ImportSummaries importSummaries = personService.savePersonXml( request.getInputStream() );
@@ -181,7 +175,7 @@
     }
 
     @RequestMapping( value = "", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
-    @PreAuthorize("hasRole('ALL') or hasRole('F_PATIENT_ADD')")
+    @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_ADD')" )
     public void postPersonJson( HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         ImportSummaries importSummaries = personService.savePersonJson( request.getInputStream() );
@@ -211,7 +205,7 @@
 
     @RequestMapping( value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_XML_VALUE )
     @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    @PreAuthorize("hasRole('ALL') or hasRole('F_PATIENT_ADD')")
+    @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_ADD')" )
     public void updatePersonXml( @PathVariable String id, HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         ImportSummary importSummary = personService.updatePersonXml( id, request.getInputStream() );
@@ -220,7 +214,7 @@
 
     @RequestMapping( value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE )
     @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    @PreAuthorize("hasRole('ALL') or hasRole('F_PATIENT_ADD')")
+    @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_ADD')" )
     public void updatePersonJson( @PathVariable String id, HttpServletRequest request, HttpServletResponse response ) throws IOException
     {
         ImportSummary importSummary = personService.updatePersonJson( id, request.getInputStream() );
@@ -233,7 +227,7 @@
 
     @RequestMapping( value = "/{id}", method = RequestMethod.DELETE )
     @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    @PreAuthorize("hasRole('ALL') or hasRole('F_PATIENT_DELETE')")
+    @PreAuthorize( "hasRole('ALL') or hasRole('F_PATIENT_DELETE')" )
     public void deletePerson( @PathVariable String id ) throws NotFoundException
     {
         Person person = getPerson( id );

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonIdentifierController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonIdentifierController.java	2013-09-26 09:58:14 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonIdentifierController.java	1970-01-01 00:00:00 +0000
@@ -1,44 +0,0 @@
-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.AbstractCrudController;
-import org.hisp.dhis.patient.PatientIdentifier;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@Controller
-@RequestMapping( value = PersonIdentifierController.RESOURCE_PATH )
-public class PersonIdentifierController extends AbstractCrudController<PatientIdentifier>
-{
-    public static final String RESOURCE_PATH = "/personsIdentifiers";
-}

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonIdentifierTypeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonIdentifierTypeController.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonIdentifierTypeController.java	2013-09-27 10:43:38 +0000
@@ -0,0 +1,44 @@
+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.AbstractCrudController;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Controller
+@RequestMapping( value = PersonIdentifierTypeController.RESOURCE_PATH )
+public class PersonIdentifierTypeController extends AbstractCrudController<PatientIdentifierType>
+{
+    public static final String RESOURCE_PATH = "/personIdentifierTypes";
+}