Example usage for javax.persistence.criteria CriteriaBuilder upper

List of usage examples for javax.persistence.criteria CriteriaBuilder upper

Introduction

In this page you can find the example usage for javax.persistence.criteria CriteriaBuilder upper.

Prototype

Expression<String> upper(Expression<String> x);

Source Link

Document

Create expression for converting a string to uppercase.

Usage

From source file:org.finra.herd.dao.impl.StorageUnitNotificationRegistrationDaoImpl.java

@Override
public List<NotificationRegistrationKey> getStorageUnitNotificationRegistrationKeysByNamespace(
        String namespace) {//from  w  ww . j  a va 2s . com
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the storage unit notification registration.
    Root<StorageUnitNotificationRegistrationEntity> businessObjectDataNotificationEntityRoot = criteria
            .from(StorageUnitNotificationRegistrationEntity.class);

    // Join to the other tables we can filter on.
    Join<StorageUnitNotificationRegistrationEntity, NamespaceEntity> namespaceEntityJoin = businessObjectDataNotificationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.namespace);

    // Get the columns.
    Path<String> notificationRegistrationNamespaceColumn = namespaceEntityJoin.get(NamespaceEntity_.code);
    Path<String> notificationRegistrationNameColumn = businessObjectDataNotificationEntityRoot
            .get(StorageUnitNotificationRegistrationEntity_.name);

    // Create the standard restrictions (i.e. the standard where clauses).
    Predicate queryRestriction = builder.equal(builder.upper(namespaceEntityJoin.get(NamespaceEntity_.code)),
            namespace.toUpperCase());

    // Add the select clause.
    criteria.multiselect(notificationRegistrationNamespaceColumn, notificationRegistrationNameColumn);

    // Add the where clause.
    criteria.where(queryRestriction);

    // Add the order by clause.
    criteria.orderBy(builder.asc(notificationRegistrationNameColumn));

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the list of keys from the returned tuples.
    return getNotificationRegistrationKeys(tuples, notificationRegistrationNamespaceColumn,
            notificationRegistrationNameColumn);
}

From source file:org.finra.herd.dao.impl.StorageUnitNotificationRegistrationDaoImpl.java

@Override
public List<NotificationRegistrationKey> getStorageUnitNotificationRegistrationKeysByNotificationFilter(
        StorageUnitNotificationFilter businessObjectDataNotificationFilter) {
    // Create the criteria builder and a tuple style criteria query.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<Tuple> criteria = builder.createTupleQuery();

    // The criteria root is the storage unit notification registration.
    Root<StorageUnitNotificationRegistrationEntity> notificationRegistrationEntityRoot = criteria
            .from(StorageUnitNotificationRegistrationEntity.class);

    // Join to the other tables we can filter on.
    Join<StorageUnitNotificationRegistrationEntity, NamespaceEntity> notificationRegistrationNamespaceEntityJoin = notificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.namespace);
    Join<StorageUnitNotificationRegistrationEntity, BusinessObjectDefinitionEntity> businessObjectDefinitionEntity = notificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.businessObjectDefinition);
    Join<BusinessObjectDefinitionEntity, NamespaceEntity> businessObjectDefinitionNamespaceEntity = businessObjectDefinitionEntity
            .join(BusinessObjectDefinitionEntity_.namespace);
    Join<StorageUnitNotificationRegistrationEntity, FileTypeEntity> fileTypeEntity = notificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.fileType, JoinType.LEFT);

    // Get the columns.
    Path<String> notificationRegistrationNamespaceColumn = notificationRegistrationNamespaceEntityJoin
            .get(NamespaceEntity_.code);
    Path<String> notificationRegistrationNameColumn = notificationRegistrationEntityRoot
            .get(StorageUnitNotificationRegistrationEntity_.name);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(//  w w  w .  j ava  2 s  .  c  o  m
            builder.equal(builder.upper(businessObjectDefinitionNamespaceEntity.get(NamespaceEntity_.code)),
                    businessObjectDataNotificationFilter.getNamespace().toUpperCase()));
    predicates.add(builder.equal(
            builder.upper(businessObjectDefinitionEntity.get(BusinessObjectDefinitionEntity_.name)),
            businessObjectDataNotificationFilter.getBusinessObjectDefinitionName().toUpperCase()));
    if (StringUtils.isNotBlank(businessObjectDataNotificationFilter.getBusinessObjectFormatUsage())) {
        predicates.add(builder.or(
                builder.isNull(notificationRegistrationEntityRoot
                        .get(StorageUnitNotificationRegistrationEntity_.usage)),
                builder.equal(
                        builder.upper(notificationRegistrationEntityRoot
                                .get(StorageUnitNotificationRegistrationEntity_.usage)),
                        businessObjectDataNotificationFilter.getBusinessObjectFormatUsage().toUpperCase())));
    }
    if (StringUtils.isNotBlank(businessObjectDataNotificationFilter.getBusinessObjectFormatFileType())) {
        predicates.add(builder.or(
                builder.isNull(notificationRegistrationEntityRoot
                        .get(StorageUnitNotificationRegistrationEntity_.fileType)),
                builder.equal(builder.upper(fileTypeEntity.get(FileTypeEntity_.code)),
                        businessObjectDataNotificationFilter.getBusinessObjectFormatFileType().toUpperCase())));
    }

    // Add the select and where clauses to the query.
    criteria.multiselect(notificationRegistrationNamespaceColumn, notificationRegistrationNameColumn)
            .where(builder.and(predicates.toArray(new Predicate[predicates.size()])));

    // Add the order by clause to the query.
    criteria.orderBy(builder.asc(notificationRegistrationNamespaceColumn),
            builder.asc(notificationRegistrationNameColumn));

    // Run the query to get a list of tuples back.
    List<Tuple> tuples = entityManager.createQuery(criteria).getResultList();

    // Populate the list of keys from the returned tuples.
    return getNotificationRegistrationKeys(tuples, notificationRegistrationNamespaceColumn,
            notificationRegistrationNameColumn);
}

From source file:org.finra.herd.dao.impl.StorageUnitNotificationRegistrationDaoImpl.java

@Override
public List<StorageUnitNotificationRegistrationEntity> getStorageUnitNotificationRegistrations(
        String notificationEventTypeCode, BusinessObjectDataKey businessObjectDataKey, String storageName,
        String newStorageUnitStatus, String oldStorageUnitStatus, String notificationRegistrationStatus) {
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<StorageUnitNotificationRegistrationEntity> criteria = builder
            .createQuery(StorageUnitNotificationRegistrationEntity.class);

    // The criteria root is the storage unit notification registration entity.
    Root<StorageUnitNotificationRegistrationEntity> storageUnitNotificationRegistrationEntityRoot = criteria
            .from(StorageUnitNotificationRegistrationEntity.class);

    // Join to the other tables we can filter on.
    Join<StorageUnitNotificationRegistrationEntity, NamespaceEntity> namespaceEntityJoin = storageUnitNotificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.namespace);
    Join<StorageUnitNotificationRegistrationEntity, NotificationEventTypeEntity> notificationEventTypeEntityJoin = storageUnitNotificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.notificationEventType);
    Join<StorageUnitNotificationRegistrationEntity, BusinessObjectDefinitionEntity> businessObjectDefinitionEntityJoin = storageUnitNotificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.businessObjectDefinition);
    Join<BusinessObjectDefinitionEntity, NamespaceEntity> businessObjectDefinitionNamespaceEntityJoin = businessObjectDefinitionEntityJoin
            .join(BusinessObjectDefinitionEntity_.namespace);
    Join<StorageUnitNotificationRegistrationEntity, StorageEntity> storageEntityJoin = storageUnitNotificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.storage);
    Join<StorageUnitNotificationRegistrationEntity, FileTypeEntity> fileTypeEntityJoin = storageUnitNotificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.fileType, JoinType.LEFT);
    Join<StorageUnitNotificationRegistrationEntity, StorageUnitStatusEntity> newStorageUnitStatusEntityJoin = storageUnitNotificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.newStorageUnitStatus, JoinType.LEFT);
    Join<StorageUnitNotificationRegistrationEntity, StorageUnitStatusEntity> oldStorageUnitStatusEntityJoin = storageUnitNotificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.oldStorageUnitStatus, JoinType.LEFT);
    Join<StorageUnitNotificationRegistrationEntity, NotificationRegistrationStatusEntity> notificationRegistrationStatusEntityJoin = storageUnitNotificationRegistrationEntityRoot
            .join(StorageUnitNotificationRegistrationEntity_.notificationRegistrationStatus);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(/*from  w w  w.j a  va  2  s .com*/
            builder.equal(builder.upper(notificationEventTypeEntityJoin.get(NotificationEventTypeEntity_.code)),
                    notificationEventTypeCode.toUpperCase()));
    predicates.add(
            builder.equal(builder.upper(businessObjectDefinitionNamespaceEntityJoin.get(NamespaceEntity_.code)),
                    businessObjectDataKey.getNamespace().toUpperCase()));
    predicates.add(builder.equal(
            builder.upper(businessObjectDefinitionEntityJoin.get(BusinessObjectDefinitionEntity_.name)),
            businessObjectDataKey.getBusinessObjectDefinitionName().toUpperCase()));
    predicates.add(builder.equal(builder.upper(storageEntityJoin.get(StorageEntity_.name)),
            storageName.toUpperCase()));
    predicates.add(builder.or(
            builder.isNull(storageUnitNotificationRegistrationEntityRoot
                    .get(StorageUnitNotificationRegistrationEntity_.usage)),
            builder.equal(
                    builder.upper(storageUnitNotificationRegistrationEntityRoot
                            .get(StorageUnitNotificationRegistrationEntity_.usage)),
                    businessObjectDataKey.getBusinessObjectFormatUsage().toUpperCase())));
    predicates.add(builder.or(
            builder.isNull(storageUnitNotificationRegistrationEntityRoot
                    .get(StorageUnitNotificationRegistrationEntity_.fileType)),
            builder.equal(builder.upper(fileTypeEntityJoin.get(FileTypeEntity_.code)),
                    businessObjectDataKey.getBusinessObjectFormatFileType().toUpperCase())));
    predicates.add(builder.or(
            builder.isNull(storageUnitNotificationRegistrationEntityRoot
                    .get(StorageUnitNotificationRegistrationEntity_.businessObjectFormatVersion)),
            builder.equal(
                    storageUnitNotificationRegistrationEntityRoot
                            .get(StorageUnitNotificationRegistrationEntity_.businessObjectFormatVersion),
                    businessObjectDataKey.getBusinessObjectFormatVersion())));
    predicates.add(builder.or(
            builder.isNull(storageUnitNotificationRegistrationEntityRoot
                    .get(StorageUnitNotificationRegistrationEntity_.newStorageUnitStatus)),
            builder.equal(builder.upper(newStorageUnitStatusEntityJoin.get(StorageUnitStatusEntity_.code)),
                    newStorageUnitStatus.toUpperCase())));
    // Please note that old business object data status parameter value is null for a business object data registration event.
    predicates.add(builder.or(
            builder.isNull(storageUnitNotificationRegistrationEntityRoot
                    .get(StorageUnitNotificationRegistrationEntity_.oldStorageUnitStatus)),
            builder.equal(builder.upper(oldStorageUnitStatusEntityJoin.get(StorageUnitStatusEntity_.code)),
                    oldStorageUnitStatus == null ? null : oldStorageUnitStatus.toUpperCase())));
    predicates.add(builder.equal(
            builder.upper(
                    notificationRegistrationStatusEntityJoin.get(NotificationRegistrationStatusEntity_.code)),
            notificationRegistrationStatus.toUpperCase()));

    // Order the results by namespace and notification name.
    List<Order> orderBy = new ArrayList<>();
    orderBy.add(builder.asc(namespaceEntityJoin.get(NamespaceEntity_.code)));
    orderBy.add(builder.asc(storageUnitNotificationRegistrationEntityRoot
            .get(StorageUnitNotificationRegistrationEntity_.name)));

    // Add the clauses for the query.
    criteria.select(storageUnitNotificationRegistrationEntityRoot)
            .where(builder.and(predicates.toArray(new Predicate[predicates.size()]))).orderBy(orderBy);

    // Execute the query and return the results.
    return entityManager.createQuery(criteria).getResultList();
}

From source file:org.finra.herd.dao.impl.TagDaoImpl.java

@Override
public TagEntity getTagByKey(TagKey tagKey) {
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<TagEntity> criteria = builder.createQuery(TagEntity.class);

    // The criteria root is the tag entity.
    Root<TagEntity> tagEntityRoot = criteria.from(TagEntity.class);

    // Join on the other tables we can filter on.
    Join<TagEntity, TagTypeEntity> tagTypeEntityJoin = tagEntityRoot.join(TagEntity_.tagType);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(builder.equal(builder.upper(tagTypeEntityJoin.get(TagTypeEntity_.code)),
            tagKey.getTagTypeCode().toUpperCase()));
    predicates.add(builder.equal(builder.upper(tagEntityRoot.get(TagEntity_.tagCode)),
            tagKey.getTagCode().toUpperCase()));

    // Add all clauses to the query.
    criteria.select(tagEntityRoot).where(builder.and(predicates.toArray(new Predicate[predicates.size()])));

    return executeSingleResultQuery(criteria,
            String.format("Found more than one tag with parameters {tagType=\"%s\", tagCode=\"%s\"}.",
                    tagKey.getTagTypeCode(), tagKey.getTagCode()));
}

From source file:org.finra.herd.dao.impl.TagDaoImpl.java

@Override
public TagEntity getTagByTagTypeAndDisplayName(String tagTypeCode, String displayName) {
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<TagEntity> criteria = builder.createQuery(TagEntity.class);

    // The criteria root is the tag entity.
    Root<TagEntity> tagEntityRoot = criteria.from(TagEntity.class);

    // Join on the other tables we can filter on.
    Join<TagEntity, TagTypeEntity> tagTypeEntityJoin = tagEntityRoot.join(TagEntity_.tagType);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(builder.equal(builder.upper(tagTypeEntityJoin.get(TagTypeEntity_.code)),
            tagTypeCode.toUpperCase()));
    predicates.add(/*from  w  w  w  .jav a 2  s  .c  o  m*/
            builder.equal(builder.upper(tagEntityRoot.get(TagEntity_.displayName)), displayName.toUpperCase()));

    // Add all clauses to the query.
    criteria.select(tagEntityRoot).where(builder.and(predicates.toArray(new Predicate[predicates.size()])));

    return executeSingleResultQuery(criteria,
            String.format("Found more than one tag with parameters {tagType=\"%s\", displayName=\"%s\"}.",
                    tagTypeCode, displayName));
}

From source file:org.finra.herd.dao.impl.TagDaoImpl.java

@Override
public List<TagChild> getTagsByTagTypeAndParentTagCode(String tagType, String parentTagCode) {
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<TagEntity> criteria = builder.createQuery(TagEntity.class);

    // The criteria root is the tag entity.
    Root<TagEntity> tagEntityRoot = criteria.from(TagEntity.class);

    // Join to the other tables we can filter on.
    Join<TagEntity, TagTypeEntity> tagTypeEntityJoin = tagEntityRoot.join(TagEntity_.tagType);

    // Get the columns.
    Path<String> displayNameColumn = tagEntityRoot.get(TagEntity_.displayName);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(//from w  w w .j  a v a2s .  com
            builder.equal(builder.upper(tagTypeEntityJoin.get(TagTypeEntity_.code)), tagType.toUpperCase()));

    if (parentTagCode == null) {
        // Parent tag code is not specified, then return all tags with no parents, i.e. root tags.
        predicates.add(builder.isNull(tagEntityRoot.get(TagEntity_.parentTagEntity)));
    } else {
        // Add a restriction for the parent tag code.
        predicates.add(builder.equal(
                builder.upper(tagEntityRoot.get(TagEntity_.parentTagEntity).get(TagEntity_.tagCode)),
                parentTagCode.toUpperCase()));
    }

    // Add all clauses to the query.
    criteria.select(tagEntityRoot).where(builder.and(predicates.toArray(new Predicate[predicates.size()])))
            .orderBy(builder.asc(displayNameColumn));

    // Run the query to get a list of tag entities back.
    List<TagEntity> tagEntities = entityManager.createQuery(criteria).getResultList();

    // Populate tag child objects from the returned tag entities.
    List<TagChild> tagChildren = new ArrayList<>();
    for (TagEntity tagEntity : tagEntities) {
        boolean hasChildren = !tagEntity.getChildrenTagEntities().isEmpty();
        tagChildren.add(new TagChild(new TagKey(tagEntity.getTagType().getCode(), tagEntity.getTagCode()),
                hasChildren));
    }

    return tagChildren;
}

From source file:org.finra.herd.dao.impl.TagDaoImpl.java

@Override
public List<TagEntity> getTagsByTagTypeEntityAndParentTagCode(TagTypeEntity tagTypeEntity, String parentTagCode,
        Boolean isParentTagNull) {
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<TagEntity> criteria = builder.createQuery(TagEntity.class);

    // The criteria root is the tag entity.
    Root<TagEntity> tagEntityRoot = criteria.from(TagEntity.class);

    // Get the columns.
    Path<String> displayNameColumn = tagEntityRoot.get(TagEntity_.displayName);

    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(builder.equal(tagEntityRoot.get(TagEntity_.tagType), tagTypeEntity));

    if (StringUtils.isNotBlank(parentTagCode)) {
        // Return all tags that are immediate children of the specified parent tag.
        predicates.add(builder.equal(/* ww  w .  j  a va  2  s  .  c o m*/
                builder.upper(tagEntityRoot.get(TagEntity_.parentTagEntity).get(TagEntity_.tagCode)),
                parentTagCode.toUpperCase()));
    } else if (BooleanUtils.isTrue(isParentTagNull)) {
        // The flag is non-null and true, return all tags with no parents, i.e. root tags.
        predicates.add(builder.isNull(tagEntityRoot.get(TagEntity_.parentTagEntity)));
    } else if (BooleanUtils.isFalse(isParentTagNull)) {
        // The flag is non-null and false, return all tags with parents.
        predicates.add(builder.isNotNull(tagEntityRoot.get(TagEntity_.parentTagEntity)));
    }

    // Add all clauses to the query.
    criteria.select(tagEntityRoot).where(builder.and(predicates.toArray(new Predicate[predicates.size()])))
            .orderBy(builder.asc(displayNameColumn));

    // Run the query to get the results.
    return entityManager.createQuery(criteria).getResultList();
}

From source file:org.finra.herd.service.EmrServiceTest.java

/**
 * Returns a list of {@link EmrClusterCreationLogEntity} objects for the given cluster namespace, cluster definition name, and EMR cluster name. All the
 * given parameters are case insensitive. The returned list's order is not guaranteed.
 *
 * @param namespace - EMR cluster namespace
 * @param definitionName - EMR cluster definition name
 * @param clusterName - EMR cluster name
 *
 * @return list of EMR cluster creation logs
 *///w  w w . j av a 2  s. c  om
protected List<EmrClusterCreationLogEntity> getEmrClusterCreationLogEntities(String namespace,
        String definitionName, String clusterName) {
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<EmrClusterCreationLogEntity> query = builder.createQuery(EmrClusterCreationLogEntity.class);
    Root<EmrClusterCreationLogEntity> emrClusterCreationLogEntity = query
            .from(EmrClusterCreationLogEntity.class);
    Join<?, NamespaceEntity> namespaceEntity = emrClusterCreationLogEntity
            .join(EmrClusterCreationLogEntity_.namespace);
    Predicate namespacePredicate = builder.equal(builder.upper(namespaceEntity.get(NamespaceEntity_.code)),
            namespace.toUpperCase());
    Predicate definitionNamePredicate = builder.equal(
            builder.upper(
                    emrClusterCreationLogEntity.get(EmrClusterCreationLogEntity_.emrClusterDefinitionName)),
            definitionName.toUpperCase());
    Predicate clusterNamePredicate = builder.equal(
            builder.upper(emrClusterCreationLogEntity.get(EmrClusterCreationLogEntity_.emrClusterName)),
            clusterName.toUpperCase());
    query.select(emrClusterCreationLogEntity)
            .where(builder.and(namespacePredicate, definitionNamePredicate, clusterNamePredicate));
    return entityManager.createQuery(query).getResultList();
}

From source file:org.kuali.rice.kew.rule.dao.impl.RuleDAOJpa.java

private List<javax.persistence.criteria.Predicate> getSearchCriteria(Root<RuleBaseValues> root,
        CriteriaQuery<RuleBaseValues> query, String docTypeName, String ruleTemplateId, String ruleDescription,
        Boolean delegateRule, Boolean activeInd, Map extensionValues) {
    List<javax.persistence.criteria.Predicate> predicates = new ArrayList<javax.persistence.criteria.Predicate>();
    CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();

    predicates.add(cb.equal(root.get("currentInd"), Boolean.TRUE));
    predicates.add(cb.equal(root.get("templateRuleInd"), Boolean.FALSE));
    if (activeInd != null) {
        predicates.add(cb.equal(root.get("active"), activeInd));
    }/*from w  w  w. j  a  va2  s  . co  m*/
    if (docTypeName != null) {
        predicates.add(cb.like(cb.upper(root.<String>get("docTypeName")), docTypeName.toUpperCase()));
    }
    if (ruleDescription != null && !ruleDescription.trim().equals("")) {
        predicates.add(cb.like(cb.upper(root.<String>get("description")), ruleDescription.toUpperCase()));
    }
    if (ruleTemplateId != null) {
        predicates.add(cb.equal(root.get("ruleTemplateId"), ruleTemplateId));
    }
    if (delegateRule != null) {
        predicates.add(cb.equal(root.get("delegateRule"), delegateRule));
    }
    if (extensionValues != null && !extensionValues.isEmpty()) {
        for (Iterator iter2 = extensionValues.entrySet().iterator(); iter2.hasNext();) {
            Map.Entry entry = (Map.Entry) iter2.next();
            if (!StringUtils.isEmpty((String) entry.getValue())) {
                Subquery ruleExtSubQuery = query.subquery(RuleExtensionBo.class);
                Root<RuleExtensionBo> ruleExtRoot = ruleExtSubQuery.from(RuleExtensionBo.class);
                javax.persistence.criteria.Predicate predAnd = cb.and(
                        cb.equal(ruleExtRoot.get("extensionValues").get("key"), entry.getKey()),
                        cb.like(ruleExtRoot.get("extensionValues").<String>get("value"),
                                ("%" + (String) entry.getValue() + "%").toUpperCase()));
                ruleExtSubQuery.where(predAnd);
                ruleExtSubQuery.select(ruleExtRoot.get("ruleBaseValuesId"));

                predicates.add(cb.in(root.get("id")).value(ruleExtSubQuery));
            }
        }
    }
    return predicates;
}