本文整理汇总了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;
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}