use of fi.otavanopisto.muikku.plugins.forum.model.ForumArea in project muikku by otavanopisto.
the class AcceptanceTestsRESTService method deleteDiscussionThread.
@DELETE
@Path("/discussiongroups/{GROUPID}/discussions/{DISCUSSIONID}/threads/{ID}")
@RESTPermit(handling = Handling.UNSECURED)
public Response deleteDiscussionThread(@PathParam("GROUPID") Long groupId, @PathParam("DISCUSSIONID") Long discussionId, @PathParam("ID") Long id) {
ForumAreaGroup group = forumController.findForumAreaGroup(groupId);
if (group == null) {
return Response.status(Status.NOT_FOUND).entity("Group not found").build();
}
ForumArea forumArea = forumController.getForumArea(discussionId);
if (forumArea == null) {
return Response.status(Status.NOT_FOUND).entity("Discussion not found").build();
}
ForumThread thread = forumController.getForumThread(id);
if (thread == null) {
return Response.status(Status.NOT_FOUND).entity("Thread not found").build();
}
forumController.deleteThread(thread);
return Response.noContent().build();
}
use of fi.otavanopisto.muikku.plugins.forum.model.ForumArea in project muikku by otavanopisto.
the class AcceptanceTestsRESTService method createDiscussionThread.
@POST
@Path("/discussiongroups/{GROUPID}/discussions/{DISCUSSIONID}/threads")
@RESTPermit(handling = Handling.UNSECURED)
public Response createDiscussionThread(@PathParam("GROUPID") Long groupId, @PathParam("DISCUSSIONID") Long discussionId, fi.otavanopisto.muikku.atests.DiscussionThread payload) {
ForumAreaGroup group = forumController.findForumAreaGroup(groupId);
if (group == null) {
return Response.status(Status.NOT_FOUND).entity("Group not found").build();
}
ForumArea discussion = forumController.getForumArea(discussionId);
if (discussion == null) {
return Response.status(Status.NOT_FOUND).entity("Discussion not found").build();
}
return Response.ok(createRestEntity(forumController.createForumThread(discussion, payload.getTitle(), payload.getMessage(), payload.getSticky(), payload.getLocked()))).build();
}
use of fi.otavanopisto.muikku.plugins.forum.model.ForumArea in project muikku by otavanopisto.
the class AcceptanceTestsRESTService method deleteWorkspaceDiscussionThread.
@DELETE
@Path("/workspaces/{WORKSPACEENTITYID}/discussiongroups/{GROUPID}/discussions/{DISCUSSIONID}/threads/{ID}")
@RESTPermit(handling = Handling.UNSECURED)
public Response deleteWorkspaceDiscussionThread(@PathParam("WORKSPACEENTITYID") Long workspaceEntityId, @PathParam("GROUPID") Long groupId, @PathParam("DISCUSSIONID") Long discussionId, @PathParam("ID") Long id) {
WorkspaceEntity workspaceEntity = workspaceEntityController.findWorkspaceEntityById(workspaceEntityId);
if (workspaceEntity == null) {
return Response.status(Status.NOT_FOUND).entity("WorkspaceEntity not found").build();
}
ForumAreaGroup group = forumController.findForumAreaGroup(groupId);
if (group == null) {
return Response.status(Status.NOT_FOUND).entity("Group not found").build();
}
ForumArea forumArea = forumController.getForumArea(discussionId);
if (forumArea == null) {
return Response.status(Status.NOT_FOUND).entity("Discussion not found").build();
}
ForumThread thread = forumController.getForumThread(id);
if (thread == null) {
return Response.status(Status.NOT_FOUND).entity("Thread not found").build();
}
forumController.deleteThread(thread);
return Response.noContent().build();
}
use of fi.otavanopisto.muikku.plugins.forum.model.ForumArea in project muikku by otavanopisto.
the class ForumAcceptanceTestsRESTService method deleteForumArea.
@DELETE
@Path("/areas/{AREAID}")
@RESTPermit(handling = Handling.UNSECURED)
public Response deleteForumArea(@PathParam("AREAID") Long forumAreaId) {
ForumArea forumArea = forumController.findForumAreaById(forumAreaId);
if (forumArea == null) {
return Response.status(Status.NOT_FOUND).entity("ForumArea not found").build();
}
forumController.deleteArea(forumArea);
return Response.noContent().build();
}
Aggregations