use of org.c4sg.entity.Bookmark in project c4sg-services by Code4SocialGood.
the class BookmarkServiceImpl method createBookmark.
@Override
public BookmarkDTO createBookmark(Integer userId, Integer projectId) {
User user = userDAO.findById(userId);
requireNonNull(user, "Invalid User Id");
Project project = projectDAO.findById(projectId);
requireNonNull(project, "Invalid Project Id");
isBookmarked(userId, projectId);
Bookmark bookmark = new Bookmark();
bookmark.setUser(user);
bookmark.setProject(project);
bookmarkDAO.save(bookmark);
return bookmarkMapper.getBookmarkDtoFromEntity(bookmark);
}
use of org.c4sg.entity.Bookmark in project c4sg-services by Code4SocialGood.
the class BookmarkMapper method getBookmarkDtosFromEntities.
public List<BookmarkDTO> getBookmarkDtosFromEntities(List<Bookmark> bookmarks) {
List<BookmarkDTO> bookmarkList = new ArrayList<BookmarkDTO>();
Iterator<Bookmark> bookmarkIter = bookmarks.iterator();
while (bookmarkIter.hasNext()) {
Bookmark bookmark = bookmarkIter.next();
bookmarkList.add(getBookmarkDtoFromEntity(bookmark));
}
return bookmarkList;
}
use of org.c4sg.entity.Bookmark in project c4sg-services by Code4SocialGood.
the class BookmarkMapper method getProjectDtosFromBookmarkEntities.
public List<ProjectDTO> getProjectDtosFromBookmarkEntities(List<Bookmark> bookmarks) {
List<ProjectDTO> projectList = new ArrayList<ProjectDTO>();
Iterator<Bookmark> bookmarkIter = bookmarks.iterator();
while (bookmarkIter.hasNext()) {
Bookmark bookmark = bookmarkIter.next();
projectList.add(getProjectDtoFromEntity(bookmark));
}
return projectList;
}
Aggregations