dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24569
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12070: convert patientIdentifiers to idObject, expose all identifiers in person (read only for now)
------------------------------------------------------------
revno: 12070
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-09-13 09:40:23 +0200
message:
convert patientIdentifiers to idObject, expose all identifiers in person (read only for now)
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifier.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifier.hbm.xml
--
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/PatientIdentifier.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifier.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifier.java 2013-09-13 07:40:23 +0000
@@ -28,14 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.io.Serializable;
+import org.hisp.dhis.common.BaseIdentifiableObject;
/**
* @author Abyot Asalefew Gizaw
* @version $Id$
*/
public class PatientIdentifier
- implements Serializable
+ extends BaseIdentifiableObject
{
/**
* Determines if a de-serialized file is compatible with this class.
@@ -44,8 +44,6 @@
public static final int IDENTIFIER_INDEX_LENGTH = 5;
- private int id;
-
private PatientIdentifierType identifierType;
private Patient patient;
@@ -53,61 +51,9 @@
private String identifier;
// -------------------------------------------------------------------------
- // hashCode, equals and toString
- // -------------------------------------------------------------------------
-
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((identifierType == null) ? 0 : identifierType.hashCode());
- result = prime * result + ((identifier == null) ? 0 : identifier.hashCode());
-
- return result;
- }
-
- public boolean equals( Object object )
- {
- if ( this == object )
- {
- return true;
- }
-
- if ( object == null )
- {
- return false;
- }
-
- if ( getClass() != object.getClass() )
- {
- return false;
- }
-
- PatientIdentifier other = (PatientIdentifier) object;
-
- return identifier.equals( other.getIdentifier() ) && identifierType.equals( other.getIdentifierType() );
- }
-
- @Override
- public String toString()
- {
- return "[" + identifierType.getName() + ":" + identifier + "]";
- }
-
- // -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
- public int getId()
- {
- return id;
- }
-
- public void setId( int id )
- {
- this.id = id;
- }
-
public Patient getPatient()
{
return patient;
@@ -137,5 +83,5 @@
{
return identifierType;
}
-
+
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java 2013-09-11 04:12:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierStore.java 2013-09-13 07:40:23 +0000
@@ -28,43 +28,43 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
import java.util.Collection;
-import org.hisp.dhis.common.GenericStore;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-
/**
* @author Abyot Asalefew Gizaw
* @version $Id$
*/
public interface PatientIdentifierStore
- extends GenericStore<PatientIdentifier>
+ extends GenericIdentifiableObjectStore<PatientIdentifier>
{
String ID = PatientIdentifierStore.class.getName();
PatientIdentifier get( Patient patient );
PatientIdentifier get( String identifier, OrganisationUnit organisationUnit );
-
+
PatientIdentifier get( PatientIdentifierType type, String identifier );
Collection<PatientIdentifier> getByIdentifier( String identifier );
-
+
Collection<PatientIdentifier> getByType( PatientIdentifierType identifierType );
-
- PatientIdentifier getPatientIdentifier(String identifier, Patient patient);
-
- PatientIdentifier getPatientIdentifier(PatientIdentifierType identifierType, Patient patient);
-
+
+ PatientIdentifier getPatientIdentifier( String identifier, Patient patient );
+
+ PatientIdentifier getPatientIdentifier( PatientIdentifierType identifierType, Patient patient );
+
Collection<PatientIdentifier> getPatientIdentifiers( Patient patient );
-
- Patient getPatient( PatientIdentifierType idenType, String value);
-
+
+ Patient getPatient( PatientIdentifierType idenType, String value );
+
Collection<Patient> getPatientsByIdentifier( String identifier, int min, int max );
-
+
int countGetPatientsByIdentifier( String identifier );
-
- Collection<PatientIdentifier> get(Collection<PatientIdentifierType> identifierTypes, Patient patient);
+
+ Collection<PatientIdentifier> get( Collection<PatientIdentifierType> identifierTypes, Patient patient );
boolean checkDuplicateIdentifier( String identifier );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2013-09-06 08:24:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java 2013-09-13 07:40:23 +0000
@@ -54,7 +54,7 @@
"dataelement", "dataelementgroupset", "dataelementcategory", "categorycombo", "categoryoptioncombo", "map", "mapview",
"reporttable", "report", "messageconversation", "message", "userinfo", "usergroup", "userrole", "maplegend",
"maplegendset", "maplayer", "section", "optionset", "program", "programinstance", "programstage", "programstageinstance",
- "patient"
+ "patient", "patientidentifier"
};
private static final Map<String, String> TABLE_ID_MAP = DimensionalObjectUtils.asMap(
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifier.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifier.hbm.xml 2012-12-11 08:03:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patient/hibernate/PatientIdentifier.hbm.xml 2013-09-13 07:40:23 +0000
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+ >
<hibernate-mapping>
<class name="org.hisp.dhis.patient.PatientIdentifier" table="patientidentifier">
@@ -9,11 +11,13 @@
<id name="id" column="patientidentifierid">
<generator class="native" />
</id>
+ &identifiableProperties;
<many-to-one name="identifierType" class="org.hisp.dhis.patient.PatientIdentifierType" column="patientidentifiertypeid"
foreign-key="fk_patientidentifier_patientidentifiertypeid" />
- <many-to-one name="patient" class="org.hisp.dhis.patient.Patient" column="patientid" not-null="true" foreign-key="fk_patientidentifier_patient" />
+ <many-to-one name="patient" class="org.hisp.dhis.patient.Patient" column="patientid" not-null="true"
+ foreign-key="fk_patientidentifier_patient" />
<property name="identifier" length="31" not-null="true" />