Example usage for org.springframework.web.bind.annotation RequestMethod DELETE

List of usage examples for org.springframework.web.bind.annotation RequestMethod DELETE

Introduction

In this page you can find the example usage for org.springframework.web.bind.annotation RequestMethod DELETE.

Prototype

RequestMethod DELETE

To view the source code for org.springframework.web.bind.annotation RequestMethod DELETE.

Click Source Link

Usage

From source file:io.github.howiefh.jeews.modules.sys.controller.RoleController.java

@RequiresPermissions("role:delete")
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)/*from  w w w. j  a va 2  s . c o m*/
public void delete(@PathVariable("id") Long id) {
    roleService.delete(id);
}

From source file:gr.abiss.calipso.tiers.controller.AbstractNoDeleteModelController.java

@RequestMapping(value = "{subjectId}/metadata/{predicate}", method = RequestMethod.DELETE)
@ResponseBody/*w  ww.j a  v a2  s.c o m*/
@ApiOperation(hidden = true, value = "Remove metadatum")
public void removeMetadatum(@PathVariable ID subjectId, @PathVariable String predicate) {
    throw new NotImplementedClientException("Method is unsupported.");
}

From source file:net.cpollet.shoppist.web.controller.TokenController.java

@RequestMapping(value = "/api/v1/token/{token}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)/*from  w w  w .j av a2  s. co m*/
@ResponseBody
public RestResponse delete(@PathVariable("token") String token) {
    logger.info("deleting token: {}", token);
    return RestResponseBuilder.aRestResponse().build();
}

From source file:org.lecture.controller.UserController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public ResponseEntity<?> delete(@PathVariable String id) {
    userRepository.delete(id);//ww  w . j a  v  a  2 s . c  o  m
    nats.publish("authentication-service.delete-user", id);
    return ResponseEntity.noContent().build();
}

From source file:de.thm.arsnova.controller.AudienceQuestionController.java

@RequestMapping(value = "/{questionId}", method = RequestMethod.DELETE)
public void deleteInterposedQuestion(@PathVariable final String questionId) {
    questionService.deleteInterposedQuestion(questionId);
}

From source file:pt.ist.fenix.ui.spring.PagesAdminController.java

@RequestMapping(value = "/{menuItemId}", method = RequestMethod.DELETE)
public @ResponseBody String delete(@PathVariable String siteId, @PathVariable String menuItemId) {
    service.delete(getDomainObject(menuItemId));
    return data(siteId);
}

From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_9.ProviderAttributeTypeController1_9Test.java

/**
 * @see ProviderAttributeTypeController#retireProviderAttributeType(ProviderAttributeType,String,WebRequest)
 * @verifies void a provider attribute type
 *//*from   ww w .ja v  a 2s  .c  om*/
@Test
public void retireProviderAttributeType_shouldRetireAProviderAttributeType() throws Exception {
    ProviderAttributeType providerAttributeType = Context.getProviderService().getProviderAttributeType(1);
    Assert.assertFalse(providerAttributeType.isRetired());

    MockHttpServletRequest request = request(RequestMethod.DELETE, getURI() + "/" + getUuid());
    request.addParameter("reason", "test");

    handle(request);

    providerAttributeType = Context.getProviderService().getProviderAttributeType(1);
    Assert.assertTrue(providerAttributeType.isRetired());
    Assert.assertEquals("test", providerAttributeType.getRetireReason());
}

From source file:org.starfishrespect.myconsumption.server.business.controllers.UserController.java

@RequestMapping(value = "/{name}", method = RequestMethod.DELETE)
public SimpleResponseDTO deleteUser(Principal principal, @PathVariable String name) {

    // Check if this user can access this resource
    if (!(principal.getName().equals(name)))
        return new SimpleResponseDTO(false, "you are not allowed to delete this user");

    mUserRepository.deleteUser(name);/*from   w w  w . j  a va  2 s.  c o  m*/

    return new SimpleResponseDTO(true, "user deleted");
}

From source file:de.sainth.recipe.backend.rest.controller.CookbookController.java

@Secured({ "ROLE_USER", "ROLE_ADMIN" })
@RequestMapping(value = "{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)//w w  w .  j av  a  2s . co  m
void delete(@PathVariable("id") Long id) {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication instanceof RecipeManagerAuthenticationToken) {
        RecipeManagerAuthenticationToken token = (RecipeManagerAuthenticationToken) authentication;
        if (ROLE_ADMIN.name().equals(token.getRole())) {
            repository.delete(id);
        } else {
            repository.delete(id, token.getPrincipal());
        }
    }
}

From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs2_0.ConceptAttributeController2_0Test.java

@Test
public void shouldVoidAttribute() throws Exception {
    ConceptAttribute conceptAttribute = service.getConceptAttributeByUuid(getUuid());
    Assert.assertFalse(conceptAttribute.isVoided());

    MockHttpServletRequest request = request(RequestMethod.DELETE, getURI() + "/" + getUuid());
    request.addParameter("reason", "unit test");
    handle(request);/*from ww  w.j a va  2 s . c  o  m*/

    conceptAttribute = service.getConceptAttributeByUuid(getUuid());
    Assert.assertTrue(conceptAttribute.isVoided());
    Assert.assertEquals("unit test", conceptAttribute.getVoidReason());
}