use of fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup in project muikku by otavanopisto.
the class ForumController method createWorkspaceForumArea.
public WorkspaceForumArea createWorkspaceForumArea(WorkspaceEntity workspace, String name, String description, Long groupId) {
UserEntity owner = sessionController.getLoggedUserEntity();
ResourceRights rights = resourceRightsController.create();
ForumAreaGroup group = groupId != null ? findForumAreaGroup(groupId) : null;
WorkspaceForumArea forumArea = workspaceForumAreaDAO.create(workspace, name, description, group, false, owner, rights);
return forumArea;
}
use of fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup in project muikku by otavanopisto.
the class ForumAreaGroupDAO method create.
public ForumAreaGroup create(String name, Boolean archived) {
ForumAreaGroup forumAreaGroup = new ForumAreaGroup();
forumAreaGroup.setName(name);
forumAreaGroup.setArchived(archived);
getEntityManager().persist(forumAreaGroup);
return forumAreaGroup;
}
use of fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup in project muikku by otavanopisto.
the class ForumAreaGroupDAO method listUnArchived.
public List<ForumAreaGroup> listUnArchived() {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<ForumAreaGroup> criteria = criteriaBuilder.createQuery(ForumAreaGroup.class);
Root<ForumAreaGroup> root = criteria.from(ForumAreaGroup.class);
criteria.select(root);
criteria.where(criteriaBuilder.equal(root.get(ForumAreaGroup_.archived), Boolean.FALSE));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup in project muikku by otavanopisto.
the class ForumRESTService method archiveAreaGroup.
@DELETE
@Path("/areagroups/{AREAGROUPID}")
@RESTPermit(ForumResourcePermissionCollection.FORUM_DELETE_FORUMAREAGROUP)
public Response archiveAreaGroup(@PathParam("AREAGROUPID") Long areaGroupId) {
ForumAreaGroup forumAreaGroup = forumController.findForumAreaGroup(areaGroupId);
forumController.archiveAreaGroup(forumAreaGroup);
return Response.noContent().build();
}
use of fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup in project muikku by otavanopisto.
the class ForumController method createEnvironmentForumArea.
public EnvironmentForumArea createEnvironmentForumArea(String name, String description, Long groupId) {
UserEntity owner = sessionController.getLoggedUserEntity();
ResourceRights rights = resourceRightsController.create();
ForumAreaGroup group = groupId != null ? findForumAreaGroup(groupId) : null;
EnvironmentForumArea forumArea = environmentForumAreaDAO.create(name, description, group, false, owner, rights);
return forumArea;
}
Aggregations