Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5049 Refactor VisitServiceImpl.stopVisits
  3. TRUNK-5051

Extract getVisitTypesToStop from VisitServiceImpl.stopVisits

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: TBD
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Core 2.2.0
    • Component/s: None
    • Complexity:
      Low

      Description

      After the first refactoring of VisitServiceImpl.stopVisits() which removed the nesting we can see that the first section of the method until

      if (!visitTypesToStop.isEmpty()) {
      

      is concerned with getting the VisitType's from the GlobalProperty which define what VisitTypes can be closed by this method.

      I suggest to extract this into private method getVisitTypesToStop()

      List<VisitType> visitTypesToStop = getVisitTypesToStop();
      if (visitTypesToStop.isEmpty()) {
          return;
      }
      

      Of course you need to ensure that this method always returns a collection and never null.

      Make sure not to extract

      if (maximumStartDate == null) {
          maximumStartDate = new Date();
      }
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                ankitkumar Ankit Kumar
                Reporter:
                teleivo Ivo Ulrich
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: