Search in sources :

Example 16 with EnvironmentForumArea

use of fi.otavanopisto.muikku.plugins.forum.model.EnvironmentForumArea 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)

Example 17 with EnvironmentForumArea

use of fi.otavanopisto.muikku.plugins.forum.model.EnvironmentForumArea in project muikku by otavanopisto.

the class ForumController method listLatestForumThreads.

public List<ForumThread> listLatestForumThreads(int firstResult, int maxResults) {
    List<EnvironmentForumArea> environmentForums = listEnvironmentForums();
    // List<WorkspaceForumArea> workspaceForums = listCourseForums();
    List<ForumArea> forumAreas = new ArrayList<ForumArea>();
    for (EnvironmentForumArea ef : environmentForums) {
        forumAreas.add(ef);
    }
    // for (WorkspaceForumArea wf : workspaceForums) {
    // forumAreas.add(wf);
    // }
    List<ForumThread> threads;
    if (!forumAreas.isEmpty())
        threads = forumThreadDAO.listLatestOrdered(forumAreas, firstResult, maxResults);
    else
        threads = new ArrayList<ForumThread>();
    return threads;
}
Also used : ArrayList(java.util.ArrayList) ForumThread(fi.otavanopisto.muikku.plugins.forum.model.ForumThread) WorkspaceForumArea(fi.otavanopisto.muikku.plugins.forum.model.WorkspaceForumArea) ForumArea(fi.otavanopisto.muikku.plugins.forum.model.ForumArea) EnvironmentForumArea(fi.otavanopisto.muikku.plugins.forum.model.EnvironmentForumArea) EnvironmentForumArea(fi.otavanopisto.muikku.plugins.forum.model.EnvironmentForumArea)

Aggregations

EnvironmentForumArea (fi.otavanopisto.muikku.plugins.forum.model.EnvironmentForumArea)17 RESTPermit (fi.otavanopisto.security.rest.RESTPermit)12 Path (javax.ws.rs.Path)12 ForumArea (fi.otavanopisto.muikku.plugins.forum.model.ForumArea)10 ForumThread (fi.otavanopisto.muikku.plugins.forum.model.ForumThread)9 GET (javax.ws.rs.GET)6 ForumThreadReply (fi.otavanopisto.muikku.plugins.forum.model.ForumThreadReply)4 ArrayList (java.util.ArrayList)3 POST (javax.ws.rs.POST)3 PUT (javax.ws.rs.PUT)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ResourceRights (fi.otavanopisto.muikku.model.security.ResourceRights)1 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)1 ForumAreaGroup (fi.otavanopisto.muikku.plugins.forum.model.ForumAreaGroup)1 WorkspaceForumArea (fi.otavanopisto.muikku.plugins.forum.model.WorkspaceForumArea)1 HashMap (java.util.HashMap)1 EntityManager (javax.persistence.EntityManager)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 CacheControl (javax.ws.rs.core.CacheControl)1