@ApiOperation(value = "用户新增", notes = "用户新增", response = ResultDTO.class, tags = { "ZhihuUser", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "返回应用服务器的请求列表", response = ResultDTO.class), @ApiResponse(code = 200, message = "返回错误信息", response = ResultDTO.class) }) @RequestMapping(value = "/user/add", produces = { "application/json" }, method = RequestMethod.POST) public ResponseEntity<ResultDTO> userAddPost( @NotNull @ApiParam(value = "用户名", required = false, defaultValue = "夕阳晚晴") @RequestParam(value = "username", required = false) String username, @NotNull @ApiParam(value = "user token", required = false, defaultValue = "xi-yang-wan-qing-30") @RequestParam(value = "userToken", required = false) String userToken, @NotNull @ApiParam(value = "位置", required = false) @RequestParam(value = "location", required = false) String location, @NotNull @ApiParam(value = "行业", required = false, defaultValue = "互联网") @RequestParam(value = "business", required = false) String business, @NotNull @ApiParam(value = "性别", required = false, defaultValue = "male") @RequestParam(value = "sex", required = false) String sex, @NotNull @ApiParam(value = "企业", required = false) @RequestParam(value = "employment", required = false) String employment, @NotNull @ApiParam(value = "教育", required = false) @RequestParam(value = "education", required = false) String education, @NotNull @ApiParam(value = "用户首页url", required = false, defaultValue = "https://www.zhihu.com/people/xi-yang-wan-qing-30/activities") @RequestParam(value = "url", required = false) String url, @NotNull @ApiParam(value = "答案赞同数", required = false, defaultValue = "0") @RequestParam(value = "agrees", required = false) Integer agrees, @NotNull @ApiParam(value = "感谢数", required = false, defaultValue = "0") @RequestParam(value = "thanks", required = false) Integer thanks, @NotNull @ApiParam(value = "提问数", required = false, defaultValue = "0") @RequestParam(value = "asks", required = false) Integer asks, @NotNull @ApiParam(value = "回答数", required = false, defaultValue = "0") @RequestParam(value = "answers", required = false) Integer answers, @NotNull @ApiParam(value = "文章数", required = false, defaultValue = "0") @RequestParam(value = "posts", required = false) Integer posts, @NotNull @ApiParam(value = "关注人数", required = false, defaultValue = "1") @RequestParam(value = "followees", required = false) Integer followees, @NotNull @ApiParam(value = "粉丝数量", required = false, defaultValue = "0") @RequestParam(value = "followers", required = false) Integer followers, @NotNull @ApiParam(value = "用户唯一标识", required = false, defaultValue = "88fb5d79df5a332cf16c8f8ad659dcf4") @RequestParam(value = "hashId", required = false) String hashId);
@ApiOperation(value = "getAdaptorConfiguration", nickname = "getAdaptorConfiguration") @RequestMapping(value = "/CISCore/getAdaptorConfiguration", method = RequestMethod.GET) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = AdaptorConfigurationImpl.class), @ApiResponse(code = 400, message = "Bad Request", response = AdaptorConfigurationImpl.class), @ApiResponse(code = 500, message = "Failure", response = AdaptorConfigurationImpl.class)}) public ResponseEntity<AdaptorConfigurationImpl> getAdaptorConfiguration() { log.info("--> getAdaptorConfiguration"); AdaptorConfigurationImpl config = (AdaptorConfigurationImpl)cisCore.getAdaptorConfiguration(); HttpHeaders responseHeaders = new HttpHeaders(); log.info("getAdaptorConfiguration -->"); return new ResponseEntity<AdaptorConfigurationImpl>(config, responseHeaders, HttpStatus.OK); }
/** * Validate logins yml. * @param loginsYml logins yml * @return true if valid */ @PostMapping(value = "/logins/validate", consumes = {TEXT_PLAIN_VALUE}) @ApiOperation(value = "Validate uaa login properties format", response = UaaValidationVM.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Uaa validation result", response = UaaValidationVM.class), @ApiResponse(code = 500, message = "Internal server error")}) @SneakyThrows @Timed public UaaValidationVM validate(@RequestBody String loginsYml) { try { mapper.readValue(loginsYml, TenantLogins.class); return UaaValidationVM.builder().isValid(true).build(); } catch (JsonParseException | JsonMappingException e) { return UaaValidationVM.builder().isValid(false).errorMessage(e.getLocalizedMessage()).build(); } }
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Creates a flow", notes = "The flow id is created by the server and populated in the returned entity.", response = VersionedFlow.class ) @ApiResponses({ @ApiResponse(code = 400, message = HttpStatusMessages.MESSAGE_400), @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response createFlow( @PathParam("bucketId") @ApiParam("The bucket identifier") final String bucketId, final VersionedFlow flow) { authorizeBucketAccess(RequestAction.WRITE, bucketId); verifyPathParamsMatchBody(bucketId, flow); final VersionedFlow createdFlow = registryService.createFlow(bucketId, flow); permissionsService.populateItemPermissions(createdFlow); linkService.populateFlowLinks(createdFlow); return Response.status(Response.Status.OK).entity(createdFlow).build(); }
@POST @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) @ApiOperation(value = "Authenticate a user", notes = "Verify a user credentials") @ApiResponses(value = { @ApiResponse(code = 200, message = "user authenticated"), @ApiResponse(code = 401, message = "Wrong user or password")}) public Response authenticate(Credentials credentials) { if (UsersDao.authenticate(credentials)) { byte[] bearer = UsersDao.getBearer(credentials); StringBuilder auth = new StringBuilder().append("Bearer ").append(PasswordStorage.toBase64(bearer)); return Response.ok() .cookie(new NewCookie("Authorization", auth.toString(), null, null, DEFAULT_VERSION, null, DEFAULT_MAX_AGE, null, true, true)) .entity(new ResponseMessage(true, "user authenticated")).build(); } else { return Response.status(UNAUTHORIZED) .entity(new ResponseMessage(false, "Username or password is incorrect")).build(); } }
@GET @Produces({"application/hal+json", "application/hal+json;concept=virtualaccount;v=1"}) @ApiOperation(value = "lists accounts", response = VirtualAccountsRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, extensions = {@Extension(name = "roles", properties = { @ExtensionProperty(name = "advisor", value = "advisors are allowed getting every virtualaccount"), @ExtensionProperty(name = "customer", value = "customer only allowed getting own locations")} )}, produces = "application/hal+json, application/hal+json;concept=locations;v=1", notes = "List all locations in a default projection, which is VirtualAccount version 1" + "Supported projections and versions are: " + "VirtualAccounts in version 1 " + "The Accept header for the default version is application/hal+json;concept=virtualaccount;v=1.0.0.... " + "The format for the default version is {....}", nickname = "listVirtualAccounts") @ApiResponses(value = { @ApiResponse(code = 415, message = "Content type not supported.") }) public Response list(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) { return accountsProducer.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request); }
@GET @Produces({APPLICATION_JSON, APPLICATION_XML}) @Path("/{id : \\d+}") @ApiOperation(value = "Get user by id", notes = "Returns user identified by is internal id") @ApiResponses(value = { @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 404, message = "User not found"), @ApiResponse(code = 500, message = "Something wrong in Server")}) public Response getById(@PathParam("id") long id) { Optional<User> userOptional = UsersDao.getById(id); if (userOptional.isPresent()) { return Response.ok().entity(userOptional.get()).build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } }
@ApiOperation(value = "Creates a Security Group", notes = "Creates a Security Group owned by Virtualization Connector provided and kicks off a " + "sync job", response = BaseJobResponse.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @Path("/{vcId}/securityGroups") @POST public Response createSecurityGroup(@Context HttpHeaders headers, @ApiParam(value = "The Virtualization Connector Id") @PathParam("vcId") Long vcId, @ApiParam(required = true) SecurityGroupDto sgDto) { logger.info("Creating Security Group ..."); this.userContext.setUser(OscAuthFilter.getUsername(headers)); this.apiUtil.setIdAndParentIdOrThrow(sgDto, null, vcId, "Security Group"); AddOrUpdateSecurityGroupRequest request = new AddOrUpdateSecurityGroupRequest(); request.setDto(sgDto); return this.apiUtil.getResponseForBaseRequest(this.addSecurityGroupService, request); }
@ApiOperation( value = "Find speaker by ID", notes = "For valid response try integer IDs with value 1 ... 999. Other values will generated exceptions", response = SpeakerResource.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieve the speaker.", response = SpeakerResource.class), @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Speaker not found"), @ApiResponse(code = 500, message = "Internal server error.")}) @GetMapping(value = "/{id}") public ResponseEntity<SpeakerResource> getSpeaker( @ApiParam(value = "ID of speaker that needs to be fetched", allowableValues = "range[1,999]", required = true) @PathVariable long id) { return speakerRepository.findOne(id) .map(speaker -> ResponseEntity.ok(new SpeakerResource(speaker))) .orElse(new ResponseEntity(HttpStatus.NOT_FOUND)); }
@ApiOperation( value = "Updates an Manager Connector. If we are unable to connect to the endpoint(IP) using the credentials provided, this call will fail.", notes = "Creates an Manager Connector and sync's it immediately. " + "If we are unable to connect to the manager using the credentials provided, this call will fail." + "To skip validation of IP and credentials 'skipRemoteValidation' flag can be used.", response = BaseJobResponse.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error validating the information", response = ErrorCodeDto.class) }) @Path("/{applianceManagerConnectorId}") @PUT public Response updateApplianceManagerConnector(@Context HttpHeaders headers, @ApiParam(value = "Id of the Appliance Manager Connector", required = true) @PathParam("applianceManagerConnectorId") Long amcId, @ApiParam(required = true) ApplianceManagerConnectorRequest amcRequest) { logger.info("Updating Appliance Manager Connector " + amcId); this.userContext.setUser(OscAuthFilter.getUsername(headers)); this.apiUtil.setIdOrThrow(amcRequest, amcId, "Appliance Manager Connector"); Response responseForBaseRequest = this.apiUtil.getResponseForBaseRequest(this.updateService, new DryRunRequest<>(amcRequest, amcRequest.isSkipRemoteValidation())); return responseForBaseRequest; }
@GET @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Get list of all available configuration files") @ApiResponses(value = { @ApiResponse(code = 207, message = "Multiple responses available"), @ApiResponse(code = 400, message = "Request contains invalid parameters")}) public Response getConfig(@QueryParam("scope") String scope, @QueryParam("nodeId") List<String> nodeId) { ApiRequester apiRequester = requesterBuilder(ControllerConfigAPI.class) .httpMethod(GET) .accept(MediaType.TEXT_PLAIN) .build(); return forwardRequest(scope, apiRequester, nodeId); }
@GET @Path("/countCustomers") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get the Customer Resource.",produces=MediaType.APPLICATION_JSON, response = Long.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "CustomerCount Resource is found"), @ApiResponse(code = 404, message = "CustomerCount Resource cannot be found") }) public long countCustomer() { try { return customerService.count(); } catch (Exception e) { e.printStackTrace(); return -1; } }
@ApiOperation(value = "getOrganisationList", nickname = "getOrganisationList") @RequestMapping(value = "/CISCore/getOrganisationList", method = RequestMethod.GET) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = ResponseEntity.class), @ApiResponse(code = 400, message = "Bad Request", response = ResponseEntity.class), @ApiResponse(code = 500, message = "Failure", response = ResponseEntity.class)}) public ResponseEntity<List<Organisation>> getOrganisationList() throws CISCommunicationException { log.info("--> getOrganisationList"); List<Organisation> organisationList = new ArrayList<Organisation>(); try { organisationList = cisCore.getOrganisationList(); } catch (CISCommunicationException e) { log.error("Error executing the request: Communication Error" , e); organisationList = null; } HttpHeaders responseHeaders = new HttpHeaders(); log.info("getOrganisationList -->"); return new ResponseEntity<List<Organisation>>(organisationList, responseHeaders, HttpStatus.OK); }
@GetMapping(value = "{id}") @ApiOperation("Retrieves JSON representation of a Stored Document.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = StoredDocumentHalResource.class) }) public ResponseEntity<Object> getMetaData(@PathVariable UUID id) { StoredDocument storedDocument = auditedStoredDocumentOperationsService.readStoredDocument(id); if (storedDocument == null) { return ResponseEntity.notFound().build(); } return ResponseEntity .ok() .contentType(V1MediaType.V1_HAL_DOCUMENT_MEDIA_TYPE) .body(new StoredDocumentHalResource(storedDocument)); }
@ApiOperation(value = "getOrganisationByName", nickname = "getOrganisationByName") @RequestMapping(value = "/CISConnector/getOrganisationByName/{organisation}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "path") }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = ResponseEntity.class), @ApiResponse(code = 400, message = "Bad Request", response = ResponseEntity.class), @ApiResponse(code = 500, message = "Failure", response = ResponseEntity.class)}) public ResponseEntity<Organisation> getOrganisationByName(@PathVariable String organisation) throws CISCommunicationException { log.info("--> getOrganisationByName: " + organisation); Organisation organisationRes = null; try { organisationRes = connector.getOrganisationByName(organisation); } catch (CISCommunicationException e) { log.error("Error executing the request: Communication Error" , e); organisationRes = null; } HttpHeaders responseHeaders = new HttpHeaders(); log.info("getOrganisationByName -->"); return new ResponseEntity<Organisation>(organisationRes, responseHeaders, HttpStatus.OK); }
@GetMapping(value = "{id}/thumbnail") @ApiOperation("Streams contents of the most recent Document Content Version associated with the Stored Document.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Returns thumbnail of a file") }) @Transactional(readOnly = true) public ResponseEntity<Resource> getPreviewThumbnail(@PathVariable UUID id) { DocumentContentVersion documentContentVersion = documentContentVersionService.findMostRecentDocumentContentVersionByStoredDocumentId(id); if (documentContentVersion == null || documentContentVersion.getStoredDocument().isDeleted()) { return ResponseEntity.notFound().build(); } return ResponseEntity.ok() .contentType(MediaType.IMAGE_JPEG) .body(documentThumbnailService.generateThumbnail(documentContentVersion)); }
@ApiOperation(value = "Deletes connector configuration for external resource attributes for the given zone.", tags = { "Attribute Connector Management" }) @ResponseStatus(value = HttpStatus.NO_CONTENT) @ApiResponses(value = { @ApiResponse(code = 204, message = "Connector configuration for the given zone is successfully deleted."), @ApiResponse(code = 404, message = "Connector configuration for the given zone is not found.") }) @RequestMapping(method = DELETE, value = V1 + AcsApiUriTemplates.RESOURCE_CONNECTOR_URL) public ResponseEntity<Void> deleteResourceConnector() { try { Boolean deleted = this.service.deleteResourceConnector(); if (deleted) { return noContent(); } return notFound(); } catch (AttributeConnectorException e) { throw new RestApiException(HttpStatus.UNPROCESSABLE_ENTITY, e.getMessage(), e); } }
@ApiResponses({ @ApiResponse(code = 200, response = String.class, message = "success"), @ApiResponse(code = 400, response = String.class, message = "illegal request content"), }) @CrossOrigin @RequestMapping(value = "requests", method = GET) public ResponseEntity<SagaExecutionQueryResult> queryExecutions( @RequestParam(name = "pageIndex") String pageIndex, @RequestParam(name = "pageSize") String pageSize, @RequestParam(name = "startTime") String startTime, @RequestParam(name = "endTime") String endTime) { if (isRequestParamValid(pageIndex, pageSize, startTime, endTime)) { try { return ResponseEntity.ok(queryService.querySagaExecution(pageIndex, pageSize, startTime, endTime)); } catch (ParseException ignored) { throw new InvocationException(BAD_REQUEST, "illegal request content"); } } else { throw new InvocationException(BAD_REQUEST, "illegal request content"); } }
@ApiOperation(value = "getParticipantFromCGOR", nickname = "getParticipantFromCGOR") @RequestMapping(value = "/CISConnector/getParticipantFromCGOR/{cgorName}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "cgorName", value = "the CGOR name", required = true, dataType = "String", paramType = "path"), @ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "query") }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = Participant.class), @ApiResponse(code = 400, message = "Bad Request", response = Participant.class), @ApiResponse(code = 500, message = "Failure", response = Participant.class)}) public ResponseEntity<Participant> getParticipantFromCGOR(@PathVariable String cgorName, @QueryParam("organisation") String organisation) { log.info("--> getParticipantFromCGOR: " + cgorName); Participant participant; try { participant = connector.getParticipantFromCGOR(cgorName, organisation); } catch (CISCommunicationException e) { log.error("Error executing the request: Communication Error" , e); participant = null; } HttpHeaders responseHeaders = new HttpHeaders(); log.info("getParticipantFromCGOR -->"); return new ResponseEntity<Participant>(participant, responseHeaders, HttpStatus.OK); }
/** * Retrieves all access policies * * @return A list of access policies */ @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Gets all access policies", response = AccessPolicy.class, responseContainer = "List" ) @ApiResponses({ @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getAccessPolicies() { verifyAuthorizerIsManaged(); authorizeAccess(RequestAction.READ); List<AccessPolicy> accessPolicies = authorizationService.getAccessPolicies(); if (accessPolicies == null) { accessPolicies = Collections.emptyList(); } return generateOkResponse(accessPolicies).build(); }
@DELETE @Path("/{repo}/{bucket}/{id}") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Deletes the LXP object matching the repo/bucket/id handle") @ApiResponses(value = { @ApiResponse(code = HTTPStatus.OK, message = "The LXP was deleted"), @ApiResponse(code = HTTPStatus.INTERNAL_SERVER, message = "The LXP could not be deleted") }) public Response deleteILXP(@PathParam("repo") final String repo, @PathParam("bucket") final String buck, @PathParam("id") final String id) { try { IRepository repository = store.getRepository(repo); IBucket bucket = repository.getBucket(buck); bucket.delete(Long.parseLong(id)); String objectHandle = objectHandle(repo, buck, id); return HTTPResponses.OK("Object with handle " + objectHandle + " was deleted"); } catch (BucketException | RepositoryException e) { return HTTPResponses.INTERNAL_SERVER(); } }
@DELETE @Path("/{file}/{property}") @ApiOperation(value = "Delete a certain property of connector file") @ApiResponses(value = { @ApiResponse(code = 207, message = "Multiple responses available"), @ApiResponse(code = 400, message = "Request contains invalid parameters")}) public Response deleteConnectorProperty( @PathParam("file") String file, @PathParam("property") String property, @QueryParam("scope") String scope, @QueryParam("nodeId") List<String> nodeId) { ApiRequester apiRequester = requesterBuilder(ControllerConnectorAPI.class) .pathMethod("deleteConnectorProperty") .httpMethod(DELETE) .resolveTemplate("file", file) .resolveTemplate("property", property) .accept(MediaType.TEXT_PLAIN) .build(); return forwardRequest(scope, apiRequester, nodeId); }
@RequestMapping(path = "/releaseLock/issuer/{issuer}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ApiOperation(value = "This operation checks if the remote collection is online and reachable.") @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = DataGateError.class), @ApiResponse(code = 401, message = "Request is not authorized", response = DataGateError.class), @ApiResponse(code = 500, message = "Error processing request", response = DataGateError.class), }) public void releaseLock( @PathVariable @ApiParam("Name of the remote collection.") String collection, @PathVariable @ApiParam("The originator of the request.") String issuer) { log.debug("Validating releaseLock request for " + collection + " by " + issuer); dataGateService.validateRequest(collection); dataGateService.releaseLock(collection, issuer); log.debug("Lock released for " + collection + " by " + issuer); }
@CrossOrigin @RequestMapping(value = "/user/{id}", method = RequestMethod.GET) @ApiOperation(value = "Find organizations by user id", notes = "Returns a collection of organizations") @ApiResponses(value = { @ApiResponse(code = 404, message = "ID of user invalid") }) public List<OrganizationDTO> getOrganizationsByUser( @ApiParam(value = "userId of organizations to return", required = true) @PathVariable("id") Integer id) { System.out.println("************** OrganizationController.getOrganizationsByUser()" + ": id=" + id + " **************"); List<OrganizationDTO> organizations = null; try { organizations = organizationService.findByUser(id); } catch (Exception e) { throw new NotFoundException("ID of user invalid"); } return organizations; }
/** * get/suggest skills based on search query -> can be used for autocompletion when user started * typing */ @ApiOperation(value = "suggest skills", nickname = "suggest skills", notes = "suggest skills") @ApiResponses({ @ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 500, message = "Failure") }) @ApiImplicitParams({ @ApiImplicitParam(name = "search", value = "Name to search", paramType = "query"), @ApiImplicitParam(name = "exclude_hidden", value = "Do not return hidden skills", paramType = "query", defaultValue = "true"), @ApiImplicitParam(name = "count", value = "Limit the number of skills to find", paramType = "query"), }) @RequestMapping(path = "/skills", method = RequestMethod.GET) public ResponseEntity<String> getSkills(@RequestParam(required = false) String search, @RequestParam(required = false, defaultValue = "true") boolean exclude_hidden, @RequestParam(required = false, defaultValue = "-1") int count) { JSONArray skillsArr = new JSONArray( skillService.getSkills(search, exclude_hidden, count) .stream() .map(KnownSkill::toJSON) .collect(Collectors.toList()) ); return new ResponseEntity<>(skillsArr.toString(), HttpStatus.OK); }
@POST @RolesAllowed({ Role.USER, Role.ADMIN }) @Path("/chat") @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Send a query to HABot to interpret.") @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = ChatReply.class), @ApiResponse(code = 500, message = "An interpretation error occured") }) public Response chat(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language, @ApiParam(value = "human language query", required = true) String query) throws Exception { final Locale locale = LocaleUtil.getLocale(language); // interpret OpenNLPInterpreter hli = (OpenNLPInterpreter) voiceManager.getHLI(OPENNLP_HLI); ChatReply reply = hli.reply(locale, query); return Response.ok(reply).build(); }
@ApiOperation(value = "getAdaptorConfiguration", nickname = "getAdaptorConfiguration") @RequestMapping(value = "/CISConnector/getAdaptorConfiguration", method = RequestMethod.GET) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = AdaptorConfigurationImpl.class), @ApiResponse(code = 400, message = "Bad Request", response = AdaptorConfigurationImpl.class), @ApiResponse(code = 500, message = "Failure", response = AdaptorConfigurationImpl.class)}) public ResponseEntity<AdaptorConfigurationImpl> getAdaptorConfiguration() { log.info("--> getAdaptorConfiguration"); AdaptorConfigurationImpl config = (AdaptorConfigurationImpl)connector.getAdaptorConfiguration(); HttpHeaders responseHeaders = new HttpHeaders(); log.info("getAdaptorConfiguration -->"); return new ResponseEntity<AdaptorConfigurationImpl>(config, responseHeaders, HttpStatus.OK); }
@ApiOperation(value = "Syncs a deployment spec", notes = "Syncs a deployment spec", response = BaseJobResponse.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @Path("/{vsId}/deploymentSpecs/{dsId}/sync") @PUT public Response syncDeploymentSpec(@Context HttpHeaders headers, @ApiParam(value = "The Virtual System Id") @PathParam("vsId") Long vsId, @ApiParam(value = "The Deployment Specification Id") @PathParam("dsId") Long dsId) { logger.info("Sync deployment spec" + dsId); this.userContext.setUser(OscAuthFilter.getUsername(headers)); DeploymentSpecDto dsDto = new DeploymentSpecDto(); dsDto.setId(dsId); return this.apiUtil.getResponseForBaseRequest(this.syncDeploymentSpecService, new BaseRequest<DeploymentSpecDto>(dsDto)); }
@POST @Path("/{id}/filetemplates") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @ApiOperation(value = "Add FileTempate to ServiceInfo)", response = FileTemplateModel.class) @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the FileTemplate was updated", response = FileTemplateModel.class), @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) }) public Response addFileTemplateToServiceInfo(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @ApiParam(value = "Attachment files", required = true) @Multipart("file") Attachment file, @ApiParam(value = "id of ServiceInfo that need to be upload file to", required = true) @PathParam("id") String id, @ApiParam(value = "Metadata of FileTemplate", required = true) @Multipart("fileTemplateNo") String fileTemplateNo, @ApiParam(value = "Metadata of FileTemplate") @Multipart("templateName") String templateName, @ApiParam(value = "Metadata of FileType") @Multipart("fileType") String fileType, @ApiParam(value = "Metadata of FileSize") @Multipart("fileSize") int fileSize, @Multipart("fileName") String fileName);
@ApiOperation(value = "Create User", notes = "Creates new User entry.", response = Void.class, tags={ "Users", }) @ApiResponses(value = { @ApiResponse(code = 201, message = "Created User.", response = Void.class), @ApiResponse(code = 400, message = "Bad request (validation failed).", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized (need to log in / get token).", response = Void.class), @ApiResponse(code = 403, message = "Forbidden (no rights to access resource).", response = Void.class), @ApiResponse(code = 404, message = "Entity not found.", response = Error.class), @ApiResponse(code = 409, message = "Request results in a conflict.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Void.class) }) @RequestMapping(value = "/api/v1/users", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.POST) ResponseEntity<Void> apiV1UsersPost(@ApiParam(value = "" ,required=true ) @RequestBody CreateUser userCreate, BindingResult bindingResult) throws DtoValidationFailedException, DuplicateUserException;
@PUT @Path("/{id}") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @ApiOperation(value = "Update a ServiceProcesses", response = ServiceProcessDetailModel.class) @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the ServiceProcesses was update", response = ServiceProcessDetailModel.class), @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) }) public Response updateServiceProcess(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @PathParam("id") long id, @BeanParam ServiceProcessInputModel input);
@GET @Path("/{id}/actions") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @ApiOperation(value = "Get all ProcessActions of a ServiceProcess", response = ProcessActionResultsModel.class) @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a list ProcessStepRoles of a ProcessStep", response = ProcessActionResultsModel.class), @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) }) public Response getProcessActions(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @PathParam("id") long id, @BeanParam ProcessActionSearchModel query);
@DELETE @Path("/{file}") @ApiOperation(value = "Delete a configuration file") @ApiResponses(value = { @ApiResponse(code = 202, message = "Acknowledged request"), @ApiResponse(code = 404, message = "Resource not found"), @ApiResponse(code = 409, message = "Request conflicts with current state")}) public synchronized Response deleteConfigFile( @PathParam("file") @ApiParam("The name of a file") String file) { return apiFileHandler.deleteFile(file); }
@RequestMapping(path = "/fallback/returnnull/{name}", method = RequestMethod.GET) @ApiResponses(value = {@ApiResponse(code = 200, response = String.class, message = "xxx"), @ApiResponse(code = 490, response = String.class, message = "xxx")}) public String fallbackReturnNull(@PathVariable(name = "name") String name) { if ("throwexception".equals(name)) { throw new InvocationException(490, "490", "xxx"); } return name; }
@DELETE @Produces(TEXT_PLAIN) @ApiOperation(value = "Uninstall Presto") @ApiResponses(value = { @ApiResponse(code = 202, message = "Acknowledged request"), @ApiResponse(code = 404, message = "Presto is not installed"), @ApiResponse(code = 409, message = "Presto is running. Please stop Presto before beginning uninstall.") }) public synchronized Response uninstall( @QueryParam("checkDependencies") @DefaultValue("true") @ApiParam("If false, disables dependency checking") boolean checkDependencies, @QueryParam("forceUninstall") @DefaultValue("false") @ApiParam("If true, warnings are ignored during uninstall") boolean forceUninstall) { return controller.uninstall(checkDependencies, forceUninstall); }
@ApiOperation(value = "Get Note", notes = "Fetches Note with defined Id.", response = CompleteNote.class, tags = { "Notes", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Note entity.", response = CompleteNote.class), @ApiResponse(code = 400, message = "Bad request (validation failed).", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized (need to log in / get token).", response = Void.class), @ApiResponse(code = 403, message = "Forbidden (no rights to access resource).", response = Void.class), @ApiResponse(code = 404, message = "Entity not found.", response = Error.class), @ApiResponse(code = 409, message = "Request results in a conflict.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) @RequestMapping(value = "/api/v1/notes/{noteId}", produces = { "application/json" }, method = RequestMethod.GET) ResponseEntity<CompleteNote> apiV1NotesNoteIdGet( @ApiParam(value = "Unique identifier of a Note.", required = true) @PathVariable("noteId") String noteId, @RequestHeader(value = "userId", required = true) Long userId) throws NoteNotFoundException, AccessingOtherUsersNotesException;
@GET @Path("/{id}/filetemplates/{templateNo}") @Produces(MediaType.APPLICATION_OCTET_STREAM) @ApiOperation(value = "Download FileTemplate by it templateNo)") @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns octet content of FileTemplate"), @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) }) public Response downloadFileTemplateOfServiceInfo(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @ApiParam(value = "id of ServiceInfo that need to be get file content", required = true) @PathParam("id") String id, @ApiParam(value = "templateNo of FileTemplate that need to be get file content", required = true) @PathParam("templateNo") String templateNo);
@GET @Path("{category}") @Produces({ "application/hal+json", "application/hal+json;concept=eventcategory;v=1"}) @ApiOperation(value = "obtain all events scoped to a certain category", response = EventsRepresentation.class, notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " + "subscribers to the account service should be able to listen for and react to. In other words this is the authoritative" + "feed for the account service, allowing for subscribers to have these grouped into categories", authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, tags = {"interval", "events"}, produces = "application/hal+json, application/hal+json;concept=eventcategory;v=1", nickname = "getAccountEventsByCategory" ) @ApiResponses(value = { @ApiResponse(code = 415, message = "Content type not supported.") }) public Response getByCategory(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept, @PathParam("category") String category, @QueryParam("interval") String interval) { return eventCategoryProducers.getOrDefault(accept, this::handleUnsupportedContentType) .getResponse(uriInfo, request, category, interval); }
@ApiResponses({ @ApiResponse(code = 400, response = String.class, message = "illegal request content"), }) @RequestMapping(path = "/{name}", method = RequestMethod.GET) @CrossOrigin @Override public HealthCheckResult healthWithName(@PathVariable(name = "name") String name) { return manager.check(name); }
@ApiResponses({ @ApiResponse(code = 400, response = String.class, message = "illegal request content"), }) @RequestMapping(path = "/{windowTime}", method = RequestMethod.GET) @CrossOrigin @Override public RegistryMetric metricsWithWindowTime(@PathVariable(name = "windowTime") long windowTime) { return dataSource.getRegistryMetric(windowTime); }