Java Code Examples for org.jooq.impl.DSL#select()

The following examples show how to use org.jooq.impl.DSL#select() . 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: AbstractIdSelectorFactory.java    From waltz with Apache License 2.0 6 votes vote down vote up
private Select<Record1<Long>> mkForSelf(IdSelectionOptions options) {

        Select<Record1<Long>> selector = null;
        switch (options.scope()) {
            case EXACT:
                selector = DSL.select(DSL.val(options.entityReference().id()));
                break;
            case CHILDREN:
                selector = DSL.select(ENTITY_HIERARCHY.ID)
                        .from(ENTITY_HIERARCHY)
                        .where(ENTITY_HIERARCHY.ANCESTOR_ID.eq(options.entityReference().id()))
                        .and(ENTITY_HIERARCHY.KIND.eq(entityKind.name()));
                break;
            case PARENTS:
                selector = DSL.select(ENTITY_HIERARCHY.ANCESTOR_ID)
                        .from(ENTITY_HIERARCHY)
                        .where(ENTITY_HIERARCHY.ID.eq(options.entityReference().id()))
                        .and(ENTITY_HIERARCHY.KIND.eq(entityKind.name()));
                break;
        }

        return selector;
    }
 
Example 2
Source File: MeasurableIdSelectorFactory.java    From waltz with Apache License 2.0 6 votes vote down vote up
private Select<Record1<Long>> mkForMeasurable(IdSelectionOptions options) {
    Select<Record1<Long>> selector = null;
    final Condition isMeasurable = ENTITY_HIERARCHY.KIND.eq(EntityKind.MEASURABLE.name());
    switch (options.scope()) {
        case EXACT:
            selector = DSL.select(DSL.val(options.entityReference().id()));
            break;
        case CHILDREN:
            selector = DSL.select(ENTITY_HIERARCHY.ID)
                    .from(ENTITY_HIERARCHY)
                    .where(ENTITY_HIERARCHY.ANCESTOR_ID.eq(options.entityReference().id()))
                    .and(isMeasurable);
            break;
        case PARENTS:
            selector = DSL.select(ENTITY_HIERARCHY.ANCESTOR_ID)
                    .from(ENTITY_HIERARCHY)
                    .where(ENTITY_HIERARCHY.ID.eq(options.entityReference().id()))
                    .and(isMeasurable);
            break;
    }

    return selector;
}
 
Example 3
Source File: GenericSelectorFactory.java    From waltz with Apache License 2.0 6 votes vote down vote up
public GenericSelector apply(IdSelectionOptions selectionOptions) {
    EntityKind kind = selectionOptions.entityReference().kind();

    ImmutableGenericSelector.Builder builder = ImmutableGenericSelector.builder()
            .kind(kind);

    if (selectionOptions.scope() == HierarchyQueryScope.EXACT) {
        Select<Record1<Long>> select = DSL.select(DSL.val(selectionOptions.entityReference().id()));
        return builder
                .selector(select)
                .build();
    }

    Select<Record1<Long>> ids = applySelectorForKind(kind, selectionOptions);
    builder.selector(ids);

    return builder.build();
}
 
Example 4
Source File: ApplicationIdSelectorFactory.java    From waltz with Apache License 2.0 4 votes vote down vote up
private Select<Record1<Long>> mkForApplication(IdSelectionOptions options) {
    checkTrue(options.scope() == EXACT, "Can only create selector for exact matches if given an APPLICATION ref");
    return DSL.select(DSL.val(options.entityReference().id()));
}
 
Example 5
Source File: ChangeInitiativeIdSelectorFactory.java    From waltz with Apache License 2.0 4 votes vote down vote up
private Select<Record1<Long>> mkForChangeInitiative(IdSelectionOptions options) {
    ensureScopeIsExact(options);
    return DSL.select(DSL.val(options.entityReference().id()));
}
 
Example 6
Source File: LogicalFlowIdSelectorFactory.java    From waltz with Apache License 2.0 4 votes vote down vote up
private Select<Record1<Long>> mkForLogicalFlow(IdSelectionOptions options) {
    checkTrue(options.scope() == EXACT, "Can only create selector for exact matches if given an LOGICAL_DATA_FLOW ref");
    return DSL.select(DSL.val(options.entityReference().id()));
}
 
Example 7
Source File: PhysicalSpecDefnIdSelectorFactory.java    From waltz with Apache License 2.0 4 votes vote down vote up
private Select<Record1<Long>> mkForPhysicalSpecDefn(IdSelectionOptions options) {
    ensureScopeIsExact(options);
    return DSL.select(DSL.val(options.entityReference().id()));
}
 
Example 8
Source File: PhysicalSpecificationIdSelectorFactory.java    From waltz with Apache License 2.0 4 votes vote down vote up
private Select<Record1<Long>> mkForSpecification(IdSelectionOptions options) {
    ensureScopeIsExact(options);
    return DSL.select(DSL.val(options.entityReference().id()));
}