Search in sources :

Example 6 with JTestItem

use of com.epam.ta.reportportal.jooq.tables.JTestItem in project commons-dao by reportportal.

the class TestItemRepositoryCustomImpl method selectIdsByAnalyzedWithLevelGte.

/**
 * {@link Log} entities are searched from the whole tree under
 * {@link TestItem} that matched to the provided `launchId` and `autoAnalyzed` conditions
 */
@Override
public List<Long> selectIdsByAnalyzedWithLevelGte(boolean autoAnalyzed, Long launchId, int logLevel) {
    JTestItem outerItemTable = TEST_ITEM.as(OUTER_ITEM_TABLE);
    JTestItem nestedItemTable = TEST_ITEM.as(NESTED);
    return dsl.selectDistinct(fieldName(ID)).from(DSL.select(outerItemTable.ITEM_ID.as(ID)).from(outerItemTable).join(TEST_ITEM_RESULTS).on(outerItemTable.ITEM_ID.eq(TEST_ITEM_RESULTS.RESULT_ID)).join(ISSUE).on(TEST_ITEM_RESULTS.RESULT_ID.eq(ISSUE.ISSUE_ID)).where(outerItemTable.LAUNCH_ID.eq(launchId)).and(outerItemTable.HAS_STATS).andNot(outerItemTable.HAS_CHILDREN).and(ISSUE.AUTO_ANALYZED.eq(autoAnalyzed)).and(DSL.exists(DSL.selectOne().from(nestedItemTable).join(LOG).on(nestedItemTable.ITEM_ID.eq(LOG.ITEM_ID)).where(nestedItemTable.LAUNCH_ID.eq(launchId)).andNot(nestedItemTable.HAS_STATS).and(LOG.LOG_LEVEL.greaterOrEqual(logLevel)).and(DSL.sql(outerItemTable.PATH + " @> " + nestedItemTable.PATH)))).unionAll(DSL.selectDistinct(TEST_ITEM.ITEM_ID.as(ID)).from(TEST_ITEM).join(TEST_ITEM_RESULTS).on(TEST_ITEM.ITEM_ID.eq(TEST_ITEM_RESULTS.RESULT_ID)).join(ISSUE).on(TEST_ITEM_RESULTS.RESULT_ID.eq(ISSUE.ISSUE_ID)).join(LOG).on(TEST_ITEM.ITEM_ID.eq(LOG.ITEM_ID)).where(TEST_ITEM.LAUNCH_ID.eq(launchId)).and(ISSUE.AUTO_ANALYZED.eq(autoAnalyzed)).and(LOG.LOG_LEVEL.greaterOrEqual(logLevel))).asTable(ITEM)).fetchInto(Long.class);
}
Also used : JTestItem(com.epam.ta.reportportal.jooq.tables.JTestItem)

Example 7 with JTestItem

use of com.epam.ta.reportportal.jooq.tables.JTestItem in project commons-dao by reportportal.

the class TestItemRepositoryCustomImpl method selectIdsByHasDescendants.

@Override
public List<Long> selectIdsByHasDescendants(Collection<Long> itemIds) {
    final JTestItem parent = TEST_ITEM.as(OUTER_ITEM_TABLE);
    final JTestItem child = TEST_ITEM.as(CHILD_ITEM_TABLE);
    return dsl.select(parent.ITEM_ID).from(parent).join(child).on(parent.ITEM_ID.eq(child.PARENT_ID)).where(parent.ITEM_ID.in(itemIds)).groupBy(parent.ITEM_ID).fetchInto(Long.class);
}
Also used : JTestItem(com.epam.ta.reportportal.jooq.tables.JTestItem)

Aggregations

JTestItem (com.epam.ta.reportportal.jooq.tables.JTestItem)7 Filter (com.epam.ta.reportportal.commons.querygen.Filter)1 QueryBuilder (com.epam.ta.reportportal.commons.querygen.QueryBuilder)1 Queryable (com.epam.ta.reportportal.commons.querygen.Queryable)1 CRITERIA_LOG_TIME (com.epam.ta.reportportal.commons.querygen.constant.LogCriteriaConstant.CRITERIA_LOG_TIME)1 CRITERIA_STATUS (com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_STATUS)1 LogRepositoryConstants (com.epam.ta.reportportal.dao.constant.LogRepositoryConstants)1 NESTED (com.epam.ta.reportportal.dao.constant.TestItemRepositoryConstants.NESTED)1 ID (com.epam.ta.reportportal.dao.constant.WidgetRepositoryConstants.ID)1 JooqFieldNameTransformer.fieldName (com.epam.ta.reportportal.dao.util.JooqFieldNameTransformer.fieldName)1 QueryUtils (com.epam.ta.reportportal.dao.util.QueryUtils)1 RecordMappers (com.epam.ta.reportportal.dao.util.RecordMappers)1 LOG_FETCHER (com.epam.ta.reportportal.dao.util.ResultFetchers.LOG_FETCHER)1 NESTED_ITEM_FETCHER (com.epam.ta.reportportal.dao.util.ResultFetchers.NESTED_ITEM_FETCHER)1 TimestampUtils (com.epam.ta.reportportal.dao.util.TimestampUtils)1 StatusEnum (com.epam.ta.reportportal.entity.enums.StatusEnum)1 NestedItem (com.epam.ta.reportportal.entity.item.NestedItem)1 Log (com.epam.ta.reportportal.entity.log.Log)1 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)1 CLUSTERS (com.epam.ta.reportportal.jooq.Tables.CLUSTERS)1