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

TRUNK-5373: Refactor the condition save logic. #2665

Merged
merged 1 commit into from
May 10, 2018

Conversation

Arthur236
Copy link
Contributor

@Arthur236 Arthur236 commented May 8, 2018

Description of what I changed

Changed 3 files for this task:

  • api/src/main/java/org/openmrs/Condition.java
  • api/src/main/java/org/openmrs/api/impl/ConditionServiceImpl.java
  • api/src/main/resources/org/openmrs/api/db/hibernate/Condition.hbm.xml

Issue I worked on

See https://issues.openmrs.org/browse/TRUNK-5373

Checklist: I completed these to help reviewers :)

  • My pull request only contains ONE single commit
    (the number above, next to the 'Commits' tab is 1).

    No? -> read here on how to squash multiple commits into one

  • My IDE is configured to follow the code style of this project.

    No? Unsure? -> configure your IDE, format the code and add the changes with git add . && git commit --amend

  • I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

    No? -> write tests and add them to this commit git add . && git commit --amend

  • I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

    No? -> execute above command

  • All new and existing tests passed.

    No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.

  • My pull request is based on the latest changes of the master branch.

    No? Unsure? -> execute command git pull --rebase upstream master

@coveralls
Copy link

coveralls commented May 8, 2018

Coverage Status

Coverage increased (+0.05%) to 59.059% when pulling 78f5c3a on Arthur236:TRUNK-5373 into 1d14c59 on openmrs:master.

@@ -48,6 +48,25 @@ public ConditionDAO getConditionDAO() {
*/
@Override
public Condition saveCondition(Condition condition) {
Condition existingCondition = getConditionByUuid(condition.getUuid());
Copy link
Member

Choose a reason for hiding this comment

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

@Arthur236 did you intentionally leave out the first three lines in the original save method of the emrapi module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dkayiwa yes I did. The Condition class in the core does not have a getter method for the endReason

Copy link
Member

Choose a reason for hiding this comment

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

You can add the getter.

if (existingCondition == null) {
return conditionDAO.saveCondition(condition);
}

Copy link
Member

Choose a reason for hiding this comment

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

Did you intentionally skip this as it was in the emrapi module? condition = Condition.newInstance(condition)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I did. I was trying to avoid having to change the original Condition class since it did not have a newInstance method. I could however add it if this is not a problem.

Copy link
Member

Choose a reason for hiding this comment

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

You can add that method

@@ -15,7 +15,7 @@
"https://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.openmrs">

<class name="Condition" table="condition">
<class name="Condition" table="`condition`">
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove these quotes around condition? We are using a different strategy as @paradisekelechi can update you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing

@openmrs openmrs deleted a comment May 10, 2018
@dkayiwa dkayiwa merged commit 0c37c7e into openmrs:master May 10, 2018
@Arthur236 Arthur236 deleted the TRUNK-5373 branch May 11, 2018 12:31
jtatia pushed a commit to jtatia/openmrs-core that referenced this pull request Aug 20, 2018
JyothsnaAshok pushed a commit to JyothsnaAshok/openmrs-core that referenced this pull request Oct 23, 2018
JyothsnaAshok added a commit to JyothsnaAshok/openmrs-core that referenced this pull request Oct 23, 2018
JyothsnaAshok added a commit to JyothsnaAshok/openmrs-core that referenced this pull request Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants