use of org.springframework.web.bind.annotation.PatchMapping in project incubator-servicecomb-java-chassis by apache.
the class PatchMappingMethodAnnotationProcessor method process.
@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");
}
}
use of org.springframework.web.bind.annotation.PatchMapping in project metasfresh-webui-api by metasfresh.
the class ViewRowEditRestController method patchRow.
@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());
}
use of org.springframework.web.bind.annotation.PatchMapping in project metasfresh-webui-api by metasfresh.
the class BoardRestController method patchCard.
@PatchMapping("/{boardId}/card/{cardId}")
public JSONBoardCard patchCard(@PathVariable("boardId") final int boardId, @PathVariable("cardId") final int cardId, @RequestBody final List<JSONDocumentChangedEvent> changes) {
userSession.assertLoggedIn();
final BoardCard card = boardsRepo.changeCard(boardId, cardId, createBoardCardChangeRequest(changes));
return JSONBoardCard.of(card, userSession.getAD_Language());
}
use of org.springframework.web.bind.annotation.PatchMapping in project metasfresh-webui-api by metasfresh.
the class ASIRestController method processChanges.
@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());
});
}
use of org.springframework.web.bind.annotation.PatchMapping in project metasfresh-webui-api by metasfresh.
the class MenuRestController method patchNode.
@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);
}
Aggregations