Search in sources :

Example 1 with SearchResult

use of com.thinkbiganalytics.rest.model.search.SearchResult in project kylo by Teradata.

the class ModelUtils method toSearchResult.

/**
 * Convert a spring-data Page to a SearchResult UI object
 */
public static SearchResult toSearchResult(Page page) {
    SearchResult searchResult = new SearchResultImpl();
    searchResult.setData(page.getContent());
    searchResult.setRecordsTotal(page.getTotalElements());
    searchResult.setRecordsFiltered(page.getTotalElements());
    return searchResult;
}
Also used : SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult)

Example 2 with SearchResult

use of com.thinkbiganalytics.rest.model.search.SearchResult in project kylo by Teradata.

the class IntegrationTestBase method getFeeds.

protected FeedSummary[] getFeeds() {
    final ObjectMapper mapper = new ObjectMapper();
    SearchResult<Object> searchResult = getFeedsExpectingStatus(HTTP_OK).as(SearchResultImpl.class);
    return searchResult.getData().stream().map(o -> mapper.convertValue(o, FeedSummary.class)).toArray(FeedSummary[]::new);
}
Also used : ConnectorController(com.thinkbiganalytics.kylo.catalog.rest.controller.ConnectorController) Arrays(java.util.Arrays) PartitionField(com.thinkbiganalytics.feedmgr.rest.model.schema.PartitionField) ReusableTemplateConnectionInfo(com.thinkbiganalytics.feedmgr.rest.model.ReusableTemplateConnectionInfo) StringUtils(org.apache.commons.lang3.StringUtils) MediaType(javax.ws.rs.core.MediaType) DefaultDataTypeDescriptor(com.thinkbiganalytics.discovery.model.DefaultDataTypeDescriptor) SpringJUnit4ClassRunner(org.springframework.test.context.junit4.SpringJUnit4ClassRunner) AlertsController(com.thinkbiganalytics.alerts.rest.controller.AlertsController) DataSource(com.thinkbiganalytics.kylo.catalog.rest.model.DataSource) SchedulerRestController(com.thinkbiganalytics.scheduler.rest.controller.SchedulerRestController) NifiFeed(com.thinkbiganalytics.feedmgr.rest.model.NifiFeed) JsonNode(com.fasterxml.jackson.databind.JsonNode) Tag(com.thinkbiganalytics.discovery.schema.Tag) Scp(org.apache.tools.ant.taskdefs.optional.ssh.Scp) JsonPath(com.jayway.restassured.path.json.JsonPath) PermissionsChange(com.thinkbiganalytics.security.rest.model.PermissionsChange) FeedSchedule(com.thinkbiganalytics.feedmgr.rest.model.FeedSchedule) NifiProperty(com.thinkbiganalytics.nifi.rest.model.NifiProperty) JobsRestController(com.thinkbiganalytics.jobrepo.rest.controller.JobsRestController) ActionGroup(com.thinkbiganalytics.security.rest.model.ActionGroup) Set(java.util.Set) ServiceLevelAssessment(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAssessment) EntityVersionDifference(com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference) JobAction(com.thinkbiganalytics.jobrepo.repository.rest.model.JobAction) PortDTO(org.apache.nifi.web.api.dto.PortDTO) ImportTemplateOptions(com.thinkbiganalytics.feedmgr.rest.model.ImportTemplateOptions) RestAssured(com.jayway.restassured.RestAssured) RoleMembershipChange(com.thinkbiganalytics.security.rest.model.RoleMembershipChange) AdminControllerV2(com.thinkbiganalytics.feedmgr.rest.controller.AdminControllerV2) SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) AdminController(com.thinkbiganalytics.feedmgr.rest.controller.AdminController) DatasourceController(com.thinkbiganalytics.feedmgr.rest.controller.DatasourceController) RunWith(org.junit.runner.RunWith) LocalDateTime(java.time.LocalDateTime) Jackson2ObjectMapperFactory(com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) AccessControlController(com.thinkbiganalytics.security.rest.controller.AccessControlController) ArrayList(java.util.ArrayList) HTTP_OK(java.net.HttpURLConnection.HTTP_OK) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) RestResponseStatus(com.thinkbiganalytics.rest.model.RestResponseStatus) JdbcDatasource(com.thinkbiganalytics.metadata.rest.model.data.JdbcDatasource) AlertRange(com.thinkbiganalytics.alerts.rest.model.AlertRange) DomainType(com.thinkbiganalytics.feedmgr.rest.model.DomainType) User(com.thinkbiganalytics.security.rest.model.User) RegisteredTemplate(com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate) ObligationGroup(com.thinkbiganalytics.metadata.sla.api.ObligationGroup) Before(org.junit.Before) Uninterruptibles(com.google.common.util.concurrent.Uninterruptibles) FeedCategoryRestController(com.thinkbiganalytics.feedmgr.rest.controller.FeedCategoryRestController) ServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement) IOException(java.io.IOException) DefaultHiveSchema(com.thinkbiganalytics.discovery.model.DefaultHiveSchema) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult) InputStreamReader(java.io.InputStreamReader) File(java.io.File) DataSourceController(com.thinkbiganalytics.kylo.catalog.rest.controller.DataSourceController) ExecutedStep(com.thinkbiganalytics.jobrepo.query.model.ExecutedStep) NifiIntegrationRestController(com.thinkbiganalytics.feedmgr.rest.controller.NifiIntegrationRestController) HiveRestController(com.thinkbiganalytics.hive.rest.controller.HiveRestController) ContextConfiguration(org.springframework.test.context.ContextConfiguration) BufferedReader(java.io.BufferedReader) Assert(org.junit.Assert) ImportComponentOption(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption) DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob) HTTP_BAD_REQUEST(java.net.HttpURLConnection.HTTP_BAD_REQUEST) DefaultExecutedStep(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedStep) ImportComponentOptionBuilder(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOptionBuilder) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) LoggerFactory(org.slf4j.LoggerFactory) ServiceLevelAgreementRestController(com.thinkbiganalytics.feedmgr.rest.controller.ServiceLevelAgreementRestController) HTTP_NO_CONTENT(java.net.HttpURLConnection.HTTP_NO_CONTENT) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) ObjectMapperSerializer(com.thinkbiganalytics.json.ObjectMapperSerializer) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) ServiceLevelAssessmentsController(com.thinkbiganalytics.jobrepo.rest.controller.ServiceLevelAssessmentsController) FeedVersions(com.thinkbiganalytics.feedmgr.rest.model.FeedVersions) ServiceLevelAgreementGroup(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup) SSHBase(org.apache.tools.ant.taskdefs.optional.ssh.SSHBase) ImportTemplate(com.thinkbiganalytics.feedmgr.service.template.importing.model.ImportTemplate) FeedRestController(com.thinkbiganalytics.feedmgr.rest.controller.FeedRestController) JSON(com.jayway.restassured.http.ContentType.JSON) DefaultTag(com.thinkbiganalytics.discovery.model.DefaultTag) UUID(java.util.UUID) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) Parser(com.jayway.restassured.parsing.Parser) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) ScheduleIdentifier(com.thinkbiganalytics.scheduler.rest.model.ScheduleIdentifier) DomainTypesController(com.thinkbiganalytics.feedmgr.rest.controller.DomainTypesController) List(java.util.List) ImportFeed(com.thinkbiganalytics.feedmgr.service.feed.importing.model.ImportFeed) JodaModule(com.fasterxml.jackson.datatype.joda.JodaModule) ImportComponent(com.thinkbiganalytics.feedmgr.rest.ImportComponent) Jackson2Mapper(com.jayway.restassured.internal.mapping.Jackson2Mapper) ChronoField(java.time.temporal.ChronoField) RequestSpecification(com.jayway.restassured.specification.RequestSpecification) Feed(com.thinkbiganalytics.metadata.api.feed.Feed) HashMap(java.util.HashMap) Response(com.jayway.restassured.response.Response) DefaultField(com.thinkbiganalytics.discovery.model.DefaultField) UserProperty(com.thinkbiganalytics.feedmgr.rest.model.UserProperty) HashSet(java.util.HashSet) Inject(javax.inject.Inject) TemplatesRestController(com.thinkbiganalytics.feedmgr.rest.controller.TemplatesRestController) NifiFlowProcessGroup(com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowProcessGroup) Project(org.apache.tools.ant.Project) PrintStream(java.io.PrintStream) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) SSHExec(org.apache.tools.ant.taskdefs.optional.ssh.SSHExec) Datasource(com.thinkbiganalytics.metadata.rest.model.data.Datasource) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SystemNamingService(com.thinkbiganalytics.feedmgr.rest.support.SystemNamingService) FieldRuleProperty(com.thinkbiganalytics.policy.rest.model.FieldRuleProperty) TimeUnit(java.util.concurrent.TimeUnit) ServiceLevelAgreementRule(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementRule) Connector(com.thinkbiganalytics.kylo.catalog.rest.model.Connector) DateTimeFormatter(java.time.format.DateTimeFormatter) SerializationFeature(com.fasterxml.jackson.databind.SerializationFeature) InputStream(java.io.InputStream) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 3 with SearchResult

use of com.thinkbiganalytics.rest.model.search.SearchResult in project kylo by Teradata.

the class FeedModelTransform method toSearchResult.

/**
 * Convert a spring-data Page to a SearchResult UI object
 */
public SearchResult toSearchResult(Page<UIFeed> page) {
    SearchResult searchResult = new SearchResultImpl();
    searchResult.setData(page.getContent());
    searchResult.setRecordsTotal(page.getTotalElements());
    searchResult.setRecordsFiltered(page.getTotalElements());
    return searchResult;
}
Also used : SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult)

Example 4 with SearchResult

use of com.thinkbiganalytics.rest.model.search.SearchResult in project kylo by Teradata.

the class IntegrationTestBase method getServiceLevelAssessments.

protected ServiceLevelAssessment[] getServiceLevelAssessments(String filter) {
    LOG.info(String.format("Getting up to 50 SLA Assessments for filter %s", filter));
    Response response = given(ServiceLevelAssessmentsController.BASE).urlEncodingEnabled(// url encoding enabled false to avoid replacing percent symbols in url query part
    false).when().get("?filter=" + filter + "&limit=50&sort=-createdTime&start=0");
    response.then().statusCode(HTTP_OK);
    SearchResult<Object> result = response.as(SearchResultImpl.class);
    final ObjectMapper mapper = new ObjectMapper();
    return result.getData().stream().map(o -> mapper.convertValue(o, ServiceLevelAssessment.class)).toArray(ServiceLevelAssessment[]::new);
}
Also used : Response(com.jayway.restassured.response.Response) ConnectorController(com.thinkbiganalytics.kylo.catalog.rest.controller.ConnectorController) Arrays(java.util.Arrays) PartitionField(com.thinkbiganalytics.feedmgr.rest.model.schema.PartitionField) ReusableTemplateConnectionInfo(com.thinkbiganalytics.feedmgr.rest.model.ReusableTemplateConnectionInfo) StringUtils(org.apache.commons.lang3.StringUtils) MediaType(javax.ws.rs.core.MediaType) DefaultDataTypeDescriptor(com.thinkbiganalytics.discovery.model.DefaultDataTypeDescriptor) SpringJUnit4ClassRunner(org.springframework.test.context.junit4.SpringJUnit4ClassRunner) AlertsController(com.thinkbiganalytics.alerts.rest.controller.AlertsController) DataSource(com.thinkbiganalytics.kylo.catalog.rest.model.DataSource) SchedulerRestController(com.thinkbiganalytics.scheduler.rest.controller.SchedulerRestController) NifiFeed(com.thinkbiganalytics.feedmgr.rest.model.NifiFeed) JsonNode(com.fasterxml.jackson.databind.JsonNode) Tag(com.thinkbiganalytics.discovery.schema.Tag) Scp(org.apache.tools.ant.taskdefs.optional.ssh.Scp) JsonPath(com.jayway.restassured.path.json.JsonPath) PermissionsChange(com.thinkbiganalytics.security.rest.model.PermissionsChange) FeedSchedule(com.thinkbiganalytics.feedmgr.rest.model.FeedSchedule) NifiProperty(com.thinkbiganalytics.nifi.rest.model.NifiProperty) JobsRestController(com.thinkbiganalytics.jobrepo.rest.controller.JobsRestController) ActionGroup(com.thinkbiganalytics.security.rest.model.ActionGroup) Set(java.util.Set) ServiceLevelAssessment(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAssessment) EntityVersionDifference(com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference) JobAction(com.thinkbiganalytics.jobrepo.repository.rest.model.JobAction) PortDTO(org.apache.nifi.web.api.dto.PortDTO) ImportTemplateOptions(com.thinkbiganalytics.feedmgr.rest.model.ImportTemplateOptions) RestAssured(com.jayway.restassured.RestAssured) RoleMembershipChange(com.thinkbiganalytics.security.rest.model.RoleMembershipChange) AdminControllerV2(com.thinkbiganalytics.feedmgr.rest.controller.AdminControllerV2) SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) AdminController(com.thinkbiganalytics.feedmgr.rest.controller.AdminController) DatasourceController(com.thinkbiganalytics.feedmgr.rest.controller.DatasourceController) RunWith(org.junit.runner.RunWith) LocalDateTime(java.time.LocalDateTime) Jackson2ObjectMapperFactory(com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) AccessControlController(com.thinkbiganalytics.security.rest.controller.AccessControlController) ArrayList(java.util.ArrayList) HTTP_OK(java.net.HttpURLConnection.HTTP_OK) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) RestResponseStatus(com.thinkbiganalytics.rest.model.RestResponseStatus) JdbcDatasource(com.thinkbiganalytics.metadata.rest.model.data.JdbcDatasource) AlertRange(com.thinkbiganalytics.alerts.rest.model.AlertRange) DomainType(com.thinkbiganalytics.feedmgr.rest.model.DomainType) User(com.thinkbiganalytics.security.rest.model.User) RegisteredTemplate(com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate) ObligationGroup(com.thinkbiganalytics.metadata.sla.api.ObligationGroup) Before(org.junit.Before) Uninterruptibles(com.google.common.util.concurrent.Uninterruptibles) FeedCategoryRestController(com.thinkbiganalytics.feedmgr.rest.controller.FeedCategoryRestController) ServiceLevelAgreement(com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAgreement) IOException(java.io.IOException) DefaultHiveSchema(com.thinkbiganalytics.discovery.model.DefaultHiveSchema) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult) InputStreamReader(java.io.InputStreamReader) File(java.io.File) DataSourceController(com.thinkbiganalytics.kylo.catalog.rest.controller.DataSourceController) ExecutedStep(com.thinkbiganalytics.jobrepo.query.model.ExecutedStep) NifiIntegrationRestController(com.thinkbiganalytics.feedmgr.rest.controller.NifiIntegrationRestController) HiveRestController(com.thinkbiganalytics.hive.rest.controller.HiveRestController) ContextConfiguration(org.springframework.test.context.ContextConfiguration) BufferedReader(java.io.BufferedReader) Assert(org.junit.Assert) ImportComponentOption(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption) DefaultExecutedJob(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedJob) HTTP_BAD_REQUEST(java.net.HttpURLConnection.HTTP_BAD_REQUEST) DefaultExecutedStep(com.thinkbiganalytics.jobrepo.query.model.DefaultExecutedStep) ImportComponentOptionBuilder(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOptionBuilder) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) LoggerFactory(org.slf4j.LoggerFactory) ServiceLevelAgreementRestController(com.thinkbiganalytics.feedmgr.rest.controller.ServiceLevelAgreementRestController) HTTP_NO_CONTENT(java.net.HttpURLConnection.HTTP_NO_CONTENT) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) ObjectMapperSerializer(com.thinkbiganalytics.json.ObjectMapperSerializer) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) ServiceLevelAssessmentsController(com.thinkbiganalytics.jobrepo.rest.controller.ServiceLevelAssessmentsController) FeedVersions(com.thinkbiganalytics.feedmgr.rest.model.FeedVersions) ServiceLevelAgreementGroup(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementGroup) SSHBase(org.apache.tools.ant.taskdefs.optional.ssh.SSHBase) ImportTemplate(com.thinkbiganalytics.feedmgr.service.template.importing.model.ImportTemplate) FeedRestController(com.thinkbiganalytics.feedmgr.rest.controller.FeedRestController) JSON(com.jayway.restassured.http.ContentType.JSON) DefaultTag(com.thinkbiganalytics.discovery.model.DefaultTag) UUID(java.util.UUID) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) Parser(com.jayway.restassured.parsing.Parser) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) ScheduleIdentifier(com.thinkbiganalytics.scheduler.rest.model.ScheduleIdentifier) DomainTypesController(com.thinkbiganalytics.feedmgr.rest.controller.DomainTypesController) List(java.util.List) ImportFeed(com.thinkbiganalytics.feedmgr.service.feed.importing.model.ImportFeed) JodaModule(com.fasterxml.jackson.datatype.joda.JodaModule) ImportComponent(com.thinkbiganalytics.feedmgr.rest.ImportComponent) Jackson2Mapper(com.jayway.restassured.internal.mapping.Jackson2Mapper) ChronoField(java.time.temporal.ChronoField) RequestSpecification(com.jayway.restassured.specification.RequestSpecification) Feed(com.thinkbiganalytics.metadata.api.feed.Feed) HashMap(java.util.HashMap) Response(com.jayway.restassured.response.Response) DefaultField(com.thinkbiganalytics.discovery.model.DefaultField) UserProperty(com.thinkbiganalytics.feedmgr.rest.model.UserProperty) HashSet(java.util.HashSet) Inject(javax.inject.Inject) TemplatesRestController(com.thinkbiganalytics.feedmgr.rest.controller.TemplatesRestController) NifiFlowProcessGroup(com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowProcessGroup) Project(org.apache.tools.ant.Project) PrintStream(java.io.PrintStream) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) SSHExec(org.apache.tools.ant.taskdefs.optional.ssh.SSHExec) Datasource(com.thinkbiganalytics.metadata.rest.model.data.Datasource) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SystemNamingService(com.thinkbiganalytics.feedmgr.rest.support.SystemNamingService) FieldRuleProperty(com.thinkbiganalytics.policy.rest.model.FieldRuleProperty) TimeUnit(java.util.concurrent.TimeUnit) ServiceLevelAgreementRule(com.thinkbiganalytics.feedmgr.sla.ServiceLevelAgreementRule) Connector(com.thinkbiganalytics.kylo.catalog.rest.model.Connector) DateTimeFormatter(java.time.format.DateTimeFormatter) SerializationFeature(com.fasterxml.jackson.databind.SerializationFeature) InputStream(java.io.InputStream) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

SearchResult (com.thinkbiganalytics.rest.model.search.SearchResult)4 SearchResultImpl (com.thinkbiganalytics.rest.model.search.SearchResultImpl)4 DeserializationFeature (com.fasterxml.jackson.databind.DeserializationFeature)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 SerializationFeature (com.fasterxml.jackson.databind.SerializationFeature)2 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 JodaModule (com.fasterxml.jackson.datatype.joda.JodaModule)2 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)2 RestAssured (com.jayway.restassured.RestAssured)2 JSON (com.jayway.restassured.http.ContentType.JSON)2 Jackson2Mapper (com.jayway.restassured.internal.mapping.Jackson2Mapper)2 Jackson2ObjectMapperFactory (com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory)2 Parser (com.jayway.restassured.parsing.Parser)2 JsonPath (com.jayway.restassured.path.json.JsonPath)2 Response (com.jayway.restassured.response.Response)2 RequestSpecification (com.jayway.restassured.specification.RequestSpecification)2 AlertsController (com.thinkbiganalytics.alerts.rest.controller.AlertsController)2 AlertRange (com.thinkbiganalytics.alerts.rest.model.AlertRange)2