Search in sources :

Example 21 with FeedSummary

use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.

the class FeedModelTransform method domainToFeedSummary.

/**
 * Transforms the specified Metadata feed to a Feed Manager feed summary.
 *
 * @param feedManagerFeed the Metadata feed
 * @return the Feed Manager feed summary
 */
public FeedSummary domainToFeedSummary(@Nonnull final Feed feedManagerFeed) {
    Category category = feedManagerFeed.getCategory();
    if (category == null) {
        return null;
    }
    FeedSummary feedSummary = new FeedSummary();
    feedSummary.setId(feedManagerFeed.getId().toString());
    feedSummary.setFeedId(feedManagerFeed.getId().toString());
    feedSummary.setCategoryId(category.getId().toString());
    if (category instanceof Category) {
        feedSummary.setCategoryIcon(category.getIcon());
        feedSummary.setCategoryIconColor(category.getIconColor());
    }
    feedSummary.setCategoryName(category.getDisplayName());
    feedSummary.setSystemCategoryName(category.getSystemName());
    feedSummary.setUpdateDate(feedManagerFeed.getModifiedTime() != null ? feedManagerFeed.getModifiedTime().toDate() : null);
    feedSummary.setFeedName(feedManagerFeed.getDisplayName());
    feedSummary.setSystemFeedName(feedManagerFeed.getName());
    feedSummary.setActive(feedManagerFeed.getState() != null && feedManagerFeed.getState().equals(Feed.State.ENABLED));
    feedSummary.setState(feedManagerFeed.getState() != null ? feedManagerFeed.getState().name() : null);
    if (feedManagerFeed instanceof Feed) {
        Feed fmf = (Feed) feedManagerFeed;
        if (fmf.getTemplate() != null) {
            feedSummary.setTemplateId(fmf.getTemplate().getId().toString());
            feedSummary.setTemplateName(fmf.getTemplate().getName());
        }
    }
    // add in access control items
    securityTransform.applyAccessControl(feedManagerFeed, feedSummary);
    return feedSummary;
}
Also used : Category(com.thinkbiganalytics.metadata.api.category.Category) FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary) Feed(com.thinkbiganalytics.metadata.api.feed.Feed) UIFeed(com.thinkbiganalytics.feedmgr.rest.model.UIFeed)

Example 22 with FeedSummary

use of com.thinkbiganalytics.feedmgr.rest.model.FeedSummary in project kylo by Teradata.

the class InMemoryFeedManagerFeedService method applyFeedSelectOptions.

@Override
public void applyFeedSelectOptions(List<FieldRuleProperty> properties) {
    if (properties != null && !properties.isEmpty()) {
        List<FeedSummary> feedSummaries = getFeedSummaryData();
        List<LabelValue> feedSelection = new ArrayList<>();
        for (FeedSummary feedSummary : feedSummaries) {
            feedSelection.add(new LabelValue(feedSummary.getCategoryAndFeedDisplayName(), feedSummary.getCategoryAndFeedSystemName()));
        }
        for (FieldRuleProperty property : properties) {
            property.setSelectableValues(feedSelection);
            if (property.getValues() == null) {
                // reset the intial values to be an empty arraylist
                property.setValues(new ArrayList<>());
            }
        }
    }
}
Also used : LabelValue(com.thinkbiganalytics.rest.model.LabelValue) ArrayList(java.util.ArrayList) FieldRuleProperty(com.thinkbiganalytics.policy.rest.model.FieldRuleProperty) FeedSummary(com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)

Aggregations

FeedSummary (com.thinkbiganalytics.feedmgr.rest.model.FeedSummary)22 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)11 FeedCategory (com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)10 ArrayList (java.util.ArrayList)9 Feed (com.thinkbiganalytics.metadata.api.feed.Feed)6 UIFeed (com.thinkbiganalytics.feedmgr.rest.model.UIFeed)5 NifiFeed (com.thinkbiganalytics.feedmgr.rest.model.NifiFeed)4 RegisteredTemplate (com.thinkbiganalytics.feedmgr.rest.model.RegisteredTemplate)4 UserProperty (com.thinkbiganalytics.feedmgr.rest.model.UserProperty)4 Category (com.thinkbiganalytics.metadata.api.category.Category)4 FeedNotFoundException (com.thinkbiganalytics.metadata.api.feed.FeedNotFoundException)4 NifiClientRuntimeException (com.thinkbiganalytics.nifi.rest.client.NifiClientRuntimeException)4 NotFoundException (javax.ws.rs.NotFoundException)4 Response (com.jayway.restassured.response.Response)3 DefaultTag (com.thinkbiganalytics.discovery.model.DefaultTag)3 EntityVersionDifference (com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference)3 FeedVersions (com.thinkbiganalytics.feedmgr.rest.model.FeedVersions)3 HadoopSecurityGroup (com.thinkbiganalytics.metadata.api.security.HadoopSecurityGroup)3 JcrHadoopSecurityGroup (com.thinkbiganalytics.metadata.modeshape.security.JcrHadoopSecurityGroup)3 FieldRuleProperty (com.thinkbiganalytics.policy.rest.model.FieldRuleProperty)3