org.jooq.Condition Java Examples

The following examples show how to use org.jooq.Condition. 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: PostgresAppSearch.java    From waltz with Apache License 2.0 6 votes vote down vote up
@Override
public List<Application> searchFullText(DSLContext dsl, EntitySearchOptions options) {
    Field<Double> rank = DSL
            .field("ts_rank_cd(to_tsvector({0} || ' ' || coalesce({1}, '')), plainto_tsquery({2}))",
                    Double.class,
                    DSL.lower(APPLICATION.DESCRIPTION),
                    DSL.lower(APPLICATION.PARENT_ASSET_CODE),
                    DSL.inline(options.searchQuery().toLowerCase()));

    Condition lifecycleCondition = APPLICATION.ENTITY_LIFECYCLE_STATUS.in(options.entityLifecycleStatuses());

    return dsl
            .select(APPLICATION.fields())
            .select(rank)
            .from(APPLICATION)
            .where(rank.greaterThan(Double.MIN_VALUE))
            .and(lifecycleCondition)
            .orderBy(rank.desc())
            .limit(options.limit())
            .fetch(ApplicationDao.TO_DOMAIN_MAPPER);
}
 
Example #2
Source File: ActorDao.java    From waltz with Apache License 2.0 6 votes vote down vote up
public boolean deleteIfNotUsed(long id) {
    Condition notMentionedInFlows = DSL
            .notExists(DSL
                    .selectFrom(LOGICAL_FLOW)
                    .where(LOGICAL_FLOW.SOURCE_ENTITY_ID.eq(id)
                        .and(LOGICAL_FLOW.SOURCE_ENTITY_KIND.eq(EntityKind.ACTOR.name()))
                        .or(LOGICAL_FLOW.TARGET_ENTITY_ID.eq(id)
                                .and(LOGICAL_FLOW.SOURCE_ENTITY_KIND.eq(EntityKind.ACTOR.name())))));

    Condition notMentionedInInvolvements = DSL
            .notExists(DSL
                    .selectFrom(INVOLVEMENT)
                    .where(INVOLVEMENT.KIND_ID.eq(id)));

    return dsl
            .deleteFrom(ACTOR)
            .where(ACTOR.ID.eq(id))
            .and(notMentionedInInvolvements)
            .and(notMentionedInFlows)
            .execute() > 0;
}
 
Example #3
Source File: FilterInfo.java    From java-crud-api with MIT License 6 votes vote down vote up
private PathTree<Character, Condition> getConditionsAsPathTree(ReflectedTable table, Params params) {
	PathTree<Character, Condition> conditions = new PathTree<>();
	LinkedList<Character> path0 = new LinkedList<>();
	addConditionFromFilteraPath(conditions, path0, table, params);
	for (char n = '0'; n <= '9'; n++) {
		LinkedList<Character> path1 = new LinkedList<>();
		path1.add(n);
		addConditionFromFilteraPath(conditions, path1, table, params);
		for (char l = 'a'; l <= 'f'; l++) {
			LinkedList<Character> path2 = new LinkedList<>();
			path2.add(n);
			path2.add(l);
			addConditionFromFilteraPath(conditions, path2, table, params);
		}
	}
	return conditions;
}
 
Example #4
Source File: ChangeUnitIdSelectorFactory.java    From waltz with Apache License 2.0 6 votes vote down vote up
private Select<Record1<Long>> mkByAppSelector(IdSelectionOptions options) {
    Select<Record1<Long>> appSelector = applicationIdSelectorFactory.apply(options);

    Condition sourceRef = LOGICAL_FLOW.SOURCE_ENTITY_KIND.eq(EntityKind.APPLICATION.name())
            .and(LOGICAL_FLOW.SOURCE_ENTITY_ID.in(appSelector));

    Condition targetRef = LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(EntityKind.APPLICATION.name())
            .and(LOGICAL_FLOW.TARGET_ENTITY_ID.in(appSelector));

    return DSL
            .select(CHANGE_UNIT.ID)
            .from(CHANGE_UNIT)
            .innerJoin(PHYSICAL_FLOW).on(PHYSICAL_FLOW.ID.eq(CHANGE_UNIT.SUBJECT_ENTITY_ID)
                    .and(CHANGE_UNIT.SUBJECT_ENTITY_KIND.eq(EntityKind.PHYSICAL_FLOW.name())))
            .innerJoin(LOGICAL_FLOW).on(LOGICAL_FLOW.ID.eq(PHYSICAL_FLOW.LOGICAL_FLOW_ID))
            .where(sourceRef.or(targetRef));
}
 
Example #5
Source File: PostgresMeasurableSearch.java    From waltz with Apache License 2.0 6 votes vote down vote up
@Override
public List<Measurable> searchFullText(DSLContext dsl, EntitySearchOptions options) {
    Condition entityLifecycleCondition = MEASURABLE.ENTITY_LIFECYCLE_STATUS.in(options.entityLifecycleStatuses());

    Field<Double> rank = DSL
            .field("ts_rank_cd(to_tsvector({0}), plainto_tsquery({1}))",
                    Double.class,
                    DSL.lower(MEASURABLE.DESCRIPTION),
                    DSL.inline(options.searchQuery().toLowerCase()));

    return dsl
            .select(MEASURABLE.fields())
            .select(rank)
            .from(MEASURABLE)
            .where(rank.greaterThan(Double.MIN_VALUE))
            .and(entityLifecycleCondition)
            .orderBy(rank.desc())
            .limit(options.limit())
            .fetch(MeasurableDao.TO_DOMAIN_MAPPER);
}
 
Example #6
Source File: ChangeUnitIdSelectorFactory.java    From waltz with Apache License 2.0 6 votes vote down vote up
private Select<Record1<Long>> mkForFlowEndpoint(IdSelectionOptions options) {
    ensureScopeIsExact(options);
    EntityReference ref = options.entityReference();

    Condition sourceRef = LOGICAL_FLOW.SOURCE_ENTITY_KIND.eq(ref.kind().name())
            .and(LOGICAL_FLOW.SOURCE_ENTITY_ID.eq(ref.id()));

    Condition targetRef = LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(ref.kind().name())
            .and(LOGICAL_FLOW.TARGET_ENTITY_ID.eq(ref.id()));

    return DSL
            .select(CHANGE_UNIT.ID)
            .from(CHANGE_UNIT)
            .innerJoin(PHYSICAL_FLOW).on(PHYSICAL_FLOW.ID.eq(CHANGE_UNIT.SUBJECT_ENTITY_ID)
                    .and(CHANGE_UNIT.SUBJECT_ENTITY_KIND.eq(EntityKind.PHYSICAL_FLOW.name())))
            .innerJoin(LOGICAL_FLOW).on(LOGICAL_FLOW.ID.eq(PHYSICAL_FLOW.LOGICAL_FLOW_ID))
            .where(sourceRef.or(targetRef));
}
 
Example #7
Source File: OrganisationalUnitSearchDao.java    From waltz with Apache License 2.0 6 votes vote down vote up
public List<OrganisationalUnit> search(EntitySearchOptions options) {
    List<String> terms = mkTerms(options.searchQuery());

    if (terms.isEmpty()) {
        return Collections.emptyList();
    }

    Condition nameCondition = terms.stream()
            .map(ORGANISATIONAL_UNIT.NAME::containsIgnoreCase)
            .collect(Collectors.reducing(
                    DSL.trueCondition(),
                    (acc, frag) -> acc.and(frag)));

    List<OrganisationalUnit> orgUnitsViaName = dsl.selectDistinct(ORGANISATIONAL_UNIT.fields())
            .from(ORGANISATIONAL_UNIT)
            .where(nameCondition)
            .orderBy(ORGANISATIONAL_UNIT.NAME)
            .limit(options.limit())
            .fetch(OrganisationalUnitDao.TO_DOMAIN_MAPPER);

    List<OrganisationalUnit> orgUnitsViaFullText = searcher.searchFullText(dsl, options);

    return new ArrayList<>(orderedUnion(orgUnitsViaName, orgUnitsViaFullText));
}
 
Example #8
Source File: EndUserAppIdSelectorFactory.java    From waltz with Apache License 2.0 6 votes vote down vote up
private Select<Record1<Long>> mkForPersonReportees(IdSelectionOptions options) {

        if (eucOmitted(options)) {
            return mkEmptySelect();
        }

        Select<Record1<String>> employeeId = mkEmployeeIdSelect(options.entityReference());
        SelectConditionStep<Record1<String>> reporteeIds = DSL.selectDistinct(personHierarchy.EMPLOYEE_ID)
                .from(personHierarchy)
                .where(personHierarchy.MANAGER_ID.eq(employeeId));

        Condition condition = involvement.ENTITY_KIND.eq(EntityKind.END_USER_APPLICATION.name())
                .and(involvement.EMPLOYEE_ID.eq(employeeId)
                        .or(involvement.EMPLOYEE_ID.in(reporteeIds)));

        return DSL
                .selectDistinct(involvement.ENTITY_ID)
                .from(involvement)
                .innerJoin(eua)
                .on(eua.ID.eq(involvement.ENTITY_ID))
                .where(condition);
    }
 
Example #9
Source File: PgExpressionHandler.java    From FROST-Server with GNU Lesser General Public License v3.0 6 votes vote down vote up
public Condition addFilterToWhere(Expression filter, Condition sqlWhere) {
    FieldWrapper filterField = filter.accept(this);
    if (filterField.isCondition()) {
        return sqlWhere.and(filterField.getCondition());

    } else if (filterField instanceof FieldListWrapper) {
        FieldListWrapper listExpression = (FieldListWrapper) filterField;
        for (Field expression : listExpression.getExpressions().values()) {
            if (Boolean.class.isAssignableFrom(expression.getType())) {
                Field<Boolean> predicate = expression;
                return sqlWhere.and(predicate);
            }
        }
    }
    LOGGER.error("Filter is not a predicate but a {}.", filterField.getClass().getName());
    throw new IllegalArgumentException("Filter is not a predicate but a " + filterField.getClass().getName());
}
 
Example #10
Source File: FlowSummaryWithTypesAndPhysicalsExport.java    From waltz with Apache License 2.0 5 votes vote down vote up
private static Select<Record1<Long>> mkLogicalFlowSelectorFromAppSelector(Select<Record1<Long>> appIdSelector) {
    Condition sourceCondition = LOGICAL_FLOW.SOURCE_ENTITY_ID.in(appIdSelector)
            .and(LOGICAL_FLOW.SOURCE_ENTITY_KIND.eq(EntityKind.APPLICATION.name()));

    Condition targetCondition = LOGICAL_FLOW.TARGET_ENTITY_ID.in(appIdSelector)
            .and(LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(EntityKind.APPLICATION.name()));

    return DSL.select(LOGICAL_FLOW.ID)
            .from(LOGICAL_FLOW)
            .where(sourceCondition.or(targetCondition))
            .and(LOGICAL_NOT_REMOVED);
}
 
Example #11
Source File: PhysicalSpecificationIdSelectorFactory.java    From waltz with Apache License 2.0 5 votes vote down vote up
private Select<Record1<Long>> mkForPhysicalFlow(IdSelectionOptions options) {
    ensureScopeIsExact(options);
    long physicalFlowId = options.entityReference().id();
    Condition matchOnPhysFlowId = PHYSICAL_FLOW.ID.eq(physicalFlowId);
    return selectViaPhysicalFlowJoin(matchOnPhysFlowId);

}
 
Example #12
Source File: FlowLineageHarness.java    From waltz with Apache License 2.0 5 votes vote down vote up
private static void findIncomingByRefs(DSLContext dsl, Set<EntityReference> entityReferences) {


        Map<EntityKind, Collection<EntityReference>> refsByKind = groupBy(ref -> ref.kind(), entityReferences);

        Condition anyTargetMatches = refsByKind
                .entrySet()
                .stream()
                .map(entry -> LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(entry.getKey().name())
                        .and(LOGICAL_FLOW.TARGET_ENTITY_ID.in(map(entry.getValue(), ref -> ref.id()))))
                .collect(Collectors.reducing(DSL.falseCondition(), (acc, c) -> acc.or(c)));

        System.out.println(anyTargetMatches);


        Field<String> SOURCE_NAME_FIELD = InlineSelectFieldFactory.mkNameField(
                LOGICAL_FLOW.SOURCE_ENTITY_ID,
                LOGICAL_FLOW.SOURCE_ENTITY_KIND,
                newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR));

        dsl.select(LOGICAL_FLOW.fields())
                .select(SOURCE_NAME_FIELD)
                .from(LOGICAL_FLOW)
                .where(anyTargetMatches.and(LogicalFlowDao.LOGICAL_NOT_REMOVED))
                .forEach(System.out::println);

        dsl.select()
                .from(LOGICAL_FLOW_DECORATOR)
                .innerJoin(LOGICAL_FLOW)
                    .on(LOGICAL_FLOW.ID.eq(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID))
                .where(anyTargetMatches)
                .forEach(System.out::println);


    }
 
Example #13
Source File: LogicalFlowIdSelectorFactory.java    From waltz with Apache License 2.0 5 votes vote down vote up
private Select<Record1<Long>> mkForDataType(IdSelectionOptions options) {
    Select<Record1<Long>> dataTypeSelector = dataTypeIdSelectorFactory.apply(options);

    Condition supplierNotRemoved =  SUPPLIER_APP.IS_REMOVED.isFalse();
    Condition consumerNotRemoved =  CONSUMER_APP.IS_REMOVED.isFalse();

    Condition appKindFilterConditions = options.filters().omitApplicationKinds().isEmpty()
            ? DSL.trueCondition()
            : SUPPLIER_APP.KIND.notIn(options.filters().omitApplicationKinds())
                .or(CONSUMER_APP.KIND.notIn(options.filters().omitApplicationKinds()));

    return DSL.select(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID)
            .from(LOGICAL_FLOW_DECORATOR)
            .innerJoin(LOGICAL_FLOW).on(LOGICAL_FLOW.ID.eq(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID))
            .innerJoin(SUPPLIER_APP)
                .on(LOGICAL_FLOW.SOURCE_ENTITY_ID.eq(SUPPLIER_APP.ID)
                    .and(LOGICAL_FLOW.SOURCE_ENTITY_KIND.eq(EntityKind.APPLICATION.name())))
            .innerJoin(CONSUMER_APP)
                .on(LOGICAL_FLOW.TARGET_ENTITY_ID.eq(CONSUMER_APP.ID)
                    .and(LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(EntityKind.APPLICATION.name())))
            .where(LOGICAL_FLOW_DECORATOR.DECORATOR_ENTITY_ID.in(dataTypeSelector)
                .and(LOGICAL_FLOW_DECORATOR.DECORATOR_ENTITY_KIND.eq(EntityKind.DATA_TYPE.name())))
            .and(LOGICAL_NOT_REMOVED)
            .and(supplierNotRemoved)
            .and(consumerNotRemoved)
            .and(appKindFilterConditions);
}
 
Example #14
Source File: SelectorUtilities.java    From waltz with Apache License 2.0 5 votes vote down vote up
/***
 * creates a select condition taking into account application specific faces in options
 * @param options
 * @return
 */
public static Condition mkApplicationConditions(IdSelectionOptions options) {
    Set<ApplicationKind> applicationKinds = minus(
            asSet(ApplicationKind.values()),
            options.filters().omitApplicationKinds());

    return APPLICATION.KIND.in(applicationKinds)
            .and(APPLICATION.ENTITY_LIFECYCLE_STATUS.in(options.entityLifecycleStatuses()));
}
 
Example #15
Source File: SqlServerMeasurableSearch.java    From waltz with Apache License 2.0 5 votes vote down vote up
@Override
public List<Measurable> searchFullText(DSLContext dsl, EntitySearchOptions options) {
    List<String> terms = mkTerms(lower(options.searchQuery()));
    Condition entityLifecycleCondition = MEASURABLE.ENTITY_LIFECYCLE_STATUS.in(options.entityLifecycleStatuses());

    return dsl
            .selectFrom(MEASURABLE)
            .where(JooqUtilities.MSSQL.mkContainsPrefix(terms))
            .and(entityLifecycleCondition)
            .limit(options.limit())
            .fetch(MeasurableDao.TO_DOMAIN_MAPPER);
}
 
Example #16
Source File: AppGroupMemberDao.java    From waltz with Apache License 2.0 5 votes vote down vote up
private List<AppGroupMember> getWhere(Condition condition) {
    return dsl.select(APPLICATION_GROUP_MEMBER.fields())
            .from(APPLICATION_GROUP_MEMBER)
            .where(condition)
            .fetch(r -> {
                ApplicationGroupMemberRecord record = r.into(APPLICATION_GROUP_MEMBER);
                return ImmutableAppGroupMember.builder()
                        .userId(record.getUserId())
                        .groupId(record.getGroupId())
                        .role(AppGroupMemberRole.valueOf(record.getRole()))
                        .build();
            });
}
 
Example #17
Source File: LogicalDataElementSearchDao.java    From waltz with Apache License 2.0 5 votes vote down vote up
public List<LogicalDataElement> search(EntitySearchOptions options) {
    List<String> terms = mkTerms(options.searchQuery());

    if (terms.isEmpty()) {
        return Collections.emptyList();
    }

    List<String> validStatusNames = map(
            options.entityLifecycleStatuses(),
            s -> s.name());

    Condition statusCondition = LOGICAL_DATA_ELEMENT.ENTITY_LIFECYCLE_STATUS.in(validStatusNames);

    Condition likeName = mkBasicTermSearch(LOGICAL_DATA_ELEMENT.NAME, terms);
    Condition likeDesc = mkBasicTermSearch(LOGICAL_DATA_ELEMENT.DESCRIPTION, terms);

    List<LogicalDataElement> results = dsl
            .select(LOGICAL_DATA_ELEMENT.fields())
            .from(LOGICAL_DATA_ELEMENT)
            .where(likeName.and(statusCondition))
            .union(dsl
                .select(LOGICAL_DATA_ELEMENT.fields())
                .from(LOGICAL_DATA_ELEMENT)
                .where(likeDesc.and(statusCondition)))
            .orderBy(LOGICAL_DATA_ELEMENT.NAME)
            .limit(options.limit())
            .fetch(LogicalDataElementDao.TO_DOMAIN_MAPPER);

    List<LogicalDataElement> sortedResults = sort(
            results,
            mkRelevancyComparator(a -> a.name(), terms.get(0)));

    return sortedResults;
}
 
Example #18
Source File: PhysicalSpecificationIdSelectorFactory.java    From waltz with Apache License 2.0 5 votes vote down vote up
private Select<Record1<Long>> selectViaPhysicalFlowJoin(Condition condition) {
    return DSL
            .select(PHYSICAL_SPECIFICATION.ID)
            .from(PHYSICAL_SPECIFICATION)
            .innerJoin(PHYSICAL_FLOW)
            .on(PHYSICAL_FLOW.SPECIFICATION_ID.eq(PHYSICAL_SPECIFICATION.ID))
            .where(condition);
}
 
Example #19
Source File: AuthoritativeSourceService.java    From waltz with Apache License 2.0 5 votes vote down vote up
public List<AuthoritativeSource> findAuthSources(IdSelectionOptions options) {
    Condition customSelectionCriteria;

    switch(options.entityReference().kind()) {
        case ORG_UNIT:
            GenericSelector orgUnitSelector = genericSelectorFactory.apply(options);
            customSelectionCriteria = AUTHORITATIVE_SOURCE.PARENT_ID.in(orgUnitSelector.selector())
                    .and(AuthoritativeSourceDao.SUPPLIER_APP.KIND.notIn(options.filters().omitApplicationKinds()));
            break;
        case DATA_TYPE:
            GenericSelector dataTypeSelector = genericSelectorFactory.apply(options);
            SelectConditionStep<Record1<String>> codeSelector = DSL
                    .select(DATA_TYPE.CODE)
                    .from(DATA_TYPE)
                    .where(DATA_TYPE.ID.in(dataTypeSelector.selector()));
            customSelectionCriteria = AUTHORITATIVE_SOURCE.DATA_TYPE.in(codeSelector)
                    .and(AuthoritativeSourceDao.SUPPLIER_APP.KIND.notIn(options.filters().omitApplicationKinds()));
            break;
        case APP_GROUP:
        case FLOW_DIAGRAM:
        case MEASURABLE:
        case PERSON:
            customSelectionCriteria = mkConsumerSelectionCondition(options);
            break;
        default:
            throw new UnsupportedOperationException("Cannot calculate auth sources for ref" + options.entityReference());
    }

    return authoritativeSourceDao.findAuthSources(customSelectionCriteria);

}
 
Example #20
Source File: UserRepository.java    From secrets-proxy with Apache License 2.0 5 votes vote down vote up
/**
 * Returns all teams in the application group assembly.
 *
 * @param appGroup {@link AppGroup}
 * @return List of {@link OneOpsTeam}
 */
public List<OneOpsTeam> getAllTeams(@Nonnull final AppGroup appGroup) {
  log.debug("Retrieving all teams for application group: " + appGroup.getNsPath());

  long start = currentTimeMillis();
  Condition teamCondition =
      CI_PROXIES
          .NS_PATH
          .equalIgnoreCase(appGroup.getOrgNsPath())
          .and(
              CI_PROXIES
                  .CI_NAME
                  .equalIgnoreCase(appGroup.getAssembly())
                  .and(CI_PROXIES.CI_CLASS_NAME.eq("account.Assembly")));

  // Read like SQL :)
  Result<Record> records =
      getDSLContext(appGroup)
          .select(TEAMS.fields())
          .from(CI_PROXIES)
          .innerJoin(CI_PROXIES_TEAMS)
          .on(CI_PROXIES.ID.eq(CI_PROXIES_TEAMS.CI_PROXY_ID))
          .innerJoin(TEAMS)
          .on(TEAMS.ID.eq(CI_PROXIES_TEAMS.TEAM_ID))
          .where(teamCondition)
          .fetch();
  metricService.submit("timer.oneops.user.allteams", currentTimeMillis() - start);
  return records.stream().map(UserRepository::mapRecord).collect(Collectors.toList());
}
 
Example #21
Source File: JsonFieldFactory.java    From FROST-Server with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Find the common type that should be used to compare the given two
 * expressions.
 *
 * @param other The type of the other that we should enforce on the json
 * type.
 * @return the extra predicate to enforce the type with.
 */
private Condition createTypePredicate(CompareType other) {
    switch (other) {
        case NUMBER:
            return DSL.field("jsonb_typeof(?)", jsonExpression).eq("number");
        case BOOLEAN:
            return DSL.field("jsonb_typeof(?)", jsonExpression).eq("boolean");
        default:
            return null;
    }
}
 
Example #22
Source File: PhysicalSpecificationIdSelectorFactory.java    From waltz with Apache License 2.0 5 votes vote down vote up
private Select<Record1<Long>> mkForFlowDiagram(IdSelectionOptions options) {
    ensureScopeIsExact(options);
    Select<Record1<Long>> flowSelector = physicalFlowIdSelectorFactory.apply(options);
    Condition condition =
            PHYSICAL_FLOW.ID.in(flowSelector)
            .and(getLifecycleCondition(options));
    return selectViaPhysicalFlowJoin(condition);
}
 
Example #23
Source File: SomethingDaoTest.java    From vertx-jooq with MIT License 4 votes vote down vote up
@Override
protected Condition eqPrimaryKey(Integer id) {
    return Tables.SOMETHING.SOMEID.eq(id);
}
 
Example #24
Source File: SomethingDaoTest.java    From vertx-jooq with MIT License 4 votes vote down vote up
@Override
protected Condition eqPrimaryKey(Integer id) {
    return Tables.SOMETHING.SOMEID.eq(id);
}
 
Example #25
Source File: SomethingWithoutJsonDaoTest.java    From vertx-jooq with MIT License 4 votes vote down vote up
@Override
protected Condition eqPrimaryKey(Integer id) {
    return Tables.SOMETHINGWITHOUTJSON.SOMEID.eq(id);
}
 
Example #26
Source File: PhysicalFlowSearchDao.java    From waltz with Apache License 2.0 4 votes vote down vote up
private Condition mkQueryCondition(String query, Field<String> nameField) {
    List<String> terms = mkTerms(query);
    Condition termMatcher = DSL.trueCondition();
    terms.forEach(t -> termMatcher.and(nameField.like("%" + t + "%")));
    return termMatcher;
}
 
Example #27
Source File: SomethingCompositeDaoTest.java    From vertx-jooq with MIT License 4 votes vote down vote up
@Override
protected Condition eqPrimaryKey(Record2<Integer, Integer> id) {
    return Tables.SOMETHINGCOMPOSITE.SOMEID.eq(id.component1()).and(Tables.SOMETHINGCOMPOSITE.SOMESECONDID.eq(id.component2()));
}
 
Example #28
Source File: AuthoritativeSourceService.java    From waltz with Apache License 2.0 4 votes vote down vote up
private Condition mkConsumerSelectionCondition(IdSelectionOptions options) {
    Select<Record1<Long>> appIdSelector = applicationIdSelectorFactory.apply(options);
    return AuthoritativeSourceDao.CONSUMER_APP.ID.in(appIdSelector);
}
 
Example #29
Source File: SomethingCompositeDaoTest.java    From vertx-jooq with MIT License 4 votes vote down vote up
@Override
protected Condition eqPrimaryKey(Record2<Integer, Integer> id) {
    return Tables.SOMETHINGCOMPOSITE.SOMEID.eq(id.component1()).and(Tables.SOMETHINGCOMPOSITE.SOMESECONDID.eq(id.component2()));
}
 
Example #30
Source File: SomethingDaoTest.java    From vertx-jooq with MIT License 4 votes vote down vote up
@Override
protected Condition eqPrimaryKey(Integer id) {
    return Tables.SOMETHING.SOMEID.eq(id);
}