org.springframework.web.bind.annotation.PatchMapping源码实例Demo

类org.springframework.web.bind.annotation.PatchMapping源码实例Demo

下面列出了怎么用org.springframework.web.bind.annotation.PatchMapping的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 *
 * @param windowIdStr
 * @param documentIdStr the string to identify the document to be returned. May also be {@link DocumentId#NEW_ID_STRING}, if a new record shall be created.
 * @param advanced
 * @param events
 * @return
 */
@PatchMapping("/{windowId}/{documentId}")
public List<JSONDocument> patchRootDocument(
		@PathVariable("windowId") final String windowIdStr //
		, @PathVariable("documentId") final String documentIdStr //
		, @RequestParam(name = PARAM_Advanced, required = false, defaultValue = PARAM_Advanced_DefaultValue) final boolean advanced //
		, @RequestBody final List<JSONDocumentChangedEvent> events)
{
	final DocumentPath documentPath = DocumentPath.builder()
			.setDocumentType(WindowId.fromJson(windowIdStr))
			.setDocumentId(documentIdStr)
			.allowNewDocumentId()
			.build();

	return patchDocument(documentPath, advanced, events);
}
 
@PatchMapping("/{windowId}/{documentId}/{tabId}/{rowId}")
public List<JSONDocument> patchIncludedDocument(
		@PathVariable("windowId") final String windowIdStr //
		, @PathVariable("documentId") final String documentIdStr //
		, @PathVariable("tabId") final String detailIdStr //
		, @PathVariable("rowId") final String rowIdStr //
		, @RequestParam(name = PARAM_Advanced, required = false, defaultValue = PARAM_Advanced_DefaultValue) final boolean advanced //
		, @RequestBody final List<JSONDocumentChangedEvent> events)
{
	final DocumentPath documentPath = DocumentPath.builder()
			.setDocumentType(WindowId.fromJson(windowIdStr))
			.setDocumentId(documentIdStr)
			.setDetailId(detailIdStr)
			.setRowId(rowIdStr)
			.allowNewRowId()
			.build();

	return patchDocument(documentPath, advanced, events);
}
 
@PatchMapping("/node/{nodeId}")
public List<JSONMenuNode> patchNode(@PathVariable(PARAM_NodeId) final String nodeId, @RequestBody final List<JSONDocumentChangedEvent> events)
{
	userSession.assertLoggedIn();

	final JSONPatchMenuNodeRequest request = JSONPatchMenuNodeRequest.ofChangeEvents(events);

	final MenuTree menuTree = getMenuTree();
	final MenuNode node = menuTree.getNodeById(nodeId);

	final LinkedHashMap<String, MenuNode> changedMenuNodesById = new LinkedHashMap<>();

	if (request.getFavorite() != null)
	{
		menuTreeRepository.setFavorite(node, request.getFavorite());
		menuTree.streamNodesByAD_Menu_ID(node.getAD_Menu_ID())
				.forEach(changedNode -> changedMenuNodesById.put(changedNode.getId(), changedNode));
	}

	return JSONMenuNode.ofList(changedMenuNodesById.values(), menuTreeRepository);
}
 
@PatchMapping
public JSONViewRow patchRow(
		@PathVariable(PARAM_WindowId) final String windowIdStr,
		@PathVariable(PARAM_ViewId) final String viewIdStr,
		@PathVariable(PARAM_RowId) final String rowIdStr,
		@RequestBody final List<JSONDocumentChangedEvent> fieldChangeRequests)
{
	userSession.assertLoggedIn();

	final ViewId viewId = ViewId.of(windowIdStr, viewIdStr);
	final DocumentId rowId = DocumentId.of(rowIdStr);

	final IEditableView view = getEditableView(viewId);
	final RowEditingContext editingCtx = createRowEditingContext(rowId);
	view.patchViewRow(editingCtx, fieldChangeRequests);

	final IViewRow row = view.getById(rowId);
	final IViewRowOverrides rowOverrides = ViewRowOverridesHelper.getViewRowOverrides(view);
	final JSONOptions jsonOpts = newJSONOptions();
	return JSONViewRow.ofRow(row, rowOverrides, jsonOpts);
}
 
源代码5 项目: spring-openapi   文件: OperationsTransformer.java
private void createOperation(Method method, String baseControllerPath, Map<String, PathItem> operationsMap, String controllerClassName) {
	logger.debug("Transforming {} controller method", method.getName());
	getAnnotation(method, PostMapping.class).ifPresent(postMapping -> mapPost(postMapping, method, operationsMap, controllerClassName, baseControllerPath));
	getAnnotation(method, PutMapping.class).ifPresent(putMapping -> mapPut(putMapping, method, operationsMap, controllerClassName, baseControllerPath));
	getAnnotation(method, PatchMapping.class).ifPresent(patchMapping -> mapPatch(patchMapping, method, operationsMap, controllerClassName,
			baseControllerPath));
	getAnnotation(method, GetMapping.class).ifPresent(getMapping -> mapGet(getMapping, method, operationsMap, controllerClassName, baseControllerPath));
	getAnnotation(method, DeleteMapping.class).ifPresent(deleteMapping -> mapDelete(deleteMapping, method, operationsMap, controllerClassName,
			baseControllerPath));
	getAnnotation(method, RequestMapping.class).ifPresent(requestMapping -> mapRequestMapping(requestMapping, method, operationsMap, controllerClassName,
			baseControllerPath));
}
 
源代码6 项目: spring-openapi   文件: OperationsTransformer.java
private void mapPatch(PatchMapping patchMapping, Method method, Map<String, PathItem> operationsMap, String controllerClassName, String baseControllerPath) {
	Operation operation = new Operation();
	operation.setOperationId(getOperationId(patchMapping.name(), method, HttpMethod.PATCH));
	operation.setSummary(StringUtils.isBlank(patchMapping.name()) ? patchMapping.name() : method.getName());
	operation.setTags(singletonList(classNameToTag(controllerClassName)));

	operation.setRequestBody(createRequestBody(method, getFirstFromArray(patchMapping.consumes())));
	operation.setResponses(createApiResponses(method, getFirstFromArray(patchMapping.produces())));
	operation.setParameters(transformParameters(method));

	String path = ObjectUtils.defaultIfNull(getFirstFromArray(patchMapping.value()), getFirstFromArray(patchMapping.path()));

	operationInterceptors.forEach(interceptor -> interceptor.intercept(method, operation));
	updateOperationsMap(prepareUrl(baseControllerPath, "/", path), operationsMap, pathItem -> pathItem.setPatch(operation));
}
 
源代码7 项目: spring-openapi   文件: DummyController.java
@PatchMapping(path = "/bodyToBeIgnored/{variable}")
@OpenApiIgnore
public ValidationDummy methodToBeIgnored(
		@PathVariable String variable,
		@RequestBody @OpenApiIgnore List<ValidationDummy> validationDummies) {
	return null;
}
 
源代码8 项目: spring-openapi   文件: OperationsTransformer.java
private void createOperation(Method method, String baseControllerPath, Map<String, Path> operationsMap, String controllerClassName) {
	logger.debug("Transforming {} controller method", method.getName());
	getAnnotation(method, PostMapping.class).ifPresent(postMapping -> mapPost(postMapping, method, operationsMap, controllerClassName, baseControllerPath));
	getAnnotation(method, PutMapping.class).ifPresent(putMapping -> mapPut(putMapping, method, operationsMap, controllerClassName, baseControllerPath));
	getAnnotation(method, PatchMapping.class).ifPresent(patchMapping -> mapPatch(patchMapping, method, operationsMap, controllerClassName,
																				 baseControllerPath));
	getAnnotation(method, GetMapping.class).ifPresent(getMapping -> mapGet(getMapping, method, operationsMap, controllerClassName, baseControllerPath));
	getAnnotation(method, DeleteMapping.class).ifPresent(deleteMapping -> mapDelete(deleteMapping, method, operationsMap, controllerClassName,
																					baseControllerPath));
	getAnnotation(method, RequestMapping.class).ifPresent(requestMapping -> mapRequestMapping(requestMapping, method, operationsMap, controllerClassName,
																							  baseControllerPath));
}
 
源代码9 项目: spring-openapi   文件: OperationsTransformer.java
private void mapPatch(PatchMapping patchMapping, Method method, Map<String, Path> operationsMap, String controllerClassName,
					  String baseControllerPath) {
	Operation operation = mapOperation(patchMapping.name(), HttpMethod.PATCH, method, patchMapping.produces(), patchMapping.consumes(), controllerClassName);

	String path = ObjectUtils.defaultIfNull(getFirstFromArray(patchMapping.value()), getFirstFromArray(patchMapping.path()));
	updateOperationsMap(prepareUrl(baseControllerPath, "/", path), operationsMap, pathItem -> pathItem.setPatch(operation));
}
 
@PatchMapping("/{letterId}")
@ApiOperation("Changes the letter")
public JSONLetter changeLetter(@PathVariable("letterId") final String letterId, @RequestBody final List<JSONDocumentChangedEvent> events)
{
	userSession.assertLoggedIn();

	final WebuiLetterChangeResult result = changeLetter(letterId, letterOld -> changeLetter(letterOld, events));
	return JSONLetter.of(result.getLetter());
}
 
@PatchMapping("/metadata/{type}/{id}")
public Mono<ResponseEntity<Metadata>> updateResourceMetadata(
    @PathVariable("type") String type,
    @PathVariable("id") String id,
    @RequestBody Metadata metadata
) {
    return service.updateResource(type, id, metadata)
                    .map(r -> ResponseEntity.ok(r))
                    .defaultIfEmpty(ResponseEntity.notFound().build());
}
 
@RequiresPermissions("finance:withdraw-record:audit-pass")
@PatchMapping("/audit-pass")
@AccessLog(module = AdminModule.FINANCE, operation = "提现记录WithdrawRecord一键审核通过")
public MessageResult auditPass(@RequestParam("ids") Long[] ids) {
    withdrawRecordService.audit(ids, WAITING);
    return success(messageSource.getMessage("PASS_THE_AUDIT"));
}
 
@RequiresPermissions("finance:withdraw-record:audit-no-pass")
@PatchMapping("/audit-no-pass")
@AccessLog(module = AdminModule.FINANCE, operation = "提现记录WithdrawRecord一键审核不通过")
public MessageResult auditNoPass(@RequestParam("ids") Long[] ids) {
    withdrawRecordService.audit(ids, FAIL);
    return success(messageSource.getMessage("AUDIT_DOES_NOT_PASS"));
}
 
@PatchMapping("/{asiDocId}")
public List<JSONDocument> processChanges(
		@PathVariable("asiDocId") final String asiDocIdStr,
		@RequestBody final List<JSONDocumentChangedEvent> events)
{
	userSession.assertLoggedIn();

	final DocumentId asiDocId = DocumentId.of(asiDocIdStr);

	return Execution.callInNewExecution(
			"processChanges",
			() -> processASIDocumentChanges(asiDocId, events));
}
 
@RequiresPermissions("business:auth:deposit:update")
@PatchMapping("update")
public MessageResult update(
        @RequestParam("id") Long id,
        @RequestParam("amount") Double amount,
        @RequestParam("status") CommonStatus status) {
    BusinessAuthDeposit oldData = businessAuthDepositService.findById(id);
    if (amount != null) {
        /*if(businessAuthDeposit.getAmount().compareTo(oldData.getAmount())>0){
            //如果上调了保证金,所有使用当前类型保证金的已认证商家的认证状态都改为保证金不足
            ArrayList<BooleanExpression> booleanExpressions = new ArrayList<>();
            booleanExpressions.add(QDepositRecord.depositRecord.coin.eq(oldData.getCoin()));
            booleanExpressions.add(QDepositRecord.depositRecord.status.eq(DepositStatusEnum.PAY));
            Predicate predicate=PredicateUtils.getPredicate(booleanExpressions);
            List<DepositRecord> depositRecordList=depositRecordService.findAll(predicate);
            if(depositRecordList!=null){
                List<Long> idList=new ArrayList<>();
                for(DepositRecord depositRecord:depositRecordList){
                    idList.add(depositRecord.getMember().getId());
                }
                memberService.updateCertifiedBusinessStatusByIdList(idList);
            }
        }*/
        oldData.setAmount(new BigDecimal(amount));
    }
    if (status != null) {
        oldData.setStatus(status);
    }
    businessAuthDepositService.save(oldData);
    return success();
}
 
源代码16 项目: cymbal   文件: ClusterScaleController.java
/**
 * Retry a failed scale.
 * The scale must be last and fail one.
 *
 * @param clusterId cluster id
 * @param scaleId scale id
 * @return http response entity
 */
@PatchMapping("/clusters/{clusterId}/scales/{scaleId}")
@PreAuthorize("hasRole('ADMIN')")
@ResponseBody
public ResponseEntity<String> retryLastScale(final @PathVariable String clusterId,
        final @PathVariable Integer scaleId) {
    try {
        redisClusterScaleProcessService.retryLastScale(scaleId);
        return ResponseEntity.ok().build();
    } catch (SecurityException e) {
        return ResponseEntity.unprocessableEntity().build();
    }
}
 
源代码17 项目: cymbal   文件: ConfigController.java
/**
 * Update name of redis config.
 *
 * @param clusterId cluster id
 * @param configId config id
 * @param configName new config name
 */
@PatchMapping("/clusters/{clusterId}/configs/{configId}")
@PreAuthorize(value = "@clusterPermissionChecker.hasOperationPermissionForCluster(#clusterId, principal.username)")
@ResponseBody
public void updateConfigName(@PathVariable final String clusterId, @PathVariable final Integer configId,
        final @RequestBody String configName) {
    redisConfigProcessService.updateConfigName(configId, configName);
}
 
源代码18 项目: cymbal   文件: InstanceController.java
@PatchMapping(value = "/clusters/{clusterId}/instances")
@PreAuthorize(value = "@clusterPermissionChecker.hasViewPermissionForCluster(#clusterId, principal.username)")
@ResponseBody
public ResponseEntity<String> refreshReplication(@PathVariable String clusterId) {
    if (redisReplicationUtilityService.refreshReplication(clusterId)) {
        return ResponseEntity.status(HttpStatus.RESET_CONTENT).build();
    }
    return ResponseEntity.ok().build();
}
 
源代码19 项目: cymbal   文件: NodeController.java
@PatchMapping("/nodes")
@PreAuthorize("hasRole('ADMIN')")
@ResponseBody
public List<NodeDTO> initNodes(@RequestBody final Set<Integer> nodeIds) {
    List<Node> failedNodes = nodeProcessService.initNodes(nodeIds);
    return nodeConverter.posToDtos(failedNodes);
}
 
@RequiresPermissions("finance:withdraw-record:audit-pass")
@PatchMapping("/audit-pass")
@AccessLog(module = AdminModule.FINANCE, operation = "提现记录WithdrawRecord一键审核通过")
public MessageResult auditPass(@RequestParam("ids") Long[] ids) {
    withdrawRecordService.audit(ids, WAITING);
    return success(messageSource.getMessage("PASS_THE_AUDIT"));
}
 
@RequiresPermissions("finance:withdraw-record:audit-no-pass")
@PatchMapping("/audit-no-pass")
@AccessLog(module = AdminModule.FINANCE, operation = "提现记录WithdrawRecord一键审核不通过")
public MessageResult auditNoPass(@RequestParam("ids") Long[] ids) {
    withdrawRecordService.audit(ids, FAIL);
    return success(messageSource.getMessage("AUDIT_DOES_NOT_PASS"));
}
 
/**
 * 单个打款 转账成功添加流水号
 *
 * @param id
 * @param transactionNumber
 * @return
 */
@RequiresPermissions("finance:withdraw-record:add-transaction-number")
@PatchMapping("/add-transaction-number")
@AccessLog(module = AdminModule.FINANCE, operation = "添加交易流水号")
@Transactional(rollbackFor = Exception.class)
public MessageResult addNumber(
        @RequestParam("id") Long id,
        @RequestParam("transactionNumber") String transactionNumber) {
    WithdrawRecord record = withdrawRecordService.findOne(id);
    Assert.notNull(record, "该记录不存在");
    Assert.isTrue(record.getIsAuto() == BooleanEnum.IS_FALSE, "该提现单为自动审核");
    record.setTransactionNumber(transactionNumber);
    record.setStatus(WithdrawStatus.SUCCESS);
    MemberWallet memberWallet = memberWalletService.findByCoinAndMemberId(record.getCoin(), record.getMemberId());
    Assert.notNull(memberWallet, "member id " + record.getMemberId() + " 的 wallet 为 null");
    memberWallet.setFrozenBalance(memberWallet.getFrozenBalance().subtract(record.getTotalAmount()));
    memberWalletService.save(memberWallet);
    record = withdrawRecordService.save(record);

    MemberTransaction memberTransaction = new MemberTransaction();
    memberTransaction.setMemberId(record.getMemberId());
    memberTransaction.setAddress(record.getAddress());
    memberTransaction.setAmount(record.getTotalAmount());
    memberTransaction.setSymbol(record.getCoin().getUnit());
    memberTransaction.setCreateTime(record.getCreateTime());
    memberTransaction.setType(TransactionType.WITHDRAW);
    memberTransaction.setFee(record.getFee());
    memberTransaction.setRealFee(record.getFee()+"");
    memberTransaction.setDiscountFee("0");
    memberTransaction= memberTransactionService.save(memberTransaction);

    return MessageResult.success(messageSource.getMessage("SUCCESS"), record);
}
 
@RequiresPermissions("business:auth:deposit:update")
@PatchMapping("update")
public MessageResult update(
        @RequestParam("id") Long id,
        @RequestParam("amount") Double amount,
        @RequestParam("status") CommonStatus status) {
    BusinessAuthDeposit oldData = businessAuthDepositService.findById(id);
    if (amount != null) {
        /*if(businessAuthDeposit.getAmount().compareTo(oldData.getAmount())>0){
            //如果上调了保证金,所有使用当前类型保证金的已认证商家的认证状态都改为保证金不足
            ArrayList<BooleanExpression> booleanExpressions = new ArrayList<>();
            booleanExpressions.add(QDepositRecord.depositRecord.coin.eq(oldData.getCoin()));
            booleanExpressions.add(QDepositRecord.depositRecord.status.eq(DepositStatusEnum.PAY));
            Predicate predicate=PredicateUtils.getPredicate(booleanExpressions);
            List<DepositRecord> depositRecordList=depositRecordService.findAll(predicate);
            if(depositRecordList!=null){
                List<Long> idList=new ArrayList<>();
                for(DepositRecord depositRecord:depositRecordList){
                    idList.add(depositRecord.getMember().getId());
                }
                memberService.updateCertifiedBusinessStatusByIdList(idList);
            }
        }*/
        oldData.setAmount(new BigDecimal(amount));
    }
    if (status != null) {
        oldData.setStatus(status);
    }
    businessAuthDepositService.save(oldData);
    return success();
}
 
@PatchMapping(path="/{orderId}", consumes="application/json")
public Mono<Order> patchOrder(@PathVariable("orderId") UUID orderId,
                        @RequestBody Order patch) {

  return repo.findById(orderId)
      .map(order -> {
        if (patch.getDeliveryName() != null) {
          order.setDeliveryName(patch.getDeliveryName());
        }
        if (patch.getDeliveryStreet() != null) {
          order.setDeliveryStreet(patch.getDeliveryStreet());
        }
        if (patch.getDeliveryCity() != null) {
          order.setDeliveryCity(patch.getDeliveryCity());
        }
        if (patch.getDeliveryState() != null) {
          order.setDeliveryState(patch.getDeliveryState());
        }
        if (patch.getDeliveryZip() != null) {
          order.setDeliveryZip(patch.getDeliveryState());
        }
        if (patch.getCcNumber() != null) {
          order.setCcNumber(patch.getCcNumber());
        }
        if (patch.getCcExpiration() != null) {
          order.setCcExpiration(patch.getCcExpiration());
        }
        if (patch.getCcCVV() != null) {
          order.setCcCVV(patch.getCcCVV());
        }
        return order;
      })
      .flatMap(repo::save);
}
 
@PatchMapping(path="/{orderId}", consumes="application/json")
public Order patchOrder(@PathVariable("orderId") Long orderId,
                        @RequestBody Order patch) {
  
  Order order = repo.findById(orderId).get();
  if (patch.getDeliveryName() != null) {
    order.setDeliveryName(patch.getDeliveryName());
  }
  if (patch.getDeliveryStreet() != null) {
    order.setDeliveryStreet(patch.getDeliveryStreet());
  }
  if (patch.getDeliveryCity() != null) {
    order.setDeliveryCity(patch.getDeliveryCity());
  }
  if (patch.getDeliveryState() != null) {
    order.setDeliveryState(patch.getDeliveryState());
  }
  if (patch.getDeliveryZip() != null) {
    order.setDeliveryZip(patch.getDeliveryState());
  }
  if (patch.getCcNumber() != null) {
    order.setCcNumber(patch.getCcNumber());
  }
  if (patch.getCcExpiration() != null) {
    order.setCcExpiration(patch.getCcExpiration());
  }
  if (patch.getCcCVV() != null) {
    order.setCcCVV(patch.getCcCVV());
  }
  return repo.save(order);
}
 
@PatchMapping(path="/{orderId}", consumes="application/json")
public Order patchOrder(@PathVariable("orderId") Long orderId,
                        @RequestBody Order patch) {
  
  Order order = repo.findById(orderId).get();
  if (patch.getDeliveryName() != null) {
    order.setDeliveryName(patch.getDeliveryName());
  }
  if (patch.getDeliveryStreet() != null) {
    order.setDeliveryStreet(patch.getDeliveryStreet());
  }
  if (patch.getDeliveryCity() != null) {
    order.setDeliveryCity(patch.getDeliveryCity());
  }
  if (patch.getDeliveryState() != null) {
    order.setDeliveryState(patch.getDeliveryState());
  }
  if (patch.getDeliveryZip() != null) {
    order.setDeliveryZip(patch.getDeliveryState());
  }
  if (patch.getCcNumber() != null) {
    order.setCcNumber(patch.getCcNumber());
  }
  if (patch.getCcExpiration() != null) {
    order.setCcExpiration(patch.getCcExpiration());
  }
  if (patch.getCcCVV() != null) {
    order.setCcCVV(patch.getCcCVV());
  }
  return repo.save(order);
}
 
@PatchMapping(path="/{orderId}", consumes="application/json")
public Order patchOrder(@PathVariable("orderId") Long orderId,
                        @RequestBody Order patch) {

  Order order = repo.findById(orderId).get();
  if (patch.getDeliveryName() != null) {
    order.setDeliveryName(patch.getDeliveryName());
  }
  if (patch.getDeliveryStreet() != null) {
    order.setDeliveryStreet(patch.getDeliveryStreet());
  }
  if (patch.getDeliveryCity() != null) {
    order.setDeliveryCity(patch.getDeliveryCity());
  }
  if (patch.getDeliveryState() != null) {
    order.setDeliveryState(patch.getDeliveryState());
  }
  if (patch.getDeliveryZip() != null) {
    order.setDeliveryZip(patch.getDeliveryState());
  }
  if (patch.getCcNumber() != null) {
    order.setCcNumber(patch.getCcNumber());
  }
  if (patch.getCcExpiration() != null) {
    order.setCcExpiration(patch.getCcExpiration());
  }
  if (patch.getCcCVV() != null) {
    order.setCcCVV(patch.getCcCVV());
  }
  return repo.save(order);
}
 
@PatchMapping(path="/{orderId}", consumes="application/json")
public Order patchOrder(@PathVariable("orderId") Long orderId,
                        @RequestBody Order patch) {
  
  Order order = repo.findById(orderId).get();
  if (patch.getDeliveryName() != null) {
    order.setDeliveryName(patch.getDeliveryName());
  }
  if (patch.getDeliveryStreet() != null) {
    order.setDeliveryStreet(patch.getDeliveryStreet());
  }
  if (patch.getDeliveryCity() != null) {
    order.setDeliveryCity(patch.getDeliveryCity());
  }
  if (patch.getDeliveryState() != null) {
    order.setDeliveryState(patch.getDeliveryState());
  }
  if (patch.getDeliveryZip() != null) {
    order.setDeliveryZip(patch.getDeliveryState());
  }
  if (patch.getCcNumber() != null) {
    order.setCcNumber(patch.getCcNumber());
  }
  if (patch.getCcExpiration() != null) {
    order.setCcExpiration(patch.getCcExpiration());
  }
  if (patch.getCcCVV() != null) {
    order.setCcCVV(patch.getCcCVV());
  }
  return repo.save(order);
}
 
/**
 * Elide [PATCH] controller.
 */
@PatchMapping(value = "/**", consumes = JSON_API_CONTENT_TYPE)
public ResponseEntity<String> elidePatch(@RequestBody String body,
    HttpServletRequest request, Principal authentication) {
  ElideResponse response = elide.patch(JSON_API_CONTENT_TYPE, JSON_API_CONTENT_TYPE,
      getJsonApiPath(request, elideProperties.getPrefix()), body, authentication);
  return ResponseEntity.status(response.getResponseCode()).body(response.getBody());
}
 
@PatchMapping("/{quickInputId}")
public List<JSONDocument> processChanges(
		@PathVariable("windowId") final String windowIdStr,
		@PathVariable("documentId") final String documentIdStr,
		@PathVariable("tabId") final String tabIdStr,
		@PathVariable("quickInputId") final String quickInputIdStr,
		@RequestBody final List<JSONDocumentChangedEvent> events)
{
	userSession.assertLoggedIn();

	final QuickInputPath quickInputPath = QuickInputPath.of(windowIdStr, documentIdStr, tabIdStr, quickInputIdStr);
	return Execution.callInNewExecution("quickInput-writable-" + quickInputPath, () -> {
		final IDocumentChangesCollector changesCollector = Execution.getCurrentDocumentChangesCollectorOrNull();

		forQuickInputWritable(quickInputPath, changesCollector, quickInput -> {
			quickInput.processValueChanges(events);

			changesCollector.setPrimaryChange(quickInput.getDocumentPath());
			return null; // void
		});

		// Extract and send websocket events
		final List<JSONDocument> jsonDocumentEvents = JSONDocument.ofEvents(changesCollector, newJSONDocumentOptions());
		websocketPublisher.convertAndPublish(jsonDocumentEvents);

		return jsonDocumentEvents;
	});
}
 
点击广告?(赏赐笔者)
 类方法