class SoapBookmarkService extends AbstractService implements BookmarkService {

	@Override
	public WSBookmark bookmarkFolder(String sid, long folderId) throws Exception {
		checkFolderAvailable(sid, folderId);
		User user = validateSession(sid);

		WSFolder folder = checkFolderAvailable(sid, folderId);

		BookmarkDAO bDao = (BookmarkDAO) Context.get().getBean(BookmarkDAO.class);
		Bookmark bmark = bDao.findByUserIdAndDocId(user.getId(), folderId);
		if (bmark == null) {
			bmark = new Bookmark();
			bmark.setType(Bookmark.TYPE_DOCUMENT);
			bmark.setTitle(folder.getName());
			bmark.setFileType("folder");
			bmark.setUserId(user.getId());
			bmark.setTargetId(folderId);
			bDao.store(bmark);
		}

		return WSBookmark.fromBookmark(bmark);
	}

}