Search in sources :

Example 1 with ServiceLevelAgreementEvent

use of com.thinkbiganalytics.metadata.api.event.sla.ServiceLevelAgreementEvent in project kylo by Teradata.

the class JcrServiceLevelAgreementProvider method addPostSlaChangeAction.

private void addPostSlaChangeAction(ServiceLevelAgreement sla, MetadataChange.ChangeType changeType) {
    ServiceLevelAgreement.ID id = sla.getId();
    String name = sla.getName();
    final Principal principal = SecurityContextHolder.getContext().getAuthentication();
    Consumer<Boolean> action = (success) -> {
        if (success) {
            ServiceLevelAgreementChange change = new ServiceLevelAgreementChange(changeType, id, name);
            ServiceLevelAgreementEvent event = new ServiceLevelAgreementEvent(change, DateTime.now(), principal);
            metadataEventService.notify(event);
        }
    };
    JcrMetadataAccess.addPostTransactionAction(action);
}
Also used : EntityUtil(com.thinkbiganalytics.metadata.modeshape.common.EntityUtil) Metric(com.thinkbiganalytics.metadata.sla.api.Metric) JcrTools(org.modeshape.jcr.api.JcrTools) SlaId(com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement.SlaId) ServiceLevelAgreementActionConfiguration(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfiguration) QueryResult(javax.jcr.query.QueryResult) Obligation(com.thinkbiganalytics.metadata.sla.api.Obligation) JcrPropertyConstants(com.thinkbiganalytics.metadata.modeshape.common.JcrPropertyConstants) JcrQueryUtil(com.thinkbiganalytics.metadata.modeshape.support.JcrQueryUtil) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) ServiceLevelAgreementChange(com.thinkbiganalytics.metadata.api.event.sla.ServiceLevelAgreementChange) JcrPropertyUtil(com.thinkbiganalytics.metadata.modeshape.support.JcrPropertyUtil) ImmutableMap(com.google.common.collect.ImmutableMap) Session(javax.jcr.Session) Collection(java.util.Collection) Set(java.util.Set) UUID(java.util.UUID) MetadataEventService(com.thinkbiganalytics.metadata.api.event.MetadataEventService) ItemNotFoundException(javax.jcr.ItemNotFoundException) Serializable(java.io.Serializable) List(java.util.List) Principal(java.security.Principal) FeedServiceLevelAgreementProvider(com.thinkbiganalytics.metadata.api.sla.FeedServiceLevelAgreementProvider) ServiceLevelAgreementEvent(com.thinkbiganalytics.metadata.api.event.sla.ServiceLevelAgreementEvent) BaseJcrProvider(com.thinkbiganalytics.metadata.modeshape.BaseJcrProvider) JcrMetadataAccess(com.thinkbiganalytics.metadata.modeshape.JcrMetadataAccess) JcrEntity(com.thinkbiganalytics.metadata.modeshape.common.JcrEntity) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) ServiceLevelAgreementBuilder(com.thinkbiganalytics.metadata.sla.spi.ServiceLevelAgreementBuilder) Iterators(com.google.common.collect.Iterators) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Inject(javax.inject.Inject) Lists(com.google.common.collect.Lists) ObligationGroupBuilder(com.thinkbiganalytics.metadata.sla.spi.ObligationGroupBuilder) RepositoryException(javax.jcr.RepositoryException) Node(javax.jcr.Node) ServiceLevelAgreementCheckBuilder(com.thinkbiganalytics.metadata.sla.spi.ServiceLevelAgreementCheckBuilder) MetadataChange(com.thinkbiganalytics.metadata.api.event.MetadataChange) JcrFeedPrecondition(com.thinkbiganalytics.metadata.modeshape.feed.JcrFeedPrecondition) ID(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement.ID) Iterator(java.util.Iterator) DateTime(org.joda.time.DateTime) ServiceLevelAgreementActionConfig(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreementActionConfig) ServiceLevelAgreementProvider(com.thinkbiganalytics.metadata.sla.spi.ServiceLevelAgreementProvider) ServiceLevelAgreementCheck(com.thinkbiganalytics.metadata.sla.spi.ServiceLevelAgreementCheck) Consumer(java.util.function.Consumer) Condition(com.thinkbiganalytics.metadata.sla.api.ObligationGroup.Condition) JcrUtil(com.thinkbiganalytics.metadata.modeshape.support.JcrUtil) ObligationBuilder(com.thinkbiganalytics.metadata.sla.spi.ObligationBuilder) ServiceLevelAgreementEvent(com.thinkbiganalytics.metadata.api.event.sla.ServiceLevelAgreementEvent) ServiceLevelAgreementChange(com.thinkbiganalytics.metadata.api.event.sla.ServiceLevelAgreementChange) ID(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement.ID) ServiceLevelAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement) Principal(java.security.Principal)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 Iterators (com.google.common.collect.Iterators)1 Lists (com.google.common.collect.Lists)1 MetadataChange (com.thinkbiganalytics.metadata.api.event.MetadataChange)1 MetadataEventService (com.thinkbiganalytics.metadata.api.event.MetadataEventService)1 ServiceLevelAgreementChange (com.thinkbiganalytics.metadata.api.event.sla.ServiceLevelAgreementChange)1 ServiceLevelAgreementEvent (com.thinkbiganalytics.metadata.api.event.sla.ServiceLevelAgreementEvent)1 FeedServiceLevelAgreementProvider (com.thinkbiganalytics.metadata.api.sla.FeedServiceLevelAgreementProvider)1 BaseJcrProvider (com.thinkbiganalytics.metadata.modeshape.BaseJcrProvider)1 JcrMetadataAccess (com.thinkbiganalytics.metadata.modeshape.JcrMetadataAccess)1 MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)1 EntityUtil (com.thinkbiganalytics.metadata.modeshape.common.EntityUtil)1 JcrEntity (com.thinkbiganalytics.metadata.modeshape.common.JcrEntity)1 JcrPropertyConstants (com.thinkbiganalytics.metadata.modeshape.common.JcrPropertyConstants)1 JcrFeedPrecondition (com.thinkbiganalytics.metadata.modeshape.feed.JcrFeedPrecondition)1 SlaId (com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement.SlaId)1 JcrPropertyUtil (com.thinkbiganalytics.metadata.modeshape.support.JcrPropertyUtil)1 JcrQueryUtil (com.thinkbiganalytics.metadata.modeshape.support.JcrQueryUtil)1 JcrUtil (com.thinkbiganalytics.metadata.modeshape.support.JcrUtil)1 Metric (com.thinkbiganalytics.metadata.sla.api.Metric)1