Java Code Examples for org.springframework.web.bind.annotation.PatchMapping

The following examples show how to use org.springframework.web.bind.annotation.PatchMapping. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 *
 * @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);
}
 
Example 2
@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);
}
 
Example 3
@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);
}
 
Example 4
@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);
}
 
Example 5
Source Project: spring-openapi   Source File: OperationsTransformer.java    License: MIT License 5 votes vote down vote up
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));
}
 
Example 6
Source Project: spring-openapi   Source File: OperationsTransformer.java    License: MIT License 5 votes vote down vote up
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));
}
 
Example 7
Source Project: spring-openapi   Source File: DummyController.java    License: MIT License 5 votes vote down vote up
@PatchMapping(path = "/bodyToBeIgnored/{variable}")
@OpenApiIgnore
public ValidationDummy methodToBeIgnored(
		@PathVariable String variable,
		@RequestBody @OpenApiIgnore List<ValidationDummy> validationDummies) {
	return null;
}
 
Example 8
Source Project: spring-openapi   Source File: OperationsTransformer.java    License: MIT License 5 votes vote down vote up
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));
}
 
Example 9
Source Project: spring-openapi   Source File: OperationsTransformer.java    License: MIT License 5 votes vote down vote up
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));
}
 
Example 10
@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());
}
 
Example 11
@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());
}
 
Example 12
Source Project: ZTuoExchange_framework   Source File: WithdrawRecordController.java    License: MIT License 5 votes vote down vote up
@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"));
}
 
Example 13
Source Project: ZTuoExchange_framework   Source File: WithdrawRecordController.java    License: MIT License 5 votes vote down vote up
@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"));
}
 
Example 14
@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));
}
 
Example 15
Source Project: ZTuoExchange_framework   Source File: BusinessAuthController.java    License: MIT License 5 votes vote down vote up
@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();
}
 
Example 16
Source Project: cymbal   Source File: ClusterScaleController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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();
    }
}
 
Example 17
Source Project: cymbal   Source File: ConfigController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 18
Source Project: cymbal   Source File: InstanceController.java    License: Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 19
Source Project: cymbal   Source File: NodeController.java    License: Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 20
Source Project: ZTuoExchange_framework   Source File: WithdrawRecordController.java    License: MIT License 5 votes vote down vote up
@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"));
}
 
Example 21
Source Project: ZTuoExchange_framework   Source File: WithdrawRecordController.java    License: MIT License 5 votes vote down vote up
@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"));
}
 
Example 22
Source Project: ZTuoExchange_framework   Source File: WithdrawRecordController.java    License: MIT License 5 votes vote down vote up
/**
 * 单个打款 转账成功添加流水号
 *
 * @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);
}
 
Example 23
Source Project: ZTuoExchange_framework   Source File: BusinessAuthController.java    License: MIT License 5 votes vote down vote up
@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();
}
 
Example 24
@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);
}
 
Example 25
@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);
}
 
Example 26
@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);
}
 
Example 27
@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);
}
 
Example 28
@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);
}
 
Example 29
/**
 * 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());
}
 
Example 30
@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;
	});
}