List of usage examples for org.springframework.web.bind.annotation RequestMethod PATCH
RequestMethod PATCH
To view the source code for org.springframework.web.bind.annotation RequestMethod PATCH.
Click Source Link
From source file:de.thm.arsnova.controller.SessionController.java
@RequestMapping(value = "/{sessionkey}/features", method = RequestMethod.PATCH) public SessionFeature changeSessionFeatures(@PathVariable final String sessionkey, @RequestBody final SessionFeature features, final HttpServletResponse response) { return sessionService.changeSessionFeatures(sessionkey, features); }
From source file:de.metas.ui.web.window.controller.WindowRestController.java
@RequestMapping(value = "/{windowId}/{documentId}/{tabId}/{rowId}", method = RequestMethod.PATCH) public List<JSONDocument> patchIncludedDocument(@PathVariable("windowId") final int adWindowId // , @PathVariable("documentId") final String documentIdStr // , @PathVariable("tabId") final String detailIdStr // , @PathVariable("rowId") final String rowIdStr // ,// w w w. j a v a 2s .c om @RequestParam(name = PARAM_Advanced, required = false, defaultValue = PARAM_Advanced_DefaultValue) final boolean advanced // , @RequestBody final List<JSONDocumentChangedEvent> events) { final DocumentPath documentPath = DocumentPath.builder().setDocumentType(DocumentType.Window, adWindowId) .setDocumentId(documentIdStr).setDetailId(detailIdStr).setRowId(rowIdStr).allowNewRowId().build(); return patchDocument(documentPath, advanced, events); }
From source file:com.boundlessgeo.geoserver.api.controllers.StoreController.java
@RequestMapping(value = "/{wsName}/{name}", method = RequestMethod.PATCH) public @ResponseBody JSONObj patch(@PathVariable String wsName, @PathVariable String name, @RequestBody JSONObj obj, HttpServletRequest req) throws IOException { Catalog cat = geoServer.getCatalog(); StoreInfo store = cat.getStoreByName(wsName, name, StoreInfo.class); boolean refresh = define(store, obj); cat.save(store);// w w w . jav a2 s . c om if (refresh) { resetConnection(store); } return storeDetails(new JSONObj(), store, req); }
From source file:com.orange.ngsi2.server.Ngsi2BaseController.java
/** * Endpoint patch /v2/entities/{entityId} * @param entityId the entity ID/*from w ww .j a v a2 s. c om*/ * @param attributes the attributes to update * @param type an optional type of entity * @param options keyValues is not supported. * @return http status 204 (no content) * @throws Exception */ @RequestMapping(method = RequestMethod.PATCH, value = { "/entities/{entityId}" }, consumes = MediaType.APPLICATION_JSON_VALUE) final public ResponseEntity updateExistingEntityAttributesEndpoint(@PathVariable String entityId, @RequestBody HashMap<String, Attribute> attributes, @RequestParam Optional<String> type, @RequestParam Optional<String> options) throws Exception { validateSyntax(entityId, type.orElse(null), attributes); //TODO: to support keyValues as options if (options.isPresent()) { throw new UnsupportedOptionException(options.get()); } updateExistingEntityAttributes(entityId, type.orElse(null), attributes); return new ResponseEntity(HttpStatus.NO_CONTENT); }
From source file:org.hsweb.web.controller.form.DynamicFormController.java
/** * ????excel?.excel?(xls,xlsx)./* ww w . ja va 2s. c o m*/ * ???,?,. * * @param name ??? * @param fileId id,{@link org.hsweb.web.controller.file.FileController#upload(MultipartFile[])} ? * ,?? * @return , ??:{@link DynamicFormService#importExcel(String, InputStream)} * @throws IOException ?excel * @throws BusinessException ?excel * @throws NotFoundException ??? */ @RequestMapping(value = "/{name}/import/{fileId:.+}", method = { RequestMethod.PATCH }) @AccessLogger("excel") @Authorize(expression = "#dynamicFormAuthorizeValidator.validate(#name,#user,#paramsMap,'import')") public ResponseMessage importExcel(@PathVariable("name") String name, @PathVariable("fileId") String fileId) throws IOException { String[] ids = fileId.split("[,]"); Map<String, Object> result = new HashMap<>(); for (int i = 0; i < ids.length; i++) { try (InputStream inputStream = fileService.readResources(ids[i])) { result.put(ids[i], dynamicFormService.importExcel(name, inputStream)); } } return ResponseMessage.ok(result); }
From source file:com.boundlessgeo.geoserver.api.controllers.LayerController.java
/** * API endpoint to update an existing layer * @param wsName The workspace of the layer * @param name The name of the layer//from w ww . ja v a 2s . c o m * @param obj Partial description of the layer, containing all changes * @param req HTTP request * @return The description of the updated layer * @throws IOException * @throws FactoryException * @throws TransformException * @throws NoSuchAuthorityCodeException */ @RequestMapping(value = "/{wsName}/{name:.+}", method = RequestMethod.PATCH) public @ResponseBody JSONObj patch(@PathVariable String wsName, @PathVariable String name, @RequestBody JSONObj obj, HttpServletRequest req) throws IOException, NoSuchAuthorityCodeException, TransformException, FactoryException { Catalog cat = geoServer.getCatalog(); WorkspaceInfo ws = findWorkspace(wsName, cat); LayerInfo layer = findLayer(wsName, name, cat); return update(layer, ws, obj, req); }
From source file:com.nagarro.core.v2.controller.UsersController.java
/** * Updates customer profile. Only attributes provided in the request body will be changed. * * @formparam firstName Customer's first name. * @formparam lastName Customer's last name. * @formparam titleCode Customer's title code. For a list of codes, see /{baseSiteId}/titles resource * @formparam language Customer's language. * @formparam currency Customer's currency. * @throws DuplicateUidException//from www. j ava2 s .c o m */ @Secured({ "ROLE_CUSTOMERGROUP", "ROLE_TRUSTED_CLIENT", "ROLE_CUSTOMERMANAGERGROUP" }) @RequestMapping(value = "/{userId}", method = RequestMethod.PATCH) @ResponseStatus(HttpStatus.OK) public void updateUser(final HttpServletRequest request) throws DuplicateUidException { final CustomerData customer = customerFacade.getCurrentCustomer(); if (LOG.isDebugEnabled()) { LOG.debug("updateUser: userId=" + customer.getUid()); } httpRequestCustomerDataPopulator.populate(request, customer); customerFacade.updateFullProfile(customer); }
From source file:com.nagarro.core.v2.controller.UsersController.java
/** * Updates customer profile. Only attributes provided in the request body will be changed. * * @param user//from w w w . j av a 2 s. com * User's object * @bodyparams firstName,lastName,titleCode,currency(isocode),language(isocode) * @throws DuplicateUidException */ @Secured({ "ROLE_CUSTOMERGROUP", "ROLE_TRUSTED_CLIENT", "ROLE_CUSTOMERMANAGERGROUP" }) @RequestMapping(value = "/{userId}", method = RequestMethod.PATCH, consumes = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE }) @ResponseStatus(HttpStatus.OK) public void updateUser(@RequestBody final UserWsDTO user) throws DuplicateUidException { final CustomerData customer = customerFacade.getCurrentCustomer(); if (LOG.isDebugEnabled()) { LOG.debug("updateUser: userId=" + customer.getUid()); } dataMapper.map(user, customer, "firstName,lastName,titleCode,currency(isocode),language(isocode)", false); customerFacade.updateFullProfile(customer); }
From source file:edu.pitt.dbmi.ccd.anno.group.GroupController.java
/** * Patch group// www . j av a 2 s. c om * * @param principal [description] * @param name [description] * @param form [description] * @return [description] */ @RequestMapping(value = GroupLinks.GROUP, method = RequestMethod.PATCH) @ResponseStatus(HttpStatus.OK) @ResponseBody public GroupResource patchGroup(@AuthenticationPrincipal UserAccountDetails principal, @PathVariable String name, @RequestBody GroupForm form) throws NotFoundException, DuplicateKeyException, ConstraintViolationException { UserAccount requester = principal.getUserAccount(); final Group group = groupService.findByName(name); if (group == null) { throw new GroupNotFoundException(name); } if (group.getModerators().stream().map(UserAccount::getId).anyMatch(u -> u.equals(requester.getId()))) { final String newName = form.getName(); final String newDescription = form.getDescription(); if (!isEmpty(newName) && !group.getName().equalsIgnoreCase(newName)) { if (groupService.findByName(newName) != null) { throw new DuplicateKeyException("Group already exists with name: " + newName); } group.setName(newName); } if (!isEmpty(newDescription) && !group.getDescription().equalsIgnoreCase(newDescription)) { group.setDescription(newDescription); } final Group patched = groupService.save(group); final GroupResource resource = assembler.toResource(patched); return resource; } else { throw new ForbiddenException(requester, request); } }