use of com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed in project kylo by Teradata.
the class NifiFeedProcessorStatisticsProvider method findFeedProcessorStatisticsByProcessorId.
@Override
public List<? extends JpaNifiFeedProcessorStats> findFeedProcessorStatisticsByProcessorId(String feedName, DateTime start, DateTime end) {
QJpaNifiFeedProcessorStats stats = QJpaNifiFeedProcessorStats.jpaNifiFeedProcessorStats;
QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
JPAQuery query = factory.select(Projections.bean(JpaNifiFeedProcessorStats.class, stats.feedName, stats.processorId, stats.processorName, stats.bytesIn.sum().as("bytesIn"), stats.bytesOut.sum().as("bytesOut"), stats.duration.sum().as("duration"), stats.jobsStarted.sum().as("jobsStarted"), stats.jobsFinished.sum().as("jobsFinished"), stats.jobDuration.sum().as("jobDuration"), stats.flowFilesStarted.sum().as("flowFilesStarted"), stats.flowFilesFinished.sum().as("flowFilesFinished"), stats.totalCount.sum().as("totalCount"), stats.maxEventTime.max().as("maxEventTime"), stats.minEventTime.min().as("minEventTime"), stats.jobsFailed.sum().as("jobsFailed"), stats.failedCount.sum().as("failedCount"), stats.count().as("resultSetCount"))).from(stats).innerJoin(feed).on(feed.name.eq(stats.feedName)).where(stats.feedName.eq(feedName).and(FeedAclIndexQueryAugmentor.generateExistsExpression(feed.id, accessController.isEntityAccessControlled())).and(stats.minEventTime.goe(start).and(stats.maxEventTime.loe(end)))).groupBy(stats.feedName, stats.processorId, stats.processorName).orderBy(stats.processorName.asc());
return (List<JpaNifiFeedProcessorStats>) query.fetch();
}
use of com.thinkbiganalytics.metadata.jpa.feed.QJpaOpsManagerFeed in project kylo by Teradata.
the class KyloEntityAwareAlertCriteria method createSummaryQuery.
public JPAQuery<AlertSummary> createSummaryQuery() {
QJpaAlert alert = QJpaAlert.jpaAlert;
QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
QJpaOpsManagerFeed slaFeed = new QJpaOpsManagerFeed("slaFeed");
QJpaServiceLevelAgreementDescription sla = QJpaServiceLevelAgreementDescription.jpaServiceLevelAgreementDescription;
JPAQuery query = queryFactory.select(Projections.bean(KyloEntityAwareAlertSummary.class, alert.typeString.as("type"), alert.subtype.as("subtype"), alert.level.as("level"), feed.id.as("feedId"), feed.name.as("feedName"), sla.slaId.as("slaId"), sla.name.as("slaName"), alert.count().as("count"), alert.createdTimeMillis.max().as("lastAlertTimestamp"))).from(alert).leftJoin(feed).on(feed.id.uuid.eq(alert.entityId.value).and(alert.entityType.eq(Expressions.stringPath("'FEED'")))).leftJoin(sla).on(sla.slaId.uuid.eq(alert.entityId.value).and(alert.entityType.eq(Expressions.stringPath("'SLA'")))).leftJoin(sla.feeds, slaFeed).groupBy(alert.typeString, alert.subtype, feed.id, feed.name, sla.slaId, sla.name, alert.level);
List<Predicate> preds = filter(alert);
boolean entityAccessControlled = !isAsServiceAccount() && controller.isEntityAccessControlled();
preds.add(feed.isNull().or(feed.isNotNull().and(FeedAclIndexQueryAugmentor.generateExistsExpression(feed.id, entityAccessControlled))));
preds.add(slaFeed.isNull().or(slaFeed.isNotNull().and(FeedAclIndexQueryAugmentor.generateExistsExpression(slaFeed.id, entityAccessControlled))));
BooleanBuilder orFilter = orFilter(alert, feed, sla);
addEntityFilter(alert, preds);
return (JPAQuery<AlertSummary>) super.addWhere(query, preds, orFilter);
}
Aggregations