当前位置: 首页>>代码示例>>Java>>正文


Java BooleanExpression类代码示例

本文整理汇总了Java中com.mysema.query.types.expr.BooleanExpression的典型用法代码示例。如果您正苦于以下问题:Java BooleanExpression类的具体用法?Java BooleanExpression怎么用?Java BooleanExpression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BooleanExpression类属于com.mysema.query.types.expr包,在下文中一共展示了BooleanExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lookUpParentAcls

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
private void lookUpParentAcls(Map<Serializable, Acl> acls, Set<String> parentIds, List<Sid> sids) {
	QAclObjectIdentity aclObjectIdentity = QAclObjectIdentity.aclObjectIdentity;
	BooleanExpression objectIdentityCondition = null;
	for (String oid : parentIds) {
		BooleanExpression oidCondition = aclObjectIdentity.id.eq(oid);
		if (objectIdentityCondition == null) {
			objectIdentityCondition = oidCondition;
		} else {
			objectIdentityCondition = objectIdentityCondition.or(oidCondition);
		}
	}
	List<AclObjectIdentity> aoiList = (List<AclObjectIdentity>) objectIdentityRepository
			.findAll(objectIdentityCondition, aclObjectIdentity.objectIdIdentity.asc());
	Set<String> parentIdsToLookup = getParentIdsToLookup(acls, aoiList, sids);
	if (parentIdsToLookup != null && parentIdsToLookup.size() > 0) {
		lookUpParentAcls(acls, parentIdsToLookup, sids);
	}
}
 
开发者ID:AlexCzar,项目名称:spring-security-acl-mongodb,代码行数:19,代码来源:MongodbAclService.java

示例2: createBooleanExpression

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
/**
 * Return an expression for {@code entityPath.fieldName} (for Booleans) with
 * the {@code operator} or "equal" by default.
 * <p/>
 * Expr: {@code entityPath.fieldName eq searchObj}
 * 
 * @param entityPath
 * @param fieldName
 * @param searchObj
 * @param operator
 * @return
 */
public static <T> BooleanExpression createBooleanExpression(
        PathBuilder<T> entityPath, String fieldName, Object searchObj,
        String operator) {
    Boolean value = BooleanUtils.toBooleanObject((String) searchObj);
    if (value != null) {
        if (StringUtils.equalsIgnoreCase(operator, OPERATOR_GOE)) {
            return entityPath.getBoolean(fieldName).goe(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, "gt")) {
            return entityPath.getBoolean(fieldName).gt(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, OPERATOR_LOE)) {
            return entityPath.getBoolean(fieldName).loe(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, "lt")) {
            return entityPath.getBoolean(fieldName).lt(value);
        }
    }
    return entityPath.get(fieldName).eq(searchObj);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:33,代码来源:QuerydslUtils.java

示例3: createStringExpression

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
/**
 * Return an expression for {@code entityPath.fieldName} (for Strings) with
 * the {@code operator} or "equal" by default.
 * <p/>
 * Expr: {@code entityPath.fieldName eq searchObj}
 * 
 * @param entityPath
 * @param fieldName
 * @param searchObj
 * @param operator
 * @return
 */
public static <T> BooleanExpression createStringExpression(
        PathBuilder<T> entityPath, String fieldName, Object searchObj,
        String operator) {
    if (StringUtils.equalsIgnoreCase(operator, OPERATOR_GOE)) {
        return entityPath.getString(fieldName).goe((String) searchObj);
    }
    else if (StringUtils.equalsIgnoreCase(operator, "gt")) {
        return entityPath.getString(fieldName).gt((String) searchObj);
    }
    else if (StringUtils.equalsIgnoreCase(operator, OPERATOR_LOE)) {
        return entityPath.getString(fieldName).loe((String) searchObj);
    }
    else if (StringUtils.equalsIgnoreCase(operator, "lt")) {
        return entityPath.getString(fieldName).lt((String) searchObj);
    }
    else if (StringUtils.equalsIgnoreCase(operator, "like")) {
        return entityPath.getString(fieldName).like((String) searchObj);
    }
    return entityPath.get(fieldName).eq(searchObj);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:33,代码来源:QuerydslUtils.java

示例4: createBooleanExpression

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public <T> BooleanExpression createBooleanExpression(
        PathBuilder<T> entityPath, String fieldName, Object searchObj,
        String operator) {
    Boolean value = BooleanUtils.toBooleanObject((String) searchObj);
    if (value != null) {
        if (StringUtils.equalsIgnoreCase(operator, OPERATOR_GOE)) {
            return entityPath.getBoolean(fieldName).goe(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, "gt")) {
            return entityPath.getBoolean(fieldName).gt(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, OPERATOR_LOE)) {
            return entityPath.getBoolean(fieldName).loe(value);
        }
        else if (StringUtils.equalsIgnoreCase(operator, "lt")) {
            return entityPath.getBoolean(fieldName).lt(value);
        }
    }
    return entityPath.get(fieldName).eq(searchObj);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:25,代码来源:QuerydslUtilsBeanImpl.java

示例5: createStringExpression

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public <T> BooleanExpression createStringExpression(
        PathBuilder<T> entityPath, String fieldName, Object searchObj,
        String operator) {
    if (StringUtils.equalsIgnoreCase(operator, OPERATOR_GOE)) {
        return entityPath.getString(fieldName).goe((String) searchObj);
    }
    else if (StringUtils.equalsIgnoreCase(operator, "gt")) {
        return entityPath.getString(fieldName).gt((String) searchObj);
    }
    else if (StringUtils.equalsIgnoreCase(operator, OPERATOR_LOE)) {
        return entityPath.getString(fieldName).loe((String) searchObj);
    }
    else if (StringUtils.equalsIgnoreCase(operator, "lt")) {
        return entityPath.getString(fieldName).lt((String) searchObj);
    }
    else if (StringUtils.equalsIgnoreCase(operator, "like")) {
        return entityPath.getString(fieldName).like((String) searchObj);
    }
    return entityPath.get(fieldName).eq(searchObj);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:25,代码来源:QuerydslUtilsBeanImpl.java

示例6: transformContextToSubQuery

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
private void transformContextToSubQuery() {
    JPASubQuery jpaSubQuery = new JPASubQuery();

    BooleanExpression booleanExpression = null;

    Context context = stackOfContexts.pop();

    if (context.clauses.size() > 0) {
        for (Clause clause : context.clauses) {
            if (booleanExpression == null) {
                booleanExpression = QWorkflowRevision.workflowRevision.id.in(clause.listSubQuery);
            } else {
                booleanExpression = booleanExpression.and(QWorkflowRevision.workflowRevision.id.in(clause.listSubQuery));
            }
        }

        stackOfSubQueries.push(jpaSubQuery.from(QWorkflowRevision.workflowRevision)
                                          .where(booleanExpression)
                                          .list(QWorkflowRevision.workflowRevision));
    }
}
 
开发者ID:ow2-proactive,项目名称:workflow-catalog-old,代码行数:22,代码来源:WorkflowCatalogQueryLanguageListener.java

示例7: buildIssueKeyPredicate

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
/**
 * Create a Predicate based on the supplied issue keys that respects the maximum size of an 'IN' statement as per
 * the constant defined in {!{@link com.atlassian.jira.plugins.dvcs.util.ActiveObjectsUtils#SQL_IN_CLAUSE_MAX}}
 * @param issueKeys The issue keys to bind into the predicate
 * @param issueKeyedMapping The QueryDSL mapping class that supports issue key based queries
 * @return A predicate that is an 'IN' statement across the issue keys
 */
@Nullable
public static Predicate buildIssueKeyPredicate(@Nonnull final Iterable<String> issueKeys,
        @Nonnull final IssueKeyedMapping issueKeyedMapping)
{
    final List<String> issueKeysList = Lists.newArrayList(issueKeys);

    if (issueKeysList.size() <= ActiveObjectsUtils.SQL_IN_CLAUSE_MAX)
    {
        return issueKeyedMapping.getIssueKeyExpression().in(issueKeysList);
    }

    List<List<String>> partititionedIssueKeys = Lists.partition(issueKeysList, ActiveObjectsUtils.SQL_IN_CLAUSE_MAX);

    BooleanExpression issueKeyPredicate = issueKeyedMapping.getIssueKeyExpression().in(partititionedIssueKeys.get(0));

    for (List<String> keys : Iterables.drop(1, partititionedIssueKeys))
    {
        issueKeyPredicate = issueKeyPredicate.or(issueKeyedMapping.getIssueKeyExpression().in(keys));
    }

    return issueKeyPredicate;
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:30,代码来源:IssueKeyPredicateFactory.java

示例8: executesQuerydslPredicate

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
/**
 * @since Step 8
 */
@Test
public void executesQuerydslPredicate() {

	Customer dietmar = repository.findByEmailAddress("[email protected]");
	Customer ralf = repository.findByEmailAddress("[email protected]");

	QCustomer customer = QCustomer.customer;

	BooleanExpression firstnameStartsWithDie = customer.firstname.startsWith("Die");
	BooleanExpression lastnameContainsBach = customer.lastname.contains("bach");

	Iterable<Customer> result = repository.findAll(firstnameStartsWithDie.or(lastnameContainsBach));

	assertThat(result).asList().hasSize(2);
	assertThat(result).asList().containsExactly(dietmar, ralf);
}
 
开发者ID:jugsaar,项目名称:visit-jugkl-20150813-springdata-repositories,代码行数:20,代码来源:CustomerRepositoryIntegrationTest.java

示例9: build

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
public BooleanExpression build() {
  if (this.getCriteria().size() == 0) {
    return null;
  }

  List<BooleanExpression> predicates = new ArrayList<BooleanExpression>();
  AlbumPredicate predicate;
  for (SearchCriteria c : this.getCriteria()) {
    predicate = new AlbumPredicate(c);
    BooleanExpression exp = predicate.getPredicate();
    if (exp != null) {
      predicates.add(exp);
    }
  }

  BooleanExpression result = predicates.get(0);
  for (int i = 1; i < predicates.size(); i++) {
    result = result.and(predicates.get(i));
  }

  return result;
}
 
开发者ID:brahalla,项目名称:PhotoAlbum-api,代码行数:23,代码来源:AlbumPredicateBuilder.java

示例10: build

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
public BooleanExpression build() {
  if (this.getCriteria().size() == 0) {
    return null;
  }

  List<BooleanExpression> predicates = new ArrayList<BooleanExpression>();
  PhotoPredicate predicate;
  for (SearchCriteria c : this.getCriteria()) {
    predicate = new PhotoPredicate(c);
    BooleanExpression exp = predicate.getPredicate();
    if (exp != null) {
      predicates.add(exp);
    }
  }

  BooleanExpression result = predicates.get(0);
  for (int i = 1; i < predicates.size(); i++) {
    result = result.and(predicates.get(i));
  }

  return result;
}
 
开发者ID:brahalla,项目名称:PhotoAlbum-api,代码行数:23,代码来源:PhotoPredicateBuilder.java

示例11: createPredicate

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
private Predicate createPredicate(PathBuilder<?> builder, PartTree tree, BeanWrapper bean){
	
	//BeanWrapper paramWrapper = PropertyAccessorFactory.forBeanPropertyAccess(param);
	
	BooleanExpression base = null;
	for (OrPart node : tree) {
		//logger.debug("OrPart : "+node.getClass());
		
		BooleanExpression criteria = null;
		for (Part part : node) {
			//logger.debug("Part "+part.getClass());
			
			if(part.getProperty() != null){
				BooleanExpression newCriteria = create(builder, part, bean);
				if(newCriteria != null){
					//logger.debug("ok....");
					criteria = criteria == null ? newCriteria : and(criteria, newCriteria, bean);
				}
			}
		}
		base = base == null ? criteria : or(base, criteria, bean);
	}
	//logger.debug("base "+base);
	
	return base;
}
 
开发者ID:u2ware,项目名称:springfield,代码行数:27,代码来源:QueryMethodResolver.java

示例12: execute

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
@Override
public Long execute() {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    return jdbcTemplate.execute(new ConnectionCallback<Long>() {
        @Override
        public Long doInConnection(Connection connection) throws SQLException, DataAccessException {
            final SQLDeleteClause deleteClause = new SQLDeleteClause(connection, configuration, pathBase);
            for (BooleanExpression expression : QueryExampleHelper.getExpressions(pathBase, example)) {
                deleteClause.where(expression);
            }
            for (SQLBindings sqlBindings : deleteClause.getSQL()) {
                LOGGER.debug("SQL: {} \nparams: {}", sqlBindings.getSQL(), sqlBindings.getBindings());
            }
            return deleteClause.execute();
        }
    });
}
 
开发者ID:edgar615,项目名称:javase-study,代码行数:18,代码来源:DeleteTransaction.java

示例13: handleListStylesWithQuery

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
private CompletableFuture<Page<Style>> handleListStylesWithQuery (final ListStyles listStyles) {
	final BooleanExpression styleInUse = new SQLSubQuery ()
		.from (layerStyle)
		.where (layerStyle.styleId.eq (style.id))
		.exists ();
	
	final AsyncSQLQuery baseQuery = db
		.query()
		.from(style)
		.orderBy (style.name.asc ());

	if (listStyles.getQuery () != null) {
		baseQuery.where (style.name.containsIgnoreCase (listStyles.getQuery ()));
	}
	
	if (listStyles.getStyleType() != null) {
		baseQuery.where (style.styleType.eq(listStyles.getStyleType()));
	}
	
	final AsyncSQLQuery listQuery = baseQuery.clone ();
	
	singlePage (listQuery, listStyles.getPage ());
	
	return baseQuery
		.count ()
		.thenCompose ((count) -> {
			final Page.Builder<Style> builder = new Page.Builder<> ();
			
			addPageInfo (builder, listStyles.getPage (), count);
			
			return listQuery
				.list (new QStyle (style.identification, style.name, style.styleSchemeType, Expressions.constant(""), style.styleType, styleInUse))
				.thenApply ((styles) -> {
					builder.addAll (styles.list ());
					return builder.build ();
				});
		});
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:39,代码来源:StyleAdmin.java

示例14: createListPredicate

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
private static <T> Predicate createListPredicate(List<T> list, EntityPathBase<T> base) {
    if (list == null || list.isEmpty()) {
        return null;
    }

    if (list.size() == 1) {
        return base.eq(list.get(0));
    }

    BooleanExpression expr = base.eq(list.get(0));
    for (int i = 1; i < list.size(); i++) {
        expr = expr.or(base.eq(list.get(i)));
    }

    return expr;
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:17,代码来源:AbstractTaskDataProvider.java

示例15: createExpression

import com.mysema.query.types.expr.BooleanExpression; //导入依赖的package包/类
/**
 * Utility for constructing where clause expressions.
 * 
 * @param entityPath Full path to entity and associations. For example:
 *        {@code Pet} , {@code Pet.owner}
 * @param fieldName Property name in the given entity path. For example:
 *        {@code name} in {@code Pet} entity, {@code firstName} in
 *        {@code Pet.owner} entity.
 * @param fieldType Property value {@code Class}
 * @param searchStr the value to find, may be null
 * @return Predicate
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> Predicate createExpression(PathBuilder<T> entityPath,
        String fieldName, String searchStr,
        ConversionService conversionService) {

    TypeDescriptor descriptor = getTypeDescriptor(fieldName, entityPath);
    if (descriptor == null) {
        throw new IllegalArgumentException(String.format(
                "Can't found field '%s' on entity '%s'", fieldName,
                entityPath.getType()));
    }
    Class<?> fieldType = descriptor.getType();

    // Check for field type in order to delegate in custom-by-type
    // create expression method
    if (String.class == fieldType) {
        return createStringLikeExpression(entityPath, fieldName, searchStr);
    }
    else if (Boolean.class == fieldType || boolean.class == fieldType) {
        return createBooleanExpression(entityPath, fieldName, searchStr);
    }
    else if (Number.class.isAssignableFrom(fieldType)
            || NUMBER_PRIMITIVES.contains(fieldType)) {
        return createNumberExpressionGenerics(entityPath, fieldName,
                fieldType, descriptor, searchStr, conversionService);
    }
    else if (Date.class.isAssignableFrom(fieldType)
            || Calendar.class.isAssignableFrom(fieldType)) {
        BooleanExpression expression = createDateExpression(entityPath,
                fieldName, (Class<Date>) fieldType, searchStr);
        return expression;
    }

    else if (fieldType.isEnum()) {
        return createEnumExpression(entityPath, fieldName, searchStr,
                (Class<? extends Enum>) fieldType);
    }
    return null;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:52,代码来源:QuerydslUtils.java


注:本文中的com.mysema.query.types.expr.BooleanExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。