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

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

Introduction

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

Prototype

RequestMethod PUT

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

Click Source Link

Usage

From source file:am.ik.categolj2.api.link.LinkRestController.java

@RequestMapping(value = "**", method = RequestMethod.PUT, headers = Categolj2Headers.X_ADMIN)
public LinkResource putLinks(HttpServletRequest request, @RequestBody @Validated LinkResource linkResource) {
    String url = getUrl(request);
    Link link = beanMapper.map(linkResource, Link.class);
    Link updated = linkService.update(url, link);
    return beanMapper.map(updated, LinkResource.class);
}

From source file:de.metas.ui.web.process.ProcessRestControllerDeprecated.java

@RequestMapping(value = "/instance", method = RequestMethod.PUT)
@Deprecated//from   w  ww. j a va2  s. c  o m
public JSONProcessInstance createInstance_DEPRECATED(
        @RequestParam(name = "processId", required = true) final int adProcessId //
        ,
        @RequestParam(name = WebConfig.PARAM_WindowId, required = false, defaultValue = "0") final int adWindowId //
        , @RequestParam(name = WebConfig.PARAM_DocumentId, required = false) final String idStr //
) {
    userSession.assertDeprecatedRestAPIAllowed();
    final JSONCreateProcessInstanceRequest request = JSONCreateProcessInstanceRequest.of(adProcessId,
            adWindowId, idStr);
    return processRestController.createInstanceFromRequest(adProcessId, request);
}

From source file:cz.fi.muni.pa165.mushroomhunter.rest.LocationRest.java

@RequestMapping(method = RequestMethod.PUT)
public LocationDto updateLocation(@RequestBody @Valid LocationDto location) {
    Long currentUserId = securityService.getCurrentlyLoggedUser().getId();
    if (!securityService.hasPermissionToModifyEntity(location.getOwnerId())) {
        throw new AccessDeniedException(
                "Access denied: User " + currentUserId + " cannot update location " + location.getId());
    }/*w w  w .  j a  v a  2 s . com*/
    return locationService.update(location);
}

From source file:bg.vitkinov.edu.services.JokeCategoryService.java

@RequestMapping(method = { RequestMethod.POST, RequestMethod.PUT })
public ResponseEntity<?> insert(@RequestParam String name, @RequestParam String keywords) {
    Optional<Category> category = repository.findByName(name);
    if (category.isPresent()) {
        return new ResponseEntity<>(category.get(), HttpStatus.CONFLICT);
    }//from   w ww .  j  av a  2  s .  c o m
    Category newCateogry = new Category();
    newCateogry.setName(name);
    newCateogry.setKeyWords(getKewWors(keywords));
    return new ResponseEntity<>(repository.save(newCateogry), HttpStatus.CREATED);
}

From source file:com.consol.citrus.demo.voting.web.VotingServiceController.java

@RequestMapping(value = "/{id}/close", method = RequestMethod.PUT)
public ResponseEntity close(@PathVariable("id") String votingId) {
    votingService.close(votingService.get(votingId));
    return ResponseEntity.ok().build();
}

From source file:no.dusken.momus.controller.SourceController.java

@RequestMapping(value = "/tag/{tagId}", method = RequestMethod.PUT)
public @ResponseBody SourceTag updateTag(@RequestBody SourceTag newTag, @PathVariable("tagId") String tagId) {
    return sourceService.updateTag(new SourceTag(tagId), newTag);
}

From source file:info.fcrp.keepitsafe.service.KeepService.java

@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public @ResponseBody Keep create(@PathVariable long id, @RequestBody Keep keep) {
    Keep curKeep = keepDAO.find(id);/*from   w  w  w  .jav a2s  .c  o  m*/
    if (curKeep != null) {
        curKeep.setName(keep.getName());
        curKeep.setDescription(keep.getDescription());
    }
    keepDAO.save(curKeep);
    return curKeep;
}

From source file:net.triptech.metahive.web.OrganisationController.java

@RequestMapping(method = RequestMethod.PUT)
@PreAuthorize("hasRole('ROLE_ADMIN')")
public String update(@Valid Organisation organisation, BindingResult bindingResult, Model uiModel,
        HttpServletRequest request) {//from www. ja  v a2s  .c  o m

    if (bindingResult.hasErrors()) {
        uiModel.addAttribute("organisation", organisation);

        FlashScope.appendMessage(getMessage("metahive_object_validation", Organisation.class), request);

        return "organisations/update";
    }
    uiModel.asMap().clear();
    organisation.merge();

    FlashScope.appendMessage(getMessage("metahive_edit_complete", Organisation.class), request);

    return "redirect:/organisations";
}

From source file:com.netflix.spinnaker.halyard.controllers.v1.FeaturesController.java

@RequestMapping(value = "/", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> setFeatures(@PathVariable String deploymentName,
        @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate,
        @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity,
        @RequestBody Object rawFeatures) {
    Features features = objectMapper.convertValue(rawFeatures, Features.class);

    UpdateRequestBuilder builder = new UpdateRequestBuilder();

    builder.setUpdate(() -> featuresService.setFeatures(deploymentName, features));

    Supplier<ProblemSet> doValidate = ProblemSet::new;

    builder.setValidate(doValidate);//from w  ww  . j ava  2  s  .  co  m
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());

    return DaemonTaskHandler.submitTask(builder::build, "Edit features");
}

From source file:org.khmeracademy.btb.auc.pojo.controller.Product_owner_controller.java

@RequestMapping(value = "/delete/{id}", method = RequestMethod.PUT, produces = "application/json")
public ResponseEntity<Map<String, Object>> delete(@PathVariable("id") int id) {
    Map<String, Object> map = new HashMap<String, Object>();
    try {/*from   w  w  w  . j  a  v  a 2 s  . co  m*/
        if (pro_owner_service.remove(id)) {
            map.put("MESSAGE", "Product owner has been deleted");
            map.put("STATUS", true);
        } else {
            map.put("MESSAGE", "Product owner has not been deleted");
            map.put("STATUS", false);
        }
    } catch (Exception e) {
        map.put("MESSAGE", "Error!");
        map.put("STATUS", false);
        e.printStackTrace();
    }
    return new ResponseEntity<Map<String, Object>>(map, HttpStatus.OK);
}