@POST @Path("{botId}") @ApiResponse(code = 200, responseHeaders = { @ResponseHeader(name = "location", response = URI.class) }, message = "returns location of the exported ZIP file to be downloaded") Response exportBot(@PathParam("botId") String botId, @ApiParam(name = "botVersion", required = true, format = "integer", example = "1") @QueryParam("botVersion") @DefaultValue("1") Integer botVersion); }
public static ResponseHeaderConfig convert(ResponseHeader responseHeader) { if (StringUtils.isEmpty(responseHeader.name())) { return null; } ResponseHeaderConfig config = new ResponseHeaderConfig(); config.setName(responseHeader.name()); config.setDescription(responseHeader.description()); config.setResponseClass(responseHeader.response()); config.setResponseContainer(responseHeader.responseContainer()); return config; }
@ApiOperation(value = "Return the configuration icon file in png format", tags = "icon", responseHeaders = { @ResponseHeader(name = HEADER_TALEND_COMPONENT_SERVER_ERROR, description = ERROR_HEADER_DESC, response = Boolean.class) }) @GET @Path("icon/{id}") @Produces({ APPLICATION_JSON, APPLICATION_OCTET_STREAM }) public CompletionStage<byte[]> getConfigurationIconById(@PathParam("id") final String id, @Context final HttpServletRequest request) { return componentClient.getFamilyIconById(id, placeholderProviderFactory.newProvider(request)); }
@RequestMapping(value = "/{accessId}", method = RequestMethod.DELETE) @ApiOperation(value ="Delete bank access", notes= "Deletes the bank access with the given id, also deletes all associated credentials, accounts and bookings. Returns the location url for loading the updated user data object.") @ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, responseHeaders={@ResponseHeader(name="location", description="Url for loading the updated user data file")}, message = "Bank access with provided id successfuly deleted"), @ApiResponse(code = HttpServletResponse.SC_GONE, responseHeaders={@ResponseHeader(name="location", description="Url for loading the updated user data file")}, message = "Bank access with provided id is gone"), @ApiResponse(code = HttpServletResponse.SC_UNAUTHORIZED, message = ErrorConstants.ERR_HTTP_CODE_UNAUTHENTICATED_DOC, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_PRECONDITION_FAILED, message = UserNotFoundException.RENDERED_MESSAGE_KEY, response = MultibankingError.class) }) public HttpEntity<Void> deleteBankAccess( @ApiParam(name = "accessId", required=true, value = "The identifier of the bank access to delete.", example="3c149076-13c4-4190-ace3-e30bf8f61526") @PathVariable String accessId) { if (bankAccessService.deleteBankAccess(accessId)) { LOGGER.debug("Bank Access [{}] deleted.", accessId); return new ResponseEntity<Void>(userDataLocationHeader(), HttpStatus.NO_CONTENT); } else { return new ResponseEntity<Void>(HttpStatus.GONE); } } }
@ApiOperation(value = "Return all the available root configuration (Data store like) from the component server", notes = "Every configuration has an icon. " + "In the response an icon key is returned. this icon key can be one of the bundled icons or a custom one. " + "The consumer of this endpoint will need to check if the icon key is in the icons bundle " + "otherwise the icon need to be gathered using the `familyId` from this endpoint `configurations/{id}/icon`", response = Nodes.class, tags = { "configurations", "datastore" }, produces = "application/json", responseHeaders = { @ResponseHeader(name = HEADER_TALEND_COMPONENT_SERVER_ERROR, description = ERROR_HEADER_DESC, response = Boolean.class) }) @GET public CompletionStage<Nodes> getRootConfig(@Context final HttpServletRequest request) { final String language = getLang(request); final Function<String, String> placeholderProvider = placeholderProviderFactory.newProvider(request); return findRoots(new HttpRequestContext(language, placeholderProvider, request)); }
@ApiResponses(value = { @ApiResponse( code = HttpServletResponse.SC_FOUND, message = "Redirect to IDP logout page", responseHeaders = { @ResponseHeader( name = "Location", response = String.class, description = "Url to IDP's logout page" ), @ResponseHeader( name = "Set-Cookie", response = String.class, description = TokenConstants.ACCESS_TOKEN_COOKIE_NAME + "=null; Path=/; Secure; HttpOnly; Max-Age=0" ), @ResponseHeader(
@POST @Consumes("application/zip") @ApiImplicitParam(type = "body", paramType = "body", required = true) @ApiResponse(code = 200, responseHeaders = { @ResponseHeader(name = "location", response = URI.class) }, message = "returns reference to the newly created (imported) bot") void importBot(InputStream zippedBotConfigFiles, @Suspended AsyncResponse response); }
for (ApiResponse swaggerResponse : swaggerResponses.value()) { ResponseCode rc = new ResponseCode(this); rc.setCode(swaggerResponse.code()); rc.setCondition(swaggerResponse.message()); io.swagger.annotations.ResponseHeader[] headers = swaggerResponse.responseHeaders(); for (io.swagger.annotations.ResponseHeader header : headers) { if (!header.name().isEmpty()) { rc.setAdditionalHeader(header.name(), header.description());
public static Map<String, Header> headers(ResponseHeader[] responseHeaders) { Map<String, Header> headers = newHashMap(); for (ResponseHeader each : from(newArrayList(responseHeaders)).filter(not(emptyOrVoid()))) { headers.put(each.name(), new Header(each.name(), each.description(), headerModel(each))); } return headers; }
private static ModelReference headerModel(ResponseHeader each) { ModelReference modelReference; String typeName = fromNullable(typeNameFor(each.response())).or("string"); if (isNullOrEmpty(each.responseContainer())) { modelReference = new ModelRef(typeName); } else { modelReference = new ModelRef(each.responseContainer(), new ModelRef(typeName)); } return modelReference; } }
@ResponseHeaders({@ResponseHeader(name = "h1", response = String.class), @ResponseHeader(name = "h2", response = String.class)}) @RequestMapping(path = "/responseEntity", method = RequestMethod.POST) public ResponseEntity<Date> responseEntity(InvocationContext c1, @RequestAttribute("date") Date date) { HttpHeaders headers = new HttpHeaders(); headers.add("h1", "h1v " + c1.getContext().toString()); InvocationContext c2 = ContextUtils.getInvocationContext(); headers.add("h2", "h2v " + c2.getContext().toString()); return new ResponseEntity<Date>(date, headers, HttpStatus.ACCEPTED); }
@POST @Path("persistence/save/{formId}") @ApiOperation(value = "Saves a configuration based on a form identifier.", response = EntityRef.class, produces = "application/json", tags = { "form", "ui spec", "configurations", "datastore", "dataset", "persistence" }, responseHeaders = @ResponseHeader(name = HEADER_TALEND_COMPONENT_SERVER_ERROR, description = ERROR_HEADER_DESC, response = Boolean.class)) public CompletionStage<EntityRef> postConfigurationFromFormId(@Context final HttpServletRequest request, @PathParam("formId") final String formId, final JsonObject payload) { return doSave(request, getLang(request), payload, formId); }
@RequestMapping(value = "/{accessId}", method = RequestMethod.DELETE) @ApiOperation(value ="Delete bank access", notes= "Deletes the bank access with the given id, also deletes all associated credentials, accounts and bookings. Returns the location url for loading the updated user data object.") @ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, responseHeaders={@ResponseHeader(name="location", description="Url for loading the updated user data file")}, message = "Bank access with provided id successfuly deleted"), @ApiResponse(code = HttpServletResponse.SC_GONE, responseHeaders={@ResponseHeader(name="location", description="Url for loading the updated user data file")}, message = "Bank access with provided id is gone"), @ApiResponse(code = HttpServletResponse.SC_UNAUTHORIZED, message = ErrorConstants.ERR_HTTP_CODE_UNAUTHENTICATED_DOC, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_PRECONDITION_FAILED, message = UserNotFoundException.RENDERED_MESSAGE_KEY, response = MultibankingError.class) }) public HttpEntity<Void> deleteBankAccess( @ApiParam(name = "accessId", required=true, value = "The identifier of the bank access to delete.", example="3c149076-13c4-4190-ace3-e30bf8f61526") @PathVariable String accessId) { if (bankAccessService.deleteBankAccess(accessId)) { LOGGER.debug("Bank Access [{}] deleted.", accessId); return new ResponseEntity<Void>(userDataLocationHeader(), HttpStatus.NO_CONTENT); } else { return new ResponseEntity<Void>(HttpStatus.GONE); } } }
@ApiResponse(code = 200, response = User.class, message = "") @ResponseHeaders({@ResponseHeader(name = "h1", response = String.class), @ResponseHeader(name = "h2", response = String.class)}) @RequestMapping(path = "/cseResponse", method = RequestMethod.GET) public Response cseResponse(InvocationContext c1) { Response response = Response.createSuccess(Status.ACCEPTED, new User()); Headers headers = response.getHeaders(); headers.addHeader("h1", "h1v " + c1.getContext().toString()); InvocationContext c2 = ContextUtils.getInvocationContext(); headers.addHeader("h2", "h2v " + c2.getContext().toString()); return response; }
@ApiOperation(value = "Return a form description ( Ui Spec ) without a specific configuration ", response = Nodes.class, produces = "application/json", tags = { "form", "ui spec", "configurations", "datastore", "dataset" }, responseHeaders = { @ResponseHeader(name = HEADER_TALEND_COMPONENT_SERVER_ERROR, description = ERROR_HEADER_DESC, response = Boolean.class) }) @GET @Path("form/initial/{type}") public CompletionStage<UiNode> getInitialForm(@PathParam("type") final String type, @Context final HttpServletRequest request) { if (type == null || type.isEmpty()) { throw new WebApplicationException(Response .status(Response.Status.BAD_REQUEST) .entity(new ProxyErrorPayload(ProxyErrorDictionary.BAD_CONFIGURATION_TYPE.name(), "No configuration type passed")) .type(APPLICATION_JSON_TYPE) .build()); } final String language = getLang(request); final Function<String, String> placeholderProvider = placeholderProviderFactory.newProvider(request); return toUiSpecAndMetadata(language, placeholderProvider, CompletableFuture .completedFuture(new ConfigTypeNode(type, 0, null, type, type, type, emptySet(), new ArrayList<>(), new ArrayList<>())), true); }
@RequestMapping(method = RequestMethod.POST, consumes=MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiOperation(value="Create bank access", notes = "Creates and adds a new bank access to the list of bank accesses of this user. Returns the location url for loading the updated user data object.") @ApiResponses(value = { @ApiResponse(code = HttpServletResponse.SC_CREATED, responseHeaders={@ResponseHeader(name="location", description="Url for loading the updated user data file")}, message = "Provided bank access successfuly created. Reload user data object."), @ApiResponse(code = HttpServletResponse.SC_UNAUTHORIZED, message = ErrorConstants.ERR_HTTP_CODE_UNAUTHENTICATED_DOC, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_PRECONDITION_FAILED, message = UserNotFoundException.RENDERED_MESSAGE_KEY, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = InvalidBankAccessException.MESSAGE_DOC, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_CONFLICT, message = BankAccessAlreadyExistException.MESSAGE_DOC, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_BAD_REQUEST, message = ErrorConstants.ERR_HTTP_CODE_BAD_REQUEST_DOC, response = MultibankingError.class) }) public HttpEntity<Void> createBankaccess(@ApiParam(name = "bankAccess", required=true, value = "The bank access data containing (Bank Code, Bank name, Bank login, PIN") @RequestBody(required = true) BankAccessEntity bankAccess) { bankAccessService.createBankAccess(bankAccess); // Trigger Perform Services operations. LOGGER.debug("Bank access created for " + userId()); return new ResponseEntity<>(userDataLocationHeader(), HttpStatus.CREATED); }
if (header.name().isEmpty()) { continue; responseHeaders = new HashMap<>(); Class<?> cls = header.response(); Property responseProperty; if (header.responseContainer().equalsIgnoreCase("list")) { responseProperty = new ArrayProperty(property); } else if (header.responseContainer().equalsIgnoreCase("map")) { responseProperty = new MapProperty(property); } else { responseProperty = property; responseProperty.setDescription(header.description()); responseHeaders.put(header.name(), responseProperty);
@POST @Path("persistence/save-from-type/{type}") @ApiOperation( value = "Saves a configuration based on a type. Concretely it is the same as `/persistence/save/{formId}` " + "but the `formId` is contained into the payload itself and marked in the metadata as such.", response = EntityRef.class, produces = "application/json", tags = { "form", "ui spec", "configurations", "datastore", "dataset", "persistence" }, responseHeaders = @ResponseHeader(name = HEADER_TALEND_COMPONENT_SERVER_ERROR, description = ERROR_HEADER_DESC, response = Boolean.class)) public CompletionStage<EntityRef> postConfigurationFromType(@Context final HttpServletRequest request, @PathParam("type") final String type, final JsonObject payload) { final String lang = getLang(request); final String formId = modelEnricherService .findEnclosedFormId(type, lang, payload) .orElseThrow(() -> new WebApplicationException(Response .status(Response.Status.BAD_REQUEST) .entity(new ProxyErrorPayload(ProxyErrorDictionary.NO_CONFIGURATION_TYPE.name(), "No form identifier found in the form properties")) .build())); return doSave(request, lang, payload, formId); }
@RequestMapping(method = RequestMethod.POST, consumes=MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiOperation(value="Create bank access", notes = "Creates and adds a new bank access to the list of bank accesses of this user. Returns the location url for loading the updated user data object.") @ApiResponses(value = { @ApiResponse(code = HttpServletResponse.SC_CREATED, responseHeaders={@ResponseHeader(name="location", description="Url for loading the updated user data file")}, message = "Provided bank access successfuly created. Reload user data object."), @ApiResponse(code = HttpServletResponse.SC_UNAUTHORIZED, message = ErrorConstants.ERR_HTTP_CODE_UNAUTHENTICATED_DOC, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_PRECONDITION_FAILED, message = UserNotFoundException.RENDERED_MESSAGE_KEY, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = InvalidBankAccessException.MESSAGE_DOC, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_CONFLICT, message = BankAccessAlreadyExistException.MESSAGE_DOC, response = MultibankingError.class), @ApiResponse(code = HttpServletResponse.SC_BAD_REQUEST, message = ErrorConstants.ERR_HTTP_CODE_BAD_REQUEST_DOC, response = MultibankingError.class) }) public HttpEntity<Void> createBankaccess(@ApiParam(name = "bankAccess", required=true, value = "The bank access data containing (Bank Code, Bank name, Bank login, PIN") @RequestBody(required = true) BankAccessEntity bankAccess) { bankAccessService.createBankAccess(bankAccess); // Trigger Perform Services operations. LOGGER.debug("Bank access created for " + userId()); return new ResponseEntity<>(userDataLocationHeader(), HttpStatus.CREATED); }