Search in sources :

Example 1 with PropertyConditionDescriptor

use of com.haulmont.cuba.gui.components.filter.descriptor.PropertyConditionDescriptor in project cuba by cuba-platform.

the class RelatedEntitiesBean method getNonOptimizedCondition.

protected PropertyCondition getNonOptimizedCondition(MetaClass metaClass, List<Object> ids, Filter component, String filterComponentName, String primaryKey) {
    PropertyConditionDescriptor conditionDescriptor = new PropertyConditionDescriptor(primaryKey, primaryKey, AppConfig.getMessagesPack(), filterComponentName, ((FilterImplementation) component).getEntityMetaClass(), ((FilterImplementation) component).getEntityAlias());
    PropertyCondition condition = (PropertyCondition) conditionDescriptor.createCondition();
    condition.setInExpr(true);
    condition.setHidden(true);
    condition.setOperator(Op.IN);
    @SuppressWarnings("ConstantConditions") Class idType = metaClass.getProperty(primaryKey).getJavaType();
    Param param = Param.Builder.getInstance().setName(paramBuilder.createParamName(condition)).setJavaClass(idType).setEntityWhere("").setEntityView("").setMetaClass(((FilterImplementation) component).getEntityMetaClass()).setProperty(metaClass.getProperty(primaryKey)).setInExpr(true).setRequired(true).build();
    param.setValue(ids);
    condition.setParam(param);
    return condition;
}
Also used : PropertyConditionDescriptor(com.haulmont.cuba.gui.components.filter.descriptor.PropertyConditionDescriptor) PropertyCondition(com.haulmont.cuba.gui.components.filter.condition.PropertyCondition) Param(com.haulmont.cuba.gui.components.filter.Param) MetaClass(com.haulmont.chile.core.model.MetaClass)

Aggregations

MetaClass (com.haulmont.chile.core.model.MetaClass)1 Param (com.haulmont.cuba.gui.components.filter.Param)1 PropertyCondition (com.haulmont.cuba.gui.components.filter.condition.PropertyCondition)1 PropertyConditionDescriptor (com.haulmont.cuba.gui.components.filter.descriptor.PropertyConditionDescriptor)1