本文整理汇总了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);
}
示例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());
}
示例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;
}
示例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);
}
示例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)));
}
示例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());
});
}
示例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());
}
示例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);
}
示例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());
});
}
示例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);
}
示例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;
}
示例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