Search in sources :

Example 1 with QJpaBatchJobExecution

use of com.thinkbiganalytics.metadata.jpa.jobrepo.job.QJpaBatchJobExecution 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)

Example 2 with QJpaBatchJobExecution

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

the class JpaBatchJobExecutionTest method testFilters.

@WithMockJaasUser(username = "dladmin", password = "secret", authorities = { "admin" })
@Test
public void testFilters() {
    operationalMetadataAccess.read(() -> {
        QJpaBatchJobExecution jobExecution = QJpaBatchJobExecution.jpaBatchJobExecution;
        BooleanBuilder builder = GenericQueryDslFilter.buildFilter(jobExecution, "status==\"COMPLETED,FAILED\"");
        int i = 0;
        return null;
    });
}
Also used : BooleanBuilder(com.querydsl.core.BooleanBuilder) QJpaBatchJobExecution(com.thinkbiganalytics.metadata.jpa.jobrepo.job.QJpaBatchJobExecution) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) WithMockJaasUser(com.thinkbiganalytics.test.security.WithMockJaasUser)

Aggregations

QJpaBatchJobExecution (com.thinkbiganalytics.metadata.jpa.jobrepo.job.QJpaBatchJobExecution)2 BooleanBuilder (com.querydsl.core.BooleanBuilder)1 JPAQuery (com.querydsl.jpa.impl.JPAQuery)1 QJpaBatchJobInstance (com.thinkbiganalytics.metadata.jpa.jobrepo.job.QJpaBatchJobInstance)1 WithMockJaasUser (com.thinkbiganalytics.test.security.WithMockJaasUser)1 List (java.util.List)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1