コード例 #1
0
  @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());
    }
  }