@Override public List<Department> retrieveData() throws Exception { list_dpt.clear(); list_Alldpt = AppContext.getInstance().getDepartmentService().getDepartments(); List<Department> list_dt = list_Alldpt; if (this.getSelectionObj() == null) { list_dpt = (ArrayList<Department>) list_dt; return list_dt; } else { for (Department dpt : list_dt) { if (dpt.getParent() != null) { if (dpt.getParent().getId() == ((Department) getSelectionObj().getEntity()).getId()) { list_dpt.add(dpt); } } if (getSelectionObj().getId() == dpt.getId()) { list_dpt.add(0, dpt); } } return list_dpt; } }
@Override public void update(Department t) { if (t.getParent() != null) { new DepartmentDialog(this.getViewSite().getShell(), t, t.getParent()).open(); } }