dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21899
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10479: Code base health check-up
------------------------------------------------------------
revno: 10479
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-04-04 20:06:19 +0200
message:
Code base health check-up
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryComboSizeComparator.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/GroupMemberAssociation.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java
dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageBoolDataElementAggregation.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/HibernateSMSCommandStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingStoreTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeGroupStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java
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/hibernate/HibernateProgramStageInstanceStore.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/HibernateIncomingSmsStore.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/SMSConsumer.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/AttributeUtils.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/velocity/VelocityManager.java
dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
dhis-2/dhis-support/dhis-support-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLStreamReader.java
dhis-2/dhis-support/dhis-support-xml/src/main/java/org/amplecode/staxwax/transformer/TransformerTask.java
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java
dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/action/UpdateClientAction.java
dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AnalyticsController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetOrganisationUnitChildrenAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/idgen/PatientIdentifierGenerator.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetAvailablePeriodsAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/ValidateDataSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowMobileSettingFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf/ExportToPdfAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitChildrenAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitGroupsByGroupSetAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/ExportImageAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java 2013-04-01 05:56:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java 2013-04-04 18:06:19 +0000
@@ -47,7 +47,7 @@
*/
public interface CaseAggregationConditionService
{
- int addCaseAggregationCondition( CaseAggregationCondition caseAggregationCondition );
+ int addCaseAggregationCondition( CaseAggregationCondition caseAggregationCondition );
void updateCaseAggregationCondition( CaseAggregationCondition caseAggregationCondition );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java 2012-11-04 08:37:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java 2013-04-04 18:06:19 +0000
@@ -79,8 +79,7 @@
public boolean selfRegistrationAllowed()
{
- return selfRegistrationRole != null && selfRegistrationRole instanceof UserAuthorityGroup &&
- selfRegistrationOrgUnit != null && selfRegistrationOrgUnit instanceof OrganisationUnit;
+ return selfRegistrationRole != null && selfRegistrationOrgUnit != null;
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryComboSizeComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryComboSizeComparator.java 2011-12-09 20:53:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/comparator/DataElementCategoryComboSizeComparator.java 2013-04-04 18:06:19 +0000
@@ -39,6 +39,6 @@
{
public int compare( DataElementCategoryCombo o1, DataElementCategoryCombo o2 )
{
- return (int) (o1.getOptionCombos().size() - o2.getOptionCombos().size());
+ return o1.getOptionCombos().size() - o2.getOptionCombos().size();
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/GroupMemberAssociation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/GroupMemberAssociation.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/GroupMemberAssociation.java 2013-04-04 18:06:19 +0000
@@ -27,16 +27,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.io.Serializable;
-
import org.hisp.dhis.common.ImportableObject;
/**
* @author Lars Helge Overland
- * @version $Id$
*/
public class GroupMemberAssociation
- implements ImportableObject, Serializable
+ implements ImportableObject
{
/**
* Determines if a de-serialized file is compatible with this class.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java 2013-03-08 09:38:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java 2013-04-04 18:06:19 +0000
@@ -39,460 +39,550 @@
/**
* @author Abyot Asalefew Gizaw
- * @version $Id$
*/
-public class Patient implements Serializable {
- /**
- * Determines if a de-serialized file is compatible with this class.
- */
- private static final long serialVersionUID = 884114994005945275L;
-
- public static final String MALE = "M";
- public static final String FEMALE = "F";
- public static final String TRANSGENDER = "M";
-
- public static final char DOB_TYPE_VERIFIED = 'V';
- public static final char DOB_TYPE_DECLARED = 'D';
- public static final char DOB_TYPE_APPROXIATED = 'A';
-
- public static final char AGE_TYPE_YEAR = 'Y';
- public static final char AGE_TYPE_MONTH = 'M';
- public static final char AGE_TYPE_DAY = 'D';
-
- public static String PREFIX_IDENTIFIER_TYPE = "iden";
- public static String PREFIX_FIXED_ATTRIBUTE = "fixedAttr";
- public static String PREFIX_PATIENT_ATTRIBUTE = "attr";
- public static String PREFIX_PROGRAM = "prg";
- public static String PREFIX_PROGRAM_EVENT_BY_STATUS = "stat";
- public static String PREFIX_PROGRAM_STAGE = "prgst";
- public static String FIXED_ATTR_BIRTH_DATE = "birthDate";
- public static String FIXED_ATTR_AGE = "age";
-
- private Integer id;
-
- private String firstName;
-
- private String middleName;
-
- private String lastName;
-
- private String gender;
-
- private Date birthDate;
-
- private String phoneNumber;
-
- private Date deathDate;
-
- private Date registrationDate;
-
- private boolean isDead = false;
-
- private Set<PatientIdentifier> identifiers = new HashSet<PatientIdentifier>();
-
- private Set<Program> programs = new HashSet<Program>();
-
- private OrganisationUnit organisationUnit;
-
- private Set<PatientAttribute> attributes = new HashSet<PatientAttribute>();
-
- private Patient representative;
-
- private boolean underAge;
-
- private Character dobType;
-
- private User healthWorker;
-
- // -------------------------------------------------------------------------
- // Constructors
- // -------------------------------------------------------------------------
-
- public Patient() {
- }
-
- // -------------------------------------------------------------------------
- // hashCode and equals
- // -------------------------------------------------------------------------
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
-
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result
- + ((birthDate == null) ? 0 : birthDate.hashCode());
- result = prime * result
- + ((firstName == null) ? 0 : firstName.hashCode());
- result = prime * result + ((gender == null) ? 0 : gender.hashCode());
- result = prime * result
- + ((lastName == null) ? 0 : lastName.hashCode());
- result = prime * result
- + ((middleName == null) ? 0 : middleName.hashCode());
-
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null) {
- return false;
- }
-
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- final Patient other = (Patient) obj;
-
- if (birthDate == null) {
- if (other.birthDate != null) {
- return false;
- }
- } else if (!birthDate.equals(other.birthDate)) {
- return false;
- }
-
- if (firstName == null) {
- if (other.firstName != null) {
- return false;
- }
- } else if (!firstName.equals(other.firstName)) {
- return false;
- }
-
- if (gender == null) {
- if (other.gender != null)
- return false;
- } else if (!gender.equals(other.gender)) {
- return false;
- }
-
- if (lastName == null) {
- if (other.lastName != null) {
- return false;
- }
- } else if (!lastName.equals(other.lastName)) {
- return false;
- }
-
- if (middleName == null) {
- if (other.middleName != null) {
- return false;
- }
- } else if (!middleName.equals(other.middleName)) {
- return false;
- }
-
- return true;
- }
-
- // -------------------------------------------------------------------------
- // Getters and setters
- // -------------------------------------------------------------------------
-
- public Integer getId() {
- return id;
- }
-
- public Set<PatientAttribute> getAttributes() {
- return attributes;
- }
-
- public OrganisationUnit getOrganisationUnit() {
- return organisationUnit;
- }
-
- public void setOrganisationUnit(OrganisationUnit organisationUnit) {
- this.organisationUnit = organisationUnit;
- }
-
- public void setAttributes(Set<PatientAttribute> attributes) {
- this.attributes = attributes;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getMiddleName() {
- return middleName;
- }
-
- public void setMiddleName(String middleName) {
- this.middleName = middleName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getGender() {
- return gender;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- public Date getBirthDate() {
- return birthDate;
- }
-
- public void setBirthDate(Date birthDate) {
- this.birthDate = birthDate;
- }
-
- public Date getDeathDate() {
- return deathDate;
- }
-
- public void setDeathDate(Date deathDate) {
- this.deathDate = deathDate;
- }
-
- public Boolean getIsDead() {
- return isDead;
- }
-
- public void setIsDead(Boolean isDead) {
- this.isDead = isDead;
- }
-
- public Set<PatientIdentifier> getIdentifiers() {
- return identifiers;
- }
-
- public void setIdentifiers(Set<PatientIdentifier> identifiers) {
- this.identifiers = identifiers;
- }
-
- public Set<Program> getPrograms() {
- return programs;
- }
-
- public void setPrograms(Set<Program> programs) {
- this.programs = programs;
- }
-
- public User getHealthWorker() {
- return healthWorker;
- }
-
- public void setHealthWorker(User healthWorker) {
- this.healthWorker = healthWorker;
- }
-
- public void setRegistrationDate(Date registrationDate) {
- this.registrationDate = registrationDate;
- }
-
- public Date getRegistrationDate() {
- return registrationDate;
- }
-
- public void setRepresentative(Patient representative) {
- this.representative = representative;
- }
-
- public Patient getRepresentative() {
- return representative;
- }
-
- // -------------------------------------------------------------------------
- // Convenience method
- // -------------------------------------------------------------------------
-
- public String getAge() {
- if (birthDate == null) {
- return "0";
- }
-
- Calendar birthCalendar = Calendar.getInstance();
- birthCalendar.setTime(birthDate);
-
- Calendar todayCalendar = Calendar.getInstance();
-
- int age = todayCalendar.get(Calendar.YEAR)
- - birthCalendar.get(Calendar.YEAR);
-
- if (todayCalendar.get(Calendar.MONTH) < birthCalendar
- .get(Calendar.MONTH)) {
- age--;
- } else if (todayCalendar.get(Calendar.MONTH) == birthCalendar
- .get(Calendar.MONTH)
- && todayCalendar.get(Calendar.DAY_OF_MONTH) < birthCalendar
- .get(Calendar.DAY_OF_MONTH)) {
- age--;
- }
-
- if (age < 1) {
- return "< 1 yr";
- } else {
- return age + " yr";
- }
- }
-
- public int getIntegerValueOfAge() {
- if (birthDate == null) {
- return 0;
- }
-
- Calendar birthCalendar = Calendar.getInstance();
- birthCalendar.setTime(birthDate);
-
- Calendar todayCalendar = Calendar.getInstance();
-
- int age = todayCalendar.get(Calendar.YEAR)
- - birthCalendar.get(Calendar.YEAR);
-
- if (todayCalendar.get(Calendar.MONTH) < birthCalendar
- .get(Calendar.MONTH)) {
- age--;
- } else if (todayCalendar.get(Calendar.MONTH) == birthCalendar
- .get(Calendar.MONTH)
- && todayCalendar.get(Calendar.DAY_OF_MONTH) < birthCalendar
- .get(Calendar.DAY_OF_MONTH)) {
- age--;
- }
-
- return age;
- }
-
- public void setBirthDateFromAge(int age, char ageType) {
- Calendar todayCalendar = Calendar.getInstance();
- todayCalendar.clear(Calendar.MILLISECOND);
- todayCalendar.clear(Calendar.SECOND);
- todayCalendar.clear(Calendar.MINUTE);
- todayCalendar.set(Calendar.HOUR_OF_DAY, 0);
-
- // Assumed relative to the 1st of January
- // todayCalendar.set( Calendar.DATE, 1 );
- // todayCalendar.set( Calendar.MONTH, Calendar.JANUARY );
-
- if (ageType == AGE_TYPE_YEAR) {
- todayCalendar.add(Calendar.YEAR, -1 * age);
- } else if (ageType == AGE_TYPE_MONTH) {
- todayCalendar.add(Calendar.MONTH, -1 * age);
- } else if (ageType == AGE_TYPE_DAY) {
- todayCalendar.add(Calendar.DATE, -1 * age);
- }
-
- setBirthDate(todayCalendar.getTime());
- }
-
- public char getAgeType() {
- Calendar todayCalendar = Calendar.getInstance();
- todayCalendar.clear(Calendar.MILLISECOND);
- todayCalendar.clear(Calendar.SECOND);
- todayCalendar.clear(Calendar.MINUTE);
- todayCalendar.set(Calendar.HOUR_OF_DAY, 0);
-
- Calendar birthCalendar = Calendar.getInstance();
- birthCalendar.setTime(birthDate);
-
- int age = todayCalendar.get(Calendar.YEAR)
- - birthCalendar.get(Calendar.YEAR);
-
- if (age > 0) {
- return AGE_TYPE_YEAR;
- }
-
- age = todayCalendar.get(Calendar.MONTH)
- - birthCalendar.get(Calendar.MONTH);
- if (age > 0) {
- return AGE_TYPE_MONTH;
- }
-
- return AGE_TYPE_DAY;
- }
-
- // -------------------------------------------------------------------------
- // Getter && Setter
- // -------------------------------------------------------------------------
-
- public String getFullName() {
- boolean space = false;
- String name = "";
-
- if (firstName != null && firstName.length() != 0) {
- name = firstName;
- space = true;
- }
-
- if (middleName != null && middleName.length() != 0) {
- if (space) {
- name += " ";
- }
-
- name += middleName;
- space = true;
- }
-
- if (lastName != null && lastName.length() != 0) {
- if (space) {
- name += " ";
- }
-
- name += lastName;
- }
-
- return name;
- }
-
- public String getPhoneNumber() {
- return phoneNumber;
- }
-
- public void setPhoneNumber(String phoneNumber) {
- this.phoneNumber = phoneNumber;
- }
-
- public boolean isUnderAge() {
- return underAge;
- }
-
- public void setUnderAge(boolean underAge) {
- this.underAge = underAge;
- }
-
- public String getTextGender() {
- return gender.equalsIgnoreCase(MALE) ? "male" : "female";
- }
-
- public Character getDobType() {
- return dobType;
- }
-
- public void setDobType(Character dobType) {
- this.dobType = dobType;
- }
-
- public String getTextDoBType() {
- switch (dobType) {
- case DOB_TYPE_VERIFIED:
- return "Verified";
- case DOB_TYPE_DECLARED:
- return "Declared";
- default:
- return "Approxiated";
- }
- }
+public class Patient
+ implements Serializable
+{
+ /**
+ * Determines if a de-serialized file is compatible with this class.
+ */
+ private static final long serialVersionUID = 884114994005945275L;
+
+ public static final String MALE = "M";
+
+ public static final String FEMALE = "F";
+
+ public static final String TRANSGENDER = "M";
+
+ public static final char DOB_TYPE_VERIFIED = 'V';
+
+ public static final char DOB_TYPE_DECLARED = 'D';
+
+ public static final char DOB_TYPE_APPROXIATED = 'A';
+
+ public static final char AGE_TYPE_YEAR = 'Y';
+
+ public static final char AGE_TYPE_MONTH = 'M';
+
+ public static final char AGE_TYPE_DAY = 'D';
+
+ public static String PREFIX_IDENTIFIER_TYPE = "iden";
+
+ public static String PREFIX_FIXED_ATTRIBUTE = "fixedAttr";
+
+ public static String PREFIX_PATIENT_ATTRIBUTE = "attr";
+
+ public static String PREFIX_PROGRAM = "prg";
+
+ public static String PREFIX_PROGRAM_EVENT_BY_STATUS = "stat";
+
+ public static String PREFIX_PROGRAM_STAGE = "prgst";
+
+ public static String FIXED_ATTR_BIRTH_DATE = "birthDate";
+
+ public static String FIXED_ATTR_AGE = "age";
+
+ private Integer id;
+
+ private String firstName;
+
+ private String middleName;
+
+ private String lastName;
+
+ private String gender;
+
+ private Date birthDate;
+
+ private String phoneNumber;
+
+ private Date deathDate;
+
+ private Date registrationDate;
+
+ private boolean isDead = false;
+
+ private Set<PatientIdentifier> identifiers = new HashSet<PatientIdentifier>();
+
+ private Set<Program> programs = new HashSet<Program>();
+
+ private OrganisationUnit organisationUnit;
+
+ private Set<PatientAttribute> attributes = new HashSet<PatientAttribute>();
+
+ private Patient representative;
+
+ private boolean underAge;
+
+ private Character dobType;
+
+ private User healthWorker;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public Patient()
+ {
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode and equals
+ // -------------------------------------------------------------------------
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((birthDate == null) ? 0 : birthDate.hashCode());
+ result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
+ result = prime * result + ((gender == null) ? 0 : gender.hashCode());
+ result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
+ result = prime * result + ((middleName == null) ? 0 : middleName.hashCode());
+
+ return result;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( obj == null )
+ {
+ return false;
+ }
+
+ if ( getClass() != obj.getClass() )
+ {
+ return false;
+ }
+
+ final Patient other = (Patient) obj;
+
+ if ( birthDate == null )
+ {
+ if ( other.birthDate != null )
+ {
+ return false;
+ }
+ }
+ else if ( !birthDate.equals( other.birthDate ) )
+ {
+ return false;
+ }
+
+ if ( firstName == null )
+ {
+ if ( other.firstName != null )
+ {
+ return false;
+ }
+ }
+ else if ( !firstName.equals( other.firstName ) )
+ {
+ return false;
+ }
+
+ if ( gender == null )
+ {
+ if ( other.gender != null )
+ return false;
+ }
+ else if ( !gender.equals( other.gender ) )
+ {
+ return false;
+ }
+
+ if ( lastName == null )
+ {
+ if ( other.lastName != null )
+ {
+ return false;
+ }
+ }
+ else if ( !lastName.equals( other.lastName ) )
+ {
+ return false;
+ }
+
+ if ( middleName == null )
+ {
+ if ( other.middleName != null )
+ {
+ return false;
+ }
+ }
+ else if ( !middleName.equals( other.middleName ) )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public Integer getId()
+ {
+ return id;
+ }
+
+ public Set<PatientAttribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ public void setOrganisationUnit( OrganisationUnit organisationUnit )
+ {
+ this.organisationUnit = organisationUnit;
+ }
+
+ public void setAttributes( Set<PatientAttribute> attributes )
+ {
+ this.attributes = attributes;
+ }
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName( String firstName )
+ {
+ this.firstName = firstName;
+ }
+
+ public String getMiddleName()
+ {
+ return middleName;
+ }
+
+ public void setMiddleName( String middleName )
+ {
+ this.middleName = middleName;
+ }
+
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ public void setLastName( String lastName )
+ {
+ this.lastName = lastName;
+ }
+
+ public String getGender()
+ {
+ return gender;
+ }
+
+ public void setGender( String gender )
+ {
+ this.gender = gender;
+ }
+
+ public Date getBirthDate()
+ {
+ return birthDate;
+ }
+
+ public void setBirthDate( Date birthDate )
+ {
+ this.birthDate = birthDate;
+ }
+
+ public Date getDeathDate()
+ {
+ return deathDate;
+ }
+
+ public void setDeathDate( Date deathDate )
+ {
+ this.deathDate = deathDate;
+ }
+
+ public Boolean getIsDead()
+ {
+ return isDead;
+ }
+
+ public void setIsDead( Boolean isDead )
+ {
+ this.isDead = isDead;
+ }
+
+ public Set<PatientIdentifier> getIdentifiers()
+ {
+ return identifiers;
+ }
+
+ public void setIdentifiers( Set<PatientIdentifier> identifiers )
+ {
+ this.identifiers = identifiers;
+ }
+
+ public Set<Program> getPrograms()
+ {
+ return programs;
+ }
+
+ public void setPrograms( Set<Program> programs )
+ {
+ this.programs = programs;
+ }
+
+ public User getHealthWorker()
+ {
+ return healthWorker;
+ }
+
+ public void setHealthWorker( User healthWorker )
+ {
+ this.healthWorker = healthWorker;
+ }
+
+ public void setRegistrationDate( Date registrationDate )
+ {
+ this.registrationDate = registrationDate;
+ }
+
+ public Date getRegistrationDate()
+ {
+ return registrationDate;
+ }
+
+ public void setRepresentative( Patient representative )
+ {
+ this.representative = representative;
+ }
+
+ public Patient getRepresentative()
+ {
+ return representative;
+ }
+
+ // -------------------------------------------------------------------------
+ // Convenience method
+ // -------------------------------------------------------------------------
+
+ public String getAge()
+ {
+ if ( birthDate == null )
+ {
+ return "0";
+ }
+
+ Calendar birthCalendar = Calendar.getInstance();
+ birthCalendar.setTime( birthDate );
+
+ Calendar todayCalendar = Calendar.getInstance();
+
+ int age = todayCalendar.get( Calendar.YEAR ) - birthCalendar.get( Calendar.YEAR );
+
+ if ( todayCalendar.get( Calendar.MONTH ) < birthCalendar.get( Calendar.MONTH ) )
+ {
+ age--;
+ }
+ else if ( todayCalendar.get( Calendar.MONTH ) == birthCalendar.get( Calendar.MONTH )
+ && todayCalendar.get( Calendar.DAY_OF_MONTH ) < birthCalendar.get( Calendar.DAY_OF_MONTH ) )
+ {
+ age--;
+ }
+
+ if ( age < 1 )
+ {
+ return "< 1 yr";
+ }
+
+ return age + " yr";
+ }
+
+ public int getIntegerValueOfAge()
+ {
+ if ( birthDate == null )
+ {
+ return 0;
+ }
+
+ Calendar birthCalendar = Calendar.getInstance();
+ birthCalendar.setTime( birthDate );
+
+ Calendar todayCalendar = Calendar.getInstance();
+
+ int age = todayCalendar.get( Calendar.YEAR ) - birthCalendar.get( Calendar.YEAR );
+
+ if ( todayCalendar.get( Calendar.MONTH ) < birthCalendar.get( Calendar.MONTH ) )
+ {
+ age--;
+ }
+ else if ( todayCalendar.get( Calendar.MONTH ) == birthCalendar.get( Calendar.MONTH )
+ && todayCalendar.get( Calendar.DAY_OF_MONTH ) < birthCalendar.get( Calendar.DAY_OF_MONTH ) )
+ {
+ age--;
+ }
+
+ return age;
+ }
+
+ public void setBirthDateFromAge( int age, char ageType )
+ {
+ Calendar todayCalendar = Calendar.getInstance();
+ todayCalendar.clear( Calendar.MILLISECOND );
+ todayCalendar.clear( Calendar.SECOND );
+ todayCalendar.clear( Calendar.MINUTE );
+ todayCalendar.set( Calendar.HOUR_OF_DAY, 0 );
+
+ // Assumed relative to the 1st of January
+ // todayCalendar.set( Calendar.DATE, 1 );
+ // todayCalendar.set( Calendar.MONTH, Calendar.JANUARY );
+
+ if ( ageType == AGE_TYPE_YEAR )
+ {
+ todayCalendar.add( Calendar.YEAR, -1 * age );
+ }
+ else if ( ageType == AGE_TYPE_MONTH )
+ {
+ todayCalendar.add( Calendar.MONTH, -1 * age );
+ }
+ else if ( ageType == AGE_TYPE_DAY )
+ {
+ todayCalendar.add( Calendar.DATE, -1 * age );
+ }
+
+ setBirthDate( todayCalendar.getTime() );
+ }
+
+ public char getAgeType()
+ {
+ Calendar todayCalendar = Calendar.getInstance();
+ todayCalendar.clear( Calendar.MILLISECOND );
+ todayCalendar.clear( Calendar.SECOND );
+ todayCalendar.clear( Calendar.MINUTE );
+ todayCalendar.set( Calendar.HOUR_OF_DAY, 0 );
+
+ Calendar birthCalendar = Calendar.getInstance();
+ birthCalendar.setTime( birthDate );
+
+ int age = todayCalendar.get( Calendar.YEAR ) - birthCalendar.get( Calendar.YEAR );
+
+ if ( age > 0 )
+ {
+ return AGE_TYPE_YEAR;
+ }
+
+ age = todayCalendar.get( Calendar.MONTH ) - birthCalendar.get( Calendar.MONTH );
+ if ( age > 0 )
+ {
+ return AGE_TYPE_MONTH;
+ }
+
+ return AGE_TYPE_DAY;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getter && Setter
+ // -------------------------------------------------------------------------
+
+ public String getFullName()
+ {
+ boolean space = false;
+ String name = "";
+
+ if ( firstName != null && firstName.length() != 0 )
+ {
+ name = firstName;
+ space = true;
+ }
+
+ if ( middleName != null && middleName.length() != 0 )
+ {
+ if ( space )
+ {
+ name += " ";
+ }
+
+ name += middleName;
+ space = true;
+ }
+
+ if ( lastName != null && lastName.length() != 0 )
+ {
+ if ( space )
+ {
+ name += " ";
+ }
+
+ name += lastName;
+ }
+
+ return name;
+ }
+
+ public String getPhoneNumber()
+ {
+ return phoneNumber;
+ }
+
+ public void setPhoneNumber( String phoneNumber )
+ {
+ this.phoneNumber = phoneNumber;
+ }
+
+ public boolean isUnderAge()
+ {
+ return underAge;
+ }
+
+ public void setUnderAge( boolean underAge )
+ {
+ this.underAge = underAge;
+ }
+
+ public String getTextGender()
+ {
+ return gender.equalsIgnoreCase( MALE ) ? "male" : "female";
+ }
+
+ public Character getDobType()
+ {
+ return dobType;
+ }
+
+ public void setDobType( Character dobType )
+ {
+ this.dobType = dobType;
+ }
+
+ public String getTextDoBType()
+ {
+ switch ( dobType )
+ {
+ case DOB_TYPE_VERIFIED:
+ return "Verified";
+ case DOB_TYPE_DECLARED:
+ return "Declared";
+ default:
+ return "Approxiated";
+ }
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java 2012-08-22 07:08:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientMobileSetting.java 2013-04-04 18:06:19 +0000
@@ -117,10 +117,12 @@
public double getVersionToUpdate()
{
- if( versionToUpdate != null )
+ if ( versionToUpdate != null )
+ {
return versionToUpdate;
- else
- return 0;
+ }
+
+ return 0;
}
public void setVersionToUpdate( Double versionToUpdate )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-03-01 07:34:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-04-04 18:06:19 +0000
@@ -396,11 +396,8 @@
{
return programStage;
}
- else
- {
- count++;
- }
-
+
+ count++;
}
return null;
@@ -417,7 +414,7 @@
// Compare property value with compare value
- int i = ((Comparable<Object>) propertyValue).compareTo( (Comparable<Object>) criteria.getValue() );
+ int i = ((Comparable<Object>) propertyValue).compareTo( criteria.getValue() );
// Return validation criteria if criteria is not met
=== 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-02-13 06:42:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstance.java 2013-04-04 18:06:19 +0000
@@ -339,10 +339,8 @@
{
return programInstanceStage;
}
- else
- {
- count++;
- }
+
+ count++;
}
return null;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2013-03-01 14:09:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2013-04-04 18:06:19 +0000
@@ -316,10 +316,8 @@
{
return ProgramStageInstance.LATE_VISIT_STATUS;
}
- else
- {
- return ProgramStageInstance.FUTURE_VISIT_STATUS;
- }
+
+ return ProgramStageInstance.FUTURE_VISIT_STATUS;
}
}
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2013-03-17 09:01:04 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java 2013-04-04 18:06:19 +0000
@@ -142,7 +142,7 @@
private Set<DataElementOperand> greyedFields = new HashSet<DataElementOperand>();
private DataEntryForm dataEntryForm;
-
+
public void extract( T object )
{
attributeValues = extractAttributeValues( object );
=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageBoolDataElementAggregation.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageBoolDataElementAggregation.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/main/java/org/hisp/dhis/aggregation/impl/dataelement/AverageBoolDataElementAggregation.java 2013-04-04 18:06:19 +0000
@@ -57,10 +57,8 @@
return average;
}
- else
- {
- return null;
- }
+
+ return null;
}
protected Collection<DataValue> getDataValues( Integer dataElementId, Integer optionComboId, Integer organisationUnitId,
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-04-04 14:30:43 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-04-04 18:06:19 +0000
@@ -663,7 +663,7 @@
// If dimension is not fixed and has no options, insert all options
// -----------------------------------------------------------------
- if ( !FIXED_DIMS.contains( dimension.getDimension() ) && ( options == null || options.isEmpty() ) )
+ if ( !FIXED_DIMS.contains( dimension.getDimension() ) && options.isEmpty() )
{
if ( DimensionType.ORGANISATIONUNIT_GROUPSET.equals( dimension.getType() ) )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java 2013-01-16 13:25:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java 2013-04-04 18:06:19 +0000
@@ -28,7 +28,6 @@
*/
import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.hibernate.HibernateGenericStore;
/**
@@ -36,7 +35,6 @@
*/
public class HibernateIdentifiableObjectStore<T extends BaseIdentifiableObject>
extends HibernateGenericStore<T>
- implements GenericIdentifiableObjectStore<T>
{
@Override
public int save( T object )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java 2012-07-01 07:12:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java 2013-04-04 18:06:19 +0000
@@ -144,7 +144,7 @@
.getNumerator() );
optionCombos.retainAll( categoryCombo.getOptionCombos() );
- if ( optionCombos != null && optionCombos.size() > 0 )
+ if ( !optionCombos.isEmpty() )
{
return indicator.getName();
}
@@ -152,7 +152,7 @@
optionCombos = expressionService.getOptionCombosInExpression( indicator.getDenominator() );
optionCombos.retainAll( categoryCombo.getOptionCombos() );
- if ( optionCombos != null && optionCombos.size() > 0 )
+ if ( !optionCombos.isEmpty() )
{
return indicator.getName();
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2013-03-04 12:07:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2013-04-04 18:06:19 +0000
@@ -491,7 +491,7 @@
List<OrganisationUnit> intersection = new ArrayList<OrganisationUnit>( CollectionUtils.intersection( subTree,
result ) );
- return limit && intersection != null && intersection.size() > MAX_LIMIT ? intersection.subList( 0, MAX_LIMIT )
+ return limit && intersection.size() > MAX_LIMIT ? intersection.subList( 0, MAX_LIMIT )
: intersection;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/HibernateSMSCommandStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/HibernateSMSCommandStore.java 2013-03-14 07:19:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/HibernateSMSCommandStore.java 2013-04-04 18:06:19 +0000
@@ -59,10 +59,13 @@
{
Criteria criteria = sessionFactory.getCurrentSession().createCriteria( SMSCommand.class );
criteria.add( Restrictions.eq( "id", id ) );
+
if ( criteria.list() != null && criteria.list().size() > 0 )
+ {
return (SMSCommand) criteria.list().get( 0 );
- else
- return null;
+ }
+
+ return null;
}
public void delete( SMSCommand cmd )
@@ -86,5 +89,4 @@
criteria.add( Restrictions.eq( "parserType", ParserType.J2ME_PARSER ) );
return criteria.list();
}
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2013-01-05 15:22:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2013-04-04 18:06:19 +0000
@@ -177,7 +177,7 @@
Set<DataElement> dataElements = getDataElementsInValidationRules( relevantRules );
- if ( relevantRules != null && relevantRules.size() > 0 )
+ if ( !relevantRules.isEmpty() )
{
for ( Period period : relevantPeriods )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingStoreTest.java 2012-11-20 17:04:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingStoreTest.java 2013-04-04 18:06:19 +0000
@@ -99,7 +99,7 @@
settingA = systemSettingStore.getByName( "Setting1" );
- assertEquals( "Value1", (String) settingA.getValue() );
+ assertEquals( "Value1", settingA.getValue() );
settingA.setValue( new String( "Value2" ) );
@@ -107,7 +107,7 @@
settingA = systemSettingStore.getByName( "Setting1" );
- assertEquals( "Value2", (String) settingA.getValue() );
+ assertEquals( "Value2", settingA.getValue() );
}
@Test
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java 2012-12-30 10:52:46 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/crosstab/DefaultCrossTabService.java 2013-04-04 18:06:19 +0000
@@ -219,9 +219,7 @@
{
return crossTabStore.getAggregatedOrgUnitDataCacheValue( operands, period.getId(), unit.getId(), group.getId(), key );
}
- else
- {
- return crossTabStore.getAggregatedDataCacheValue( operands, period.getId(), unit.getId(), key );
- }
+
+ return crossTabStore.getAggregatedDataCacheValue( operands, period.getId(), unit.getId(), key );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java 2013-03-15 16:33:34 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/engine/DefaultDataMartEngine.java 2013-04-04 18:06:19 +0000
@@ -330,7 +330,7 @@
clock.logTime( "Populated crosstab table, " + SystemUtils.getMemoryString() );
- final boolean isIndicators = indicators != null && indicators.size() > 0;
+ final boolean isIndicators = !indicators.isEmpty();
// ---------------------------------------------------------------------
// 1. Create aggregated data cache
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java 2013-04-03 15:46:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/jdbc/JdbcCaseAggregationConditionManager.java 2013-04-04 18:06:19 +0000
@@ -65,6 +65,7 @@
import org.hisp.dhis.jdbc.StatementBuilder;
import org.hisp.dhis.period.CalendarPeriodType;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.system.util.DateUtils;
import org.nfunk.jep.JEP;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -74,8 +75,6 @@
/**
* @author Chau Thu Tran
- *
- * @version JdbcCaseAggregationConditionManager.java Nov 18, 2010 9:36:20 AM
*/
public class JdbcCaseAggregationConditionManager
implements CaseAggregationConditionManager
@@ -161,6 +160,7 @@
runAggregate( null, dataSet, periods );
}
+
return null;
}
@@ -383,7 +383,7 @@
Date endDate = calEndDate.getTime();
- CalendarPeriodType periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( periodTypeName );
+ CalendarPeriodType periodType = (CalendarPeriodType) PeriodType.getPeriodTypeByName( periodTypeName );
String sql = "select periodtypeid from periodtype where name='" + periodTypeName + "'";
int periodTypeId = jdbcTemplate.queryForInt( sql );
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeGroupStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeGroupStore.java 2013-01-07 05:07:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientAttributeGroupStore.java 2013-04-04 18:06:19 +0000
@@ -29,7 +29,7 @@
import java.util.Collection;
-import org.hibernate.Criteria;
+import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
import org.hisp.dhis.patient.PatientAttributeGroup;
@@ -50,7 +50,7 @@
@Override
public Collection<PatientAttributeGroup> get( Program program )
{
- return getCriteria().setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY ).createAlias( "attributes",
+ return getCriteria().setResultTransformer( CriteriaSpecification.DISTINCT_ROOT_ENTITY ).createAlias( "attributes",
"attribute" ).add( Restrictions.eq( "attribute.program", program ) ).list();
}
@@ -58,7 +58,7 @@
@Override
public Collection<PatientAttributeGroup> getWithoutProgram()
{
- return getCriteria().setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY ).createAlias( "attributes",
+ return getCriteria().setResultTransformer( CriteriaSpecification.DISTINCT_ROOT_ENTITY ).createAlias( "attributes",
"attribute" ).add( Restrictions.isNull( "attribute.program" ) ).list();
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java 2012-12-11 08:03:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java 2013-04-04 18:06:19 +0000
@@ -90,7 +90,7 @@
@SuppressWarnings( "unchecked" )
public Collection<PatientIdentifier> getPatientIdentifiers( Patient patient )
{
- return (Collection<PatientIdentifier>) getCriteria( Restrictions.eq( "patient", patient ) ).list();
+ return getCriteria( Restrictions.eq( "patient", patient ) ).list();
}
public Patient getPatient( PatientIdentifierType idenType, String value )
=== 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-01-24 12:32:08 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramInstanceDeletionHandler.java 2013-04-04 18:06:19 +0000
@@ -103,7 +103,7 @@
dataValues.addAll( patientDataValueService.getPatientDataValues( programInstance
.getProgramStageInstances() ) );
- if ( dataValues != null )
+ if ( !dataValues.isEmpty() )
{
for ( PatientDataValue dataValue : dataValues )
{
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-03-25 04:56:23 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-04-04 18:06:19 +0000
@@ -62,8 +62,8 @@
import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.patientreport.PatientAggregateReport;
import org.hisp.dhis.patientreport.TabularReportColumn;
-import org.hisp.dhis.period.CalendarPeriodType;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramInstanceService;
@@ -159,7 +159,7 @@
Restrictions.eq( "programInstance", programInstance ), Restrictions.eq( "programStage", programStage ) )
.addOrder( Order.asc( "id" ) ).list() );
- return (list == null || list.size() == 0) ? null : list.get( list.size() - 1 );
+ return list.isEmpty() ? null : list.get( list.size() - 1 );
}
@SuppressWarnings( "unchecked" )
@@ -699,7 +699,7 @@
{
Calendar yesterday = Calendar.getInstance();
yesterday.add( Calendar.DATE, -1 );
- CalendarPeriodType.clearTimeOfDay( yesterday );
+ PeriodType.clearTimeOfDay( yesterday );
Date now = yesterday.getTime();
if ( endDate.before( now ) )
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/HibernateIncomingSmsStore.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/HibernateIncomingSmsStore.java 2012-11-20 13:34:03 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/inbound/HibernateIncomingSmsStore.java 2013-04-04 18:06:19 +0000
@@ -80,7 +80,7 @@
{
Session session = sessionFactory.getCurrentSession();
Criteria criteria = session.createCriteria( IncomingSms.class ).add( Restrictions.eq( "status", status ) );
- return (Collection<IncomingSms>) criteria.list();
+ return criteria.list();
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java 2012-10-22 09:24:29 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/HibernateOutboundSmsStore.java 2013-04-04 18:06:19 +0000
@@ -89,7 +89,7 @@
public List<OutboundSms> getAll()
{
Session session = sessionFactory.getCurrentSession();
- return (List<OutboundSms>) session.createCriteria( OutboundSms.class ).addOrder( Order.asc( "date" ) ).list();
+ return session.createCriteria( OutboundSms.class ).addOrder( Order.asc( "date" ) ).list();
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/SMSConsumer.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/SMSConsumer.java 2013-03-05 17:06:26 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/SMSConsumer.java 2013-04-04 18:06:19 +0000
@@ -6,9 +6,6 @@
// IEatSMS
public class SMSConsumer
{
-
-
-
private ParserManager parserManager;
private MessageQueue messageQueue;
@@ -36,6 +33,10 @@
{
private boolean stop;
+ public SMSConsumerThread()
+ {
+ }
+
public void run()
{
while ( !stop )
@@ -64,13 +65,16 @@
IncomingSms message = messageQueue.get();
while ( message != null )
{
- try{
+ try
+ {
parserManager.parse( message );
- }catch(Exception e){
- System.out.println(e.getMessage());
+ }
+ catch ( Exception e )
+ {
+ System.out.println( e.getMessage() );
}
- messageQueue.remove( message );
+ messageQueue.remove( message );
message = messageQueue.get();
}
}
@@ -81,16 +85,15 @@
}
}
-
+
public void setMessageQueue( MessageQueue messageQueue )
{
this.messageQueue = messageQueue;
}
-
+
public void setParserManager( ParserManager parserManager )
{
this.parserManager = parserManager;
}
-
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/AttributeUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/AttributeUtils.java 2012-07-17 10:05:45 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/AttributeUtils.java 2013-04-04 18:06:19 +0000
@@ -77,7 +77,7 @@
{
if ( attributeValueItem.getAttribute().getId() == attribute.getId() )
{
- if ( attributeValue.getValue() == null || attributeValue.getValue().length() == 0 )
+ if ( attributeValue == null || attributeValue.getValue() == null || attributeValue.getValue().length() == 0 )
{
attributeService.deleteAttributeValue( attributeValueItem );
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java 2012-11-07 09:51:51 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ExcelUtils.java 2013-04-04 18:06:19 +0000
@@ -56,8 +56,6 @@
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import com.lowagie.text.DocumentException;
-
/**
* @author Dang Duy Hieu
* @version $Id$
@@ -242,7 +240,6 @@
public static void writeDataBrowserResults( WritableSheet sheet, WritableCellFormat parFormat,
WritableCellFormat oddFormat, int fontSize, Grid grid )
- throws DocumentException
{
// Data rows
int i = 0;
@@ -274,7 +271,7 @@
{
temp = "";
}
- else if ( ((String) temp).trim().matches( "0" ) )
+ else if ( temp.trim().matches( "0" ) )
{
cellFormat.setFont( zeroFont );
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/velocity/VelocityManager.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/velocity/VelocityManager.java 2012-09-25 11:36:26 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/velocity/VelocityManager.java 2013-04-04 18:06:19 +0000
@@ -30,8 +30,8 @@
import java.io.StringWriter;
import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
public class VelocityManager
@@ -46,7 +46,7 @@
public VelocityManager()
{
velocity = new VelocityEngine();
- velocity.setProperty( Velocity.RESOURCE_LOADER, RESOURCE_LOADER_NAME );
+ velocity.setProperty( RuntimeConstants.RESOURCE_LOADER, RESOURCE_LOADER_NAME );
velocity.setProperty( RESOURCE_LOADER_NAME + ".resource.loader.class", ClasspathResourceLoader.class.getName() );
velocity.setProperty( "runtime.log.logsystem.log4j.logger", "console" );
velocity.setProperty( "runtime.log", "" );
=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2013-03-01 08:54:22 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2013-04-04 18:06:19 +0000
@@ -238,7 +238,7 @@
return true;
}
- if ( actual == null || collection == null )
+ if ( actual == null )
{
return false;
}
=== modified file 'dhis-2/dhis-support/dhis-support-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLStreamReader.java'
--- dhis-2/dhis-support/dhis-support-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLStreamReader.java 2012-03-29 21:52:27 +0000
+++ dhis-2/dhis-support/dhis-support-xml/src/main/java/org/amplecode/staxwax/reader/DefaultXMLStreamReader.java 2013-04-04 18:06:19 +0000
@@ -39,6 +39,7 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import org.apache.commons.logging.Log;
@@ -355,7 +356,7 @@
{
StringBuffer sb = new StringBuffer();
- while ( reader.isCharacters() || reader.getEventType() == XMLStreamReader2.CDATA )
+ while ( reader.isCharacters() || reader.getEventType() == XMLStreamConstants.CDATA )
{
sb.append( reader.getText() );
reader.next();
=== modified file 'dhis-2/dhis-support/dhis-support-xml/src/main/java/org/amplecode/staxwax/transformer/TransformerTask.java'
--- dhis-2/dhis-support/dhis-support-xml/src/main/java/org/amplecode/staxwax/transformer/TransformerTask.java 2010-07-16 20:12:45 +0000
+++ dhis-2/dhis-support/dhis-support-xml/src/main/java/org/amplecode/staxwax/transformer/TransformerTask.java 2013-04-04 18:06:19 +0000
@@ -173,6 +173,6 @@
log.info( "transform successful - importing dxf" );
// set reader to output of pipe
- return new DefaultXMLEventReader( (XMLEventReader2) pipeoutput );
+ return new DefaultXMLEventReader( pipeoutput );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-03-29 12:34:41 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-04-04 18:06:19 +0000
@@ -673,7 +673,7 @@
return builder.toString();
}
- private void checkIdentifier( Facility facility, String id ) throws IOException
+ private void checkIdentifier( Facility facility, String id )
{
Identifier identifier = new Identifier();
=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/action/UpdateClientAction.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/action/UpdateClientAction.java 2013-03-13 10:11:52 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/action/UpdateClientAction.java 2013-04-04 18:06:19 +0000
@@ -73,10 +73,8 @@
throws Exception
{
File fileToDownload = new File( fileName );
-
- if ( fileToDownload != null )
- inputStream = new BufferedInputStream( new FileInputStream( fileToDownload ) );
+ inputStream = new BufferedInputStream( new FileInputStream( fileToDownload ) );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java 2013-04-03 08:06:46 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java 2013-04-04 18:06:19 +0000
@@ -173,8 +173,7 @@
public ActivityPlan search2_8( @PathVariable int id, @RequestHeader( "identifier" ) String identifier )
throws NotAllowedException
{
- ActivityPlan activityPlan = activityReportingService.getActivitiesByIdentifier( identifier );
- ;
+ ActivityPlan activityPlan = activityReportingService.getActivitiesByIdentifier( identifier );
activityPlan.setClientVersion( DataStreamSerializable.TWO_POINT_EIGHT );
return activityPlan;
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AnalyticsController.java 2013-03-21 15:07:48 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AnalyticsController.java 2013-04-04 18:06:19 +0000
@@ -27,7 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.io.IOException;
+import static org.hisp.dhis.analytics.AnalyticsService.NAMES_META_KEY;
+
import java.util.Map;
import java.util.Set;
@@ -50,8 +51,6 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import static org.hisp.dhis.analytics.AnalyticsService.NAMES_META_KEY;
-
@Controller
public class AnalyticsController
{
@@ -158,7 +157,6 @@
@ExceptionHandler(IllegalQueryException.class)
public void handleError( IllegalQueryException ex, HttpServletResponse response )
- throws IOException
{
ContextUtils.conflictResponse( response, ex.getMessage() );
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java 2012-12-07 13:04:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java 2013-04-04 18:06:19 +0000
@@ -129,7 +129,6 @@
@ExceptionHandler(IllegalArgumentException.class)
public void handleError( IllegalArgumentException ex, HttpServletResponse response )
- throws IOException
{
ContextUtils.conflictResponse( response, ex.getMessage() );
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2013-02-06 14:45:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2013-04-04 18:06:19 +0000
@@ -27,7 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -122,7 +121,7 @@
@RequestMapping( value = "/chart/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
public void shareChartInterpretation(
@PathVariable( "uid" ) String chartUid,
- @RequestBody String text, HttpServletResponse response ) throws IOException
+ @RequestBody String text, HttpServletResponse response )
{
Chart chart = chartService.getChart( chartUid );
@@ -151,7 +150,7 @@
@RequestMapping( value = "/map/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
public void shareMapInterpretation(
@PathVariable( "uid" ) String mapUid,
- @RequestBody String text, HttpServletResponse response ) throws IOException
+ @RequestBody String text, HttpServletResponse response )
{
Map map = mappingService.getMap( mapUid );
@@ -173,7 +172,7 @@
@PathVariable( "uid" ) String reportTableUid,
@RequestParam( value = "pe", required = false ) String isoPeriod,
@RequestParam( value = "ou", required = false ) String orgUnitUid,
- @RequestBody String text, HttpServletResponse response ) throws IOException
+ @RequestBody String text, HttpServletResponse response )
{
ReportTable reportTable = reportTableService.getReportTable( reportTableUid );
@@ -210,7 +209,7 @@
@PathVariable( "uid" ) String dataSetUid,
@RequestParam( "pe" ) String isoPeriod,
@RequestParam( "ou" ) String orgUnitUid,
- @RequestBody String text, HttpServletResponse response ) throws IOException
+ @RequestBody String text, HttpServletResponse response )
{
DataSet dataSet = dataSetService.getDataSet( dataSetUid );
@@ -246,7 +245,7 @@
@RequestMapping( value = "/{uid}/comment", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
public void postComment(
@PathVariable( "uid" ) String uid,
- @RequestBody String text, HttpServletResponse response ) throws IOException
+ @RequestBody String text, HttpServletResponse response )
{
interpretationService.addInterpretationComment( uid, text );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2013-03-16 14:22:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2013-04-04 18:06:19 +0000
@@ -27,6 +27,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.io.IOException;
+import java.util.Map;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy;
import org.hisp.dhis.common.view.ExportView;
@@ -48,17 +59,6 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.bind.JAXBException;
-import java.io.IOException;
-import java.util.Map;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -222,7 +222,7 @@
@RequestMapping( value = MetaDataController.RESOURCE_PATH, method = RequestMethod.POST, consumes = { "application/xml", "text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
- public void importXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
+ public void importXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
MetaData metaData = JacksonUtils.fromXml( request.getInputStream(), MetaData.class );
@@ -250,7 +250,7 @@
@RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".zip", MetaDataController.RESOURCE_PATH + ".xml.zip" }, method = RequestMethod.POST, consumes = { "application/xml", "text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
- public void importZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
+ public void importZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
ZipInputStream zip = new ZipInputStream( request.getInputStream() );
zip.getNextEntry();
@@ -284,7 +284,7 @@
@RequestMapping( value = { MetaDataController.RESOURCE_PATH + ".gz", MetaDataController.RESOURCE_PATH + ".xml.gz" }, method = RequestMethod.POST, consumes = { "application/xml", "text/*" } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
- public void importGZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
+ public void importGZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
GZIPInputStream gzip = new GZIPInputStream( request.getInputStream() );
MetaData metaData = JacksonUtils.fromXml( gzip, MetaData.class );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java 2013-02-04 07:29:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java 2013-04-04 18:06:19 +0000
@@ -31,6 +31,7 @@
import javax.servlet.http.HttpServletResponse;
import net.sf.jasperreports.engine.JasperPrint;
+import net.sf.jasperreports.j2ee.servlets.BaseHttpServlet;
import net.sf.jasperreports.j2ee.servlets.ImageServlet;
import org.hisp.dhis.api.utils.ContextUtils;
@@ -101,7 +102,7 @@
{
JasperPrint print = getReport( request, response, uid, organisationUnitUid, period, "html", ContextUtils.CONTENT_TYPE_HTML, false );
- request.getSession().setAttribute( ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, print );
+ request.getSession().setAttribute( BaseHttpServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, print );
}
@RequestMapping( value = "/{uid}/design", method = RequestMethod.PUT )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java 2013-04-01 05:56:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java 2013-04-04 18:06:19 +0000
@@ -51,6 +51,7 @@
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.period.CalendarPeriodType;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.ProgramStageInstanceService;
import com.opensymphony.xwork2.Action;
@@ -226,7 +227,7 @@
Date sDate = format.parseDate( startDate );
Date eDate = format.parseDate( endDate );
- CalendarPeriodType periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( selectedDataSet
+ CalendarPeriodType periodType = (CalendarPeriodType) PeriodType.getPeriodTypeByName( selectedDataSet
.getPeriodType().getName() );
periods.addAll( periodType.generatePeriods( sDate, eDate ) );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java 2012-11-01 15:15:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadProgramStageInstancesAction.java 2013-04-04 18:06:19 +0000
@@ -151,7 +151,7 @@
programInstances = new ArrayList<ProgramInstance>( programInstanceService.getProgramInstances( program ) );
}
- if ( programInstances != null && programInstances.size() > 0 )
+ if ( !programInstances.isEmpty() )
{
programInstance = programInstances.iterator().next();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2013-03-18 05:30:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/PatientDashboardAction.java 2013-04-04 18:06:19 +0000
@@ -43,7 +43,7 @@
import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
-import org.hisp.dhis.period.CalendarPeriodType;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramInstanceService;
@@ -248,7 +248,7 @@
patientAudits = patientAuditService.getPatientAudits( patient );
Calendar today = Calendar.getInstance();
- CalendarPeriodType.clearTimeOfDay( today );
+ PeriodType.clearTimeOfDay( today );
Date date = today.getTime();
String visitor = currentUserService.getCurrentUsername();
PatientAudit patientAudit = patientAuditService.getPatientAudit( patientId, visitor, date,
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetOrganisationUnitChildrenAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetOrganisationUnitChildrenAction.java 2013-01-21 06:18:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetOrganisationUnitChildrenAction.java 2013-04-04 18:06:19 +0000
@@ -85,11 +85,11 @@
throws Exception
{
OrganisationUnit unit = organisationUnitService.getOrganisationUnit( node );
-
- int level = organisationUnitService.getLevelOfOrganisationUnit( unit.getId() ) + 1;
-
+
if ( unit != null )
{
+ int level = organisationUnitService.getLevelOfOrganisationUnit( unit.getId() ) + 1;
+
units = new ArrayList<OrganisationUnit>( unit.getChildren() );
for ( OrganisationUnit organisationUnit : units )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/idgen/PatientIdentifierGenerator.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/idgen/PatientIdentifierGenerator.java 2011-12-14 11:15:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/idgen/PatientIdentifierGenerator.java 2013-04-04 18:06:19 +0000
@@ -69,11 +69,11 @@
{
char ch = idWithoutCheckdigit.charAt( idWithoutCheckdigit.length() - i - 1 );
- int digit = (int) ch - 48;
+ int digit = ch - 48;
int weight;
if ( i % 2 == 0 )
{
- weight = (2 * digit) - (int) (digit / 5) * 9;
+ weight = (2 * digit) - (digit / 5) * 9;
}
else
{
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetAvailablePeriodsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetAvailablePeriodsAction.java 2012-04-24 10:28:06 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetAvailablePeriodsAction.java 2013-04-04 18:06:19 +0000
@@ -91,7 +91,7 @@
{
periodType = periodType != null && !periodType.isEmpty() ? periodType : MonthlyPeriodType.NAME;
- CalendarPeriodType _periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( periodType );
+ CalendarPeriodType _periodType = (CalendarPeriodType) PeriodType.getPeriodTypeByName( periodType );
int thisYear = Calendar.getInstance().get( Calendar.YEAR );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridPdfResult.java 2013-04-04 18:06:19 +0000
@@ -106,7 +106,7 @@
OutputStream out = response.getOutputStream();
- String filename = filenameEncode( defaultIfEmpty( grid != null ? grid.getTitle() : grids.iterator().next().getTitle(), DEFAULT_NAME ) ) + ".pdf";;
+ String filename = filenameEncode( defaultIfEmpty( grid != null ? grid.getTitle() : grids.iterator().next().getTitle(), DEFAULT_NAME ) ) + ".pdf";
ContextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, true, filename, false );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/result/GridXlsResult.java 2013-04-04 18:06:19 +0000
@@ -106,7 +106,7 @@
OutputStream out = response.getOutputStream();
- String filename = filenameEncode( defaultIfEmpty( grid != null ? grid.getTitle() : grids.iterator().next().getTitle(), DEFAULT_NAME ) ) + ".xls";;
+ String filename = filenameEncode( defaultIfEmpty( grid != null ? grid.getTitle() : grids.iterator().next().getTitle(), DEFAULT_NAME ) ) + ".xls";
ContextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, true, filename, true );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java 2012-06-25 18:40:49 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java 2013-04-04 18:06:19 +0000
@@ -196,7 +196,7 @@
String inputTag = request.getHeader( HEADER_IF_NONE_MATCH );
- if ( objects != null && inputTag != null && tag != null && inputTag.equals( tag ) )
+ if ( objects != null && inputTag != null && inputTag.equals( tag ) )
{
response.setStatus( HttpServletResponse.SC_NOT_MODIFIED );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java 2013-01-28 09:58:12 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java 2013-04-04 18:06:19 +0000
@@ -186,11 +186,14 @@
DataSet dataSet = dataSetService.getDataSet( dataSetId );
Period period = PeriodType.createPeriodExternalId( periodId );
+ // TODO null-checks
+
// ---------------------------------------------------------------------
// Data values & Min-max data elements
// ---------------------------------------------------------------------
dataValues.addAll( dataValueService.getDataValues( organisationUnit, period, dataSet.getDataElements() ) );
+
minMaxDataElements.addAll( minMaxDataElementService.getMinMaxDataElements( organisationUnit, dataSet
.getDataElements() ) );
@@ -198,8 +201,10 @@
{
for ( OrganisationUnit ou : children )
{
- // make sure that the orgUnit have this dataSet (the same data
- // elements can be contained in another dataSet)
+ // -------------------------------------------------------------
+ // Make sure that the org unit have this data set
+ // -------------------------------------------------------------
+
if ( ou.getDataSets().contains( dataSet ) )
{
dataValues.addAll( dataValueService.getDataValues( ou, period, dataSet.getDataElements() ) );
@@ -213,7 +218,7 @@
// Data set completeness info
// ---------------------------------------------------------------------
- if ( dataSet != null && period != null && organisationUnit != null )
+ if ( period != null )
{
if ( !multiOrganisationUnit )
{
@@ -233,8 +238,10 @@
{
complete = true;
- // if this is multiOrg, and one of the children is locked. Then
- // just lock everything down.
+ // -------------------------------------------------------------
+ // If multi-org and one of the children is locked, lock all
+ // -------------------------------------------------------------
+
for ( OrganisationUnit ou : children )
{
if ( ou.getDataSets().contains( dataSet ) )
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2013-02-03 10:44:42 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2013-04-04 18:06:19 +0000
@@ -385,7 +385,7 @@
for ( DataElementCategoryCombo categoryCombo : orderedCategoryCombos )
{
- des = (List<DataElement>) orderedDataElements.get( categoryCombo );
+ des = orderedDataElements.get( categoryCombo );
Collections.sort( des, IdentifiableObjectNameComparator.INSTANCE );
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java 2013-03-20 07:14:26 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java 2013-04-04 18:06:19 +0000
@@ -33,8 +33,10 @@
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
+
import javax.servlet.http.HttpServletRequest;
-import org.apache.struts2.ServletActionContext;
+
+import org.apache.struts2.StrutsStatics;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.light.utils.NamebasedUtils;
@@ -250,7 +252,7 @@
Collections.sort( programStageDataElements, OrderBySortOrder );
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
- ServletActionContext.HTTP_REQUEST );
+ StrutsStatics.HTTP_REQUEST );
Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java 2013-03-13 14:17:15 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java 2013-04-04 18:06:19 +0000
@@ -33,9 +33,11 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import javax.servlet.http.HttpServletRequest;
+
import org.apache.commons.lang.math.NumberUtils;
-import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsStatics;
import org.hisp.dhis.light.utils.FormUtils;
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientAttribute;
@@ -60,6 +62,7 @@
import org.hisp.dhis.util.ContextUtils;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
+
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
@@ -303,7 +306,7 @@
List<PatientAttributeValue> patientAttributeValues = new ArrayList<PatientAttributeValue>();
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
- ServletActionContext.HTTP_REQUEST );
+ StrutsStatics.HTTP_REQUEST );
Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
DateTimeFormatter sdf = ISODateTimeFormat.yearMonthDay();
@@ -327,7 +330,7 @@
PatientIdentifier duplicateId = null;
- if ( !value.isEmpty() )
+ if ( value != null && !value.isEmpty() )
{
duplicateId = patientIdentifierService.get( patientIdentifierType, value );
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java 2012-10-03 07:23:08 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java 2013-04-04 18:06:19 +0000
@@ -27,13 +27,31 @@
package org.hisp.dhis.light.beneficiaryregistration.action;
-import com.opensymphony.xwork2.Action;
-import com.opensymphony.xwork2.ActionContext;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+
import org.apache.commons.lang.math.NumberUtils;
-import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsStatics;
import org.hisp.dhis.light.utils.FormUtils;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.patient.*;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeOption;
+import org.hisp.dhis.patient.PatientAttributeOptionService;
+import org.hisp.dhis.patient.PatientAttributeService;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierService;
+import org.hisp.dhis.patient.PatientIdentifierType;
+import org.hisp.dhis.patient.PatientIdentifierTypeService;
+import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
@@ -42,8 +60,8 @@
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
public class SaveBeneficiaryAction
implements Action
@@ -405,7 +423,7 @@
}
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
- ServletActionContext.HTTP_REQUEST );
+ StrutsStatics.HTTP_REQUEST );
Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
// Add Identifier and Attributes
@@ -428,7 +446,7 @@
PatientIdentifier duplicateId = null;
- if ( !value.isEmpty() )
+ if ( value != null && !value.isEmpty() )
{
duplicateId = patientIdentifierService.get( patientIdentifierType, value );
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2012-02-16 12:58:37 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2013-04-04 18:06:19 +0000
@@ -38,7 +38,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
-import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsStatics;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -294,7 +294,7 @@
}
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
- ServletActionContext.HTTP_REQUEST );
+ StrutsStatics.HTTP_REQUEST );
Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
for ( String key : parameterMap.keySet() )
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2013-03-20 07:14:26 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java 2013-04-04 18:06:19 +0000
@@ -36,7 +36,7 @@
import javax.servlet.http.HttpServletRequest;
-import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsStatics;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.light.utils.NamebasedUtils;
@@ -358,7 +358,7 @@
this.patient = patient;
}
- private Map<Integer, String> leftsideFormulaMap = new HashMap<Integer, String>();;
+ private Map<Integer, String> leftsideFormulaMap = new HashMap<Integer, String>();
public Map<Integer, String> getLeftsideFormulaMap()
{
@@ -370,7 +370,7 @@
this.leftsideFormulaMap = leftsideFormulaMap;
}
- private Map<Integer, String> rightsideFormulaMap = new HashMap<Integer, String>();;
+ private Map<Integer, String> rightsideFormulaMap = new HashMap<Integer, String>();
public Map<Integer, String> getRightsideFormulaMap()
{
@@ -447,7 +447,7 @@
}
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
- ServletActionContext.HTTP_REQUEST );
+ StrutsStatics.HTTP_REQUEST );
Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
// List<DataValue> dataValues = new ArrayList<DataValue>();
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java 2013-03-20 07:14:26 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java 2013-04-04 18:06:19 +0000
@@ -37,7 +37,7 @@
import javax.servlet.http.HttpServletRequest;
-import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsStatics;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.light.utils.NamebasedUtils;
@@ -343,7 +343,7 @@
Collections.sort( programStageDataElements, OrderBySortOrder );
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
- ServletActionContext.HTTP_REQUEST );
+ StrutsStatics.HTTP_REQUEST );
Map<String, String> parameterMap = ContextUtils.getParameterMap( request );
typeViolations.clear();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java 2011-10-17 08:11:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java 2013-04-04 18:06:19 +0000
@@ -185,7 +185,7 @@
dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
}
- if ( (dataElements != null) && !dataElements.isEmpty() )
+ if ( !dataElements.isEmpty() )
{
params.setDataElementObjects( dataElements );
}
@@ -216,7 +216,7 @@
indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
}
- if ( (indicators != null) && !indicators.isEmpty() )
+ if ( !indicators.isEmpty() )
{
params.setIndicatorObjects( indicators );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/ValidateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/ValidateDataSetAction.java 2013-03-14 10:50:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/ValidateDataSetAction.java 2013-04-04 18:06:19 +0000
@@ -53,20 +53,6 @@
this.dataSetId = dataSetId;
}
- private String name;
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- private String shortName;
-
- public void setShortName( String shortName )
- {
- this.shortName = shortName;
- }
-
private String code;
public void setCode( String code )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java 2012-06-07 13:45:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SaveDataEntryFormAction.java 2013-04-04 18:06:19 +0000
@@ -105,8 +105,8 @@
DataEntryForm form = dataset.getDataEntryForm();
if ( form == null || form.getHtmlCode() == null ||
- ( form != null && form.getStyle() != null && !form.getStyle().equals( style ) ) ||
- ( form != null && form.getHtmlCode() != null && !form.getHtmlCode().equals( designTextarea ) ) )
+ ( form.getStyle() != null && !form.getStyle().equals( style ) ) ||
+ ( form.getHtmlCode() != null && !form.getHtmlCode().equals( designTextarea ) ) )
{
dataset.increaseVersion(); // Check if version must be updated
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.java 2013-03-29 07:39:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/J2meClientUpdateAction.java 2013-04-04 18:06:19 +0000
@@ -27,7 +27,6 @@
package org.hisp.dhis.mobile.action;
-import java.util.ArrayList;
import java.util.List;
import org.hisp.dhis.api.mobile.PatientMobileSettingService;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowMobileSettingFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowMobileSettingFormAction.java 2012-05-30 08:49:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowMobileSettingFormAction.java 2013-04-04 18:06:19 +0000
@@ -137,7 +137,7 @@
Collection<PatientMobileSetting> paSettings = new HashSet<PatientMobileSetting>( patientMobileSettingService
.getCurrentSetting() );
- if ( paSettings != null )
+ if ( !paSettings.isEmpty() )
{
Iterator<PatientMobileSetting> settingsIt = paSettings.iterator();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf/ExportToPdfAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf/ExportToPdfAction.java 2011-10-17 08:11:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/pdf/ExportToPdfAction.java 2013-04-04 18:06:19 +0000
@@ -171,7 +171,7 @@
organisationUnitService.searchOrganisationUnitByName( organisationUnits, curKey );
}
- if ( (organisationUnits != null) && !organisationUnits.isEmpty() )
+ if ( !organisationUnits.isEmpty() )
{
params.setOrganisationUnitObjects( organisationUnits );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserAction.java 2012-11-08 13:26:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserAction.java 2013-04-04 18:06:19 +0000
@@ -105,7 +105,7 @@
return ERROR;
}
- boolean isCurrentUser = currentUser != null && currentUser.equals( user );
+ boolean isCurrentUser = currentUser.equals( user );
UserCredentials userCredentials = user.getUserCredentials();
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java 2012-10-23 16:39:06 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java 2013-04-04 18:06:19 +0000
@@ -28,7 +28,6 @@
*/
import java.awt.Color;
-import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
@@ -37,6 +36,7 @@
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
+import org.apache.batik.transcoder.image.ImageTranscoder;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -99,11 +99,11 @@
}
public void convertToPNG( StringBuffer buffer, OutputStream out )
- throws TranscoderException, IOException
+ throws TranscoderException
{
PNGTranscoder t = new PNGTranscoder();
- t.addTranscodingHint( PNGTranscoder.KEY_BACKGROUND_COLOR, Color.WHITE );
+ t.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, Color.WHITE );
TranscoderInput input = new TranscoderInput( new StringReader( buffer.toString() ) );
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitChildrenAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitChildrenAction.java 2012-08-22 13:20:23 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitChildrenAction.java 2013-04-04 18:06:19 +0000
@@ -85,11 +85,11 @@
throws Exception
{
OrganisationUnit unit = organisationUnitService.getOrganisationUnit( node );
-
- int level = organisationUnitService.getLevelOfOrganisationUnit( unit.getId() ) + 1;
-
+
if ( unit != null )
{
+ int level = organisationUnitService.getLevelOfOrganisationUnit( unit.getId() ) + 1;
+
units = new ArrayList<OrganisationUnit>( unit.getChildren() );
for ( OrganisationUnit organisationUnit : units )
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitGroupsByGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitGroupsByGroupSetAction.java 2012-11-13 16:39:50 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitGroupsByGroupSetAction.java 2013-04-04 18:06:19 +0000
@@ -91,7 +91,7 @@
{
object = groupSet.getOrganisationUnitGroups();
- boolean modified = !clearIfNotModified( ServletActionContext.getRequest(), ServletActionContext.getResponse(), object );
+ clearIfNotModified( ServletActionContext.getRequest(), ServletActionContext.getResponse(), object );
}
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java 2012-12-14 16:56:33 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/InitializeAction.java 2013-04-04 18:06:19 +0000
@@ -80,13 +80,6 @@
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
-
- private String id;
-
- public void setId( String id )
- {
- this.id = id;
- }
private String callback;
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java 2013-04-04 18:06:19 +0000
@@ -148,7 +148,7 @@
for ( ValidationResult validationResult : results )
{
- OrganisationUnit unit = (OrganisationUnit) validationResult.getSource();
+ OrganisationUnit unit = validationResult.getSource();
Period period = validationResult.getPeriod();
grid.addRow();
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/ExportImageAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/ExportImageAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/ExportImageAction.java 2013-04-04 18:06:19 +0000
@@ -27,25 +27,23 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.awt.Color;
import java.io.OutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.system.util.CodecUtils;
-import org.hisp.dhis.util.ContextUtils;
-import org.hisp.dhis.util.StreamActionSupport;
+import java.io.StringReader;
import javax.servlet.http.HttpServletResponse;
-import java.awt.Color;
-import java.io.IOException;
-import java.io.StringReader;
-
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
+import org.apache.batik.transcoder.image.ImageTranscoder;
import org.apache.batik.transcoder.image.PNGTranscoder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.fop.svg.PDFTranscoder;
+import org.hisp.dhis.system.util.CodecUtils;
+import org.hisp.dhis.util.ContextUtils;
+import org.hisp.dhis.util.StreamActionSupport;
/**
* @author Jan Henrik Overland
@@ -118,11 +116,11 @@
}
public void convertToPNG( StringBuffer buffer, OutputStream out )
- throws TranscoderException, IOException
+ throws TranscoderException
{
PNGTranscoder t = new PNGTranscoder();
- t.addTranscodingHint( PNGTranscoder.KEY_BACKGROUND_COLOR, Color.WHITE );
+ t.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, Color.WHITE );
TranscoderInput input = new TranscoderInput( new StringReader( buffer.toString() ) );
@@ -132,7 +130,7 @@
}
public void convertToPDF( StringBuffer buffer, OutputStream out )
- throws TranscoderException, IOException
+ throws TranscoderException
{
PDFTranscoder t = new PDFTranscoder();