Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-1824

Refactor common code out of Services and DAOs and into common utilities

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Ready for Work
    • Priority: Should
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Low

      Description

      We have a LOT of code that is duplicated across both our Service layer and (particularly) our DAO layer. Virtually every metadata type, for example, must implement the same set of methods to "get by name", "get all by name", "get all matching fuzzy name", "get by id", "get by uuid", "void", "retire", etc. This is bad on a number of levels, not the least of which is that it makes it much more likely we'll introduce errors or inconsistencies across our services.

      The SaveHandlers help with some of this, but only cover the modification use cases (i.e. void/retire/etc). They also don't feel exactly right.

      This ticket proposes refactoring out as much of this common code as possible into a standard set of classes which utilize generics. For example:

      <T extends OpenmrsMetadata> T MetadataDAOUtil.getMetadataById(Integer id);
      

        Gliffy Diagrams

          Attachments

            Issue Links

            1.
            Create generic DAO interfaces and abstract classes Sub-task Closed Lluis Martinez

            100%

            Original Estimate - Not Specified Original Estimate - Not Specified
            Time Spent - 1 hour
            2.
            Refactor ActiveListDAO Sub-task Closed Ivo Ulrich  
            3.
            Refactor AdministrationDAO Sub-task Ready for Work Unassigned  
            4.
            Refactor CohortDAO Sub-task Ready for Work Unassigned  
            5.
            Refactor ConceptDAO Sub-task Code Review (Initial) tendo kiiza Martyn

            100%

            Original Estimate - 15 minutes Original Estimate - 15 minutes
            Time Spent - 1 hour
            6.
            Refactor DatatypeDAO Sub-task Ready for Work Unassigned  
            7.
            Refactor EncounterDAO Sub-task Ready for Work Unassigned  
            8.
            Refactor FormDAO Sub-task Ready for Work Unassigned  
            9.
            Refactor LocationDAO Sub-task Ready for Work Unassigned  
            10.
            Refactor NoteDAO Sub-task Closed Unassigned  
            11.
            Refactor ObsDAO Sub-task Waiting on Information Unassigned  
            12.
            Refactor OrderDAO Sub-task Ready for Work Unassigned  
            13.
            Refactor PatientDAO Sub-task Ready for Work Unassigned  
            14.
            Refactor PersonDAO Sub-task Ready for Work Unassigned  
            15.
            Refactor ProgramWorkflowDAO Sub-task Ready for Work Unassigned  
            16.
            Refactor ProviderDAO Sub-task Ready for Work Unassigned  
            17.
            Refactor TemplateDAO Sub-task Waiting on Information Unassigned  
            18.
            Refactor UserDAO Sub-task Ready for Work Unassigned  
            19.
            Refactor VisitDAO Sub-task Design Unassigned  

              Activity

                People

                Assignee:
                Unassigned
                Reporter:
                mseaton Mike Seaton
                Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                  Dates

                  Created:
                  Updated:

                    Time Tracking

                    Estimated:
                    Original Estimate - 15 minutes Original Estimate - 15 minutes
                    15m
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 5 hours
                    5h