=== 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 + extends GenericIdentifiableObjectStore { String ID = PatientIdentifierStore.class.getName(); PatientIdentifier get( Patient patient ); PatientIdentifier get( String identifier, OrganisationUnit organisationUnit ); - + PatientIdentifier get( PatientIdentifierType type, String identifier ); Collection getByIdentifier( String identifier ); - + Collection 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 getPatientIdentifiers( Patient patient ); - - Patient getPatient( PatientIdentifierType idenType, String value); - + + Patient getPatient( PatientIdentifierType idenType, String value ); + Collection getPatientsByIdentifier( String identifier, int min, int max ); - + int countGetPatientsByIdentifier( String identifier ); - - Collection get(Collection identifierTypes, Patient patient); + + Collection get( Collection 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 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 @@ + "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" + [] + > @@ -9,11 +11,13 @@ + &identifiableProperties; - +