Source:
<code>public Response getActivityStatistics(@PathParam ("WORKSPACEENTITYID") Long workspaceEntityId, @QueryParam ("userIdentifier") String userId) { WorkspaceEntity workspaceEntity = workspaceEntityController.findWorkspaceEntityById(workspaceEntityId); if (workspaceEntity == null) { return Response.status(Status.BAD_REQUEST).build(); } if (!sessionController.hasWorkspacePermission(MuikkuPermissions.LIST_USER_WORKSPACE_ACTIVITY, workspaceEntity)) { return Response.status(Status.FORBIDDEN).build(); } SchoolDataIdentifier userIdentifier = null; if (StringUtils.isNotBlank(userId)) { userIdentifier = SchoolDataIdentifier.fromId(userId); } if (userIdentifier == null) { <START> return Response.status(Status.NOT_IMPLEMENTED).entity("User does not exist").build(); <END> } UserEntity userEntity = userEntityController.findUserEntityByUserIdentifier(userIdentifier); List<fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialReply> workspaceMaterialReplies = workspaceMaterialReplyController.listVisibleWorkspaceMaterialRepliesByWorkspaceEntity(workspaceEntity, userEntity); List<WorkspaceActivityRecord> activityStatisitics = new ArrayList<WorkspaceActivityRecord>(); for(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialReply workspaceMaterialReply: workspaceMaterialReplies) { WorkspaceActivityRecord workspaceActivityRecord = new WorkspaceActivityRecord(workspaceMaterialReply.getWorkspaceMaterial().getAssignmentType().toString(), workspaceMaterialReply.getCreated()); activityStatisitics.add(workspaceActivityRecord); } return Response.ok(activityStatisitics).build(); }</code><technical_language>this Status.NOT_FOUND or, if caller is responsible of providing valid data, Status.BAD_REQUEST</technical_language>

Target:
public Response getActivityStatistics(@PathParam ("WORKSPACEENTITYID") Long workspaceEntityId, @QueryParam ("userIdentifier") String userId) { WorkspaceEntity workspaceEntity = workspaceEntityController.findWorkspaceEntityById(workspaceEntityId); if (workspaceEntity == null) { return Response.status(Status.BAD_REQUEST).build(); } if (!sessionController.hasWorkspacePermission(MuikkuPermissions.LIST_USER_WORKSPACE_ACTIVITY, workspaceEntity)) { return Response.status(Status.FORBIDDEN).build(); } SchoolDataIdentifier userIdentifier = null; if (StringUtils.isNotBlank(userId)) { userIdentifier = SchoolDataIdentifier.fromId(userId); } if (userIdentifier == null) { return Response.status(Status.NOT_FOUND).entity("User does not exist").build(); } UserEntity userEntity = userEntityController.findUserEntityByUserIdentifier(userIdentifier); List<fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialReply> workspaceMaterialReplies = workspaceMaterialReplyController.listVisibleWorkspaceMaterialRepliesByWorkspaceEntity(workspaceEntity, userEntity); List<WorkspaceActivityRecord> activityStatisitics = new ArrayList<WorkspaceActivityRecord>(); for(fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialReply workspaceMaterialReply: workspaceMaterialReplies) { WorkspaceActivityRecord workspaceActivityRecord = new WorkspaceActivityRecord(workspaceMaterialReply.getWorkspaceMaterial().getAssignmentType().toString(), workspaceMaterialReply.getCreated()); activityStatisitics.add(workspaceActivityRecord); } return Response.ok(activityStatisitics).build(); }