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