use of com.thinkbiganalytics.metadata.api.event.template.TemplateChange in project kylo by Teradata.
the class DefaultFeedManagerTemplateService method notifyTemplateStateChange.
/**
* update audit information for template changes
*
* @param template the template
* @param templateId the template id
* @param state the new state
* @param changeType the type of change
*/
private void notifyTemplateStateChange(RegisteredTemplate template, FeedManagerTemplate.ID templateId, FeedManagerTemplate.State state, MetadataChange.ChangeType changeType) {
final Principal principal = SecurityContextHolder.getContext().getAuthentication() != null ? SecurityContextHolder.getContext().getAuthentication() : null;
TemplateChange change = new TemplateChange(changeType, template != null ? template.getTemplateName() : "", templateId, state);
TemplateChangeEvent event = new TemplateChangeEvent(change, DateTime.now(), principal);
metadataEventService.notify(event);
}
use of com.thinkbiganalytics.metadata.api.event.template.TemplateChange in project kylo by Teradata.
the class JcrFeedTemplateProvider method addPostFeedChangeAction.
/**
* Registers an action that produces a template change event upon a successful transaction commit.
*
* @param template the feed to being created
*/
private void addPostFeedChangeAction(FeedManagerTemplate template, ChangeType changeType) {
FeedManagerTemplate.State state = template.getState();
FeedManagerTemplate.ID id = template.getId();
String desc = template.getName();
DateTime createTime = template.getCreatedTime();
final Principal principal = SecurityContextHolder.getContext().getAuthentication() != null ? SecurityContextHolder.getContext().getAuthentication() : null;
Consumer<Boolean> action = (success) -> {
if (success) {
TemplateChange change = new TemplateChange(changeType, desc, id, state);
TemplateChangeEvent event = new TemplateChangeEvent(change, createTime, principal);
metadataEventService.notify(event);
}
};
JcrMetadataAccess.addPostTransactionAction(action);
}
Aggregations