Search in sources :

Example 6 with DBStoreEvent

use of com.blackducksoftware.integration.hub.alert.event.DBStoreEvent in project hub-alert by blackducksoftware.

the class AccumulatorProcessor method process.

@Override
public DBStoreEvent process(final NotificationResults notificationData) throws Exception {
    if (notificationData != null) {
        try {
            final HubServicesFactory hubServicesFactory = globalProperties.createHubServicesFactoryAndLogErrors(logger);
            if (hubServicesFactory != null) {
                logger.info("Processing accumulated notifications");
                final NotificationItemProcessor notificationItemProcessor = new NotificationItemProcessor(globalProperties, hubServicesFactory.getRestConnection().logger);
                final DBStoreEvent storeEvent = notificationItemProcessor.process(notificationData.getNotificationContentItems());
                return storeEvent;
            }
        } catch (final Exception ex) {
            logger.error("Error occurred durring processing of accumulated notifications", ex);
        }
    } else {
        logger.info("No notifications to process");
    }
    return null;
}
Also used : HubServicesFactory(com.blackducksoftware.integration.hub.service.HubServicesFactory) NotificationItemProcessor(com.blackducksoftware.integration.hub.alert.processor.NotificationItemProcessor) DBStoreEvent(com.blackducksoftware.integration.hub.alert.event.DBStoreEvent)

Aggregations

DBStoreEvent (com.blackducksoftware.integration.hub.alert.event.DBStoreEvent)6 Test (org.junit.Test)4 NotificationEvent (com.blackducksoftware.integration.hub.notification.NotificationEvent)3 NotificationResults (com.blackducksoftware.integration.hub.notification.NotificationResults)2 AbstractJmsTemplate (com.blackducksoftware.integration.hub.alert.AbstractJmsTemplate)1 NotificationManager (com.blackducksoftware.integration.hub.alert.NotificationManager)1 TestGlobalProperties (com.blackducksoftware.integration.hub.alert.TestGlobalProperties)1 AccumulatorProcessor (com.blackducksoftware.integration.hub.alert.accumulator.AccumulatorProcessor)1 AccumulatorReader (com.blackducksoftware.integration.hub.alert.accumulator.AccumulatorReader)1 AccumulatorWriter (com.blackducksoftware.integration.hub.alert.accumulator.AccumulatorWriter)1 ChannelTemplateManager (com.blackducksoftware.integration.hub.alert.channel.ChannelTemplateManager)1 GlobalProperties (com.blackducksoftware.integration.hub.alert.config.GlobalProperties)1 NotificationItemProcessor (com.blackducksoftware.integration.hub.alert.processor.NotificationItemProcessor)1 ProjectRequest (com.blackducksoftware.integration.hub.api.generated.component.ProjectRequest)1 ProjectVersionRequest (com.blackducksoftware.integration.hub.api.generated.component.ProjectVersionRequest)1 ProjectView (com.blackducksoftware.integration.hub.api.generated.view.ProjectView)1 NotificationCategoryEnum (com.blackducksoftware.integration.hub.notification.NotificationCategoryEnum)1 HubServicesFactory (com.blackducksoftware.integration.hub.service.HubServicesFactory)1 TestLogger (com.blackducksoftware.integration.test.TestLogger)1 HubConnectionTest (com.blackducksoftware.integration.test.annotation.HubConnectionTest)1