Uses of Interface
is.codion.framework.domain.entity.condition.ConditionProvider

Packages that use ConditionProvider
  • Uses of ConditionProvider in is.codion.framework.domain.entity

    Modifier and Type
    Method
    Description
    EntityDefinition.condition(ConditionType conditionType)
    Returns the ConditionProvider associated with the given type
    // Define custom condition types in entity definition
    interface Customer {
        EntityType TYPE = DOMAIN.entityType("customer");
        Column<String> STATUS = TYPE.stringColumn("status");
        Column<LocalDate> LAST_ORDER_DATE = TYPE.localDateColumn("last_order_date");
    
        // Custom condition for active customers
        ConditionType ACTIVE = ConditionType.custom("activeCustomers");
    }
    
    // In domain definition
    Customer.TYPE.define(
            Customer.STATUS.define()
                .column(),
            Customer.LAST_ORDER_DATE.define()
                .column())
        .condition(Customer.ACTIVE, (columns, values) ->
            // Returns customers with active status and recent activity
            Condition.and(
                Customer.STATUS.equalTo("ACTIVE"),
                Customer.LAST_ORDER_DATE.greaterThanOrEqualTo(LocalDate.now().minusMonths(6))
            ))
        .build();
    
    // Usage
    Condition activeCondition = Customer.ACTIVE.get();
    
    List<Entity> activeCustomers = connection.select(activeCondition);
    
    Methods in is.codion.framework.domain.entity with parameters of type ConditionProvider
    Modifier and Type
    Method
    Description
    EntityDefinition.Builder.condition(ConditionType conditionType, ConditionProvider conditionProvider)
    Adds a ConditionProvider which provides a dynamic query condition string.