=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm 2011-03-18 14:14:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm 2011-03-20 17:57:30 +0000 @@ -64,7 +64,7 @@ var key = getFieldValue( "indicator-expression-container input[id=filter]"); - dataDictionary.loadOperands( "#indicator-expression-container select[id=dataElementId]", {aggregationOperator: aggregationOperator, usePaging: true, key: key} ); + dataDictionary.loadOperands( "#indicator-expression-container select[id=dataElementId]", {aggregationOperator: aggregationOperator, usePaging: true, key: key, includeTotals: true} ); checkAggregationOperator(); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAllCaseAggregationConditionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAllCaseAggregationConditionAction.java 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAllCaseAggregationConditionAction.java 2011-03-20 17:57:30 +0000 @@ -80,5 +80,4 @@ return SUCCESS; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetCaseAggregationConditionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetCaseAggregationConditionAction.java 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetCaseAggregationConditionAction.java 2011-03-20 17:57:30 +0000 @@ -85,5 +85,4 @@ return SUCCESS; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/RemoveCaseAggregationConditionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/RemoveCaseAggregationConditionAction.java 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/RemoveCaseAggregationConditionAction.java 2011-03-20 17:57:30 +0000 @@ -80,5 +80,4 @@ return SUCCESS; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/ShowCaseAggregationConditionFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/ShowCaseAggregationConditionFormAction.java 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/ShowCaseAggregationConditionFormAction.java 2011-03-20 17:57:30 +0000 @@ -77,6 +77,7 @@ // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- + public List getDataElementGroups() { return dataElementGroups; @@ -131,5 +132,4 @@ return SUCCESS; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java 2011-03-20 17:57:30 +0000 @@ -138,5 +138,4 @@ return SUCCESS; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SelectDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SelectDataElementAction.java 2010-08-31 14:34:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SelectDataElementAction.java 2011-03-20 17:57:30 +0000 @@ -56,10 +56,10 @@ private ProgramStageService programStageService; - public void setProgramStageService(ProgramStageService programStageService) { - this.programStageService = programStageService; - } - + public void setProgramStageService( ProgramStageService programStageService ) + { + this.programStageService = programStageService; + } private Comparator dataElementComparator; @@ -76,12 +76,12 @@ } private ProgramStageDataElementService programStageDataElementService; - - public void setProgramStageDataElementService( - ProgramStageDataElementService programStageDataElementService ) + + public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService ) { this.programStageDataElementService = programStageDataElementService; } + // ------------------------------------------------------------------------- // Getters & Setters // ------------------------------------------------------------------------- @@ -115,7 +115,8 @@ private ProgramStage association; - public ProgramStage getAssociation() { + public ProgramStage getAssociation() + { return association; } @@ -127,6 +128,7 @@ throws Exception { association = programStageService.getProgramStage( associationId ); + if ( association != null ) { dataElements = new ArrayList( programStageDataElementService.getListDataElement( association ) ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ShowDataEntryFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ShowDataEntryFormAction.java 2010-10-14 08:14:12 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ShowDataEntryFormAction.java 2011-03-20 17:57:30 +0000 @@ -24,6 +24,7 @@ * (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.patient.action.dataentryform; import org.hisp.dhis.dataentryform.DataEntryForm; @@ -83,7 +84,6 @@ public String execute() throws Exception { - if ( dataEntryFormId != null ) { DataEntryForm dataEntryForm = dataEntryFormService.getDataEntryForm( dataEntryFormId ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/ShowMobileSettingFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/ShowMobileSettingFormAction.java 2010-11-25 08:05:58 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/ShowMobileSettingFormAction.java 2011-03-20 17:57:30 +0000 @@ -1,11 +1,37 @@ package org.hisp.dhis.patient.action.mobilesetting; +/* + * Copyright (c) 2004-2010, 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 java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Set; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeService; @@ -88,35 +114,35 @@ public String execute() throws Exception { - //List of all attribute attributes = patientAttributeService.getAllPatientAttributes(); Collection paSettings = new HashSet( patientMobileSettingService.getCurrentSetting() ); - if(paSettings != null){ + + if ( paSettings != null ) + { Iterator settingsIt = paSettings.iterator(); if ( settingsIt.hasNext() ) { setting = settingsIt.next(); - //Selected List patientAtts = setting.getPatientAttributes(); - - //Delete object which is in "selected list" - for(PatientAttribute attribute : patientAtts){ - if(attributes.contains( attribute )){ + + for ( PatientAttribute attribute : patientAtts ) + { + if ( attributes.contains( attribute ) ) + { attributes.remove( attribute ); } } } else { - System.out.println( "Setting is null" ); patientAtts = new ArrayList(); } } -// System.out.println( "List " + patientAtts + " has size: " + patientAtts.size() ); + return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/UpdateMobileSettingAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/UpdateMobileSettingAction.java 2010-11-25 08:05:58 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/mobilesetting/UpdateMobileSettingAction.java 2011-03-20 17:57:30 +0000 @@ -1,5 +1,32 @@ package org.hisp.dhis.patient.action.mobilesetting; +/* + * Copyright (c) 2004-2010, 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 java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -12,11 +39,13 @@ import com.opensymphony.xwork2.Action; -public class UpdateMobileSettingAction implements Action +public class UpdateMobileSettingAction + implements Action { // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- + private PatientAttributeService patientAttributeService; public PatientAttributeService getPatientAttributeService() @@ -28,7 +57,7 @@ { this.patientAttributeService = patientAttributeService; } - + private PatientMobileSettingService patientMobileSettingService; public PatientMobileSettingService getPatientMobileSettingService() @@ -44,6 +73,7 @@ // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- + private Collection selectedList = new HashSet(); public void setSelectedList( Collection selectedList ) @@ -52,7 +82,7 @@ } private String gender, dobtype, birthdate, bloodgroup, registrationdate; - + public void setGender( String gender ) { this.gender = gender; @@ -82,65 +112,75 @@ public String execute() throws Exception { - - if(selectedList.size() > 0){ + + if ( selectedList.size() > 0 ) + { PatientMobileSetting setting; - if(patientMobileSettingService.getCurrentSetting().size()>0){ + if ( patientMobileSettingService.getCurrentSetting().size() > 0 ) + { setting = patientMobileSettingService.getCurrentSetting().iterator().next(); List attributes = new ArrayList(); setting.setPatientAttributes( attributes ); fillValues( attributes ); - setting.setGender( Boolean.parseBoolean( gender )); - setting.setDobtype( Boolean.parseBoolean(dobtype )); - setting.setBirthdate( Boolean.parseBoolean(birthdate )); - setting.setBloodgroup( Boolean.parseBoolean(bloodgroup )); - setting.setRegistrationdate( Boolean.parseBoolean(registrationdate )); + setting.setGender( Boolean.parseBoolean( gender ) ); + setting.setDobtype( Boolean.parseBoolean( dobtype ) ); + setting.setBirthdate( Boolean.parseBoolean( birthdate ) ); + setting.setBloodgroup( Boolean.parseBoolean( bloodgroup ) ); + setting.setRegistrationdate( Boolean.parseBoolean( registrationdate ) ); patientMobileSettingService.updatePatientMobileSetting( setting ); - }else{ + } + else + { setting = new PatientMobileSetting(); List attributes = new ArrayList(); setting.setPatientAttributes( attributes ); - setting.setGender( Boolean.parseBoolean( gender )); - setting.setDobtype( Boolean.parseBoolean(dobtype )); - setting.setBirthdate( Boolean.parseBoolean(birthdate )); - setting.setBloodgroup( Boolean.parseBoolean(bloodgroup )); - setting.setRegistrationdate( Boolean.parseBoolean(registrationdate )); + setting.setGender( Boolean.parseBoolean( gender ) ); + setting.setDobtype( Boolean.parseBoolean( dobtype ) ); + setting.setBirthdate( Boolean.parseBoolean( birthdate ) ); + setting.setBloodgroup( Boolean.parseBoolean( bloodgroup ) ); + setting.setRegistrationdate( Boolean.parseBoolean( registrationdate ) ); fillValues( attributes ); patientMobileSettingService.savePatientMobileSetting( setting ); } - }else{ + } + else + { PatientMobileSetting setting; - if(patientMobileSettingService.getCurrentSetting().size()>0){ + if ( patientMobileSettingService.getCurrentSetting().size() > 0 ) + { setting = patientMobileSettingService.getCurrentSetting().iterator().next(); List attributes = new ArrayList(); setting.setPatientAttributes( attributes ); - setting.setGender( Boolean.parseBoolean( gender )); - setting.setDobtype( Boolean.parseBoolean(dobtype )); - setting.setBirthdate( Boolean.parseBoolean(birthdate )); - setting.setBloodgroup( Boolean.parseBoolean(bloodgroup )); - setting.setRegistrationdate( Boolean.parseBoolean(registrationdate )); + setting.setGender( Boolean.parseBoolean( gender ) ); + setting.setDobtype( Boolean.parseBoolean( dobtype ) ); + setting.setBirthdate( Boolean.parseBoolean( birthdate ) ); + setting.setBloodgroup( Boolean.parseBoolean( bloodgroup ) ); + setting.setRegistrationdate( Boolean.parseBoolean( registrationdate ) ); fillValues( attributes ); patientMobileSettingService.updatePatientMobileSetting( setting ); - }else{ + } + else + { setting = new PatientMobileSetting(); List attributes = new ArrayList(); setting.setPatientAttributes( attributes ); - setting.setGender( Boolean.parseBoolean( gender )); - setting.setDobtype( Boolean.parseBoolean(dobtype )); - setting.setBirthdate( Boolean.parseBoolean(birthdate )); - setting.setBloodgroup( Boolean.parseBoolean(bloodgroup )); - setting.setRegistrationdate( Boolean.parseBoolean(registrationdate )); + setting.setGender( Boolean.parseBoolean( gender ) ); + setting.setDobtype( Boolean.parseBoolean( dobtype ) ); + setting.setBirthdate( Boolean.parseBoolean( birthdate ) ); + setting.setBloodgroup( Boolean.parseBoolean( bloodgroup ) ); + setting.setRegistrationdate( Boolean.parseBoolean( registrationdate ) ); fillValues( attributes ); patientMobileSettingService.savePatientMobileSetting( setting ); } } return SUCCESS; } - - private void fillValues(List attributes){ - for(String id : selectedList){ - attributes.add( patientAttributeService.getPatientAttribute( Integer.parseInt( id )) ); + + private void fillValues( List attributes ) + { + for ( String id : selectedList ) + { + attributes.add( patientAttributeService.getPatientAttribute( Integer.parseInt( id ) ) ); } } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java 2011-02-23 04:27:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddPatientAction.java 2011-03-20 17:57:30 +0000 @@ -169,7 +169,7 @@ String middleName = ""; String lastName = ""; - if( fullName.indexOf( ' ' ) != -1 ) + if ( fullName.indexOf( ' ' ) != -1 ) { firstName = fullName.substring( 0, startIndex ); if ( startIndex == endIndex ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java 2011-03-02 08:47:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/AddRepresentativeAction.java 2011-03-20 17:57:30 +0000 @@ -114,7 +114,7 @@ // Get FirstName, MiddleName, LastName by FullName // --------------------------------------------------------------------- - // --------------------------------------------------------------------- + // --------------------------------------------------------------------- // Set FirstName, MiddleName, LastName by FullName // --------------------------------------------------------------------- @@ -127,7 +127,7 @@ String middleName = ""; String lastName = ""; - if( fullName.indexOf( ' ' ) != -1 ) + if ( fullName.indexOf( ' ' ) != -1 ) // TODO fix hack { firstName = fullName.substring( 0, startIndex ); if ( startIndex == endIndex ) @@ -145,6 +145,7 @@ patient.setFirstName( firstName ); patient.setMiddleName( middleName ); patient.setLastName( lastName ); + // --------------------------------------------------------------------- // Get Other information for patient // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/DefinePatientOrgnunitRegistrationAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/DefinePatientOrgnunitRegistrationAction.java 2011-02-16 02:55:58 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/DefinePatientOrgnunitRegistrationAction.java 2011-03-20 17:57:30 +0000 @@ -28,13 +28,10 @@ package org.hisp.dhis.patient.action.patient; import java.util.Collection; -import java.util.HashSet; -import java.util.Set; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.oust.manager.SelectionTreeManager; -import org.hisp.dhis.program.Program; import com.opensymphony.xwork2.Action; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java 2010-12-28 03:11:15 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientAction.java 2011-03-20 17:57:30 +0000 @@ -97,7 +97,7 @@ private String childContactName; private String childContactType; - + private String systemIdentifier; private String benicode; @@ -115,7 +115,6 @@ public String execute() throws Exception { - patient = patientService.getPatient( id ); patientIdentifier = patientIdentifierService.getPatientIdentifier( patient ); @@ -127,37 +126,40 @@ PatientIdentifierType idType = null; Patient representative = patient.getRepresentative(); - if( patient.isUnderAge() && representative != null ) + if ( patient.isUnderAge() && representative != null ) { - for( PatientIdentifier representativeIdentifier : representative.getIdentifiers() ) + for ( PatientIdentifier representativeIdentifier : representative.getIdentifiers() ) { - if( representativeIdentifier.getIdentifierType() != null && representativeIdentifier.getIdentifierType().isRelated() ) + if ( representativeIdentifier.getIdentifierType() != null + && representativeIdentifier.getIdentifierType().isRelated() ) { - identiferMap.put( representativeIdentifier.getIdentifierType().getId(), representativeIdentifier.getIdentifier() ); + identiferMap.put( representativeIdentifier.getIdentifierType().getId(), + representativeIdentifier.getIdentifier() ); } } } - + for ( PatientIdentifier identifier : patient.getIdentifiers() ) { idType = identifier.getIdentifierType(); + if ( idType != null ) { identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() ); - if(idType.getFormat().equals("State Format")) + if ( idType.getFormat().equals( "State Format" ) ) { - String iden = identifier.getIdentifier(); - benicode = iden.substring( 12,16 );//abcdefghi1121111 - yearcode = iden.substring( 10, 12 ); - progcode = iden.substring( 9, 10 ); - orgunitcode = iden.substring( 0, 9); + String iden = identifier.getIdentifier(); + benicode = iden.substring( 12, 16 ); + yearcode = iden.substring( 10, 12 ); + progcode = iden.substring( 9, 10 ); + orgunitcode = iden.substring( 0, 9 ); } } - else + else systemIdentifier = identifier.getIdentifier(); } - + for ( PatientAttribute patientAttribute : patient.getAttributes() ) { patientAttributeValueMap.put( patientAttribute.getId(), PatientAttributeValue.UNKNOWN ); @@ -168,14 +170,17 @@ for ( PatientAttributeValue patientAttributeValue : patientAttributeValues ) { - if( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttributeValue.getPatientAttribute().getValueType() ) ) - { - patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), patientAttributeValue - .getPatientAttributeOption().getName() ); - }else{ - patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), patientAttributeValue - .getValue() ); - } + if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttributeValue.getPatientAttribute() + .getValueType() ) ) + { + patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), + patientAttributeValue.getPatientAttributeOption().getName() ); + } + else + { + patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), + patientAttributeValue.getValue() ); + } } programs = programService.getAllPrograms(); @@ -287,7 +292,8 @@ return systemIdentifier; } - public String getBenicode() { + public String getBenicode() + { return benicode; } @@ -305,5 +311,4 @@ { return yearcode; } - -} \ No newline at end of file +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ProgramEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ProgramEnrollmentAction.java 2009-12-01 09:17:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ProgramEnrollmentAction.java 2011-03-20 17:57:30 +0000 @@ -177,6 +177,5 @@ } return SUCCESS; - } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/RemoveEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/RemoveEnrollmentAction.java 2011-01-20 02:15:19 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/RemoveEnrollmentAction.java 2011-03-20 17:57:30 +0000 @@ -63,215 +63,222 @@ * @author Abyot Asalefew Gizaw * @version $Id$ */ -public class RemoveEnrollmentAction implements Action { - public static final String PREFIX_ATTRIBUTE = "attr"; - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private PatientService patientService; - - private ProgramService programService; - - private ProgramInstanceService programInstanceService; - - private ProgramAttributeService programAttributeService; - - private ProgramAttributeOptionService programAttributeOptionService; - - private ProgramAttributeValueService programAttributeValueService; - - private I18nFormat format; - - // ------------------------------------------------------------------------- - // Input/Output - // ------------------------------------------------------------------------- - - private Integer programInstanceId; - - private Collection programs = new ArrayList(); - - private Patient patient; - - // ------------------------------------------------------------------------- - // Getters && Setters - // ------------------------------------------------------------------------- - - public void setPatientService(PatientService patientService) { - this.patientService = patientService; - } - - public void setProgramService(ProgramService programService) { - this.programService = programService; - } - - public void setProgramInstanceService( - ProgramInstanceService programInstanceService) { - this.programInstanceService = programInstanceService; - } - - public void setProgramAttributeService( - ProgramAttributeService programAttributeService) { - this.programAttributeService = programAttributeService; - } - - public void setProgramAttributeOptionService( - ProgramAttributeOptionService programAttributeOptionService) { - this.programAttributeOptionService = programAttributeOptionService; - } - - public void setProgramAttributeValueService( - ProgramAttributeValueService programAttributeValueService) { - this.programAttributeValueService = programAttributeValueService; - } - - public void setFormat(I18nFormat format) { - this.format = format; - } - - public Patient getPatient() { - return patient; - } - - public Collection getPrograms() { - return programs; - } - - public void setProgramInstanceId(Integer programInstanceId) { - this.programInstanceId = programInstanceId; - } - - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() throws Exception { - - ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId ); - - // Get selected patient from programInstance - patient = programInstance.getPatient(); - - // Get selected program from programInstance - Program program = programInstance.getProgram(); - - // --------------------------------------------------------------------- - // Update Information of programInstance - // --------------------------------------------------------------------- - - programInstance.setEndDate(new Date()); - programInstance.setCompleted(true); - - programInstanceService.updateProgramInstance(programInstance); - - patient.getPrograms().remove(program); - patientService.updatePatient(patient); - - // --------------------------------------------------------------------- - // Save Program Attributes - // --------------------------------------------------------------------- - - HttpServletRequest request = ServletActionContext.getRequest(); - - Collection attributes = programAttributeService - .getAllProgramAttributes(); - - Set programAttributes = new HashSet(); - - // End-user inputs attribute value for DEAD-attribute - boolean flag = false; - - if (attributes != null && attributes.size() > 0) { - programInstance.getAttributes().clear(); - - // Save other attributes - for (ProgramAttribute attribute : attributes) { - String value = request - .getParameter(RemoveEnrollmentAction.PREFIX_ATTRIBUTE - + attribute.getId()); - - if (StringUtils.isNotBlank(value)) { - programAttributes.add(attribute); - - ProgramAttributeValue attributeValue = programAttributeValueService - .getProgramAttributeValue(programInstance, - attribute); - - // attributeValue is not exist - if (attributeValue == null) { - attributeValue = new ProgramAttributeValue(); - attributeValue.setProgramInstance(programInstance); - attributeValue.setProgramAttribute(attribute); - - // DEAD program-attribute - if (attribute.getName().equalsIgnoreCase( - ProgramAttribute.DEAD_NAME) - && attribute.getValueType().equalsIgnoreCase( - ProgramAttribute.TYPE_BOOL)) { - attributeValue.setValue(value.trim()); - patient.setIsDead(Boolean - .parseBoolean(value.trim())); - patientService.updatePatient(patient); - flag = true; - } else if (ProgramAttribute.TYPE_COMBO - .equalsIgnoreCase(attribute.getValueType())) { - ProgramAttributeOption option = programAttributeOptionService - .get(NumberUtils.toInt(value, 0)); - if (option != null) { - attributeValue - .setProgramAttributeOption(option); - attributeValue.setValue(option.getName()); - } - } else { - attributeValue.setValue(value.trim()); - } - - // CLOSED-DATE program-attribute - if (attribute.getName().equalsIgnoreCase( - ProgramAttribute.CLOSED_DATE) - && attribute.getValueType().equalsIgnoreCase( - ProgramAttribute.TYPE_DATE) && flag) { - patient - .setDeathDate(format - .parseDate(value.trim())); - patientService.updatePatient(patient); - } - - // save values - programAttributeValueService - .saveProgramAttributeValue(attributeValue); - - } - // attributeValue is exist - else { - if (ProgramAttribute.TYPE_COMBO - .equalsIgnoreCase(attribute.getValueType())) { - ProgramAttributeOption option = programAttributeOptionService - .get(NumberUtils.toInt(value, 0)); - if (option != null) { - attributeValue - .setProgramAttributeOption(option); - attributeValue.setValue(option.getName()); - } - } else { - attributeValue.setValue(value.trim()); - } - } - - // update values - programAttributeValueService - .updateProgramAttributeValue(attributeValue); - } - } - } - System.out.println("\n\n ++++++++ \n programAttributes : " - + programAttributes); - programInstance.setAttributes(programAttributes); - - programInstanceService.updateProgramInstance(programInstance); - - return SUCCESS; - } +public class RemoveEnrollmentAction + implements Action +{ + public static final String PREFIX_ATTRIBUTE = "attr"; + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private PatientService patientService; + + private ProgramService programService; + + private ProgramInstanceService programInstanceService; + + private ProgramAttributeService programAttributeService; + + private ProgramAttributeOptionService programAttributeOptionService; + + private ProgramAttributeValueService programAttributeValueService; + + private I18nFormat format; + + // ------------------------------------------------------------------------- + // Input/Output + // ------------------------------------------------------------------------- + + private Integer programInstanceId; + + private Collection programs = new ArrayList(); + + private Patient patient; + + // ------------------------------------------------------------------------- + // Getters && Setters + // ------------------------------------------------------------------------- + + public void setPatientService( PatientService patientService ) + { + this.patientService = patientService; + } + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + + public void setProgramInstanceService( ProgramInstanceService programInstanceService ) + { + this.programInstanceService = programInstanceService; + } + + public void setProgramAttributeService( ProgramAttributeService programAttributeService ) + { + this.programAttributeService = programAttributeService; + } + + public void setProgramAttributeOptionService( ProgramAttributeOptionService programAttributeOptionService ) + { + this.programAttributeOptionService = programAttributeOptionService; + } + + public void setProgramAttributeValueService( ProgramAttributeValueService programAttributeValueService ) + { + this.programAttributeValueService = programAttributeValueService; + } + + public void setFormat( I18nFormat format ) + { + this.format = format; + } + + public Patient getPatient() + { + return patient; + } + + public Collection getPrograms() + { + return programs; + } + + public void setProgramInstanceId( Integer programInstanceId ) + { + this.programInstanceId = programInstanceId; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + + ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId ); + + // Get selected patient from programInstance + patient = programInstance.getPatient(); + + // Get selected program from programInstance + Program program = programInstance.getProgram(); + + // --------------------------------------------------------------------- + // Update Information of programInstance + // --------------------------------------------------------------------- + + programInstance.setEndDate( new Date() ); + programInstance.setCompleted( true ); + + programInstanceService.updateProgramInstance( programInstance ); + + patient.getPrograms().remove( program ); + patientService.updatePatient( patient ); + + // --------------------------------------------------------------------- + // Save Program Attributes + // --------------------------------------------------------------------- + + HttpServletRequest request = ServletActionContext.getRequest(); + + Collection attributes = programAttributeService.getAllProgramAttributes(); + + Set programAttributes = new HashSet(); + + // End-user inputs attribute value for DEAD-attribute + boolean flag = false; + + if ( attributes != null && attributes.size() > 0 ) + { + programInstance.getAttributes().clear(); + + // Save other attributes + for ( ProgramAttribute attribute : attributes ) + { + String value = request.getParameter( RemoveEnrollmentAction.PREFIX_ATTRIBUTE + attribute.getId() ); + + if ( StringUtils.isNotBlank( value ) ) + { + programAttributes.add( attribute ); + + ProgramAttributeValue attributeValue = programAttributeValueService.getProgramAttributeValue( + programInstance, attribute ); + + // attributeValue is not exist + if ( attributeValue == null ) + { + attributeValue = new ProgramAttributeValue(); + attributeValue.setProgramInstance( programInstance ); + attributeValue.setProgramAttribute( attribute ); + + // DEAD program-attribute + if ( attribute.getName().equalsIgnoreCase( ProgramAttribute.DEAD_NAME ) + && attribute.getValueType().equalsIgnoreCase( ProgramAttribute.TYPE_BOOL ) ) + { + attributeValue.setValue( value.trim() ); + patient.setIsDead( Boolean.parseBoolean( value.trim() ) ); + patientService.updatePatient( patient ); + flag = true; + } + else if ( ProgramAttribute.TYPE_COMBO.equalsIgnoreCase( attribute.getValueType() ) ) + { + ProgramAttributeOption option = programAttributeOptionService.get( NumberUtils.toInt( + value, 0 ) ); + if ( option != null ) + { + attributeValue.setProgramAttributeOption( option ); + attributeValue.setValue( option.getName() ); + } + } + else + { + attributeValue.setValue( value.trim() ); + } + + // CLOSED-DATE program-attribute + if ( attribute.getName().equalsIgnoreCase( ProgramAttribute.CLOSED_DATE ) + && attribute.getValueType().equalsIgnoreCase( ProgramAttribute.TYPE_DATE ) && flag ) + { + patient.setDeathDate( format.parseDate( value.trim() ) ); + patientService.updatePatient( patient ); + } + + // save values + programAttributeValueService.saveProgramAttributeValue( attributeValue ); + + } + // attributeValue is exist + else + { + if ( ProgramAttribute.TYPE_COMBO.equalsIgnoreCase( attribute.getValueType() ) ) + { + ProgramAttributeOption option = programAttributeOptionService.get( NumberUtils.toInt( + value, 0 ) ); + if ( option != null ) + { + attributeValue.setProgramAttributeOption( option ); + attributeValue.setValue( option.getName() ); + } + } + else + { + attributeValue.setValue( value.trim() ); + } + } + + // update values + programAttributeValueService.updateProgramAttributeValue( attributeValue ); + } + } + } + + programInstance.setAttributes( programAttributes ); + + programInstanceService.updateProgramInstance( programInstance ); + + return SUCCESS; + } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/RemoveEnrollmentSelectAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/RemoveEnrollmentSelectAction.java 2011-01-20 02:15:19 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/RemoveEnrollmentSelectAction.java 2011-03-20 17:57:30 +0000 @@ -44,122 +44,132 @@ * @author Chau Thu Tran * @version $ID : RemoveEnrollmentSelectAction.java Jan 11, 2011 10:00:55 AM $ */ -public class RemoveEnrollmentSelectAction implements Action { - // ------------------------------------------------------------------------- - // Dependency - // ------------------------------------------------------------------------- - - private ProgramAttributeService programAttributeService; - - private ProgramInstanceService programInstanceService; - - private ProgramService programService; - - private PatientService patientService; - - // ------------------------------------------------------------------------- - // Input/Output - // ------------------------------------------------------------------------- - - private Integer patientId; - - private Integer programInstanceId; - - private Collection programInstances; - - private Collection programAttributes; - - private ProgramInstance programInstance; - - private Patient patient; - - // ------------------------------------------------------------------------- - // Getter - // ------------------------------------------------------------------------- - - public void setProgramAttributeService( - ProgramAttributeService programAttributeService) { - this.programAttributeService = programAttributeService; - } - - public ProgramInstance getProgramInstance() { - return programInstance; - } - - public void setPatientService(PatientService patientService) { - this.patientService = patientService; - } - - public void setProgramService(ProgramService programService) { - this.programService = programService; - } - - public Patient getPatient() { - return patient; - } - - public void setPatientId(Integer patientId) { - this.patientId = patientId; - } - - public void setProgramInstanceId(Integer programInstanceId) { - this.programInstanceId = programInstanceId; - } - - public Collection getProgramInstances() { - return programInstances; - } - - public Collection getProgramAttributes() { - return programAttributes; - } - - public void setProgramInstanceService( - ProgramInstanceService programInstanceService) { - this.programInstanceService = programInstanceService; - } - - // ------------------------------------------------------------------------- - // Implementation Action - // ------------------------------------------------------------------------- - - @Override - public String execute() throws Exception { - - programAttributes = programAttributeService.getAllProgramAttributes(); - - // --------------------------------------------------------------------- - // Get programInstance - // --------------------------------------------------------------------- - - programInstances = new ArrayList(); - - // Get selected patient - patient = patientService.getPatient( patientId ); - // Get all of programs - Collection programs = programService.getAllPrograms(); - - for( Program program : programs ) - { - Collection instances = programInstanceService - .getProgramInstances(patient, program, false); - - if (instances.iterator().hasNext()) { - programInstances.add( instances.iterator().next() ); - } - - } - - // --------------------------------------------------------------------- - // Get selected programInstance - // --------------------------------------------------------------------- - - if( programInstanceId != null ) - { - programInstance = programInstanceService.getProgramInstance( programInstanceId ); - } - - return SUCCESS; - } - +public class RemoveEnrollmentSelectAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependency + // ------------------------------------------------------------------------- + + private ProgramAttributeService programAttributeService; + + private ProgramInstanceService programInstanceService; + + private ProgramService programService; + + private PatientService patientService; + + // ------------------------------------------------------------------------- + // Input/Output + // ------------------------------------------------------------------------- + + private Integer patientId; + + private Integer programInstanceId; + + private Collection programInstances; + + private Collection programAttributes; + + private ProgramInstance programInstance; + + private Patient patient; + + // ------------------------------------------------------------------------- + // Getter + // ------------------------------------------------------------------------- + + public void setProgramAttributeService( ProgramAttributeService programAttributeService ) + { + this.programAttributeService = programAttributeService; + } + + public ProgramInstance getProgramInstance() + { + return programInstance; + } + + public void setPatientService( PatientService patientService ) + { + this.patientService = patientService; + } + + public void setProgramService( ProgramService programService ) + { + this.programService = programService; + } + + public Patient getPatient() + { + return patient; + } + + public void setPatientId( Integer patientId ) + { + this.patientId = patientId; + } + + public void setProgramInstanceId( Integer programInstanceId ) + { + this.programInstanceId = programInstanceId; + } + + public Collection getProgramInstances() + { + return programInstances; + } + + public Collection getProgramAttributes() + { + return programAttributes; + } + + public void setProgramInstanceService( ProgramInstanceService programInstanceService ) + { + this.programInstanceService = programInstanceService; + } + + // ------------------------------------------------------------------------- + // Implementation Action + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + programAttributes = programAttributeService.getAllProgramAttributes(); + + // --------------------------------------------------------------------- + // Get programInstance + // --------------------------------------------------------------------- + + programInstances = new ArrayList(); + + patient = patientService.getPatient( patientId ); + + Collection programs = programService.getAllPrograms(); + + for ( Program program : programs ) + { + Collection instances = programInstanceService + .getProgramInstances( patient, program, false ); + + if ( instances.iterator().hasNext() ) + { + programInstances.add( instances.iterator().next() ); + } + + } + + // --------------------------------------------------------------------- + // Get selected programInstance + // --------------------------------------------------------------------- + + if ( programInstanceId != null ) + { + programInstance = programInstanceService.getProgramInstance( programInstanceId ); + } + + return SUCCESS; + } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SaveDueDateAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SaveDueDateAction.java 2009-11-24 15:39:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SaveDueDateAction.java 2011-03-20 17:57:30 +0000 @@ -106,7 +106,6 @@ public String execute() throws Exception { - ProgramStageInstance programStageInstance = programStageInstanceService .getProgramStageInstance( programStageInstanceId ); @@ -129,7 +128,6 @@ programStageInstanceService.updateProgramStageInstance( programStageInstance ); LOG.debug( "Updating Due Date, value added/changed" ); - } return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientFormAction.java 2011-02-24 06:02:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientFormAction.java 2011-03-20 17:57:30 +0000 @@ -45,7 +45,6 @@ public class SearchPatientFormAction implements Action { - // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPersonAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPersonAction.java 2010-10-20 13:34:22 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPersonAction.java 2011-03-20 17:57:30 +0000 @@ -38,37 +38,36 @@ import com.opensymphony.xwork2.Action; - /** * @author Viet * @version $Id$ */ -public class SearchPersonAction implements Action +public class SearchPersonAction + implements Action { - // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- private PatientService patientService; - + private PatientAttributeValueService patientAttributeValueService; - + // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- - private Integer identifierTypeId; - + private Integer identifierTypeId; + private Integer attributeId; - + private String searchValue; - + // ------------------------------------------------------------------------- // Output // ------------------------------------------------------------------------- - + private Map patientAttributeValueMap = new HashMap(); private Collection patients; @@ -80,23 +79,23 @@ public String execute() throws Exception { - patients = patientService.getPatient( identifierTypeId, attributeId, searchValue ); - - if( patients != null && patients.size() > 0 ) + patients = patientService.getPatient( identifierTypeId, attributeId, searchValue ); + + if ( patients != null && patients.size() > 0 ) { for ( Patient p : patients ) { Collection patientAttributeValues = patientAttributeValueService .getPatientAttributeValues( p ); - + for ( PatientAttributeValue patientAttributeValue : patientAttributeValues ) { - patientAttributeValueMap - .put( p.getId() + "_" + patientAttributeValue.getPatientAttribute().getId(), - patientAttributeValue.getValue() ); + patientAttributeValueMap.put( + p.getId() + "_" + patientAttributeValue.getPatientAttribute().getId(), + patientAttributeValue.getValue() ); } } - } + } return SUCCESS; } @@ -138,6 +137,4 @@ { this.searchValue = searchValue; } - - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java 2011-01-11 01:56:03 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddPatientFormAction.java 2011-03-20 17:57:30 +0000 @@ -59,36 +59,36 @@ { this.selectionManager = selectionManager; } - + private PatientAttributeService patientAttributeService; - + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) { this.patientAttributeService = patientAttributeService; } - + private PatientAttributeGroupService patientAttributeGroupService; - + public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) { this.patientAttributeGroupService = patientAttributeGroupService; } - + private PatientIdentifierTypeService patientIdentifierTypeService; - + public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService ) { this.patientIdentifierTypeService = patientIdentifierTypeService; } - + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- private Collection noGroupAttributes; - + private Collection attributeGroups; - + private Collection identifierTypes; private OrganisationUnit organisationUnit; @@ -96,7 +96,7 @@ private String year; private boolean showMsg; - + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -105,32 +105,33 @@ { showMsg = false; - identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes(); - + identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes(); + noGroupAttributes = patientAttributeService.getPatientAttributesNotGroup(); - - attributeGroups = patientAttributeGroupService.getAllPatientAttributeGroups(); - + + attributeGroups = patientAttributeGroupService.getAllPatientAttributeGroups(); + organisationUnit = selectionManager.getSelectedOrganisationUnit(); - for(PatientIdentifierType identifierType :identifierTypes) + for ( PatientIdentifierType identifierType : identifierTypes ) { - if(identifierType.getFormat() != null && identifierType.getFormat().equals("State Format") && identifierType.isMandatory()==true ) + if ( identifierType.getFormat() != null && identifierType.getFormat().equals( "State Format" ) + && identifierType.isMandatory() == true ) { - if(organisationUnit.getCode()==null || organisationUnit.getCode().length() < 9) + if ( organisationUnit.getCode() == null || organisationUnit.getCode().length() < 9 ) showMsg = true; } } - - SimpleDateFormat dataFormat = new SimpleDateFormat("y"); - year = dataFormat.format(new Date()); + + SimpleDateFormat dataFormat = new SimpleDateFormat( "y" ); + year = dataFormat.format( new Date() ); return SUCCESS; } - // ------------------------------------------------------------------------- // Getter/Setter // ------------------------------------------------------------------------- + public Collection getIdentifierTypes() { return identifierTypes; @@ -140,21 +141,24 @@ { return attributeGroups; } + public Collection getNoGroupAttributes() { return noGroupAttributes; } + public OrganisationUnit getOrganisationUnit() { return organisationUnit; } - public String getYear() { + public String getYear() + { return year; } - public boolean isShowMsg() { + public boolean isShowMsg() + { return showMsg; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddRepresentativeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddRepresentativeAction.java 2010-09-25 07:53:17 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ShowAddRepresentativeAction.java 2011-03-20 17:57:30 +0000 @@ -1,6 +1,32 @@ package org.hisp.dhis.patient.action.patient; -import java.lang.reflect.Array; +/* + * Copyright (c) 2004-2009, 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 java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -17,13 +43,6 @@ public class ShowAddRepresentativeAction implements Action { - - private static final String PARENTS = "Parent"; - - private static final String GUARDIAN = "Guardian"; - - private static final String CHILD = "Child"; - // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- @@ -49,21 +68,11 @@ // ------------------------------------------------------------------------- public String execute() - throws Exception { - // //TODO Have to create identifier Group, it should base on age or - // somewhat... - // // Current ...hard code ... - // RelationshipType r = relationshipTypeService.getRelationshipType( - // PARENTS, CHILD ); - // relationshipTypes.add( r ); - // r = relationshipTypeService.getRelationshipType( GUARDIAN, CHILD ); - // relationshipTypes.add( r ); - relationshipTypes = new ArrayList( relationshipTypeService.getAllRelationshipTypes() ); identifierTypes = patientIdentifierTypeService.getAllPatientIdentifierTypes(); attributes = patientAttributeService.getAllPatientAttributes(); - + return SUCCESS; } @@ -100,5 +109,4 @@ { return attributes; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java 2011-02-23 04:24:19 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java 2011-03-20 17:57:30 +0000 @@ -252,18 +252,9 @@ { String value = null; String idDuplicate = ""; + for ( PatientIdentifierType idType : identifiers ) { - // If underAge is TRUE : Only check duplicate on - // PatientIdentifierType which related is FALSE - /* - * if(idType.getFormat().equals("State Format")) { String - * orgUnitCodeValue = request.getParameter( "orgunitcode" ); - * if(orgUnitCodeValue!=null) { - * System.out.println("orgUnitCodeValue = "+orgUnitCodeValue ); - * if(orgUnitCodeValue.length()<9) { message = i18n.getString( - * "oucode_must_be_valid" ); return INPUT; } } } - */ if ( !underAge || (underAge && !idType.isRelated()) ) { value = request.getParameter( AddPatientAction.PREFIX_IDENTIFIER + idType.getId() ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetOptionalPatientAttributesWithoutGroupAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetOptionalPatientAttributesWithoutGroupAction.java 2010-01-29 09:15:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetOptionalPatientAttributesWithoutGroupAction.java 2011-03-20 17:57:30 +0000 @@ -64,7 +64,6 @@ return patientAttributes; } - // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetPatientAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetPatientAttributeAction.java 2010-11-12 10:28:30 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetPatientAttributeAction.java 2011-03-20 17:57:30 +0000 @@ -77,7 +77,6 @@ { patientAttribute = patientAttributeService.getPatientAttribute( id ); - return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetPatientAttributesWithdoutGroupAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetPatientAttributesWithdoutGroupAction.java 2010-09-27 10:20:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/GetPatientAttributesWithdoutGroupAction.java 2011-03-20 17:57:30 +0000 @@ -40,8 +40,11 @@ * * @version GetPatientAttributesWithdoutGroupAction.java Sep 27, 2010 4:55:01 PM */ -public class GetPatientAttributesWithdoutGroupAction implements Action +public class GetPatientAttributesWithdoutGroupAction + implements Action { + //TODO typo in class name + // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/RemovePatientAttributeOptionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/RemovePatientAttributeOptionAction.java 2010-04-03 09:35:43 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/RemovePatientAttributeOptionAction.java 2011-03-20 17:57:30 +0000 @@ -35,17 +35,16 @@ /** * @author Viet - * - * @version $Id$ */ -public class RemovePatientAttributeOptionAction implements Action +public class RemovePatientAttributeOptionAction + implements Action { // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- private PatientAttributeOptionService patientAttributeOptionService; - + private PatientAttributeValueService patientAttributeValueService; // ------------------------------------------------------------------------- @@ -58,35 +57,37 @@ { this.id = id; } - + private String message; - + private I18n i18n; - public String execute() throws Exception { PatientAttributeOption attributeOption = patientAttributeOptionService.get( id ); - - if( attributeOption != null ) + + if ( attributeOption != null ) { - int count = patientAttributeValueService.countByPatientAttributeoption( attributeOption ); - if( count > 0 ) + int count = patientAttributeValueService.countByPatientAttributeoption( attributeOption ); + if ( count > 0 ) { message = i18n.getString( "warning_delete_patient_attribute_option" ); return INPUT; - }else + } + else { patientAttributeOptionService.deletePatientAttributeOption( attributeOption ); message = i18n.getString( "success_delete_patient_attribute_option" ); return SUCCESS; } - }else{ + } + else + { message = i18n.getString( "error_delete_patient_attribute_option" ); return ERROR; } - + } public void setPatientAttributeOptionService( PatientAttributeOptionService patientAttributeOptionService ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowUpdatePatientAttributeValueAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowUpdatePatientAttributeValueAction.java 2010-04-03 09:35:43 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowUpdatePatientAttributeValueAction.java 2011-03-20 17:57:30 +0000 @@ -146,22 +146,8 @@ { patient = patientService.getPatient( id ); - // if ( patientAttributeGroups == null ) patientAttributeGroups = patientAttributeGroupService.getAllPatientAttributeGroups(); - // if ( patientAttributeGroupId != 0 ) - // { - // patientAttributes = new ArrayList(); - // - // patientAttributes = - // patientAttributeGroupService.getPatientAttributeGroup( - // patientAttributeGroupId ).getAttributes(); - // }else - // { - // patientAttributes = - // patientAttributeService.getAllPatientAttributes(); - // } - patientNoGroupAttributes = patientAttributeService.getPatientAttributesNotGroup(); Collection patientAttributeValues = patientAttributeValueService === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ValidatePatientAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ValidatePatientAttributeAction.java 2010-09-26 11:49:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ValidatePatientAttributeAction.java 2011-03-20 17:57:30 +0000 @@ -106,6 +106,5 @@ message = i18n.getString( "everything_is_ok" ); return SUCCESS; - } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/AddPatientAttributeGroupAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/AddPatientAttributeGroupAction.java 2010-09-26 11:49:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/AddPatientAttributeGroupAction.java 2011-03-20 17:57:30 +0000 @@ -98,7 +98,6 @@ public String execute() throws Exception { - PatientAttributeGroup patientAttributeGroup = new PatientAttributeGroup(); patientAttributeGroup.setName( name ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/GetPatientAttributeGroupListAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/GetPatientAttributeGroupListAction.java 2010-05-06 13:24:03 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/GetPatientAttributeGroupListAction.java 2011-03-20 17:57:30 +0000 @@ -60,6 +60,7 @@ // ------------------------------------------------------------------------- // Getter && Setter // ------------------------------------------------------------------------- + public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) { this.patientAttributeGroupService = patientAttributeGroupService; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/UpdatePatientAttributeGroupAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/UpdatePatientAttributeGroupAction.java 2010-09-26 11:49:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/UpdatePatientAttributeGroupAction.java 2011-03-20 17:57:30 +0000 @@ -105,19 +105,20 @@ public String execute() throws Exception { - PatientAttributeGroup patientAttributeGroup = patientAttributeGroupService.getPatientAttributeGroup( id ); patientAttributeGroup.setName( name ); patientAttributeGroup.setDescription( description ); List attributes = new ArrayList(); + for ( String attributeId : selectedAttributes ) { PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( Integer .parseInt( attributeId ) ); attributes.add( patientAttribute ); } + patientAttributeGroup.setAttributes( attributes ); patientAttributeGroupService.updatePatientAttributeGroup( patientAttributeGroup ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/ValidatePatientAttributeGroupAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/ValidatePatientAttributeGroupAction.java 2010-09-26 11:49:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattributegroup/ValidatePatientAttributeGroupAction.java 2011-03-20 17:57:30 +0000 @@ -41,7 +41,6 @@ public class ValidatePatientAttributeGroupAction implements Action { - // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- @@ -96,7 +95,6 @@ public String execute() throws Exception { - name = name.trim(); PatientAttributeGroup match = patientAttributeGroupService.getPatientAttributeGroupByName( name ); @@ -111,6 +109,5 @@ message = i18n.getString( "everything_is_ok" ); return SUCCESS; - } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/GetPatientIdentifierTypeListAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/GetPatientIdentifierTypeListAction.java 2010-05-06 13:24:03 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/GetPatientIdentifierTypeListAction.java 2011-03-20 17:57:30 +0000 @@ -72,7 +72,6 @@ return SUCCESS; } - // ------------------------------------------------------------------------- // Getter && Setter // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/RemovePatientIdentifierTypeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/RemovePatientIdentifierTypeAction.java 2010-10-22 06:43:14 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/RemovePatientIdentifierTypeAction.java 2011-03-20 17:57:30 +0000 @@ -121,5 +121,4 @@ { this.i18n = i18n; } - } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/ValidatePatientIdentifierTypeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/ValidatePatientIdentifierTypeAction.java 2010-09-27 07:33:12 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/ValidatePatientIdentifierTypeAction.java 2011-03-20 17:57:30 +0000 @@ -109,5 +109,4 @@ { this.id = id; } - } === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2011-03-08 14:55:19 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2011-03-20 17:57:30 +0000 @@ -3,7 +3,7 @@ - OpenHealthMapper - Joint HISP/WHO initiative + DHIS 2 - OpenHealthMapper