@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; }
@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()); } }
@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()); } }
@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; }