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


Java Condition.or方法代码示例

本文整理汇总了Java中org.jooq.Condition.or方法的典型用法代码示例。如果您正苦于以下问题:Java Condition.or方法的具体用法?Java Condition.or怎么用?Java Condition.or使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jooq.Condition的用法示例。


在下文中一共展示了Condition.or方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleConnectiveP

import org.jooq.Condition; //导入方法依赖的package包/类
private Condition handleConnectiveP(String key, ConnectiveP predicate) {
    List<P> predicates = predicate.getPredicates();
    List<Condition> queries = predicates.stream().map(p -> {
        if (p instanceof ConnectiveP) return handleConnectiveP(key, (ConnectiveP) p);
        Object pValue = p.getValue();
        BiPredicate pBiPredicate = p.getBiPredicate();
        return predicateToQuery(key, pValue, pBiPredicate);
    }).collect(Collectors.toList());
    Condition condition = queries.get(0);
    if (predicate instanceof AndP){
        for (int i = 1; i < queries.size(); i++) {
            condition = condition.and(queries.get(i));
        }
    }
    else if (predicate instanceof OrP){
        for (int i = 1; i < queries.size(); i++) {
            condition = condition.or(queries.get(i));
        }
    }
    else throw new IllegalArgumentException("Connective predicate not supported by unipop");
    return condition;
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:23,代码来源:JdbcPredicatesTranslator.java

示例2: getProjectMembersByIdentity

import org.jooq.Condition; //导入方法依赖的package包/类
@Override
public List<? extends ProjectMember> getProjectMembersByIdentity(long projectId, Set<Identity> identities) {
    Condition allMembers = DSL.falseCondition();
    for (Identity identity : identities) {
        allMembers = allMembers.or(PROJECT_MEMBER.EXTERNAL_ID.eq(identity.getExternalId())
                .and(PROJECT_MEMBER.EXTERNAL_ID_TYPE.eq(identity.getExternalIdType()))
                .and(PROJECT_MEMBER.REMOVED.isNull())
                .and(PROJECT_MEMBER.STATE.eq(CommonStatesConstants.ACTIVE))
                .and(PROJECT_MEMBER.PROJECT_ID.eq(projectId)));
    }
    SelectQuery<Record> query = create().selectQuery();
    query.addFrom(PROJECT_MEMBER);
    query.addConditions(allMembers);
    query.setDistinct(true);
    return query.fetchInto(PROJECT_MEMBER);
}
 
开发者ID:rancher,项目名称:cattle,代码行数:17,代码来源:AuthDaoImpl.java

示例3: isProjectOwner

import org.jooq.Condition; //导入方法依赖的package包/类
@Override
public boolean isProjectOwner(long projectId, Long usingAccount, boolean isAdmin, Set<Identity> identities) {
    if (identities == null) {
        return false;
    }
    if (isAdmin) {
        return true;
    }
    if (usingAccount != null && usingAccount.equals(projectId)) {
        return false;
    }
    Set<ProjectMemberRecord> projectMembers = new HashSet<>();
    Condition allMembers = DSL.falseCondition();
    for (Identity id : identities) {
        allMembers = allMembers.or(PROJECT_MEMBER.EXTERNAL_ID.eq(id.getExternalId())
                .and(PROJECT_MEMBER.EXTERNAL_ID_TYPE.eq(id.getExternalIdType()))
                .and(PROJECT_MEMBER.ROLE.eq(ProjectConstants.OWNER))
                .and(PROJECT_MEMBER.PROJECT_ID.eq(projectId))
                .and(PROJECT_MEMBER.STATE.eq(CommonStatesConstants.ACTIVE))
                .and(PROJECT_MEMBER.REMOVED.isNull()));
    }
    projectMembers.addAll(create().selectFrom(PROJECT_MEMBER).where(allMembers).fetch());
    return !projectMembers.isEmpty();
}
 
开发者ID:rancher,项目名称:cattle,代码行数:25,代码来源:AuthDaoImpl.java

示例4: isProjectMember

import org.jooq.Condition; //导入方法依赖的package包/类
@Override
public boolean isProjectMember(long projectId, Long usingAccount, boolean isAdmin, Set<Identity> identities) {
    if (identities == null) {
        return false;
    }
    if ((usingAccount != null && usingAccount.equals(projectId)) || isAdmin) {
        return true;
    }
    Set<ProjectMemberRecord> projectMembers = new HashSet<>();
    Condition allMembers = DSL.falseCondition();
    for (Identity id : identities) {
        allMembers = allMembers.or(PROJECT_MEMBER.EXTERNAL_ID.eq(id.getExternalId())
                .and(PROJECT_MEMBER.EXTERNAL_ID_TYPE.eq(id.getExternalIdType()))
                .and(PROJECT_MEMBER.PROJECT_ID.eq(projectId))
                .and(PROJECT_MEMBER.STATE.eq(CommonStatesConstants.ACTIVE))
                .and(PROJECT_MEMBER.REMOVED.isNull()));
    }
    projectMembers.addAll(create().selectFrom(PROJECT_MEMBER).where(allMembers).fetch());
    return !projectMembers.isEmpty();
}
 
开发者ID:rancher,项目名称:cattle,代码行数:21,代码来源:AuthDaoImpl.java

示例5: groupCondition

import org.jooq.Condition; //导入方法依赖的package包/类
protected Condition groupCondition() {
    if ( groupManager.shouldHandleWildcard() ) {
        return DSL.trueCondition();
    }

    Condition condition = DSL.falseCondition();
    Set<Long> supported = groupManager.supportedGroups();

    if ( supported.size() > 0 ) {
        condition = AGENT.AGENT_GROUP_ID.in(supported);
    }

    if ( groupManager.shouldHandleUnassigned() ) {
        condition = condition.or(AGENT.AGENT_GROUP_ID.isNull());
    }

    return condition;
}
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:19,代码来源:PingDaoImpl.java

示例6: addCondition

import org.jooq.Condition; //导入方法依赖的package包/类
private Condition addCondition(QueryParams queryParams, Map<String, Object> queryMap) {

		List<Condition> ccc = new LinkedList<Condition>();
		String queryOperator = null;
		for (QueryParam queryParam : queryParams) {
			queryOperator = queryParam.getOperator().toString();
			switch (queryParam.getOperator()) {
			case EQ:
			case GT:
			case GTE:
			case LT:
			case LTE:
			case NE:
			case IN:
			case LIKE:
			case NIN:
				ccc.add(getSimpleCondition(queryParam.getOperator(), DSL.field(queryParam.getKey()),
						queryMap.get(queryParam.getKey())));
				break;
			case OR:
			case AND:

				QueryParam qp = queryParam.getParams().get(0);

				Condition condition = getSimpleCondition(qp.getOperator(), DSL.field(qp.getKey()),
						queryMap.get(qp.getKey()));

				for (int i = 1; i < queryParam.getParams().size(); i++) {

					QueryParam orQueryParam = queryParam.getParams().get(i);

					Condition c = getSimpleCondition(orQueryParam.getOperator(), DSL.field(orQueryParam.getKey()),
							queryMap.get(orQueryParam.getKey()));

					switch (queryParam.getOperator()) {
					case OR:
						condition = condition.or(c);
						break;
					case AND:
						condition = condition.and(c);
						break;
					default:
						break;
					}
				}

				ccc.add(condition);
				break;
			default:
				break;
			}
		}
		Condition rc = null;
		for (Condition xc : ccc) {
			if (rc == null) {
				rc = xc;
			} else {
				if (queryOperator.equals("LIKE")) {
					rc = rc.and(xc);
				} else {
					rc = rc.or(xc);
				}
			}
		}
		return rc;
	}
 
开发者ID:SmallBadFish,项目名称:practice,代码行数:67,代码来源:JooqMysqlProvider.java


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