Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Changeset 5395

Show
Ignore:
Timestamp:
08/28/08 21:35:15 (3 months ago)
Author:
mseaton
Message:

synchronization-bidirectional-branch: Modified Program property in order to keep getter and setter properties consistent and without side effect. This is to fix a failing unit test.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/branches/data_synchronization_bidirectional/metadata/api/hibernate/org/openmrs/api/db/hibernate/Program.hbm.xml

    r4969 r5395  
    4747 
    4848                <!-- bi-directional one-to-many association to ProgramWorkflow --> 
    49                 <set name="workflows" inverse="true" lazy="false" cascade="all-delete-orphan" order-by="date_created asc" access="field"> 
     49                <set name="allWorkflows" inverse="true" lazy="false" cascade="all-delete-orphan" order-by="date_created asc" access="field"> 
    5050                        <key column="program_id" not-null="true"/> 
    5151                        <one-to-many class="ProgramWorkflow" /> 
  • openmrs/branches/data_synchronization_bidirectional/src/api/org/openmrs/Program.java

    r5138 r5395  
    4747        private Date dateChanged; 
    4848        private Boolean retired = false;  
    49         private Set<ProgramWorkflow> workflows; 
     49        private Set<ProgramWorkflow> allWorkflows; 
    5050        private String guid; 
    5151        private transient String lastRecordGuid; 
    52          
    53         public String getLastRecordGuid() { 
    54             return lastRecordGuid; 
    55         } 
    56  
    57         public void setLastRecordGuid(String lastRecordGuid) { 
    58             this.lastRecordGuid = lastRecordGuid; 
    59         } 
    60          
    61   public String getGuid() { 
    62       return guid; 
    63   } 
    64  
    65   public void setGuid(String guid) { 
    66       this.guid = guid; 
    67   } 
    6852   
    6953        // ****************** 
     
    7256         
    7357        /** Default Constructor */ 
    74         public Program() {  
    75                 workflows = new HashSet<ProgramWorkflow>(); 
    76         } 
     58        public Program() { } 
    7759         
    7860        /** Constructor with id */ 
     
    225207        this.retired = retired; 
    226208    } 
     209     
     210    public String getLastRecordGuid() { 
     211        return lastRecordGuid; 
     212    } 
     213     
     214    public void setLastRecordGuid(String lastRecordGuid) { 
     215        this.lastRecordGuid = lastRecordGuid; 
     216    } 
     217     
     218    public String getGuid() { 
     219        return guid; 
     220    } 
     221     
     222    public void setGuid(String guid) { 
     223        this.guid = guid; 
     224    } 
    227225 
    228226        /** 
     
    233231        public Set<ProgramWorkflow> getWorkflows() { 
    234232                Set<ProgramWorkflow> ret = new HashSet<ProgramWorkflow>(); 
    235                  
    236                 if (this.workflows != null) { 
    237                         for (ProgramWorkflow workflow : this.workflows) { 
    238                                 if (workflow.isRetired() == false) 
    239                                         ret.add(workflow); 
    240                         } 
    241                 } 
    242                          
     233                for (ProgramWorkflow workflow : getAllWorkflows()) { 
     234                        if (workflow.isRetired() == false) 
     235                                ret.add(workflow); 
     236                }        
    243237                return ret; 
    244238        } 
     
    246240        /** 
    247241         * Get all workflows...including the retired ones 
    248          *  
    249242         * @return 
    250243         */ 
    251244        public Set<ProgramWorkflow> getAllWorkflows() { 
    252                 return workflows; 
    253         } 
    254  
    255         public void setWorkflows(Set<ProgramWorkflow> workflows) { 
    256                 this.workflows = workflows; 
     245                if (allWorkflows == null) { 
     246                        allWorkflows = new HashSet<ProgramWorkflow>(); 
     247                } 
     248                return allWorkflows; 
     249        } 
     250 
     251        public void setAllWorkflows(Set<ProgramWorkflow> allWorkflows) { 
     252                this.allWorkflows = allWorkflows; 
    257253        } 
    258254