@Override public void removeAllStapleByUuid(String uuid) throws OKMException { try { List<String> idToDelete = new ArrayList<String>(); for (StapleGroup sg : StapleGroupDAO.findAll(uuid)) { for (Staple staple : sg.getStaples()) { if (staple.getUuid().equals(uuid)) { idToDelete.add(String.valueOf(staple.getId())); } } } for (String id : idToDelete) { StapleGroupDAO.deleteStaple(Integer.parseInt(id)); } } catch (DatabaseException e) { log.error(e.getMessage(), e); throw new OKMException( ErrorCode.get(ErrorCode.ORIGIN_OKMStaplingService, ErrorCode.CAUSE_Database), e.getMessage()); } catch (RepositoryException e) { log.error(e.getMessage(), e); throw new OKMException( ErrorCode.get(ErrorCode.ORIGIN_OKMStaplingService, ErrorCode.CAUSE_Repository), e.getMessage()); } }
@Override public List<GWTStapleGroup> getAll(String uuid) throws OKMException { List<GWTStapleGroup> stapList = new ArrayList<GWTStapleGroup>(); try { for (StapleGroup sg : StapleGroupDAO.findAll(uuid)) { stapList.add(GWTUtil.copy(sg)); } } catch (DatabaseException e) { log.error(e.getMessage(), e); throw new OKMException( ErrorCode.get(ErrorCode.ORIGIN_OKMStaplingService, ErrorCode.CAUSE_Database), e.getMessage()); } catch (RepositoryException e) { log.error(e.getMessage(), e); throw new OKMException( ErrorCode.get(ErrorCode.ORIGIN_OKMStaplingService, ErrorCode.CAUSE_Repository), e.getMessage()); } catch (PathNotFoundException e) { log.error(e.getMessage(), e); throw new OKMException( ErrorCode.get(ErrorCode.ORIGIN_OKMStaplingService, ErrorCode.CAUSE_PathNotFound), e.getMessage()); } return stapList; }