use of io.swagger.annotations.ApiImplicitParams in project plumdo-work by wengwh.
the class FormModelResource method updateFormModel.
@ApiOperation(value = "更新表单模型", notes = "根据表单模型的id来指定更新对象,并根据传过来的modelRequest信息来更新表单模型")
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "表单模型ID", required = true, dataType = "Long", paramType = "path"), @ApiImplicitParam(name = "modelRequest", value = "表单模型请求实体modelRequest", required = true, dataType = "FormModelRequest") })
@RequestMapping(value = "/form-models/{id}", method = RequestMethod.PUT, produces = "application/json")
@ResponseStatus(value = HttpStatus.OK)
public FormModelResponse updateFormModel(@PathVariable Long id, @RequestBody FormModelRequest modelRequest) {
FormModel formModel = getFormModelFromRequest(id);
if (modelRequest.getName() != null) {
formModel.setName(modelRequest.getName());
}
if (modelRequest.getKey() != null) {
formModel.setKey(modelRequest.getKey());
}
if (modelRequest.getCategory() != null) {
formModel.setCategory(modelRequest.getCategory());
}
if (modelRequest.getTenantId() != null) {
formModel.setTenantId(modelRequest.getTenantId());
}
formModelRepository.save(formModel);
return responseFactory.createFormModelResponse(formModel);
}
use of io.swagger.annotations.ApiImplicitParams in project plumdo-work by wengwh.
the class FormModelEditorResource method saveEditorJson.
@ApiOperation(value = "保存表单模型设计内容", notes = "根据传入的editorJson来保存表单模型设计内容")
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "表单模型ID", required = true, dataType = "Long", paramType = "path"), @ApiImplicitParam(name = "editorJson", value = "表单模型设计内容", required = true, dataType = "String") })
@RequestMapping(value = "/form-models/{id}/json", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.OK)
public FormModelResponse saveEditorJson(@PathVariable Long id, @RequestBody String editorJson) throws UnsupportedEncodingException {
FormModel formModel = getFormModelFromRequest(id);
formModel.setEditorSourceBytes(editorJson.getBytes("utf-8"));
formModelRepository.save(formModel);
return responseFactory.createFormModelResponse(formModel);
}
use of io.swagger.annotations.ApiImplicitParams in project incubator-servicecomb-java-chassis by apache.
the class ApiImplicitParamsClassProcessor method process.
@Override
public void process(Object annotation, SwaggerGenerator swaggerGenerator) {
ApiImplicitParams apiImplicitParamsAnnotation = (ApiImplicitParams) annotation;
ClassAnnotationProcessor processor = swaggerGenerator.getContext().findClassAnnotationProcessor(ApiImplicitParam.class);
for (ApiImplicitParam paramAnnotation : apiImplicitParamsAnnotation.value()) {
processor.process(paramAnnotation, swaggerGenerator);
}
}
use of io.swagger.annotations.ApiImplicitParams in project incubator-servicecomb-java-chassis by apache.
the class ApiImplicitParamsMethodProcessor method process.
@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
ApiImplicitParams apiImplicitParamsAnnotation = (ApiImplicitParams) annotation;
MethodAnnotationProcessor processor = operationGenerator.getContext().findMethodAnnotationProcessor(ApiImplicitParam.class);
for (ApiImplicitParam paramAnnotation : apiImplicitParamsAnnotation.value()) {
processor.process(paramAnnotation, operationGenerator);
}
}
use of io.swagger.annotations.ApiImplicitParams in project indy by Commonjava.
the class DeprecatedStoreAdminHandler method store.
/*
* (non-Javadoc)
* @see org.commonjava.indy.core.rest.admin.DeployPointAdminResource#store(java.lang.String)
*/
@ApiOperation("Update an existing store")
@ApiResponses({ @ApiResponse(code = 200, message = "The store was updated"), @ApiResponse(code = 400, message = "The store specified in the body JSON didn't match the URL parameters") })
@ApiImplicitParams({ @ApiImplicitParam(allowMultiple = false, paramType = "body", name = "body", required = true, dataType = "org.commonjava.indy.model.core.ArtifactStore", value = "The artifact store definition JSON") })
@Path("/{name}")
@PUT
@Consumes(ApplicationContent.application_json)
public Response store(@ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String type, @ApiParam(required = true) @PathParam("name") final String name, @Context final HttpServletRequest request, @Context final SecurityContext securityContext) {
String altPath = Paths.get(MavenPackageTypeDescriptor.MAVEN_ADMIN_REST_BASE_PATH, type, name).toString();
Consumer<Response.ResponseBuilder> modifier = (rb) -> responseHelper.markDeprecated(rb, altPath);
final StoreType st = StoreType.get(type);
Response response = null;
String json = null;
try {
json = IOUtils.toString(request.getInputStream());
json = objectMapper.patchLegacyStoreJson(json);
} catch (final IOException e) {
final String message = "Failed to read " + st.getStoreClass().getSimpleName() + " from request body.";
logger.error(message, e);
response = responseHelper.formatResponse(e, message, modifier);
}
if (response != null) {
return response;
}
ArtifactStore store = null;
try {
store = objectMapper.readValue(json, st.getStoreClass());
} catch (final IOException e) {
final String message = "Failed to parse " + st.getStoreClass().getSimpleName() + " from request body.";
logger.error(message, e);
response = responseHelper.formatResponse(e, message, modifier);
}
if (response != null) {
return response;
}
if (!name.equals(store.getName())) {
response = responseHelper.markDeprecated(Response.status(Status.BAD_REQUEST).entity(String.format("Store in URL path is: '%s' but in JSON it is: '%s'", name, store.getName())), altPath).build();
}
try {
String user = securityManager.getUser(securityContext, request);
logger.info("Storing: {}", store);
if (adminController.store(store, user, false)) {
response = responseHelper.markDeprecated(ok(), altPath).build();
} else {
logger.warn("{} NOT modified!", store);
response = responseHelper.markDeprecated(notModified(), altPath).build();
}
} catch (final IndyWorkflowException e) {
logger.error(e.getMessage(), e);
response = responseHelper.formatResponse(e, modifier);
}
return response;
}
Aggregations