dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27499
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13695: Minor fix in program hibernate mapping file.
------------------------------------------------------------
revno: 13695
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-01-13 10:25:30 +0700
message:
Minor fix in program hibernate mapping file.
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientAttribute.hbm.xml
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientIdentifierType.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java 2014-01-09 15:34:25 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java 2014-01-13 03:25:30 +0000
@@ -53,7 +53,7 @@
{
this.patientAttributeStore = patientAttributeStore;
}
-
+
private ProgramService programService;
public void setProgramService( ProgramService programService )
@@ -132,28 +132,38 @@
public Collection<PatientAttribute> getPatientAttributesWithoutProgram()
{
+ System.out.println( "\n\n === \n 1" );
Collection<PatientAttribute> patientAttributes = patientAttributeStore.getAll();
+ System.out.println( "\n 2" );
Iterator<PatientAttribute> iterator = patientAttributes.iterator();
-
+ System.out.println( "\n 3" );
+
Collection<Program> programs = programService.getAllPrograms();
-
- for ( Program program : programs )
+ System.out.println( "\n 4" );
+ while ( iterator.hasNext() )
{
- while ( iterator.hasNext() )
+ for ( Program program : programs )
{
+ System.out.println( "\n ****** 5" );
+
PatientAttribute attribute = iterator.next();
-
+ System.out.println( "\n 6" );
+
+
if ( program.getAttributes().contains( attribute ) )
{
iterator.remove();
+ break;
}
+ System.out.println( "\n 7" );
+
}
}
-
+
return patientAttributes;
}
-
- public Collection<PatientAttribute> getPatientAttributesDisplayed(boolean displayInListNoProgram )
+
+ public Collection<PatientAttribute> getPatientAttributesDisplayed( boolean displayInListNoProgram )
{
return patientAttributeStore.getPatientAttributesDisplayed( displayInListNoProgram );
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientAttribute.hbm.xml 2014-01-09 15:34:25 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientAttribute.hbm.xml 2014-01-13 03:25:30 +0000
@@ -11,7 +11,7 @@
</id>
<many-to-one name="patientAttribute" class="org.hisp.dhis.patient.PatientAttribute"
- column="attributeid" foreign-key="fk_program_attributeid" />
+ column="patientattributeid" foreign-key="fk_program_attributeid" />
<property name="sortOrder" column="sort_order" />
=== modified 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 2014-01-09 15:34:25 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/ProgramPatientIdentifierType.hbm.xml 2014-01-13 03:25:30 +0000
@@ -11,7 +11,7 @@
</id>
<many-to-one name="patientIdentifierType" class="org.hisp.dhis.patient.PatientIdentifierType"
- column="identifiertypeid" foreign-key="fk_program_identifiertypeid" />
+ column="patientidentifiertypeid" foreign-key="fk_program_identifiertypeid" />
<property name="sortOrder" column="sort_order" />
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java 2013-10-24 08:31:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SelectAction.java 2014-01-13 03:25:30 +0000
@@ -79,9 +79,9 @@
// Input/output
// -------------------------------------------------------------------------
- private Collection<PatientAttribute> patientAttributes;
+ private List<PatientAttribute> patientAttributes;
- public Collection<PatientAttribute> getPatientAttributes()
+ public List<PatientAttribute> getPatientAttributes()
{
return patientAttributes;
}
@@ -115,13 +115,18 @@
throws Exception
{
organisationUnit = selectionManager.getSelectedOrganisationUnit();
-
- patientAttributes = patientAttributeService.getAllPatientAttributes();
-
- programs = new ArrayList<Program>( programService.getProgramsByCurrentUser( organisationUnit ) );
- programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
-
- Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
+ patientAttributes = new ArrayList<PatientAttribute>(
+ patientAttributeService.getPatientAttributesWithoutProgram() );
+ patientAttributes.addAll( patientAttributeService.getPatientAttributesDisplayed( true ) );
+ Collections.sort( patientAttributes, IdentifiableObjectNameComparator.INSTANCE );
+
+ if ( organisationUnit != null )
+ {
+ programs = new ArrayList<Program>( programService.getProgramsByCurrentUser( organisationUnit ) );
+ programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+
+ Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
+ }
return SUCCESS;
}