dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27367
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13615: Add missing files
------------------------------------------------------------
revno: 13615
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-07 22:14:19 +0700
message:
Add missing files
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierTypeService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierTypeStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramPatientIdentiferTypeService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramPatientIdentifierTypeStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientIdentifierType.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierType.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierType.java 2014-01-07 15:14:19 +0000
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.program;
+
+import java.io.Serializable;
+
+import org.hisp.dhis.patient.PatientIdentifierType;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ ProgramPatientIdentifierType.java Jan 7, 2014 3:37:02 PM $
+ */
+public class ProgramPatientIdentifierType
+ implements Serializable
+{
+ private static final long serialVersionUID = -2420475559273198337L;
+
+ private Program program;
+
+ private PatientIdentifierType patientIdentifierType;
+
+ private boolean displayedInList;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public ProgramPatientIdentifierType()
+ {
+ }
+
+ public ProgramPatientIdentifierType( Program program, PatientIdentifierType patientIdentifierType,
+ boolean displayedInList )
+ {
+ this.program = program;
+ this.patientIdentifierType = patientIdentifierType;
+ this.displayedInList = displayedInList;
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode, equals and toString
+ // -------------------------------------------------------------------------
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+
+ result = result * prime + program.hashCode();
+ result = result * prime + patientIdentifierType.hashCode();
+
+ return result;
+ }
+
+ @Override
+ public boolean equals( Object object )
+ {
+ if ( object == null )
+ {
+ return false;
+ }
+
+ if ( getClass() != object.getClass() )
+ {
+ return false;
+ }
+
+ final ProgramPatientIdentifierType other = (ProgramPatientIdentifierType) object;
+
+ return program.getId() == other.getProgram().getId()
+ && patientIdentifierType.getId() == other.getPatientIdentifierType().getId();
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters && Setters
+ // -------------------------------------------------------------------------
+
+ public Program getProgram()
+ {
+ return program;
+ }
+
+ public void setProgram( Program program )
+ {
+ this.program = program;
+ }
+
+ public PatientIdentifierType getPatientIdentifierType()
+ {
+ return patientIdentifierType;
+ }
+
+ public void setPatientIdentifierType( PatientIdentifierType patientIdentifierType )
+ {
+ this.patientIdentifierType = patientIdentifierType;
+ }
+
+ public Boolean getDisplayedInList()
+ {
+ return displayedInList;
+ }
+
+ public void setDisplayedInList( Boolean displayedInList )
+ {
+ this.displayedInList = displayedInList;
+ }
+
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierTypeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierTypeService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierTypeService.java 2014-01-07 15:14:19 +0000
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.program;
+
+import java.util.Collection;
+
+import org.hisp.dhis.patient.PatientIdentifierType;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ ProgramPatientIdentifierTypeService.java Jan 7, 2014 9:33:20 AM $
+ */
+public interface ProgramPatientIdentifierTypeService
+{
+ String ID = ProgramPatientIdentifierTypeService.class.getName();
+
+ /**
+ * Adds an {@link ProgramPatientIdentifierType}
+ *
+ * @param programPatientIdentifierType The to ProgramPatientIdentifierType add.
+ *
+ * @return A generated unique id of the added
+ * {@link ProgramPatientIdentifierType}.
+ */
+ void addProgramPatientIdentifierType( ProgramPatientIdentifierType programPatientIdentifierType );
+
+ /**
+ * Updates an {@link ProgramPatientIdentifierType}.
+ *
+ * @param programPatientIdentifierType the ProgramPatientIdentifierType to update.
+ */
+ void updateProgramPatientIdentifierType( ProgramPatientIdentifierType programPatientIdentifierType );
+
+ /**
+ * Deletes a {@link ProgramPatientIdentifierType}.
+ *
+ * @param programPatientIdentifierType the ProgramPatientIdentifierType to delete.
+ */
+ void deleteProgramPatientIdentifierType( ProgramPatientIdentifierType programPatientIdentifierType );
+
+ /**
+ * Retrieve ProgramPatientIdentifierType list on a program and a data
+ * element
+ *
+ * @param program Program
+ * @param patientIdentifierType PatientIdentifierType
+ *
+ * @return ProgramPatientIdentifierType
+ */
+ ProgramPatientIdentifierType get( Program program, PatientIdentifierType patientIdentifierType );
+
+ /**
+ * Returns all {@link ProgramPatientIdentifierType}
+ *
+ * @return a collection of all ProgramPatientIdentifierType, or an empty
+ * collection if there are no ProgramPatientIdentifierTypes.
+ */
+ Collection<ProgramPatientIdentifierType> getAllProgramPatientIdentifierTypes();
+
+ /**
+ * Retrieve ProgramPatientIdentifierType list on a program
+ *
+ * @param program Program
+ *
+ * @return ProgramPatientIdentifierType list
+ */
+ Collection<ProgramPatientIdentifierType> get( Program program );
+
+ /**
+ * Retrieve PatientIdentifierType list on a program
+ *
+ * @param program Program
+ *
+ * @return ProgramPatientIdentifierType list
+ */
+ Collection<PatientIdentifierType> getListPatientIdentifierType( Program program );
+
+
+ /**
+ * Retrieve PatientIdentifierType list on a program
+ *
+ * @return ProgramPatientIdentifierType list
+ */
+ Collection<PatientIdentifierType> getPatientIdentifierTypes();
+
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierTypeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierTypeStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramPatientIdentifierTypeStore.java 2014-01-07 15:14:19 +0000
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.program;
+
+import java.util.Collection;
+
+import org.hisp.dhis.patient.PatientIdentifierType;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ ProgramPatientIdentifierTypeStore.java Jan 7, 2014 9:40:31 AM $
+ */
+public interface ProgramPatientIdentifierTypeStore
+{
+ String ID = ProgramPatientIdentifierTypeStore.class.getName();
+
+ /**
+ * Adds an {@link ProgramPatientIdentifierType}
+ *
+ * @param programPatientIdentifierType The to ProgramPatientIdentifierType add.
+ *
+ * @return A generated unique id of the added
+ * {@link ProgramPatientIdentifierType}.
+ */
+ void save( ProgramPatientIdentifierType programPatientIdentifierType );
+
+ /**
+ * Updates an {@link ProgramPatientIdentifierType}.
+ *
+ * @param programPatientIdentifierType the ProgramPatientIdentifierType to update.
+ */
+ void update( ProgramPatientIdentifierType programPatientIdentifierType );
+
+ /**
+ * Deletes a {@link ProgramPatientIdentifierType}.
+ *
+ * @param programPatientIdentifierType the ProgramPatientIdentifierType to delete.
+ */
+ void delete( ProgramPatientIdentifierType programPatientIdentifierType );
+
+ /**
+ * Retrieve ProgramPatientIdentifierType list on a program and a data element
+ *
+ * @param program Program
+ * @param patientIdentifierType PatientIdentifierType
+ *
+ * @return ProgramPatientIdentifierType
+ */
+ ProgramPatientIdentifierType get( Program program, PatientIdentifierType patientIdentifierType );
+
+ /**
+ * Returns all {@link ProgramPatientIdentifierType}
+ *
+ * @return a collection of all ProgramPatientIdentifierType, or an empty
+ * collection if there are no ProgramPatientIdentifierTypes.
+ */
+ Collection<ProgramPatientIdentifierType> getAll();
+
+ /**
+ * Retrieve ProgramPatientIdentifierType list on a program
+ *
+ * @param program Program
+ *
+ * @return ProgramPatientIdentifierType list
+ */
+ Collection<ProgramPatientIdentifierType> get( Program program );
+
+ /**
+ * Retrieve PatientIdentifierType list on a program
+ *
+ * @param program Program
+ *
+ * @return PatientIdentifierType list
+ */
+ Collection<PatientIdentifierType> getListPatientIdentifierType( Program program );
+
+ /**
+ * Retrieve PatientIdentifierType list on a program
+ *
+ * @param program Program
+ *
+ * @return PatientIdentifierType list
+ */
+ Collection<PatientIdentifierType> getPatientIdentifierTypes();
+}
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramPatientIdentiferTypeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramPatientIdentiferTypeService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramPatientIdentiferTypeService.java 2014-01-07 15:14:19 +0000
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.program;
+
+import java.util.Collection;
+
+import org.hisp.dhis.patient.PatientIdentifierType;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ DefaultProgramPatientIdentiferTypeService.java Jan 7, 2014 10:07:21 AM
+ * $
+ */
+public class DefaultProgramPatientIdentiferTypeService
+ implements ProgramPatientIdentifierTypeService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramPatientIdentifierTypeStore programPatientIdentifierTypeStore;
+
+ public void setProgramPatientIdentifierTypeStore( ProgramPatientIdentifierTypeStore programPatientIdentifierTypeStore )
+ {
+ this.programPatientIdentifierTypeStore = programPatientIdentifierTypeStore;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation methods
+ // -------------------------------------------------------------------------
+
+ public void addProgramPatientIdentifierType( ProgramPatientIdentifierType programPatientIdentifierType )
+ {
+ programPatientIdentifierTypeStore.save( programPatientIdentifierType );
+ }
+
+ public void deleteProgramPatientIdentifierType( ProgramPatientIdentifierType programPatientIdentifierType )
+ {
+ programPatientIdentifierTypeStore.delete( programPatientIdentifierType );
+ }
+
+ public Collection<ProgramPatientIdentifierType> getAllProgramPatientIdentifierTypes()
+ {
+ return programPatientIdentifierTypeStore.getAll();
+ }
+
+ public Collection<ProgramPatientIdentifierType> get( Program program )
+ {
+ return programPatientIdentifierTypeStore.get( program );
+ }
+
+ public ProgramPatientIdentifierType get( Program program, PatientIdentifierType patientIdentifierType )
+ {
+ return programPatientIdentifierTypeStore.get( program, patientIdentifierType );
+ }
+
+ public void updateProgramPatientIdentifierType( ProgramPatientIdentifierType programPatientIdentifierType )
+ {
+ programPatientIdentifierTypeStore.update( programPatientIdentifierType );
+ }
+
+ public Collection<PatientIdentifierType> getListPatientIdentifierType( Program program )
+ {
+ return programPatientIdentifierTypeStore.getListPatientIdentifierType( program );
+ }
+
+ public Collection<PatientIdentifierType> getPatientIdentifierTypes()
+ {
+ return programPatientIdentifierTypeStore.getPatientIdentifierTypes();
+ }
+}
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramPatientIdentifierTypeStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramPatientIdentifierTypeStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramPatientIdentifierTypeStore.java 2014-01-07 15:14:19 +0000
@@ -0,0 +1,148 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.program.hibernate;
+
+import java.util.Collection;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramPatientIdentifierType;
+import org.hisp.dhis.program.ProgramPatientIdentifierTypeStore;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ HibernateProgramPatientIdentifierTypeStore.java Jan 7, 2014 9:49:20 AM
+ * $
+ */
+public class HibernateProgramPatientIdentifierTypeStore
+ implements ProgramPatientIdentifierTypeStore
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SessionFactory sessionFactory;
+
+ public void setSessionFactory( SessionFactory sessionFactory )
+ {
+ this.sessionFactory = sessionFactory;
+ }
+
+ // -------------------------------------------------------------------------
+ // Basic ProgramPatientIdentifierType
+ // -------------------------------------------------------------------------
+
+ public void save( ProgramPatientIdentifierType programPatientIdentifierType )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.save( programPatientIdentifierType );
+ }
+
+ public void update( ProgramPatientIdentifierType programPatientIdentifierType )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.update( programPatientIdentifierType );
+ }
+
+ public void delete( ProgramPatientIdentifierType programPatientIdentifierType )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.delete( programPatientIdentifierType );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<ProgramPatientIdentifierType> getAll()
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ProgramPatientIdentifierType.class );
+
+ return criteria.list();
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<ProgramPatientIdentifierType> get( Program program )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ProgramPatientIdentifierType.class );
+
+ return criteria.add( Restrictions.eq( "program", program ) ).list();
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<ProgramPatientIdentifierType> get( Program program, boolean compulsory )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ProgramPatientIdentifierType.class );
+ criteria.add( Restrictions.eq( "program", program ) );
+ criteria.add( Restrictions.eq( "compulsory", compulsory ) );
+
+ return criteria.list();
+ }
+
+ public ProgramPatientIdentifierType get( Program program, PatientIdentifierType patientIdentifierType )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ProgramPatientIdentifierType.class );
+ criteria.add( Restrictions.eq( "program", program ) );
+ criteria.add( Restrictions.eq( "patientIdentifierType", patientIdentifierType ) );
+
+ return (ProgramPatientIdentifierType) criteria.uniqueResult();
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<PatientIdentifierType> getListPatientIdentifierType( Program program )
+ {
+ Session session = sessionFactory.getCurrentSession();
+ Criteria criteria = session.createCriteria( ProgramPatientIdentifierType.class );
+ criteria.add( Restrictions.eq( "program", program ) );
+ criteria.setProjection( Projections.property( "patientIdentifierType" ) );
+ return criteria.list();
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<PatientIdentifierType> getPatientIdentifierTypes()
+ {
+ Session session = sessionFactory.getCurrentSession();
+ Criteria criteria = session.createCriteria( ProgramPatientIdentifierType.class );
+ criteria.setProjection( Projections.property( "patientIdentifierType" ) );
+ return criteria.list();
+ }
+}
=== added file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientIdentifierType.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientIdentifierType.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientIdentifierType.hbm.xml 2014-01-07 15:14:19 +0000
@@ -0,0 +1,19 @@
+<?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">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.program.ProgramPatientIdentifierType" table="program_identifierTypes">
+
+ <composite-id>
+ <key-many-to-one name="program" class="org.hisp.dhis.program.Program" column="programid"
+ foreign-key="fk_programidentifierTypes_programid" />
+ <key-many-to-one name="patientIdentifierType" class="org.hisp.dhis.patient.PatientIdentifierType" column="patientidentifiertypeid"
+ foreign-key="fk_program_patientidentifiertypeid" />
+ </composite-id>
+
+ <property name="displayedInList"/>
+
+ </class>
+</hibernate-mapping>