Beispiel #1
0
  @Override
  public GWTBookmark add(String nodePath, String name) throws OKMException {
    log.debug("add({}, {})", nodePath, name);
    updateSessionManager();

    try {
      Bookmark bookmark = OKMBookmark.getInstance().add(null, nodePath, name);
      String path = NodeBaseDAO.getInstance().getPathFromUuid(bookmark.getNode());
      return GWTUtil.copy(bookmark, path);
    } catch (PathNotFoundException e) {
      log.warn(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_PathNotFound),
          e.getMessage());
    } catch (RepositoryException e) {
      log.error(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_Repository),
          e.getMessage());
    } catch (DatabaseException e) {
      log.error(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_Database),
          e.getMessage());
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_General),
          e.getMessage());
    }
  }
Beispiel #2
0
  @Override
  public GWTBookmark get(int bmId) throws OKMException {
    log.debug("get({})", bmId);
    updateSessionManager();

    try {
      Bookmark bookmark = OKMBookmark.getInstance().get(null, bmId);
      String path = NodeBaseDAO.getInstance().getPathFromUuid(bookmark.getNode());
      return GWTUtil.copy(bookmark, path);
    } catch (RepositoryException e) {
      log.error(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_Repository),
          e.getMessage());
    } catch (DatabaseException e) {
      log.error(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_Database),
          e.getMessage());
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_General),
          e.getMessage());
    }
  }
Beispiel #3
0
  @Override
  public List<GWTBookmark> getAll() throws OKMException {
    log.debug("getAll()");
    List<GWTBookmark> bookmarkList = new ArrayList<GWTBookmark>();
    updateSessionManager();

    try {
      Collection<Bookmark> col = OKMBookmark.getInstance().getAll(null);

      for (Iterator<Bookmark> it = col.iterator(); it.hasNext(); ) {
        Bookmark bookmark = it.next();
        log.debug("Bookmark: {}", bookmark);
        String path = NodeBaseDAO.getInstance().getPathFromUuid(bookmark.getNode());
        GWTBookmark bookmarkClient = GWTUtil.copy(bookmark, path);
        bookmarkList.add(bookmarkClient);
      }

      Collections.sort(bookmarkList, BookmarkComparator.getInstance(getLanguage()));
    } catch (RepositoryException e) {
      log.error(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_Repository),
          e.getMessage());
    } catch (DatabaseException e) {
      log.error(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_Database),
          e.getMessage());
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      throw new OKMException(
          ErrorCode.get(ErrorCode.ORIGIN_OKMBookmarkService, ErrorCode.CAUSE_General),
          e.getMessage());
    }

    log.debug("getAll: {}", bookmarkList);
    return bookmarkList;
  }