當前位置: 首頁>>代碼示例>>Java>>正文


Java Restrictions.and方法代碼示例

本文整理匯總了Java中org.hibernate.criterion.Restrictions.and方法的典型用法代碼示例。如果您正苦於以下問題:Java Restrictions.and方法的具體用法?Java Restrictions.and怎麽用?Java Restrictions.and使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.criterion.Restrictions的用法示例。


在下文中一共展示了Restrictions.and方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildNested

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
private Criterion buildNested(NestedExpression nestedExpression) {
    
    Criterion full = null;

    for (int i = 0; i < nestedExpression.getExpressionCount(); i++) {
        Criterion expr;
        Expression expression = nestedExpression.getExpression(i);

        if (expression.isNested()) {
            expr = buildNested((NestedExpression) nestedExpression.getExpression(i));
        } else {
            FieldExpression sub = (FieldExpression) nestedExpression.getExpression(i);
            expr = queryComparison(sub);

            if (sub.isNegate()) {
                expr = Restrictions.not(expr);
            }
        }

        if (full == null) {
            full = expr;
        } else {
            switch (nestedExpression.getExpressionOperator()) {
            case AND:
                full = Restrictions.and(full, expr);
                break;

            case OR:
                full = Restrictions.or(full, expr);
            }
        }
    }

    return full;
}
 
開發者ID:will-gilbert,項目名稱:OSWf-OSWorkflow-fork,代碼行數:36,代碼來源:HibernateStore.java

示例2: on

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
@Transactional
@Listen
public void on(RefUpdated event) {
	String branch = GitUtils.ref2branch(event.getRefName());
	if (branch != null) {
		ProjectAndBranch projectAndBranch = new ProjectAndBranch(event.getProject(), branch);
		Criterion criterion = Restrictions.and(
				ofOpen(), 
				Restrictions.or(ofSource(projectAndBranch), ofTarget(projectAndBranch)));
		for (PullRequest request: findAll(EntityCriteria.of(PullRequest.class).add(criterion))) {
			check(request);
		}
	}
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:15,代碼來源:DefaultPullRequestManager.java

示例3: findEffective

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
@Sessional
@Override
public PullRequest findEffective(ProjectAndBranch target, ProjectAndBranch source) {
	EntityCriteria<PullRequest> criteria = EntityCriteria.of(PullRequest.class);
	Criterion merged = Restrictions.and(
			Restrictions.eq("closeInfo.closeStatus", CloseInfo.Status.MERGED), 
			Restrictions.eq("lastMergePreview.requestHead", source.getObjectName()));
	
	criteria.add(ofTarget(target)).add(ofSource(source)).add(Restrictions.or(ofOpen(), merged));
	
	return find(criteria);
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:13,代碼來源:DefaultPullRequestManager.java

示例4: ofTarget

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
public static Criterion ofTarget(ProjectAndBranch target) {
	return Restrictions.and(
			Restrictions.eq("targetProject", target.getProject()),
			Restrictions.eq("targetBranch", target.getBranch()));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:6,代碼來源:PullRequest.java

示例5: ofSource

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
public static Criterion ofSource(ProjectAndBranch source) {
	return Restrictions.and(
			Restrictions.eq("sourceProject", source.getProject()),
			Restrictions.eq("sourceBranch", source.getBranch()));
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:6,代碼來源:PullRequest.java


注:本文中的org.hibernate.criterion.Restrictions.and方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。