Java Code Examples for org.jooq.impl.DSL#exists()
The following examples show how to use
org.jooq.impl.DSL#exists() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SurveyInstanceRecipientDao.java From waltz with Apache License 2.0 | 5 votes |
public boolean isPersonInstanceRecipient(long personId, long surveyInstanceId) { Condition recipientExists = DSL.exists(DSL.selectFrom(SURVEY_INSTANCE_RECIPIENT) .where(SURVEY_INSTANCE_RECIPIENT.SURVEY_INSTANCE_ID.eq(surveyInstanceId) .and(SURVEY_INSTANCE_RECIPIENT.PERSON_ID.eq(personId)))); return dsl.select(DSL.when(recipientExists, true).otherwise(false)) .fetchOne(Record1::value1); }
Example 2
Source File: PersonApplicationExtractor.java From waltz with Apache License 2.0 | 5 votes |
private SelectConditionStep<Record9<Long, String, String, String, String, String, String, String, String>> prepareExtractQuery(String empId) { Condition isDirect = DSL.exists(DSL .select(INVOLVEMENT.ENTITY_ID) .from(INVOLVEMENT) .where(INVOLVEMENT.EMPLOYEE_ID.eq(empId) .and(INVOLVEMENT.ENTITY_ID.eq(APPLICATION.ID)))); Field<String> directOrOversightField = DSL .when(isDirect, "Direct") .otherwise("Oversight"); return dsl .selectDistinct( APPLICATION.ID.as("Waltz Id"), APPLICATION.NAME.as("Name"), APPLICATION.ASSET_CODE.as("Asset Code"), ORGANISATIONAL_UNIT.NAME.as("Org Unit"), APPLICATION.KIND.as("Application Kind"), APPLICATION.OVERALL_RATING.as("Overall Rating"), APPLICATION.BUSINESS_CRITICALITY.as("Business Criticality"), APPLICATION.LIFECYCLE_PHASE.as("Lifecycle Phase"), directOrOversightField.as("Direct or Oversight")) .from(APPLICATION) .innerJoin(INVOLVEMENT) .on(INVOLVEMENT.ENTITY_ID.eq(APPLICATION.ID) .and(INVOLVEMENT.ENTITY_KIND.eq(EntityKind.APPLICATION.name()))) .innerJoin(ORGANISATIONAL_UNIT) .on(ORGANISATIONAL_UNIT.ID.eq(APPLICATION.ORGANISATIONAL_UNIT_ID)) .innerJoin(PERSON_HIERARCHY) .on(PERSON_HIERARCHY.EMPLOYEE_ID.eq(INVOLVEMENT.EMPLOYEE_ID)) .where(PERSON_HIERARCHY.MANAGER_ID.eq(empId) .and(APPLICATION.ENTITY_LIFECYCLE_STATUS.notEqual(EntityLifecycleStatus.REMOVED.name()))); }
Example 3
Source File: EnumValueDao.java From waltz with Apache License 2.0 | 4 votes |
public static Condition mkExistsCondition(EnumValueKind kind, String key) { return DSL.exists( DSL.selectFrom(Tables.ENUM_VALUE) .where(Tables.ENUM_VALUE.TYPE.eq(kind.dbValue())) .and(Tables.ENUM_VALUE.KEY.eq(key))); }