Search in sources :

Example 1 with User

use of com.thinkbiganalytics.security.rest.model.User in project kylo by Teradata.

the class FeedModelTransform method domainToFeedMetadata.

/**
 * Transforms the specified Metadata feed to a Feed Manager feed.
 *
 * @param domain       the Metadata feed
 * @param userFieldMap cache map from category to user-defined fields, or {@code null}
 * @return the Feed Manager feed
 */
@Nonnull
private FeedMetadata domainToFeedMetadata(@Nonnull final Feed domain, @Nullable final Map<Category, Set<UserFieldDescriptor>> userFieldMap) {
    FeedMetadata feed = deserializeFeedMetadata(domain, false);
    feed.setId(domain.getId().toString());
    feed.setFeedId(domain.getId().toString());
    feed.setFeedName(domain.getDisplayName());
    feed.setSystemFeedName(domain.getName());
    feed.setDescription(domain.getDescription());
    feed.setAllowIndexing(domain.isAllowIndexing());
    feed.setHistoryReindexingStatus(domain.getCurrentHistoryReindexingStatus().getHistoryReindexingState().toString());
    feed.setOwner(domain.getOwner() != null ? new User(domain.getOwner().getName()) : null);
    if (domain.getCreatedTime() != null) {
        feed.setCreateDate(domain.getCreatedTime().toDate());
    }
    if (domain.getModifiedTime() != null) {
        feed.setUpdateDate(domain.getModifiedTime().toDate());
    }
    FeedManagerTemplate template = domain.getTemplate();
    if (template != null) {
        RegisteredTemplate registeredTemplate = templateModelTransform.DOMAIN_TO_REGISTERED_TEMPLATE.apply(template);
        feed.setRegisteredTemplate(registeredTemplate);
        feed.setTemplateId(registeredTemplate.getId());
        feed.setTemplateName(registeredTemplate.getTemplateName());
    }
    Category category = domain.getCategory();
    if (category != null) {
        feed.setCategory(categoryModelTransform.domainToFeedCategorySimple(category));
    }
    feed.setState(domain.getState() != null ? domain.getState().name() : null);
    feed.setVersionName(domain.getVersionName() != null ? domain.getVersionName() : null);
    // Set user-defined properties
    final Set<UserFieldDescriptor> userFields;
    if (userFieldMap == null) {
        userFields = getUserFields(category);
    } else if (userFieldMap.containsKey(category)) {
        userFields = userFieldMap.get(category);
    } else {
        userFields = getUserFields(category);
        userFieldMap.put(category, userFields);
    }
    @SuppressWarnings("unchecked") final Set<UserProperty> userProperties = UserPropertyTransform.toUserProperties(domain.getUserProperties(), userFields);
    feed.setUserProperties(userProperties);
    // Convert JCR securitygroup to DTO
    List<com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup> restSecurityGroups = new ArrayList<>();
    if (domain.getSecurityGroups() != null && domain.getSecurityGroups().size() > 0) {
        for (Object group : domain.getSecurityGroups()) {
            HadoopSecurityGroup hadoopSecurityGroup = (HadoopSecurityGroup) group;
            com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup restSecurityGroup = new com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup();
            restSecurityGroup.setDescription(hadoopSecurityGroup.getDescription());
            restSecurityGroup.setId(hadoopSecurityGroup.getGroupId());
            restSecurityGroup.setName(hadoopSecurityGroup.getName());
            restSecurityGroups.add(restSecurityGroup);
        }
    }
    feed.setSecurityGroups(restSecurityGroups);
    feed.setTags(domain.getTags().stream().map(name -> new DefaultTag(name)).collect(Collectors.toList()));
    if (domain.getUsedByFeeds() != null) {
        final List<FeedSummary> usedByFeeds = domain.getUsedByFeeds().stream().map(this::domainToFeedSummary).collect(Collectors.toList());
        feed.setUsedByFeeds(usedByFeeds);
    }
    // add in access control items
    securityTransform.applyAccessControl(domain, feed);
    return feed;
}
Also used : User(com.thinkbiganalytics.security.rest.model.User) Category(com.thinkbiganalytics.metadata.api.category.Category) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) UserFieldDescriptor(com.thinkbiganalytics.metadata.api.extension.UserFieldDescriptor) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) ArrayList(java.util.ArrayList) HadoopSecurityGroup(com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup) JcrHadoopSecurityGroup(com.thinkbiganalytics.metadata.modeshape.security.JcrHadoopSecurityGroup) UserProperty(com.thinkbiganalytics.feedmgr.rest.model.UserProperty) RegisteredTemplate(com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate) FeedManagerTemplate(com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate) DefaultTag(com.thinkbiganalytics.discovery.model.DefaultTag) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) Nonnull(javax.annotation.Nonnull)

Example 2 with User

use of com.thinkbiganalytics.security.rest.model.User in project kylo by Teradata.

the class Datasource method setOwner.

@JsonIgnore
public void setOwner(final String owner) {
    final User user = new User();
    user.setSystemName(owner);
    setOwner(user);
}
Also used : User(com.thinkbiganalytics.security.rest.model.User) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 3 with User

use of com.thinkbiganalytics.security.rest.model.User in project kylo by Teradata.

the class AboutKyloController method getCurrentUser.

/**
 * Gets information about the current user.
 */
@GET
@Path("/me")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Gets information about the current user.")
@ApiResponses(@ApiResponse(code = 200, message = "Returns the user.", response = User.class))
public Response getCurrentUser() {
    // Create principal from current user
    final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    final User user = new User();
    user.setEnabled(true);
    if (auth.getPrincipal() instanceof UserDetails) {
        final UserDetails details = (UserDetails) auth.getPrincipal();
        user.setGroups(details.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toSet()));
        user.setSystemName(details.getUsername());
    } else {
        user.setGroups(auth.getAuthorities().stream().filter(JaasGrantedAuthority.class::isInstance).map(JaasGrantedAuthority.class::cast).filter(authority -> authority.getPrincipal() instanceof Group).map(JaasGrantedAuthority::getAuthority).collect(Collectors.toSet()));
        user.setSystemName(auth.getName());
    }
    // Return principal
    return Response.ok(user).build();
}
Also used : KyloVersionProvider(com.thinkbiganalytics.metadata.api.app.KyloVersionProvider) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Path(javax.ws.rs.Path) ApiResponses(io.swagger.annotations.ApiResponses) Collectors(java.util.stream.Collectors) GrantedAuthority(org.springframework.security.core.GrantedAuthority) Inject(javax.inject.Inject) ApiOperation(io.swagger.annotations.ApiOperation) Component(org.springframework.stereotype.Component) MediaType(javax.ws.rs.core.MediaType) Response(javax.ws.rs.core.Response) Group(java.security.acl.Group) ApiResponse(io.swagger.annotations.ApiResponse) UserDetails(org.springframework.security.core.userdetails.UserDetails) User(com.thinkbiganalytics.security.rest.model.User) Api(io.swagger.annotations.Api) Authentication(org.springframework.security.core.Authentication) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) KyloVersion(com.thinkbiganalytics.KyloVersion) JaasGrantedAuthority(org.springframework.security.authentication.jaas.JaasGrantedAuthority) Group(java.security.acl.Group) User(com.thinkbiganalytics.security.rest.model.User) UserDetails(org.springframework.security.core.userdetails.UserDetails) Authentication(org.springframework.security.core.Authentication) GrantedAuthority(org.springframework.security.core.GrantedAuthority) JaasGrantedAuthority(org.springframework.security.authentication.jaas.JaasGrantedAuthority) JaasGrantedAuthority(org.springframework.security.authentication.jaas.JaasGrantedAuthority) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 4 with User

use of com.thinkbiganalytics.security.rest.model.User in project kylo by Teradata.

the class FeedModelTransform method domainToFeedMetadata.

/**
 * Transforms the specified Metadata feed to a Feed Manager feed.
 *
 * @param domain       the Metadata feed
 * @param userFieldMap cache map from category to user-defined fields, or {@code null}
 * @return the Feed Manager feed
 */
@Nonnull
private FeedMetadata domainToFeedMetadata(@Nonnull final Feed domain, @Nullable final Map<Category, Set<UserFieldDescriptor>> userFieldMap, @Nullable ActionGroup actionGroup) {
    FeedMetadata feed = deserializeFeedMetadata(domain, false);
    feed.setId(domain.getId().toString());
    feed.setFeedId(domain.getId().toString());
    feed.setFeedName(domain.getDisplayName());
    feed.setSystemFeedName(domain.getName());
    feed.setDescription(domain.getDescription());
    feed.setAllowIndexing(domain.isAllowIndexing());
    feed.setHistoryReindexingStatus(domain.getCurrentHistoryReindexingStatus().getHistoryReindexingState().toString());
    feed.setOwner(domain.getOwner() != null ? new User(domain.getOwner().getName()) : null);
    if (domain.getCreatedTime() != null) {
        feed.setCreateDate(domain.getCreatedTime().toDate());
    }
    if (domain.getModifiedTime() != null) {
        feed.setUpdateDate(domain.getModifiedTime().toDate());
    }
    setFeedMetadataRegisteredTemplate(domain, feed);
    Category category = domain.getCategory();
    if (category != null) {
        feed.setCategory(categoryModelTransform.domainToFeedCategorySimple(category));
    }
    feed.setState(domain.getState() != null ? domain.getState().name() : null);
    // Set user-defined properties
    final Set<UserFieldDescriptor> userFields;
    if (userFieldMap == null) {
        userFields = getUserFields(category);
    } else if (userFieldMap.containsKey(category)) {
        userFields = userFieldMap.get(category);
    } else {
        userFields = getUserFields(category);
        userFieldMap.put(category, userFields);
    }
    @SuppressWarnings("unchecked") final Set<UserProperty> userProperties = UserPropertyTransform.toUserProperties(domain.getUserProperties(), userFields);
    feed.setUserProperties(userProperties);
    // Convert JCR securitygroup to DTO
    List<com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup> restSecurityGroups = new ArrayList<>();
    if (domain.getSecurityGroups() != null && domain.getSecurityGroups().size() > 0) {
        for (Object group : domain.getSecurityGroups()) {
            HadoopSecurityGroup hadoopSecurityGroup = (HadoopSecurityGroup) group;
            com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup restSecurityGroup = new com.thinkbiganalytics.feedmgr.rest.model.HadoopSecurityGroup();
            restSecurityGroup.setDescription(hadoopSecurityGroup.getDescription());
            restSecurityGroup.setId(hadoopSecurityGroup.getGroupId());
            restSecurityGroup.setName(hadoopSecurityGroup.getName());
            restSecurityGroups.add(restSecurityGroup);
        }
    }
    feed.setSecurityGroups(restSecurityGroups);
    feed.setTags(domain.getTags().stream().map(name -> new DefaultTag(name)).collect(Collectors.toList()));
    if (domain.getUsedByFeeds() != null) {
        final List<FeedSummary> usedByFeeds = domain.getUsedByFeeds().stream().map(this::domainToFeedSummary).collect(Collectors.toList());
        feed.setUsedByFeeds(usedByFeeds);
    }
    List<DataSet> srcDataSets = domain.getSources().stream().map(FeedConnection::getDataSet).filter(Optional::isPresent).map(Optional::get).map(dataSet -> {
        try {
            return catalogModelTransform.dataSetToRestModel().apply(dataSet);
        } catch (final AccessControlException e) {
            log.debug("Denied access to data set: {}: {}", domain.getId(), e);
            final DataSource dataSource = new DataSource();
            dataSource.setAllowedActions(new ActionGroup());
            dataSource.getAllowedActions().setActions(Collections.emptyList());
            final DataSet model = new DataSet();
            model.setId(domain.getId().toString());
            model.setDataSource(dataSource);
            return model;
        }
    }).collect(Collectors.toList());
    feed.setSourceDataSets(srcDataSets);
    if (actionGroup == null) {
        // add in access control items
        securityTransform.applyAccessControl(domain, feed);
    } else {
        feed.setAllowedActions(actionGroup);
    }
    return feed;
}
Also used : Category(com.thinkbiganalytics.metadata.api.category.Category) DataSourceProvider(com.thinkbiganalytics.metadata.api.catalog.DataSourceProvider) LoggerFactory(org.slf4j.LoggerFactory) StringUtils(org.apache.commons.lang3.StringUtils) ObjectReader(com.fasterxml.jackson.databind.ObjectReader) ObjectMapperSerializer(com.thinkbiganalytics.json.ObjectMapperSerializer) FeedProvider(com.thinkbiganalytics.metadata.api.feed.FeedProvider) DataSetProvider(com.thinkbiganalytics.metadata.api.catalog.DataSetProvider) HiveService(com.thinkbiganalytics.hive.service.HiveService) DataSource(com.thinkbiganalytics.kylo.catalog.rest.model.DataSource) Map(java.util.Map) AccessController(com.thinkbiganalytics.security.AccessController) JsonNode(com.fasterxml.jackson.databind.JsonNode) Pageable(org.springframework.data.domain.Pageable) Tag(com.thinkbiganalytics.discovery.schema.Tag) CatalogModelTransform(com.thinkbiganalytics.kylo.catalog.rest.model.CatalogModelTransform) FeedManagerTemplateProvider(com.thinkbiganalytics.metadata.api.template.FeedManagerTemplateProvider) DataSet(com.thinkbiganalytics.kylo.catalog.rest.model.DataSet) FeedVersions(com.thinkbiganalytics.feedmgr.rest.model.FeedVersions) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) Collection(java.util.Collection) ActionGroup(com.thinkbiganalytics.security.rest.model.ActionGroup) Set(java.util.Set) DefaultTag(com.thinkbiganalytics.discovery.model.DefaultTag) Page(org.springframework.data.domain.Page) EntityVersionDifference(com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) List(java.util.List) CategoryProvider(com.thinkbiganalytics.metadata.api.category.CategoryProvider) AccessControlException(java.security.AccessControlException) Optional(java.util.Optional) PageImpl(org.springframework.data.domain.PageImpl) JsonDiff(com.flipkart.zjsonpatch.JsonDiff) SecurityModelTransform(com.thinkbiganalytics.security.rest.controller.SecurityModelTransform) SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) Feed(com.thinkbiganalytics.metadata.api.feed.Feed) HistoryReindexingStatus(com.thinkbiganalytics.metadata.api.feed.reindex.HistoryReindexingStatus) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) EntityVersion(com.thinkbiganalytics.metadata.api.versioning.EntityVersion) UserProperty(com.thinkbiganalytics.feedmgr.rest.model.UserProperty) ArrayList(java.util.ArrayList) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) Inject(javax.inject.Inject) FeedConnection(com.thinkbiganalytics.metadata.api.feed.FeedConnection) UIFeed(com.thinkbiganalytics.feedmgr.rest.model.UIFeed) TemplateModelTransform(com.thinkbiganalytics.feedmgr.service.template.TemplateModelTransform) User(com.thinkbiganalytics.security.rest.model.User) RegisteredTemplate(com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) Logger(org.slf4j.Logger) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IOException(java.io.IOException) UserFieldDescriptor(com.thinkbiganalytics.metadata.api.extension.UserFieldDescriptor) Maps(com.google.common.collect.Maps) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult) FeedManagerTemplate(com.thinkbiganalytics.metadata.api.template.FeedManagerTemplate) HadoopSecurityGroup(com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup) EncryptionService(com.thinkbiganalytics.security.core.encrypt.EncryptionService) CategoryModelTransform(com.thinkbiganalytics.feedmgr.service.category.CategoryModelTransform) UserPropertyTransform(com.thinkbiganalytics.feedmgr.service.UserPropertyTransform) DatasourceAccessControl(com.thinkbiganalytics.metadata.api.datasource.security.DatasourceAccessControl) JcrHadoopSecurityGroup(com.thinkbiganalytics.metadata.modeshape.security.JcrHadoopSecurityGroup) HadoopSecurityGroupProvider(com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroupProvider) Collections(java.util.Collections) User(com.thinkbiganalytics.security.rest.model.User) Category(com.thinkbiganalytics.metadata.api.category.Category) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) DataSet(com.thinkbiganalytics.kylo.catalog.rest.model.DataSet) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) ArrayList(java.util.ArrayList) HadoopSecurityGroup(com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup) JcrHadoopSecurityGroup(com.thinkbiganalytics.metadata.modeshape.security.JcrHadoopSecurityGroup) Optional(java.util.Optional) UserFieldDescriptor(com.thinkbiganalytics.metadata.api.extension.UserFieldDescriptor) FeedConnection(com.thinkbiganalytics.metadata.api.feed.FeedConnection) AccessControlException(java.security.AccessControlException) DataSource(com.thinkbiganalytics.kylo.catalog.rest.model.DataSource) UserProperty(com.thinkbiganalytics.feedmgr.rest.model.UserProperty) ActionGroup(com.thinkbiganalytics.security.rest.model.ActionGroup) DefaultTag(com.thinkbiganalytics.discovery.model.DefaultTag) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) Nonnull(javax.annotation.Nonnull)

Example 5 with User

use of com.thinkbiganalytics.security.rest.model.User in project kylo by Teradata.

the class FeedIT method getCreateFeedRequest.

protected FeedMetadata getCreateFeedRequest(FeedCategory category, ImportTemplate template, String name) throws Exception {
    FeedMetadata feed = new FeedMetadata();
    feed.setFeedName(name);
    feed.setSystemFeedName(name.toLowerCase());
    feed.setCategory(category);
    feed.setTemplateId(template.getTemplateId());
    feed.setTemplateName(template.getTemplateName());
    feed.setDescription("Created by functional test");
    feed.setInputProcessorType("org.apache.nifi.processors.standard.GetFile");
    List<NifiProperty> properties = new ArrayList<>();
    NifiProperty fileFilter = new NifiProperty("305363d8-015a-1000-0000-000000000000", "1f67e296-2ff8-4b5d-0000-000000000000", "File Filter", USERDATA1_CSV);
    fileFilter.setProcessGroupName("NiFi Flow");
    fileFilter.setProcessorName("Filesystem");
    fileFilter.setProcessorType("org.apache.nifi.processors.standard.GetFile");
    fileFilter.setTemplateValue("mydata\\d{1,3}.csv");
    fileFilter.setInputProperty(true);
    fileFilter.setUserEditable(true);
    properties.add(fileFilter);
    NifiProperty inputDir = new NifiProperty("305363d8-015a-1000-0000-000000000000", "1f67e296-2ff8-4b5d-0000-000000000000", "Input Directory", VAR_DROPZONE);
    inputDir.setProcessGroupName("NiFi Flow");
    inputDir.setProcessorName("Filesystem");
    inputDir.setProcessorType("org.apache.nifi.processors.standard.GetFile");
    inputDir.setInputProperty(true);
    inputDir.setUserEditable(true);
    properties.add(inputDir);
    NifiProperty loadStrategy = new NifiProperty("305363d8-015a-1000-0000-000000000000", "6aeabec7-ec36-4ed5-0000-000000000000", "Load Strategy", "FULL_LOAD");
    loadStrategy.setProcessGroupName("NiFi Flow");
    loadStrategy.setProcessorName("GetTableData");
    loadStrategy.setProcessorType("com.thinkbiganalytics.nifi.v2.ingest.GetTableData");
    properties.add(loadStrategy);
    feed.setProperties(properties);
    FeedSchedule schedule = new FeedSchedule();
    schedule.setConcurrentTasks(1);
    schedule.setSchedulingPeriod("15 sec");
    schedule.setSchedulingStrategy("TIMER_DRIVEN");
    feed.setSchedule(schedule);
    TableSetup table = new TableSetup();
    DefaultTableSchema schema = new DefaultTableSchema();
    schema.setName("test1");
    List<Field> fields = new ArrayList<>();
    fields.add(newTimestampField("registration_dttm"));
    fields.add(newBigIntField("id"));
    fields.add(newStringField("first_name"));
    fields.add(newStringField("second_name"));
    fields.add(newStringField("email"));
    fields.add(newStringField("gender"));
    fields.add(newStringField("ip_address"));
    fields.add(newBinaryField("cc"));
    fields.add(newStringField("country"));
    fields.add(newStringField("birthdate"));
    fields.add(newStringField("salary"));
    schema.setFields(fields);
    table.setTableSchema(schema);
    table.setSourceTableSchema(schema);
    table.setFeedTableSchema(schema);
    table.setTargetMergeStrategy("DEDUPE_AND_MERGE");
    table.setFeedFormat("ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'\n WITH SERDEPROPERTIES ( 'separatorChar' = ',' ,'escapeChar' = '\\\\' ,'quoteChar' = '\\'') STORED AS TEXTFILE");
    table.setTargetFormat("STORED AS ORC");
    List<FieldPolicy> policies = new ArrayList<>();
    policies.add(newPolicyBuilder("registration_dttm").toPolicy());
    policies.add(newPolicyBuilder("id").toPolicy());
    policies.add(newPolicyBuilder("first_name").withStandardisation(toUpperCase).withProfile().withIndex().toPolicy());
    policies.add(newPolicyBuilder("second_name").withProfile().withIndex().toPolicy());
    policies.add(newPolicyBuilder("email").withValidation(email).toPolicy());
    policies.add(newPolicyBuilder("gender").withValidation(lookup, notNull).toPolicy());
    policies.add(newPolicyBuilder("ip_address").withValidation(ipAddress).toPolicy());
    policies.add(newPolicyBuilder("cc").withStandardisation(base64EncodeBinary).withProfile().toPolicy());
    policies.add(newPolicyBuilder("country").withStandardisation(base64EncodeBinary, base64DecodeBinary, base64EncodeString, base64DecodeString).withValidation(notNull, length).withProfile().toPolicy());
    policies.add(newPolicyBuilder("birthdate").toPolicy());
    policies.add(newPolicyBuilder("salary").toPolicy());
    table.setFieldPolicies(policies);
    List<PartitionField> partitions = new ArrayList<>();
    partitions.add(byYear("registration_dttm"));
    table.setPartitions(partitions);
    TableOptions options = new TableOptions();
    options.setCompressionFormat("SNAPPY");
    options.setAuditLogging(true);
    table.setOptions(options);
    table.setTableType("SNAPSHOT");
    feed.setTable(table);
    feed.setOptions(new FeedProcessingOptions());
    feed.getOptions().setSkipHeader(true);
    feed.setDataOwner("Marketing");
    List<Tag> tags = new ArrayList<>();
    tags.add(new DefaultTag("users"));
    tags.add(new DefaultTag("registrations"));
    feed.setTags(tags);
    User owner = new User();
    owner.setSystemName("dladmin");
    owner.setDisplayName("Data Lake Admin");
    Set<String> groups = new HashSet<>();
    groups.add("admin");
    groups.add("user");
    owner.setGroups(groups);
    feed.setOwner(owner);
    return feed;
}
Also used : FeedProcessingOptions(com.thinkbiganalytics.feedmgr.rest.model.schema.FeedProcessingOptions) User(com.thinkbiganalytics.security.rest.model.User) FieldPolicy(com.thinkbiganalytics.policy.rest.model.FieldPolicy) FeedMetadata(com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata) ArrayList(java.util.ArrayList) PartitionField(com.thinkbiganalytics.feedmgr.rest.model.schema.PartitionField) Field(com.thinkbiganalytics.discovery.schema.Field) PartitionField(com.thinkbiganalytics.feedmgr.rest.model.schema.PartitionField) TableOptions(com.thinkbiganalytics.feedmgr.rest.model.schema.TableOptions) FeedSchedule(com.thinkbiganalytics.feedmgr.rest.model.FeedSchedule) NifiProperty(com.thinkbiganalytics.nifi.rest.model.NifiProperty) TableSetup(com.thinkbiganalytics.feedmgr.rest.model.schema.TableSetup) DefaultTableSchema(com.thinkbiganalytics.discovery.model.DefaultTableSchema) Tag(com.thinkbiganalytics.discovery.schema.Tag) DefaultTag(com.thinkbiganalytics.discovery.model.DefaultTag) DefaultTag(com.thinkbiganalytics.discovery.model.DefaultTag) HashSet(java.util.HashSet)

Aggregations

User (com.thinkbiganalytics.security.rest.model.User)10 DefaultTag (com.thinkbiganalytics.discovery.model.DefaultTag)6 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)6 Tag (com.thinkbiganalytics.discovery.schema.Tag)5 ArrayList (java.util.ArrayList)5 FeedSchedule (com.thinkbiganalytics.feedmgr.rest.model.FeedSchedule)4 NifiProperty (com.thinkbiganalytics.nifi.rest.model.NifiProperty)3 HashSet (java.util.HashSet)3 Nonnull (javax.annotation.Nonnull)3 DefaultTableSchema (com.thinkbiganalytics.discovery.model.DefaultTableSchema)2 FeedCategory (com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)2 FeedSummary (com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)2 RegisteredTemplate (com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate)2 UserProperty (com.thinkbiganalytics.feedmgr.rest.model.UserProperty)2 FeedProcessingOptions (com.thinkbiganalytics.feedmgr.rest.model.schema.FeedProcessingOptions)2 PartitionField (com.thinkbiganalytics.feedmgr.rest.model.schema.PartitionField)2 TableOptions (com.thinkbiganalytics.feedmgr.rest.model.schema.TableOptions)2 TableSetup (com.thinkbiganalytics.feedmgr.rest.model.schema.TableSetup)2 Category (com.thinkbiganalytics.metadata.api.category.Category)2 UserFieldDescriptor (com.thinkbiganalytics.metadata.api.extension.UserFieldDescriptor)2