| | 345 | public String[] getLocationType(){ |
|---|
| | 346 | List<String> arrList = null; |
|---|
| | 347 | String query = "select name from AddressHierarchyType"; |
|---|
| | 348 | arrList = sessionFactory.getCurrentSession().find(query); |
|---|
| | 349 | String[] arr = new String[arrList.size()]; |
|---|
| | 350 | for(int i=0;i<arrList.size();i++){ |
|---|
| | 351 | arr[i] = arrList.get(i); |
|---|
| | 352 | } |
|---|
| | 353 | return arr; |
|---|
| | 354 | } |
|---|
| | 355 | |
|---|
| | 356 | public String[] getLocationTypeTable(){ |
|---|
| | 357 | Iterator iter = null; |
|---|
| | 358 | String query = "select typeId,name,choice,listorder from AddressHierarchyType order by listorder"; |
|---|
| | 359 | iter = sessionFactory.getCurrentSession().find(query).iterator(); |
|---|
| | 360 | String[] arr = new String[44]; |
|---|
| | 361 | int i = 0; |
|---|
| | 362 | while(iter.hasNext()){ |
|---|
| | 363 | Object[] x = (Object[]) iter.next(); |
|---|
| | 364 | arr[i] = x[0].toString(); |
|---|
| | 365 | i++; |
|---|
| | 366 | arr[i] = x[1].toString(); |
|---|
| | 367 | i++; |
|---|
| | 368 | arr[i] = x[2].toString(); |
|---|
| | 369 | i++; |
|---|
| | 370 | arr[i] = x[3].toString(); |
|---|
| | 371 | i++; |
|---|
| | 372 | } |
|---|
| | 373 | return arr; |
|---|
| | 374 | } |
|---|
| | 375 | |
|---|
| | 376 | public void updateLocationTypeTable(AddressHierarchyType aht){ |
|---|
| | 377 | sessionFactory.getCurrentSession().beginTransaction(); |
|---|
| | 378 | sessionFactory.getCurrentSession().createQuery("update AddressHierarchyType set listorder = '"+aht.getListorder()+"', choice = '"+aht.getChoice()+"' where name = '"+aht.getName()+"'").executeUpdate(); |
|---|
| | 379 | sessionFactory.getCurrentSession().getTransaction().commit(); |
|---|
| | 380 | |
|---|
| | 381 | } |
|---|
| | 382 | |
|---|
| | 383 | public void loadTable(){ |
|---|
| | 384 | |
|---|
| | 385 | } |
|---|
| | 386 | |
|---|
| | 387 | public void unloadTable(){ |
|---|
| | 388 | sessionFactory.getCurrentSession().beginTransaction(); |
|---|
| | 389 | sessionFactory.getCurrentSession().createQuery("delete * from AddressHierarchy").executeUpdate(); |
|---|
| | 390 | sessionFactory.getCurrentSession().getTransaction().commit(); |
|---|
| | 391 | } |
|---|
| | 392 | |
|---|
| | 393 | public String[] getAddressHierarchyTypeList(Integer typeid){ |
|---|
| | 394 | String query = "select name from AddressHierarchyType where typeId > "+typeid+" and choice = 1 order by listorder"; |
|---|
| | 395 | List<String> x = sessionFactory.getCurrentSession().find(query); |
|---|
| | 396 | String[] arr = new String[x.size()]; |
|---|
| | 397 | for(int i=0;i<x.size();i++){ |
|---|
| | 398 | arr[i]=x.get(i); |
|---|
| | 399 | } |
|---|
| | 400 | return arr; |
|---|
| | 401 | } |
|---|
| | 402 | |
|---|