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


Java Junction.add方法代码示例

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


在下文中一共展示了Junction.add方法的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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: addAnnotationCriterionValues

import org.hibernate.criterion.Junction; //导入方法依赖的package包/类
private void addAnnotationCriterionValues(Criteria c, Junction junction, Set<String> values,
        String assocPath, String alias) {
    if (!values.isEmpty()) {
        c.createAlias(assocPath, alias);
        junction.add(Restrictions.in(alias + ".value", values));
    }
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:8,代码来源:SampleDaoImpl.java

示例11: 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:vishwaabhinav,项目名称:OpenNMS,代码行数:16,代码来源:HibernateCriteriaConverter.java

示例12: 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:vishwaabhinav,项目名称:OpenNMS,代码行数:16,代码来源:HibernateCriteriaConverter.java

示例13: findGenesByLocation

import org.hibernate.criterion.Junction; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
@SuppressWarnings(UNCHECKED) // Hibernate operations are untyped
public List<Gene> findGenesByLocation(String chromosome, Integer startPosition, Integer endPosition,
        GenomeBuildVersionEnum genomeBuildVersion) {
    String locStartPosition = "location.startPosition";
    String locEndPosition = "location.endPosition";
    Criteria geneLocationCriteria = getCurrentSession().createCriteria(GeneChromosomalLocation.class);
    // (gene.startPos <= startPosition && gene.endPos >= startPosition)
    //  || (gene.startPos >= lowerInput  && gene.startPos <= higherInput)
    Junction overallOrStatement = Restrictions.disjunction();
    overallOrStatement.add(Restrictions.conjunction().add(Restrictions.le(locStartPosition, startPosition))
            .add(Restrictions.ge(locEndPosition, startPosition)));
    overallOrStatement.add(Restrictions.conjunction().add(Restrictions.ge(locStartPosition, startPosition)).add(
            Restrictions.le(locStartPosition, endPosition)));
    geneLocationCriteria.add(overallOrStatement);
    geneLocationCriteria.add(getChromosomeRestriction(chromosome));
    geneLocationCriteria.createCriteria("geneLocationConfiguration").
        add(Restrictions.eq("genomeBuildVersion", genomeBuildVersion));
    geneLocationCriteria.setProjection(Projections.property("geneSymbol"));
    List<String> geneSymbols = geneLocationCriteria.list();
    return geneSymbols.isEmpty() ? new ArrayList<Gene>()
            : getCurrentSession().createCriteria(Gene.class).setProjection(
                    Projections.distinct(Projections.property(SYMBOL_ATTRIBUTE))).
                    add(Restrictions.in(SYMBOL_ATTRIBUTE, geneSymbols)).
                    addOrder(Order.asc(SYMBOL_ATTRIBUTE)).list();
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:30,代码来源:CaIntegrator2DaoImpl.java

示例14: completeCriteriaWithTranslations

import org.hibernate.criterion.Junction; //导入方法依赖的package包/类
/**
 * Complete criteria with translations.
 *
 * @param currentCriteria
 *     the current criteria
 * @param translationsPath
 *     the translations path
 * @param translationsAlias
 *     the translations alias
 * @param property
 *     the property
 * @param propertyDescriptor
 *     the property descriptor
 * @param prefixedProperty
 *     the prefixed property
 * @param locale
 *     the locale
 * @param componentDescriptor
 *     the component descriptor
 * @param queryComponent
 *     the query component
 * @param context
 *     the context
 */
@SuppressWarnings("unchecked")
protected void completeCriteriaWithTranslations(DetachedCriteria currentCriteria, String translationsPath,
                                                String translationsAlias, Map.Entry<String, Object> property,
                                                IPropertyDescriptor propertyDescriptor, String prefixedProperty,
                                                Locale locale, IComponentDescriptor<?> componentDescriptor,
                                                IQueryComponent queryComponent, Map<String, Object> context) {
  if (propertyDescriptor instanceof IStringPropertyDescriptor && ((IStringPropertyDescriptor) propertyDescriptor)
      .isTranslatable()) {
    String nlsOrRawValue = null;
    String nlsValue = (String) property.getValue();
    String barePropertyName = property.getKey();
    if (property.getKey().endsWith(IComponentDescriptor.NLS_SUFFIX)) {
      barePropertyName = barePropertyName.substring(0,
          barePropertyName.length() - IComponentDescriptor.NLS_SUFFIX.length());
    } else {
      nlsOrRawValue = nlsValue;
    }
    if (nlsValue != null) {
      Junction translationRestriction = Restrictions.conjunction();
      translationRestriction.add(createStringRestriction(
          ((ICollectionPropertyDescriptor<IPropertyTranslation>) componentDescriptor.getPropertyDescriptor(
              translationsPath)).getCollectionDescriptor().getElementDescriptor().getPropertyDescriptor(
              IPropertyTranslation.TRANSLATED_VALUE), translationsAlias + "." + IPropertyTranslation.TRANSLATED_VALUE,
          nlsValue, componentDescriptor, queryComponent, context));
      String languagePath = translationsAlias + "." + IPropertyTranslation.LANGUAGE;
      translationRestriction.add(Restrictions.eq(languagePath, locale.getLanguage()));
      translationRestriction.add(Restrictions.eq(translationsAlias + "." + IPropertyTranslation.PROPERTY_NAME,
          barePropertyName));

      Junction disjunction = Restrictions.disjunction();
      disjunction.add(translationRestriction);
      if (nlsOrRawValue != null) {
        Junction rawValueRestriction = Restrictions.conjunction();
        rawValueRestriction.add(Restrictions.disjunction().add(Restrictions.isNull(languagePath)).add(Restrictions.ne(
            languagePath, locale.getLanguage())));
        String rawPropertyName = barePropertyName + IComponentDescriptor.RAW_SUFFIX;
        rawValueRestriction.add(createStringRestriction(componentDescriptor.getPropertyDescriptor(rawPropertyName),
            rawPropertyName, nlsOrRawValue, componentDescriptor, queryComponent, context));
        disjunction.add(rawValueRestriction);
      }
      currentCriteria.add(disjunction);
    }
  } else {
    completeCriteria(currentCriteria, createStringRestriction(propertyDescriptor, prefixedProperty,
        (String) property.getValue(), componentDescriptor, queryComponent, context));
  }
}
 
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:72,代码来源:DefaultCriteriaFactory.java

示例15: createStringRestriction

import org.hibernate.criterion.Junction; //导入方法依赖的package包/类
/**
 * Creates a string based restriction.
 *
 * @param propertyDescriptor
 *     the property descriptor.
 * @param prefixedProperty
 *     the full path of the property.
 * @param propertyValue
 *     the string property value.
 * @param componentDescriptor
 *     the component descriptor
 * @param queryComponent
 *     the query component
 * @param context
 *     the context
 * @return the created criterion or null if no criterion necessary.
 */
protected Criterion createStringRestriction(IPropertyDescriptor propertyDescriptor, String prefixedProperty,
                                            String propertyValue, IComponentDescriptor<?> componentDescriptor,
                                            IQueryComponent queryComponent, Map<String, Object> context) {
  Junction disjunction = null;
  if (propertyValue.length() > 0) {
    String[] stringDisjunctions = propertyValue.split(IQueryComponent.DISJUNCT);
    disjunction = Restrictions.disjunction();
    for (String stringDisjunction : stringDisjunctions) {
      Junction conjunction = Restrictions.conjunction();
      String[] stringConjunctions = stringDisjunction.split(IQueryComponent.CONJUNCT);
      for (String stringConjunction : stringConjunctions) {
        String val = stringConjunction;
        if (val.length() > 0) {
          Criterion crit;
          boolean negate = false;
          if (val.startsWith(IQueryComponent.NOT_VAL)) {
            val = val.substring(1);
            negate = true;
          }
          if (IQueryComponent.NULL_VAL.equals(val)) {
            crit = Restrictions.isNull(prefixedProperty);
          } else {
            if (IEntity.ID.equals(propertyDescriptor.getName())
                || propertyDescriptor instanceof IEnumerationPropertyDescriptor) {
              crit = Restrictions.eq(prefixedProperty, val);
            } else {
              crit = createLikeRestriction(propertyDescriptor, prefixedProperty, val, componentDescriptor,
                  queryComponent, context);
            }
          }
          if (negate) {
            crit = Restrictions.not(crit);
          }
          conjunction.add(crit);
        }
      }
      disjunction.add(conjunction);
    }
  }
  return disjunction;
}
 
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:59,代码来源:DefaultCriteriaFactory.java


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