dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27261
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13540: Code style fix for r 13537
------------------------------------------------------------
revno: 13540
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-01-02 14:45:23 +0100
message:
Code style fix for r 13537
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Event.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Note.java
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/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeTypeController.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SavePatientCommentAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java 2013-12-16 08:29:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java 2014-01-02 13:45:23 +0000
@@ -383,14 +383,16 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public Set<PatientComment> getPatientComments() {
- return patientComments;
- }
-
- public void setPatientComments(Set<PatientComment> patientComments) {
- this.patientComments = patientComments;
- }
-
+ public Set<PatientComment> getPatientComments()
+ {
+ return patientComments;
+ }
+
+ public void setPatientComments( Set<PatientComment> patientComments )
+ {
+ this.patientComments = patientComments;
+ }
+
public List<MessageConversation> getMessageConversations()
{
return messageConversations;
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-01-02 11:35:24 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-01-02 13:45:23 +0000
@@ -579,14 +579,14 @@
Collection<PatientComment> patientComments = programInstance.getPatientComments();
- for( PatientComment patientComment : patientComments )
+ for ( PatientComment patientComment : patientComments )
{
- Note note = new Note();
- note.setValue( patientComment.getCommentText() );
- note.setStoredBy( patientComment.getCreator() );
- note.setStoredDate( patientComment.getCreatedDate().toString() );
- event.getNotes().add( note );
- }
+ Note note = new Note();
+ note.setValue( patientComment.getCommentText() );
+ note.setStoredBy( patientComment.getCreator() );
+ note.setStoredDate( patientComment.getCreatedDate().toString() );
+ event.getNotes().add( note );
+ }
return event;
}
@@ -807,18 +807,18 @@
private void savePatientCommentFromEvent(ProgramInstance programInstance, Event event, String storedBy)
{
- for( Note note : event.getNotes() ) //only one note is expected?
+ for ( Note note : event.getNotes() )
{
- PatientComment patientComment = new PatientComment();
- patientComment.setCreator( storedBy );
- patientComment.setCreatedDate( new Date() );
- patientComment.setCommentText( note.getValue() );
-
- patientCommentService.addPatientComment( patientComment );
-
- programInstance.getPatientComments().add( patientComment );
-
- programInstanceService.updateProgramInstance( programInstance );
+ PatientComment patientComment = new PatientComment();
+ patientComment.setCreator( storedBy );
+ patientComment.setCreatedDate( new Date() );
+ patientComment.setCommentText( note.getValue() );
+
+ patientCommentService.addPatientComment( patientComment );
+
+ programInstance.getPatientComments().add( patientComment );
+
+ programInstanceService.updateProgramInstance( programInstance );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Event.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Event.java 2013-12-27 14:27:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Event.java 2014-01-02 13:45:23 +0000
@@ -191,18 +191,19 @@
{
this.dataValues = dataValues;
}
-
-
+
@JsonProperty
@JacksonXmlElementWrapper( localName = "notes", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "note", namespace = DxfNamespaces.DXF_2_0 )
- public List<Note> getNotes() {
- return notes;
- }
+ public List<Note> getNotes()
+ {
+ return notes;
+ }
- public void setNotes(List<Note> notes) {
- this.notes = notes;
- }
+ public void setNotes( List<Note> notes )
+ {
+ this.notes = notes;
+ }
@Override
public boolean equals( Object o )
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Note.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Note.java 2013-12-27 14:27:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/Note.java 2014-01-02 13:45:23 +0000
@@ -1,48 +1,81 @@
package org.hisp.dhis.dxf2.events.event;
+/*
+ * 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.
+ */
+
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-public class Note {
-
- private String value;
-
- private String storedBy;
-
- private String storedDate;
-
- public Note()
- {
- }
-
- @JsonProperty
- @JacksonXmlProperty( isAttribute = true )
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- @JsonProperty
- @JacksonXmlProperty( isAttribute = true )
- public String getStoredBy() {
- return storedBy;
- }
-
- public void setStoredBy(String storedBy) {
- this.storedBy = storedBy;
- }
-
- @JsonProperty
- @JacksonXmlProperty( isAttribute = true )
- public String getStoredDate() {
- return storedDate;
- }
-
- public void setStoredDate(String storedDate) {
- this.storedDate = storedDate;
- }
-
+public class Note
+{
+ private String value;
+
+ private String storedBy;
+
+ private String storedDate;
+
+ public Note()
+ {
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( isAttribute = true )
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue( String value )
+ {
+ this.value = value;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( isAttribute = true )
+ public String getStoredBy()
+ {
+ return storedBy;
+ }
+
+ public void setStoredBy( String storedBy )
+ {
+ this.storedBy = storedBy;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty( isAttribute = true )
+ public String getStoredDate()
+ {
+ return storedDate;
+ }
+
+ public void setStoredDate( String storedDate )
+ {
+ this.storedDate = storedDate;
+ }
}
=== 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 2013-12-12 15:17:55 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientAttributeService.java 2014-01-02 13:45:23 +0000
@@ -140,19 +140,19 @@
return i18n( i18nService, patientAttributeStore.getByDisplayOnVisitSchedule( displayOnVisitSchedule ) );
}
- public Collection<PatientAttribute> getPatientAttributesWithoutProgram() {
-
- Collection<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
- Collection<Program> programs = new ArrayList<Program>();
-
- attributes = patientAttributeStore.getAll();
- programs = programService.getAllPrograms();
-
- for( Program p : programs ){
- attributes.removeAll( p.getPatientAttributes() );
- }
-
- return i18n(i18nService, attributes);
- }
-
+ public Collection<PatientAttribute> getPatientAttributesWithoutProgram()
+ {
+ Collection<PatientAttribute> attributes = new ArrayList<PatientAttribute>();
+ Collection<Program> programs = new ArrayList<Program>();
+
+ attributes = patientAttributeStore.getAll();
+ programs = programService.getAllPrograms();
+
+ for ( Program p : programs )
+ {
+ attributes.removeAll( p.getPatientAttributes() );
+ }
+
+ return i18n( i18nService, attributes );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2014-01-02 13:13:21 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2014-01-02 13:45:23 +0000
@@ -466,9 +466,7 @@
ResultSet resultSet = statement.executeQuery( "SELECT gender FROM patientattribute" );
- //this should execute only if gender and other attributes
- //mentioned below are not inserted. If gender is there, then we assume
- //others are also inserted.
+ // Only execute once
if ( !resultSet.next() )
{
int max = jdbcTemplate.queryForObject( "select max(patientattributeid) from patientattribute", Integer.class );
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2013-12-27 14:27:26 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java 2014-01-02 13:45:23 +0000
@@ -451,10 +451,10 @@
//Get patient comments for the program instance
Set<PatientComment> patientComments = programInstance.getPatientComments();
-
- for( PatientComment patientComment : patientComments ){
-
- grid.addRow();
+
+ for ( PatientComment patientComment : patientComments )
+ {
+ grid.addRow();
grid.addValue( i18n.getString( "comment" ) + " " + i18n.getString( "on" ) + " "
+ format.formatDateTime( patientComment.getCreatedDate() ) );
grid.addValue( patientComment.getCommentText() );
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java 2013-12-18 16:56:55 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java 2014-01-02 13:45:23 +0000
@@ -64,22 +64,22 @@
{
this.patientDataValueService = patientDataValueService;
}
-
- private PatientCommentService patientCommentService;
-
- public void setPatientCommentService(PatientCommentService patientCommentService)
- {
- this.patientCommentService = patientCommentService;
- }
-
- private PatientAttributeValueService patientAttributeValueService;
-
- public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
- {
- this.patientAttributeValueService = patientAttributeValueService;
- }
-
- public ProgramStageDataElementService programStageDEService;
+
+ private PatientCommentService patientCommentService;
+
+ public void setPatientCommentService( PatientCommentService patientCommentService )
+ {
+ this.patientCommentService = patientCommentService;
+ }
+
+ private PatientAttributeValueService patientAttributeValueService;
+
+ public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService )
+ {
+ this.patientAttributeValueService = patientAttributeValueService;
+ }
+
+ public ProgramStageDataElementService programStageDEService;
public void setProgramStageDEService( ProgramStageDataElementService programStageDEService )
{
@@ -106,42 +106,43 @@
@Override
public void deletePatient( Patient patient )
{
- for( ProgramInstance programInstance : patient.getProgramInstances() )
- {
- for( ProgramStageInstance programStageInstance : programInstance.getProgramStageInstances() )
- {
- for( PatientDataValue patientDataValue : patientDataValueService.getPatientDataValues(programStageInstance) )
- {
- patientDataValueService.deletePatientDataValue( patientDataValue );
- }
-
- programStageInstanceService.deleteProgramStageInstance( programStageInstance );
- }
-
- for ( PatientComment patientComment : programInstance.getPatientComments() )
- {
- patientCommentService.deletePatientComment(patientComment);
- }
-
- for( PatientAttribute patientAttribute : programInstance.getProgram().getPatientAttributes() )
- {
- PatientAttributeValue patientAttributeValue = patientAttributeValueService.getPatientAttributeValue( patient, patientAttribute );
-
- if( patientAttributeValue != null )
- {
- patientAttributeValueService.deletePatientAttributeValue(patientAttributeValue);
- }
- }
-
- programInstanceService.deleteProgramInstance( programInstance );
- }
+ for ( ProgramInstance programInstance : patient.getProgramInstances() )
+ {
+ for ( ProgramStageInstance programStageInstance : programInstance.getProgramStageInstances() )
+ {
+ for ( PatientDataValue patientDataValue : patientDataValueService.getPatientDataValues( programStageInstance ) )
+ {
+ patientDataValueService.deletePatientDataValue( patientDataValue );
+ }
+
+ programStageInstanceService.deleteProgramStageInstance( programStageInstance );
+ }
+
+ for ( PatientComment patientComment : programInstance.getPatientComments() )
+ {
+ patientCommentService.deletePatientComment( patientComment );
+ }
+
+ for ( PatientAttribute patientAttribute : programInstance.getProgram().getPatientAttributes() )
+ {
+ PatientAttributeValue patientAttributeValue = patientAttributeValueService.getPatientAttributeValue(
+ patient, patientAttribute );
+
+ if ( patientAttributeValue != null )
+ {
+ patientAttributeValueService.deletePatientAttributeValue( patientAttributeValue );
+ }
+ }
+
+ programInstanceService.deleteProgramInstance( programInstance );
+ }
}
@Override
public void deleteProgram( Program program )
{
Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( program );
- for( ProgramInstance programInstance : programInstances)
+ for ( ProgramInstance programInstance : programInstances )
{
programInstanceService.deleteProgramInstance( programInstance );
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeTypeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeTypeController.java 2014-01-02 13:13:21 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonAttributeTypeController.java 2014-01-02 13:45:23 +0000
@@ -48,29 +48,30 @@
*/
@Controller
@RequestMapping( value = PersonAttributeTypeController.RESOURCE_PATH )
-public class PersonAttributeTypeController extends AbstractCrudController<PatientAttribute>
+public class PersonAttributeTypeController
+ extends AbstractCrudController<PatientAttribute>
{
public static final String RESOURCE_PATH = "/personAttributeTypes";
-
+
@Autowired
private PatientAttributeService patientAttributeService;
-
+
@Autowired
private ProgramService programService;
-
-
+
@Override
protected List<PatientAttribute> getEntityList( WebMetaData metaData, WebOptions options )
{
- List<PatientAttribute> entityList = new ArrayList<PatientAttribute>();
+ List<PatientAttribute> entityList = new ArrayList<PatientAttribute>();
- boolean withoutPrograms = options.getOptions().containsKey( "withoutPrograms" ) && Boolean.parseBoolean( options.getOptions().get( "withoutPrograms" ) );
+ boolean withoutPrograms = options.getOptions().containsKey( "withoutPrograms" )
+ && Boolean.parseBoolean( options.getOptions().get( "withoutPrograms" ) );
if ( withoutPrograms )
{
- entityList = new ArrayList<PatientAttribute>( patientAttributeService.getPatientAttributesWithoutProgram() );
+ entityList = new ArrayList<PatientAttribute>( patientAttributeService.getPatientAttributesWithoutProgram() );
}
-
+
else if ( options.getOptions().containsKey( "program" ) )
{
String programId = options.getOptions().get( "program" );
@@ -81,7 +82,7 @@
entityList = new ArrayList<PatientAttribute>( program.getPatientAttributes() );
}
}
-
+
else if ( options.hasPaging() )
{
int count = manager.getCount( getEntityClass() );
@@ -89,16 +90,15 @@
Pager pager = new Pager( options.getPage(), count, options.getPageSize() );
metaData.setPager( pager );
- entityList = new ArrayList<PatientAttribute>( manager.getBetween( getEntityClass(), pager.getOffset(), pager.getPageSize() ) );
+ entityList = new ArrayList<PatientAttribute>( manager.getBetween( getEntityClass(), pager.getOffset(),
+ pager.getPageSize() ) );
}
-
+
else
{
entityList = new ArrayList<PatientAttribute>( patientAttributeService.getAllPatientAttributes() );
}
- return entityList;
-
- }
+ return entityList;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SavePatientCommentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SavePatientCommentAction.java 2013-12-16 17:16:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/reminder/SavePatientCommentAction.java 2014-01-02 13:45:23 +0000
@@ -29,17 +29,16 @@
*/
import java.util.Date;
+import java.util.Set;
import org.hisp.dhis.patientcomment.PatientComment;
-import org.hisp.dhis.patientcomment.PatientCommentService;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.user.CurrentUserService;
import com.opensymphony.xwork2.Action;
-import java.util.Set;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramInstanceService;
/**
* @author Chau Thu Tran
@@ -74,13 +73,6 @@
this.currentUserService = currentUserService;
}
- private PatientCommentService patientCommentService;
-
- public void setPatientCommentService( PatientCommentService patientCommentService )
- {
- this.patientCommentService = patientCommentService;
- }
-
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -109,8 +101,7 @@
.getProgramStageInstance( programStageInstanceId );
ProgramInstance programInstance = programStageInstance.getProgramInstance();
-
-
+
Set<PatientComment> patientComments = programInstance.getPatientComments();
if ( commentText != null && !commentText.isEmpty() )
@@ -128,5 +119,4 @@
return SUCCESS;
}
-
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-12-27 14:27:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-01-02 13:45:23 +0000
@@ -1034,8 +1034,6 @@
<property name="programInstanceService"
ref="org.hisp.dhis.program.ProgramInstanceService" />
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
- <property name="patientCommentService"
- ref="org.hisp.dhis.patientcomment.PatientCommentService" />
</bean>
<bean