Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA-1832: Collection.isEmpty() should be used to test for emptiness #391

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ public Collection<FormSubmissionError> validateSubmission(FormEntryContext conte
JsonNode submittedList = new ObjectMapper().readTree(submitted);

List<Diagnosis> diagnoses = parseDiagnoses(submittedList, null);
if (diagnoses.size() == 0 && required) {
if (diagnoses.isEmpty() && required) {
return Collections.singleton(new FormSubmissionError(hiddenDiagnoses, "Required"));
}
if (diagnoses.size() > 0) {
if (!diagnoses.isEmpty()) {
// at least one diagnosis must be primary
boolean foundPrimary = false;
for (Diagnosis diagnosis : diagnoses) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ public Collection<FormSubmissionError> validateSubmission(FormEntryContext conte

try {
List<Diagnosis> diagnoses = parseDiagnoses(submitted, null);
if (diagnoses.size() == 0 && required) {
if (diagnoses.isEmpty() && required) {
return Collections.singleton(new FormSubmissionError(hiddenDiagnoses, "Required"));
}
if (diagnoses.size() > 0) {
if (!diagnoses.isEmpty()) {
// at least one diagnosis must be primary
boolean foundPrimary = false;
for (Diagnosis diagnosis : diagnoses) {
Expand Down
184 changes: 184 additions & 0 deletions api/bin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dexter808 ,do we nee changes here since we are only replacing .size() with isEmpty()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @HerbertYiga , I did not touch these files, Maybe these changes were made by the IDE I was using. Is it a problem?

Copy link
Contributor

@HerbertYiga HerbertYiga Mar 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not touch these files, Maybe these changes were made by the IDE I was using. Is it a problem?

only needed changes are the ones to be merged, can you try dropping all the unneeded files for your changes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @HerbertYiga , sorry for the late reply. I will make a new PR with only the changes that are required.

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>coreapps</artifactId>
<version>1.32.0-SNAPSHOT</version>
</parent>

<artifactId>coreapps-api</artifactId>
<packaging>jar</packaging>
<name>Core Apps Module API</name>
<description>API project for CoreApps</description>

<dependencies>

<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-api-pre2.2</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>

<!--
Add other dependencies from parent's pom:
<dependency>
<groupId>org.other.library</groupId>
<artifactId>library-name</artifactId>
</dependency>
-->

<!-- Begin OpenMRS core -->

<dependency>
<groupId>org.openmrs.api</groupId>
<artifactId>openmrs-api</artifactId>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.openmrs.web</groupId>
<artifactId>openmrs-web</artifactId>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.openmrs.api</groupId>
<artifactId>openmrs-api</artifactId>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>org.openmrs.web</groupId>
<artifactId>openmrs-web</artifactId>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>org.openmrs.test</groupId>
<artifactId>openmrs-test</artifactId>
<type>pom</type>
</dependency>

<!-- End OpenMRS core -->

<!-- Begin OpenMRS modules -->

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>appframework-api</artifactId>
</dependency>
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>emrapi-api</artifactId>
</dependency>
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>emrapi-api-1.10</artifactId>
</dependency>
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>emrapi-api-1.11</artifactId>
</dependency>
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>emrapi-api-1.12</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>providermanagement-api</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>uiframework-api</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>reporting-api</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>serialization.xstream-api</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>serialization.xstream-api-1.9</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>serialization.xstream-api-1.10</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>serialization.xstream-api-2.0</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>calculation-api</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>htmlformentry-api-1.10</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs</groupId>
<artifactId>event-api</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>appui-api</artifactId>
<classifier>tests</classifier>
<version>${appuiVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>emrapi-api</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>metadatamapping-api</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>webservices.rest-omod-common</artifactId>
<scope>provided</scope>
</dependency>

<!-- End OpenMRS modules -->

</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>

<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
</build>

</project>
18 changes: 18 additions & 0 deletions api/bin/src/main/resources/liquibase.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
<!--
See http://www.liquibase.org/manual/home#available_database_refactorings
for a list of supported elements and attributes
-->
<changeSet id="20161011-001" author="themoonraker13">
<comment>Updated the value of patient dashboard URL global property</comment>
<update tableName="global_property">
<column name="property_value" value="/coreapps/clinicianfacing/patient.page?patientId={{patientId}}"></column>
<where>property ='coreapps.dashboardUrl' and property_value='/coreapps/clinicianfacing/patient.page?patientId={{patientId}}&amp;app=pih.app.clinicianDashboard'</where>
</update>
</changeSet>
</databaseChangeLog>
Loading