Search in sources :

Example 11 with WorkspaceJournalEntry

use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceJournalEntry in project muikku by otavanopisto.

the class WorkspaceRESTService method updateJournalEntry.

@DELETE
@Path("/workspaces/{WORKSPACEID}/journal/{JOURNALENTRYID}")
@RESTPermit(handling = Handling.INLINE, requireLoggedIn = true)
public Response updateJournalEntry(@PathParam("WORKSPACEID") Integer workspaceId, @PathParam("JOURNALENTRYID") Long journalEntryId) {
    WorkspaceJournalEntry workspaceJournalEntry = workspaceJournalController.findJournalEntry(journalEntryId);
    if (workspaceJournalEntry == null) {
        return Response.status(Status.NOT_FOUND).build();
    }
    if (!workspaceJournalEntry.getUserEntityId().equals(sessionController.getLoggedUserEntity().getId())) {
        return Response.status(Status.FORBIDDEN).build();
    }
    workspaceJournalController.archiveJournalEntry(workspaceJournalEntry);
    return Response.noContent().build();
}
Also used : WorkspaceJournalEntry(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceJournalEntry) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) RESTPermit(fi.otavanopisto.security.rest.RESTPermit)

Aggregations

WorkspaceJournalEntry (fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceJournalEntry)11 EntityManager (javax.persistence.EntityManager)6 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)6 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)3 Path (javax.ws.rs.Path)3 WorkspaceEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceEntity)2 RESTPermit (fi.otavanopisto.security.rest.RESTPermit)2 UserSchoolDataIdentifier (fi.otavanopisto.muikku.model.users.UserSchoolDataIdentifier)1 WorkspaceUserEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity)1 CorePluginsDAO (fi.otavanopisto.muikku.plugins.CorePluginsDAO)1 WorkspaceJournalEntry_ (fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceJournalEntry_)1 WorkspaceMaterial (fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterial)1 WorkspaceMaterialReply (fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialReply)1 WorkspaceJournalEntryRESTModel (fi.otavanopisto.muikku.plugins.workspace.rest.model.WorkspaceJournalEntryRESTModel)1 RESTPermitUnimplemented (fi.otavanopisto.muikku.rest.RESTPermitUnimplemented)1 SchoolDataIdentifier (fi.otavanopisto.muikku.schooldata.SchoolDataIdentifier)1 User (fi.otavanopisto.muikku.schooldata.entity.User)1 WorkspaceUser (fi.otavanopisto.muikku.schooldata.entity.WorkspaceUser)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1