Changeset 5418
- Timestamp:
- 09/01/08 16:21:09 (3 months ago)
- Files:
-
- openmrs-modules/addresshierarchy/src/org/openmrs/module/addresshierarchy/AddressHierarchy.java (modified) (1 diff)
- openmrs-modules/addresshierarchy/src/org/openmrs/module/addresshierarchy/db/hibernate/HibernateAddressHierarchyDAO.java (modified) (3 diffs)
- openmrs-modules/addresshierarchy/test/org/openmrs/module/addresshierarchy/AddressHierarchyTest.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/addresshierarchy/src/org/openmrs/module/addresshierarchy/AddressHierarchy.java
r4705 r5418 10 10 11 11 public String toString(){ 12 return locationName ;12 return locationName+" "+locationId+" "+typeId+" "+parentId; 13 13 } 14 14 openmrs-modules/addresshierarchy/src/org/openmrs/module/addresshierarchy/db/hibernate/HibernateAddressHierarchyDAO.java
r5411 r5418 117 117 if(parentLocationId == 0){ 118 118 query = "select locationId from AddressHierarchy where locationName = '"+name+"' and parentId = null"; 119 119 120 } 120 121 else{ 121 122 query = "select locationId from AddressHierarchy where locationName = '"+name+"' and parentId = "+parentLocationId; 123 122 124 } 123 125 List<Integer> x = sessionFactory.getCurrentSession().find(query); 124 x.add(parentLocationId);126 //x.add(parentLocationId); 125 127 for(int i=0;b;i++){ 126 128 String queryx = "select locationId from AddressHierarchy where parentId = "+x.get(i); 129 127 130 List<Integer> y = sessionFactory.getCurrentSession().find(queryx); 128 131 if(!y.isEmpty()) … … 137 140 if(x.get(j)==0){ 138 141 delete = "delete from AddressHierarchy where parentId = null and name ='"+name+"'"; 142 139 143 } 140 144 else{ 141 145 delete = "delete from AddressHierarchy where parentId = "+x.get(j); 146 142 147 } 143 148 sessionFactory.getCurrentSession().beginTransaction(); … … 146 151 147 152 } 153 String delete = "delete from AddressHierarchy where locationId = "+x.get(0); 154 sessionFactory.getCurrentSession().beginTransaction(); 155 sessionFactory.getCurrentSession().createQuery(delete).executeUpdate(); 156 sessionFactory.getCurrentSession().getTransaction().commit(); 148 157 } 149 158 openmrs-modules/addresshierarchy/test/org/openmrs/module/addresshierarchy/AddressHierarchyTest.java
r5411 r5418 33 33 } 34 34 } 35 35 */ 36 36 public void testDeleteLocation() throws Exception{ 37 ((AddressHierarchyService)Context.getService(AddressHierarchyService.class)).deleteLocation( 0, "tamil nadu");37 ((AddressHierarchyService)Context.getService(AddressHierarchyService.class)).deleteLocation(6, "h"); 38 38 39 39 } 40 40 /* 41 41 public void testEditLocation() throws Exception{ 42 42 ((AddressHierarchyService)Context.getService(AddressHierarchyService.class)).editLocation(0, "asdalsd", "usa"); … … 77 77 System.out.println(x); 78 78 79 } */79 } 80 80 81 81 public void testDWRCreate(){