@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 void removeStaple(String id) throws OKMException { try { StapleGroupDAO.deleteStaple(Integer.parseInt(id)); } catch (NumberFormatException e) { log.error(e.getMessage(), e); throw new OKMException( ErrorCode.get(ErrorCode.ORIGIN_OKMStaplingService, ErrorCode.CAUSE_NumberFormat), e.getMessage()); } catch (DatabaseException e) { log.error(e.getMessage(), e); throw new OKMException( ErrorCode.get(ErrorCode.ORIGIN_OKMStaplingService, ErrorCode.CAUSE_Database), e.getMessage()); } }