use of com.thinkbiganalytics.security.role.RoleMembership in project kylo by Teradata.
the class JcrFeedProvider method moveFeed.
/* (non-Javadoc)
* @see com.thinkbiganalytics.metadata.api.feed.FeedProvider#moveFeed(com.thinkbiganalytics.metadata.api.feed.Feed, com.thinkbiganalytics.metadata.api.category.Category)
*/
@Override
public Feed moveFeed(Feed feed, Category toCat) {
// Only allow a move if none of this feed's versions has ever been deployed.
if (findDeployedVersion(feed.getId(), false).isPresent()) {
throw new MetadataRepositoryException("Only a draft feed with no versions may change its category - current category is: " + toCat.getDisplayName());
} else {
Set<RoleMembership> prevCatMemberships = feed.getCategory().getFeedRoleMemberships();
Node feedNode = ((JcrFeed) feed).getNode();
Path newPath = JcrUtil.path(EntityUtil.pathForFeed(toCat.getSystemName(), feed.getSystemName()));
feedNode = JcrUtil.moveNode(feedNode, newPath);
JcrFeed moved = JcrUtil.getJcrObject(feedNode, JcrFeed.class, this.opsAccessProvider);
moved.updateAllRoleMembershipPermissions(prevCatMemberships.stream());
return moved;
}
}
Aggregations