Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
05/18/08 08:16:49 (3 months ago)
Author:
djazayeri
Message:

Fixing #746 - Merge Patients should merge orders, program enrollment, person attributes, and relationship
Also allowing identifiers for voided patients to be reassigned to non-voided patients

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/trunk/src/api/org/openmrs/PatientProgram.java

    r4158 r4245  
    4848                states = new HashSet<PatientState>(); 
    4949        } 
     50         
     51        /** 
     52         * Does a mostly-shallow copy of this PatientProgram. Does not copy patientProgramId. 
     53         * The 'states' property will be deep-copied. 
     54         *  
     55         * @return a shallow copy of this PatientProgram 
     56         */ 
     57        public PatientProgram copy() { 
     58                return copyHelper(new PatientProgram()); 
     59        } 
     60         
     61        /** 
     62         * The purpose of this method is to allow subclasses of PatientProgram to delegate a portion of 
     63         * their copy() method back to the superclass, in case the base class implementation changes.  
     64         *  
     65         * @param target a PatientProgram that will have the state of <code>this</code> copied into it 
     66         * @return the PatientProgram that was passed in, with state copied into it 
     67         */ 
     68        protected PatientProgram copyHelper(PatientProgram target) { 
     69                target.setPatient(this.getPatient()); 
     70                target.setProgram(this.getProgram()); 
     71                target.setDateEnrolled(this.getDateEnrolled()); 
     72                target.setDateCompleted(target.getDateCompleted()); 
     73                Set<PatientState> statesCopy = new HashSet<PatientState>(); 
     74                if (this.getStates() != null) { 
     75                        for (PatientState s : this.getStates()) { 
     76                                PatientState stateCopy = s.copy(); 
     77                                stateCopy.setPatientProgram(target); 
     78                                statesCopy.add(stateCopy); 
     79                        } 
     80                } 
     81                target.setStates(statesCopy); 
     82                target.setCreator(this.getCreator()); 
     83                target.setDateCreated(this.getDateCreated()); 
     84                target.setChangedBy(this.getChangedBy()); 
     85                target.setDateChanged(this.getDateChanged()); 
     86                target.setVoided(this.getVoided()); 
     87                target.setVoidedBy(this.getVoidedBy()); 
     88                target.setDateVoided(this.getDateVoided()); 
     89                target.setVoidReason(this.getVoidReason()); 
     90                return target; 
     91        } 
     92        /* 
     93        private Set<PatientState> states; 
     94        */ 
    5095 
    5196        public User getCreator() {