MappingRest { @DELETE @Path("{recordId}") @RolesAllowed("user") @ApiOperation("Delete an uploaded mapping") @ActionId(Delete.TYPE) @ResourceId(type = ValueType.PATH, value = "recordId") public Response deleteMapping(@Context ContainerRequestContext context, @PathParam("recordId") String recordId) { try { catalogManager.deleteRecord(getActiveUser(context, engineManager), vf.createIRI(recordId), MappingRecord.class); } catch (MobiException e) { throw ErrorUtils.sendError(e, e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR); } catch (IllegalArgumentException e) { throw ErrorUtils.sendError(e, e.getMessage(), Response.Status.BAD_REQUEST); } return Response.ok().build(); }  @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @RolesAllowed("user") @ApiOperation("Upload mapping sent as form data.") @ActionAttributes(@AttributeValue(id = com.mobi.ontologies.rdfs.Resource.type_IRI, value = MappingRecord.TYPE)) @ResourceId("http://mobi.com/catalog-local") Response upload(@Context ContainerRequestContext context,
                    @FormDataParam("title") String title,
                    @FormDataParam("description") String description,
                    @FormDataParam("markdown") String markdown,
                    @FormDataParam("keywords") List<FormDataBodyPart> keywords,
                    @FormDataParam("file") InputStream fileInputStream,
                    @FormDataParam("file") FormDataContentDisposition fileDetail,
                    @FormDataParam("jsonld") String jsonld); @GET @Path("{recordId}") @Produces(MediaType.APPLICATION_JSON) @RolesAllowed("user") @ApiOperation("Retrieve JSON-LD of an uploaded mapping") @ResourceId(type = ValueType.PATH, value = "recordId") Response getMapping(@PathParam("recordId") String recordId); @GET @Path("{recordId}") @Produces({MediaType.APPLICATION_OCTET_STREAM, "text/*", "application/*"}) @RolesAllowed("user") @ApiOperation("Download an uploaded mapping") @ResourceId(type = ValueType.PATH, value = "recordId") Response downloadMapping(@PathParam("recordId") String recordId,
                             @DefaultValue("jsonld") @QueryParam("format") String format); @DELETE @Path("{recordId}") @RolesAllowed("user") @ApiOperation("Delete an uploaded mapping") @ActionId(Delete.TYPE) @ResourceId(type = ValueType.PATH, value = "recordId") Response deleteMapping(@Context ContainerRequestContext context,
                           @PathParam("recordId") String recordId);  }
@Test public void deleteMappingTest() { Response response = target().path("mappings/" + encode(MAPPING_RECORD_IRI)).request().delete(); assertEquals(response.getStatus(), 200); verify(catalogManager).deleteRecord(user, recordId, MappingRecord.class); verify(engineManager, atLeastOnce()).retrieveUser(anyString()); }