Search in sources :

Example 1 with QJpaBatchJobInstance

use of com.thinkbiganalytics.metadata.jpa.jobrepo.job.QJpaBatchJobInstance in project kylo by Teradata.

the class OpsFeedManagerFeedProvider method getJobStatusCountByDateFromNow.

public List<JobStatusCount> getJobStatusCountByDateFromNow(String feedName, ReadablePeriod period) {
    QJpaBatchJobExecution jobExecution = QJpaBatchJobExecution.jpaBatchJobExecution;
    QJpaBatchJobInstance jobInstance = QJpaBatchJobInstance.jpaBatchJobInstance;
    QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
    JPAQuery query = factory.select(Projections.constructor(JpaBatchJobExecutionStatusCounts.class, JobStatusDslQueryExpressionBuilder.jobState().as("status"), Expressions.constant(feedName), jobExecution.startYear, jobExecution.startMonth, jobExecution.startDay, jobExecution.count().as("count"))).from(jobExecution).innerJoin(jobInstance).on(jobExecution.jobInstance.jobInstanceId.eq(jobInstance.jobInstanceId)).innerJoin(feed).on(jobInstance.feed.id.eq(feed.id)).where(jobExecution.startTime.goe(DateTime.now().minus(period)).and(feed.name.eq(feedName)).and(FeedAclIndexQueryAugmentor.generateExistsExpression(feed.id, accessController.isEntityAccessControlled()))).groupBy(jobExecution.status, jobExecution.startYear, jobExecution.startMonth, jobExecution.startDay);
    return (List<JobStatusCount>) query.fetch();
}
Also used : QJpaBatchJobInstance(com.thinkbiganalytics.metadata.jpa.jobrepo.job.QJpaBatchJobInstance) List(java.util.List) QJpaBatchJobExecution(com.thinkbiganalytics.metadata.jpa.jobrepo.job.QJpaBatchJobExecution) JPAQuery(com.querydsl.jpa.impl.JPAQuery)

Aggregations

JPAQuery (com.querydsl.jpa.impl.JPAQuery)1 QJpaBatchJobExecution (com.thinkbiganalytics.metadata.jpa.jobrepo.job.QJpaBatchJobExecution)1 QJpaBatchJobInstance (com.thinkbiganalytics.metadata.jpa.jobrepo.job.QJpaBatchJobInstance)1 List (java.util.List)1