当前位置: 首页>>代码示例>>Java>>正文


Java PatchMapping类代码示例

本文整理汇总了Java中org.springframework.web.bind.annotation.PatchMapping的典型用法代码示例。如果您正苦于以下问题:Java PatchMapping类的具体用法?Java PatchMapping怎么用?Java PatchMapping使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PatchMapping类属于org.springframework.web.bind.annotation包,在下文中一共展示了PatchMapping类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
  PatchMapping mappingAnnotation = (PatchMapping) annotation;
  Operation operation = operationGenerator.getOperation();

  // path/value是等同的
  this.processPath(mappingAnnotation.path(), operationGenerator);
  this.processPath(mappingAnnotation.value(), operationGenerator);
  this.processMethod(RequestMethod.PATCH, operationGenerator);
  this.processConsumes(mappingAnnotation.consumes(), operation);
  this.processProduces(mappingAnnotation.produces(), operation);

  if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
      && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
    throw new Error("HttpMethod must not both be empty in class and method");
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:18,代码来源:PatchMappingMethodAnnotationProcessor.java

示例2: patchRootDocument

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
/**
 * 
 * @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);
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:24,代码来源:WindowRestController.java

示例3: patchUser

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@PatchMapping("/{id}")
public ResponseEntity patchUser(@PathVariable Long id, @RequestBody JsonPatch jsonPatch) {
  return this.userService
      .getUserByID(id)
      .map(existing -> {
        try {
          JsonNode patched = jsonPatch.apply(objectMapper.convertValue(existing, JsonNode.class));

          UserDTO patchedUser = objectMapper.treeToValue(patched, UserDTO.class);
          // TODO add patched operations
          return ResponseEntity.ok(this.userService.update(patchedUser));
        } catch (JsonPatchException | JsonProcessingException e) {
          return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
        }
      })
      .orElse(ResponseEntity.notFound().build());
}
 
开发者ID:empt-ak,项目名称:meditor,代码行数:18,代码来源:UserRestController.java

示例4: workspaces

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@ApiOperation(value = "Start an existing workspace. Stop all other workspaces (only one workspace can be running at a time)")
@PatchMapping("/workspace/{name}")
public Workspace startExisting(@PathVariable String name, @RequestParam String masterUrl,
        @RequestParam String namespace,
        @ApiParam(value = "Keycloak token", required = true) @RequestHeader("Authorization") String keycloakToken)
        throws IOException, URISyntaxException, RouteNotFoundException, StackNotFoundException,
        GitHubOAthTokenException, ProjectCreationException, KeycloakException, WorkspaceNotFound {

    KeycloakTokenValidator.validate(keycloakToken);

    String openShiftToken = keycloakClient.getOpenShiftToken(keycloakToken);
    String gitHubToken = keycloakClient.getGitHubToken(keycloakToken);
    String cheServerURL = openShiftClientWrapper.getCheServerUrl(masterUrl, namespace, openShiftToken, keycloakToken);

    Workspace workspace = workspaceClient.startWorkspace(cheServerURL, name, masterUrl, namespace, openShiftToken, keycloakToken);
    setGitHubOAthTokenAndCommitterInfo(cheServerURL, gitHubToken, keycloakToken);
    return workspace;
}
 
开发者ID:redhat-developer,项目名称:che-starter,代码行数:19,代码来源:WorkspaceController.java

示例5: update

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
/**
 * @api {patch} /credentials/:name Update
 * @apiParam {String} name Credential name to update
 *
 * @apiParamExample {multipart} RSA-Multipart-Body:
 *  the same as create
 *
 * @apiGroup Credenital
 */
@PatchMapping(path = "/{name}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@WebSecurity(action = Actions.ADMIN_UPDATE)
public Credential update(@PathVariable String name,
                         @RequestParam(name = "detail") String detailJson,
                         @RequestPart(name = "android-file", required = false) MultipartFile androidFile,
                         @RequestPart(name = "p12-files", required = false) MultipartFile[] p12Files,
                         @RequestPart(name = "pp-files", required = false) MultipartFile[] ppFiles) {

    // check name is existed
    if (!credentialService.existed(name)) {
        throw new IllegalParameterException("Credential name does not existed");
    }

    CredentialDetail detail = jsonConverter.getGsonForReader().fromJson(detailJson, CredentialDetail.class);
    return createOrUpdate(name, detail, androidFile, p12Files, ppFiles);
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:26,代码来源:CredentialController.java

示例6: saveOrUpdate

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@Authorize(action = {Permission.ACTION_UPDATE, Permission.ACTION_ADD}, logical = Logical.AND)
@PatchMapping
@ApiOperation("新增或者修改")
default ResponseMessage<PK> saveOrUpdate(@RequestBody M data) {
    E entity = getService().createEntity();
    return ResponseMessage.ok(getService().saveOrUpdate(modelToEntity(data, entity)));
}
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:8,代码来源:UpdateController.java

示例7: processChanges

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@PatchMapping
public List<JSONDocument> processChanges(
		@PathVariable(PARAM_WindowId) final String windowIdStr //
		, @PathVariable(PARAM_ViewId) final String viewIdStr //
		, @PathVariable(PARAM_RowId) final String rowIdStr //
		, @RequestBody final List<JSONDocumentChangedEvent> events //
)
{
	userSession.assertLoggedIn();

	final ViewId viewId = ViewId.of(windowIdStr, viewIdStr);
	final DocumentId rowId = DocumentId.of(rowIdStr);
	return Execution.callInNewExecution("processChanges", () -> {
		viewsRepo.getView(viewId)
				.getById(rowId)
				.getAttributes()
				.processChanges(events);
		return JSONDocument.ofEvents(Execution.getCurrentDocumentChangesCollectorOrNull(), newJSONOptions());
	});
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:21,代码来源:ViewRowAttributesRestController.java

示例8: patchRow

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@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);
	return JSONViewRow.ofRow(row, rowOverrides, userSession.getAD_Language());
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:21,代码来源:ViewRowEditRestController.java

示例9: patchIncludedDocument

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@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);
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:20,代码来源:WindowRestController.java

示例10: processChanges

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@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", () -> {
		final IDocumentChangesCollector changesCollector = Execution.getCurrentDocumentChangesCollectorOrNull();
		asiRepo.processASIDocumentChanges(asiDocId, events, changesCollector);
		return JSONDocument.ofEvents(changesCollector, newJsonOpts());
	});
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:17,代码来源:ASIRestController.java

示例11: patchNode

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@PatchMapping("/node/{nodeId}")
public List<JSONMenuNode> patchNode(@PathVariable(PARAM_NodeId) final String nodeId, @RequestBody 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);
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:22,代码来源:MenuRestController.java

示例12: updateServiceInstance

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@PatchMapping(value = {
		"/{cfInstanceId}/v2/service_instances/{instanceId}",
		"/v2/service_instances/{instanceId}"
})
public ResponseEntity<?> updateServiceInstance(@PathVariable Map<String, String> pathVariables,
											   @PathVariable("instanceId") String serviceInstanceId,
											   @RequestParam(value = ASYNC_REQUEST_PARAMETER, required = false) boolean acceptsIncomplete,
											   @RequestHeader(value = API_INFO_LOCATION_HEADER, required = false) String apiInfoLocation,
											   @RequestHeader(value = ORIGINATING_IDENTITY_HEADER, required = false) String originatingIdentityString,
											   @Valid @RequestBody UpdateServiceInstanceRequest request) {
	ServiceDefinition serviceDefinition = getServiceDefinition(request.getServiceDefinitionId());

	request.setServiceInstanceId(serviceInstanceId);
	request.setServiceDefinition(serviceDefinition);
	setCommonRequestFields(request, pathVariables.get("cfInstanceId"), apiInfoLocation,
			originatingIdentityString, acceptsIncomplete);

	log.debug("Updating a service instance: request={}", request);

	UpdateServiceInstanceResponse response = service.updateServiceInstance(request);

	log.debug("Updating a service instance succeeded: serviceInstanceId={}, response={}",
			serviceInstanceId, response);

	return new ResponseEntity<>(response, response.isAsync() ? HttpStatus.ACCEPTED : HttpStatus.OK);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry-service-broker,代码行数:27,代码来源:ServiceInstanceController.java

示例13: findMappingAnnotation

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
Annotation findMappingAnnotation(AnnotatedElement element) {
  Annotation mappingAnnotation = element.getAnnotation(RequestMapping.class);

  if (mappingAnnotation == null) {
    mappingAnnotation = element.getAnnotation(GetMapping.class);

    if (mappingAnnotation == null) {
      mappingAnnotation = element.getAnnotation(PostMapping.class);

      if (mappingAnnotation == null) {
        mappingAnnotation = element.getAnnotation(PutMapping.class);

        if (mappingAnnotation == null) {
          mappingAnnotation = element.getAnnotation(DeleteMapping.class);

          if (mappingAnnotation == null) {
            mappingAnnotation = element.getAnnotation(PatchMapping.class);
          }
        }
      }
    }
  }

  if (mappingAnnotation == null) {
    if (element instanceof Method) {
      Method method = (Method) element;
      mappingAnnotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);
    } else {
      Class<?> clazz = (Class<?>) element;
      mappingAnnotation = AnnotationUtils.findAnnotation(clazz, RequestMapping.class);
    }
  }

  return mappingAnnotation;
}
 
开发者ID:mental-party,项目名称:meparty,代码行数:36,代码来源:RestApiProxyInvocationHandler.java

示例14: canProcess

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@Override
public boolean canProcess(Method method) {
  return method.getAnnotation(RequestMapping.class) != null ||
      method.getAnnotation(GetMapping.class) != null ||
      method.getAnnotation(PutMapping.class) != null ||
      method.getAnnotation(PostMapping.class) != null ||
      method.getAnnotation(PatchMapping.class) != null ||
      method.getAnnotation(DeleteMapping.class) != null;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:10,代码来源:SpringmvcSwaggerGeneratorContext.java

示例15: initMethodAnnotationMgr

import org.springframework.web.bind.annotation.PatchMapping; //导入依赖的package包/类
@Override
protected void initMethodAnnotationMgr() {
  super.initMethodAnnotationMgr();

  methodAnnotationMgr.register(RequestMapping.class, new RequestMappingMethodAnnotationProcessor());
  methodAnnotationMgr.register(GetMapping.class, new GetMappingMethodAnnotationProcessor());
  methodAnnotationMgr.register(PutMapping.class, new PutMappingMethodAnnotationProcessor());
  methodAnnotationMgr.register(PostMapping.class, new PostMappingMethodAnnotationProcessor());
  methodAnnotationMgr.register(PatchMapping.class, new PatchMappingMethodAnnotationProcessor());
  methodAnnotationMgr.register(DeleteMapping.class, new DeleteMappingMethodAnnotationProcessor());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:12,代码来源:SpringmvcSwaggerGeneratorContext.java


注:本文中的org.springframework.web.bind.annotation.PatchMapping类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。