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


Java CQLQuery.getQueryModifier方法代码示例

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


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

示例1: convertToHql

import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入方法依赖的package包/类
/**
 * Converts CQL to parameterized HQL suitable for use with Hibernate
 * v3.2.0ga and the caCORE SDK version 4.0
 *
 * @param query
 *            The query to convert
 * @return A parameterized HQL Query representing the CQL query
 * @throws QueryProcessingException
 */
public ParameterizedHqlQuery convertToHql(CQLQuery query)
		throws QueryProcessingException {
	// create a string builder to build up the HQL
	StringBuilder rawHql = new StringBuilder();

	// create the list in which parameters will be placed
	List<java.lang.Object> parameters = new LinkedList<java.lang.Object>();

	// determine if the target has subclasses
	List<String> subclasses = typesInfoUtil.getSubclasses(query.getTarget()
			.getName());
	boolean hasSubclasses = !(subclasses == null || subclasses.size() == 0);
	LOG.debug(query.getTarget().getName()
			+ (hasSubclasses ? " has " + subclasses.size() + " subclasses"
					: " has no subclasse"));

	// begin processing at the target level
	//
	// processTarget(query.getTarget(), rawHql, parameters, hasSubclasses);
	// modified by Sue Pan to turn off checking of subclasses. There is a
	// reported
	// bug GForge Bug #18649 related to generating the correct HQL for
	// subclasses mapped by table per
	// hierarchy inheritance.
	processTarget(query.getTarget(), rawHql, parameters, false);

	// apply query modifiers
	if (query.getQueryModifier() != null) {
		handleQueryModifier(query.getQueryModifier(), rawHql);
	} else {
		// select only unique objects
		rawHql.insert(0, "Select distinct (" + TARGET_ALIAS + ") ");
	}

	// build the final query object
	ParameterizedHqlQuery hqlQuery = new ParameterizedHqlQuery(rawHql
			.toString(), parameters);
	return hqlQuery;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:49,代码来源:PublicDataCQL2ParameterizedHQL.java

示例2: convertToHql

import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入方法依赖的package包/类
/**
 * Converts CQL to parameterized HQL suitable for use with 
    * Hibernate v3.2.0ga
 * 
 * @param query
 * 		The query to convert
 * @return
 * 		A parameterized HQL Query representing the CQL query
 * @throws QueryTranslationException
 */
public ParameterizedHqlQuery convertToHql(CQLQuery query) throws QueryTranslationException {
    LOG.debug("Converting caGrid Query Language to Hibernate Query Language");
	// create a string builder to build up the HQL
	StringBuilder rawHql = new StringBuilder();
       
       // create the list in which parameters will be placed
       List<java.lang.Object> parameters = new LinkedList<java.lang.Object>();
       
       // determine if the target has subclasses
       boolean hasSubclasses = false;
       try {
           hasSubclasses = typesInformationResolver.classHasSubclasses(query.getTarget().getName());
       } catch (TypesInformationException ex) {
           throw new QueryTranslationException(ex.getMessage(), ex);
       }
       LOG.debug(query.getTarget().getName() 
           + (hasSubclasses ? " has subclasses" : " has no subclasse"));
       
       // begin processing at the target level
	processTarget(query.getTarget(), rawHql, parameters, hasSubclasses);
       
       // apply query modifiers
	if (query.getQueryModifier() != null) {
		handleQueryModifier(query.getQueryModifier(), rawHql);
	} else {
	    // select only unique objects
           rawHql.insert(0, "Select distinct (" + TARGET_ALIAS + ") ");      
       }
       
       // build the final query object
       ParameterizedHqlQuery hqlQuery = new ParameterizedHqlQuery(rawHql.toString(), parameters);
	return hqlQuery;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:44,代码来源:CQL2ParameterizedHQL.java

示例3: validateCqlStructure

import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入方法依赖的package包/类
public void validateCqlStructure(CQLQuery query) throws MalformedQueryException {
	if (query.getQueryModifier() != null) {
		validateQueryMods(query.getQueryModifier());
	}
	if (query.getTarget() == null) {
		throw new MalformedStructureException("Query target cannot be null");
	}
	validateObjectStructure(query.getTarget());
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:10,代码来源:ObjectWalkingCQLValidator.java

示例4: convertToHql

import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入方法依赖的package包/类
/**
 * Converts CQL to parameterized HQL suitable for use with 
    * Hibernate v3.2.0ga and the caCORE SDK version 4.0
 * 
 * @param query
 * 		The query to convert
 * @return
 * 		A parameterized HQL Query representing the CQL query
 * @throws QueryProcessingException
 */
public ParameterizedHqlQuery convertToHql(CQLQuery query) throws QueryProcessingException {
	// create a string builder to build up the HQL
	StringBuilder rawHql = new StringBuilder();
       
       // create the list in which parameters will be placed
       List<java.lang.Object> parameters = new LinkedList<java.lang.Object>();
       
       // determine if the target has subclasses
       List<String> subclasses = typesInfoUtil.getSubclasses(query.getTarget().getName());
       boolean hasSubclasses = !(subclasses == null || subclasses.size() == 0);
       LOG.debug(query.getTarget().getName() 
           + (hasSubclasses ? " has " + subclasses.size() + " subclasses" : " has no subclasse"));
       
       // begin processing at the target level
	processTarget(query.getTarget(), rawHql, parameters, hasSubclasses);
       
       // apply query modifiers
	if (query.getQueryModifier() != null) {
		handleQueryModifier(query.getQueryModifier(), rawHql);
	} else {
	    // select only unique objects
           rawHql.insert(0, "Select distinct (" + TARGET_ALIAS + ") ");      
       }
       
       // build the final query object
       ParameterizedHqlQuery hqlQuery = new ParameterizedHqlQuery(rawHql.toString(), parameters);
	return hqlQuery;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:39,代码来源:CQL2ParameterizedHQL.java

示例5: query

import gov.nih.nci.cagrid.cqlquery.CQLQuery; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public List<?> query(final CQLQuery cqlQuery) {
    try {
        String s = CQL2HQL.translate(cqlQuery, false, true);
        if (cqlQuery.getQueryModifier() == null) {
            // ensure results are distinct
            s = "select distinct " + CQL2HQL.TARGET_ALIAS + " " + s;
        }
        Query hqlquery = getCurrentSession().createQuery(s);
        return hqlquery.list();            
    } catch (QueryProcessingException e) {
        LOG.error("Unable to parse CQL query", e);
        throw new DAOException("Unable to parse CQL query", e);
    }
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:18,代码来源:SearchDaoImpl.java


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