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;
}
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<>());
}
}
}
}
Aggregations