use of com.thinkbiganalytics.metadata.api.event.feed.FeedChangeEvent in project kylo by Teradata.
the class JcrFeedProvider method addPostFeedChangeAction.
/**
* Registers an action that produces a feed change event upon a successful transaction commit.
*
* @param feed the feed to being created
*/
private void addPostFeedChangeAction(Feed feed, ChangeType changeType) {
Feed.State state = feed.getState();
Feed.ID id = feed.getId();
String feedName = feed.getQualifiedName();
final Principal principal = SecurityContextHolder.getContext().getAuthentication();
Consumer<Boolean> action = (success) -> {
if (success) {
FeedChange change = new FeedChange(changeType, feedName, feedName, id, state);
FeedChangeEvent event = new FeedChangeEvent(change, DateTime.now(), principal);
metadataEventService.notify(event);
}
};
JcrMetadataAccess.addPostTransactionAction(action);
}
use of com.thinkbiganalytics.metadata.api.event.feed.FeedChangeEvent in project kylo by Teradata.
the class DefaultFeedManagerFeedService method notifyFeedStateChange.
/**
* update the audit information for feed state changes
*
* @param feedId the feed id
* @param state the new state
* @param changeType the event type
*/
private void notifyFeedStateChange(FeedMetadata feedMetadata, Feed.ID feedId, Feed.State state, MetadataChange.ChangeType changeType) {
final Principal principal = SecurityContextHolder.getContext().getAuthentication() != null ? SecurityContextHolder.getContext().getAuthentication() : null;
String feedName = feedMetadata != null ? feedMetadata.getCategoryAndFeedName() : "";
FeedChange change = new FeedChange(changeType, feedName, feedName, feedId, state);
FeedChangeEvent event = new FeedChangeEvent(change, DateTime.now(), principal);
metadataEventService.notify(event);
}
Aggregations