Search in sources :

Example 6 with ForumAreaGroup

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;
}
Also used : WorkspaceForumArea(fi.otavanopisto.muikku.plugins.forum.model.WorkspaceForumArea) ResourceRights(fi.otavanopisto.muikku.model.security.ResourceRights) ForumAreaGroup(fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup) UserEntity(fi.otavanopisto.muikku.model.users.UserEntity)

Example 7 with ForumAreaGroup

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;
}
Also used : ForumAreaGroup(fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup)

Example 8 with 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();
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) EntityManager(javax.persistence.EntityManager) ForumAreaGroup(fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup)

Example 9 with ForumAreaGroup

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();
}
Also used : ForumAreaGroup(fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) RESTPermit(fi.otavanopisto.security.rest.RESTPermit)

Example 10 with ForumAreaGroup

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;
}
Also used : ResourceRights(fi.otavanopisto.muikku.model.security.ResourceRights) ForumAreaGroup(fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup) UserEntity(fi.otavanopisto.muikku.model.users.UserEntity) EnvironmentForumArea(fi.otavanopisto.muikku.plugins.forum.model.EnvironmentForumArea)

Aggregations

ForumAreaGroup (fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup)16 RESTPermit (fi.otavanopisto.security.rest.RESTPermit)12 Path (javax.ws.rs.Path)12 EnvironmentForumArea (fi.otavanopisto.muikku.plugins.forum.model.EnvironmentForumArea)7 WorkspaceForumArea (fi.otavanopisto.muikku.plugins.forum.model.WorkspaceForumArea)7 DELETE (javax.ws.rs.DELETE)7 ForumArea (fi.otavanopisto.muikku.plugins.forum.model.ForumArea)6 WorkspaceEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceEntity)5 ForumThread (fi.otavanopisto.muikku.plugins.forum.model.ForumThread)4 POST (javax.ws.rs.POST)4 ResourceRights (fi.otavanopisto.muikku.model.security.ResourceRights)2 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)2 ForumThreadReply (fi.otavanopisto.muikku.plugins.forum.model.ForumThreadReply)2 EntityManager (javax.persistence.EntityManager)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 GET (javax.ws.rs.GET)1