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


Java Junction类代码示例

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


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

示例1: getCriteria

import org.hibernate.criterion.Junction; //导入依赖的package包/类
@Override
public DetachedCriteria getCriteria() {
	DetachedCriteria crit = getParent().getCriteria();
	Junction junction = null;
	if (disjunction) {
		junction = Restrictions.disjunction();
	} else {
		junction = Restrictions.conjunction();
	}
	for (Iterator iter = attributeExpressions.iterator(); iter.hasNext();) {
		AttributeExpression aExpr = (AttributeExpression) iter.next();
		DetachedCriteria attrCriteria = aExpr.getCriteria();
		junction.add(Property.forName("longId").in(attrCriteria.setProjection(Projections.property("ownerId"))));
	}
	crit.add(junction);
	
	return(crit);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:19,代码来源:ConstrainGroupExpression.java

示例2: createEnumQueryStructureRestriction

import org.hibernate.criterion.Junction; //导入依赖的package包/类
/**
 * Complements a criteria by processing an enumeration query structure.
 *
 * @param path
 *     the path to the comparable property.
 * @param enumQueryStructure
 *     the collection of checked / unchecked enumeration values.
 * @return the created criterion or null if no criterion necessary.
 */
protected Criterion createEnumQueryStructureRestriction(String path, EnumQueryStructure enumQueryStructure) {
  Set<String> inListValues = new HashSet<>();
  boolean nullAllowed = false;
  for (EnumValueQueryStructure inListValue : enumQueryStructure.getSelectedEnumerationValues()) {
    if (inListValue.getValue() == null || "".equals(inListValue.getValue())) {
      nullAllowed = true;
    } else {
      inListValues.add(inListValue.getValue());
    }
  }
  Junction queryStructureRestriction = null;
  if (!inListValues.isEmpty() || nullAllowed) {
    queryStructureRestriction = Restrictions.disjunction();
    if (!inListValues.isEmpty()) {
      queryStructureRestriction.add(Restrictions.in(path, inListValues));
    }
    if (nullAllowed) {
      queryStructureRestriction.add(Restrictions.isNull(path));
    }
  }
  return queryStructureRestriction;
}
 
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:32,代码来源:DefaultCriteriaFactory.java

示例3: getDatumJunction

import org.hibernate.criterion.Junction; //导入依赖的package包/类
private Junction getDatumJunction(AdvancedSampleSearchBean searchBean) {
	// if AND and more than one type of datum, don't use junction
	if (searchBean.getCharacterizationLogicalOperator().equals("and")
			&& searchBean.getDatumTypeCount() > 1) {
		return null;
	}
	Disjunction datumDisjunction = Restrictions.disjunction();
	Conjunction datumConjunction = Restrictions.conjunction();
	for (CharacterizationQueryBean charQuery : searchBean
			.getCharacterizationQueries()) {
		Criterion datumCrit = getDatumCriterion(charQuery);
		if (datumCrit != null) {
			datumDisjunction.add(datumCrit);
			if (searchBean.getDatumTypeCount() == 1) {
				datumConjunction.add(datumCrit);
			}
		}
	}
	// default to or if only one query
	Junction junction = (searchBean.getCharacterizationLogicalOperator()
			.equals("or") || searchBean.getCharacterizationQueries().size() == 1) ? datumDisjunction
			: datumConjunction;
	return junction;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:25,代码来源:AdvancedSampleServiceHelper.java

示例4: getSampleNameJunction

import org.hibernate.criterion.Junction; //导入依赖的package包/类
/**
 * Get the sample name junction used in sample queries
 * 
 * @param searchBean
 * @param crit
 * @return
 * @throws Exception
 */
private Junction getSampleNameJunction(AdvancedSampleSearchBean searchBean)
		throws Exception {
	Disjunction sampleDisjunction = Restrictions.disjunction();
	Conjunction sampleConjunction = Restrictions.conjunction();
	for (SampleQueryBean query : searchBean.getSampleQueries()) {
		if (query.getNameType().equals("sample name")) {
			Criterion sampleNameCrit = getSampleNameCriterion(query);
			if (sampleNameCrit != null) {
				sampleDisjunction.add(sampleNameCrit);
				sampleConjunction.add(sampleNameCrit);
			}
		}
	}
	Junction junction = (searchBean.getSampleLogicalOperator().equals("or") || searchBean
			.getSampleQueries().size() == 1) ? sampleDisjunction
			: sampleConjunction;
	return junction;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:27,代码来源:AdvancedSampleServiceHelper.java

示例5: applySearchFilters

import org.hibernate.criterion.Junction; //导入依赖的package包/类
public boolean applySearchFilters(Criteria criteria, String searchTerm) {
    boolean filterAdded = false;
    //If search string is integer type, it only searches on Id field
    if (NumberUtils.isDigits(searchTerm)) {
        criteria.add(Restrictions.eq(getIdField(), Integer.parseInt(searchTerm)));
        filterAdded = true;
    } else if (getSearchFields() != null && getSearchFields().size() != 0) {
        //Text filtering is applied only if you have specified getSearchFields().
        String likeTerm = "%" + searchTerm + "%";
        Junction disjunction = Restrictions.disjunction();
        for (String field : getSearchFields()) {
            //Performs case insensitive search on all search fields.
            //Also does not searches on associations. Only value types are searched.
            disjunction.add(Restrictions.ilike(field, likeTerm));
        }
        criteria.add(disjunction);
        filterAdded = true;
    }
    return filterAdded;
}
 
开发者ID:webshrub,项目名称:cpagenie,代码行数:21,代码来源:ImpressionReportDataTables.java

示例6: addChromosomeCoordinatesToCriterion

import org.hibernate.criterion.Junction; //导入依赖的package包/类
private void addChromosomeCoordinatesToCriterion(Integer chromosomeCoordinateHigh,
        Integer chromosomeCoordinateLow, Criteria segmentDataCrit, String chromosomeNumber) {
    if (chromosomeCoordinateHigh == null || chromosomeCoordinateLow == null) {
        segmentDataCrit.add(chromosomeNumberExpression(chromosomeNumber));
        if (chromosomeCoordinateHigh != null) {
            segmentDataCrit.add(segmentEndLessThanHigh(chromosomeCoordinateHigh));
        }
        if (chromosomeCoordinateLow != null) {
            segmentDataCrit.add(segmentStartGreaterThanLow(chromosomeCoordinateLow));
        }
    } else {
        Junction overallOrStatement = Restrictions.disjunction();
        // (loc.startPos <= lowerInput && loc.endPos >= lowerInput && loc.chromosome == chromosomeInput)
        //  || (loc.startPos >= lowerInput  && loc.startPos <= higherInput && loc.chromosome == chromosomeInput)
        overallOrStatement.add(Restrictions.conjunction().add(segmentStartLessThanLow(chromosomeCoordinateLow))
                .add(segmentEndGreaterThanLow(chromosomeCoordinateLow)).add(
                        chromosomeNumberExpression(chromosomeNumber)));
        overallOrStatement.add(Restrictions.conjunction().add(segmentStartGreaterThanLow(chromosomeCoordinateLow))
                .add(segmentStartLessThanHigh(chromosomeCoordinateHigh)).add(
                        chromosomeNumberExpression(chromosomeNumber)));
        segmentDataCrit.add(overallOrStatement);
    }
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:24,代码来源:CopyNumberAlterationCriterionConverter.java

示例7: addMultipleChromosomeCoordinatesToCriterion

import org.hibernate.criterion.Junction; //导入依赖的package包/类
private void addMultipleChromosomeCoordinatesToCriterion(Criteria segmentDataCrit,
        List<GeneChromosomalLocation> geneLocations) {
    Junction overallOrStatement = Restrictions.disjunction();
    // (loc.startPos <= lowerInput && loc.endPos >= lowerInput && loc.chromosome == chromosomeInput)
    //  || (loc.startPos >= lowerInput  && loc.startPos <= higherInput && loc.chromosome == chromosomeInput)
    for (GeneChromosomalLocation geneLocation : geneLocations) {
        Integer chromosomeCoordinateLow = geneLocation.getLocation().getStartPosition();
        Integer chromosomeCoordinateHigh = geneLocation.getLocation().getEndPosition();
        overallOrStatement.add(Restrictions.conjunction().add(segmentStartLessThanLow(chromosomeCoordinateLow))
                .add(segmentEndGreaterThanLow(chromosomeCoordinateLow)).add(
                        chromosomeNumberExpression(Cai2Util.getInternalChromosomeNumber(
                                geneLocation.getLocation().getChromosome()))));
        overallOrStatement.add(Restrictions.conjunction().add(segmentStartGreaterThanLow(chromosomeCoordinateLow))
                .add(segmentStartLessThanHigh(chromosomeCoordinateHigh)).add(
                        chromosomeNumberExpression(Cai2Util.getInternalChromosomeNumber(
                                geneLocation.getLocation().getChromosome()))));
    }
    segmentDataCrit.add(overallOrStatement);

}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:21,代码来源:CopyNumberAlterationCriterionConverter.java

示例8: findMatchingSegmentDatasByLocation

import org.hibernate.criterion.Junction; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
@SuppressWarnings(UNCHECKED) // Hibernate operations are untyped
public List<SegmentData> findMatchingSegmentDatasByLocation(List<SegmentData> segmentDatasToMatch,
        Study study, Platform platform) {
    Criteria segmentDataCrit = getCurrentSession().createCriteria(SegmentData.class);
    Criteria arrayDataCrit = segmentDataCrit.createCriteria("arrayData");
    Criteria reporterListsCrit = arrayDataCrit.createCriteria("reporterLists");
    reporterListsCrit.add(Restrictions.eq(PLATFORM_ASSOCIATION, platform));
    arrayDataCrit.add(Restrictions.eq(STUDY_ASSOCIATION, study));
    Junction overallOrStatement = Restrictions.disjunction();
    for (SegmentData segmentData : segmentDatasToMatch) {
        ChromosomalLocation location = segmentData.getLocation();
        overallOrStatement.add(Restrictions.conjunction().
                add(Restrictions.eq("Location.startPosition", location.getStartPosition())).
                add(Restrictions.eq("Location.endPosition", location.getEndPosition())));
    }
    segmentDataCrit.add(overallOrStatement);
    return segmentDataCrit.list();
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:23,代码来源:CaIntegrator2DaoImpl.java

示例9: applyCategoryCriterion

import org.hibernate.criterion.Junction; //导入依赖的package包/类
private static boolean applyCategoryCriterion(Object criteriaJunction, CategoryCriterion categoryCriterion) {
	Criterion restriction = getCategoryCriterionRestriction(categoryCriterion);
	if (restriction != null) {
		if (criteriaJunction instanceof Criteria) {
			((Criteria) criteriaJunction).add(restriction);
			return true;
		} else if (criteriaJunction instanceof Junction) {
			((Junction) criteriaJunction).add(restriction);
			return true;
		}
	}
	return false;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:14,代码来源:CategoryCriterion.java

示例10: applyCategoryCriterions

import org.hibernate.criterion.Junction; //导入依赖的package包/类
private static void applyCategoryCriterions(Criteria criteria, Junction junction, CategoryCriterion... categoryCriterions) {
	if (criteria != null && junction != null && categoryCriterions != null) {
		if (categoryCriterions.length > 0) {
			boolean applied = false;
			for (int i = 0; i < categoryCriterions.length; i++) {
				applied |= applyCategoryCriterion(junction, categoryCriterions[i]);
			}
			if (applied) {
				criteria.add(junction);
			}
		}
	}
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:14,代码来源:CategoryCriterion.java

示例11: createCriterion

import org.hibernate.criterion.Junction; //导入依赖的package包/类
private Criterion createCriterion(CriteriaWrapper crit, AndOrPredicate pred,
        String contextAlias) {
    Operator op = pred.getOperator();
    Junction junction = (op == Operator.And) ? Restrictions.conjunction()
            : Restrictions.disjunction();

    for (Predicate subPred : pred.getPredicates()) {
        Criterion cr = toCriterion(crit, subPred, contextAlias);
        junction.add(cr);
    }

    return junction;
}
 
开发者ID:Breeze,项目名称:breeze.server.java,代码行数:14,代码来源:CriteriaBuilder.java

示例12: visitAllComplete

import org.hibernate.criterion.Junction; //导入依赖的package包/类
@Override
public void visitAllComplete(final AllRestriction restriction) {
    final int restrictionSize = restriction.getRestrictions().size();
    final int criterionSize = m_criterions.size();
    if (criterionSize < restrictionSize) {
        throw new IllegalStateException("AllRestriction with " + restrictionSize + " entries encountered, but we only have " + criterionSize + " criterions!");
    }
    final List<Criterion> criterions = m_criterions.subList(criterionSize - restrictionSize, criterionSize);
    final Junction j = org.hibernate.criterion.Restrictions.conjunction();
    for (final Criterion crit : criterions) {
        j.add(crit);
    }
    criterions.clear();
    m_criterions.add(j);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:16,代码来源:HibernateCriteriaConverter.java

示例13: visitAnyComplete

import org.hibernate.criterion.Junction; //导入依赖的package包/类
@Override
public void visitAnyComplete(final AnyRestriction restriction) {
    final int restrictionSize = restriction.getRestrictions().size();
    final int criterionSize = m_criterions.size();
    if (criterionSize < restrictionSize) {
        throw new IllegalStateException("AllRestriction with " + restrictionSize + " entries encountered, but we only have " + criterionSize + " criterions!");
    }
    final List<Criterion> criterions = m_criterions.subList(criterionSize - restrictionSize, criterionSize);
    final Junction j = org.hibernate.criterion.Restrictions.disjunction();
    for (final Criterion crit : criterions) {
        j.add(crit);
    }
    criterions.clear();
    m_criterions.add(j);
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:16,代码来源:HibernateCriteriaConverter.java

示例14: getFunctionJunction

import org.hibernate.criterion.Junction; //导入依赖的package包/类
/**
 * Get the junction used in function queries
 * 
 * @param searchBean
 * @param crit
 * @return
 * @throws Exception
 */
private Junction getFunctionJunction(AdvancedSampleSearchBean searchBean,
		DetachedCriteria crit) throws Exception {
	// if AND and more than one query per type, don't use junction
	if (searchBean.getCompositionLogicalOperator().equals("and")
			&& searchBean.getFuncCount() > 1) {
		return null;
	}
	Disjunction compDisjunction = Restrictions.disjunction();
	Conjunction compConjunction = Restrictions.conjunction();
	for (CompositionQueryBean compQuery : searchBean
			.getCompositionQueries()) {
		// function
		if (compQuery.getCompositionType().equals("function")) {
			Criterion funcCrit = this.getFunctionCriterion(compQuery, "",
					"");
			if (funcCrit != null) {
				compDisjunction.add(funcCrit);
				// only add to conjunction if there is only one query for
				// the type
				if (searchBean.getFuncCount() == 1) {
					compConjunction.add(funcCrit);
				}
			}
		}
	}
	// default to or if only one query
	Junction junction = (searchBean.getCompositionLogicalOperator().equals(
			"or") || searchBean.getCompositionQueries().size() == 1) ? compDisjunction
			: compConjunction;
	return junction;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:40,代码来源:AdvancedSampleServiceHelper.java

示例15: getNanomaterialEntityJunction

import org.hibernate.criterion.Junction; //导入依赖的package包/类
/**
 * Get the junction used in nanomaterial entity queries
 * 
 * @param searchBean
 * @param crit
 * @return
 * @throws Exception
 */
private Junction getNanomaterialEntityJunction(
		AdvancedSampleSearchBean searchBean, DetachedCriteria crit)
		throws Exception {
	// if AND and more than one query per type, don't use junction
	if (searchBean.getCompositionLogicalOperator().equals("and")
			&& searchBean.getNanoEntityCount() > 1) {
		return null;
	}
	Disjunction compDisjunction = Restrictions.disjunction();
	Conjunction compConjunction = Restrictions.conjunction();
	for (CompositionQueryBean compQuery : searchBean
			.getCompositionQueries()) {
		// nanomaterial entity
		if (compQuery.getCompositionType().equals("nanomaterial entity")) {
			Criterion nanoEntityCrit = getNanomaterialEntityCriterion(
					compQuery, "");
			if (nanoEntityCrit != null) {
				compDisjunction.add(nanoEntityCrit);
				// only add to conjunction if there is only one query for
				// the type
				if (searchBean.getNanoEntityCount() == 1) {
					compConjunction.add(nanoEntityCrit);
				}
			}
		}
	}
	// default to or if only one query
	Junction junction = (searchBean.getCompositionLogicalOperator().equals(
			"or") || searchBean.getCompositionQueries().size() == 1) ? compDisjunction
			: compConjunction;
	return junction;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:41,代码来源:AdvancedSampleServiceHelper.java


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