本文整理了Java中org.eclipse.persistence.internal.expressions.QueryKeyExpression.getBaseExpression
方法的一些代码示例,展示了QueryKeyExpression.getBaseExpression
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryKeyExpression.getBaseExpression
方法的具体详情如下:
包路径:org.eclipse.persistence.internal.expressions.QueryKeyExpression
类名称:QueryKeyExpression
方法名:getBaseExpression
暂无
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Return the descriptor which contains this query key.
*/
public ClassDescriptor getContainingDescriptor() {
return ((DataExpression)getBaseExpression()).getDescriptor();
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* Iterate through a list of expressions searching for the given attribute name.
* Return true if it is found, false otherwise.
*/
protected boolean isAttributeNameInJoinedExpressionList(String attributeName, List joinedExpressionList) {
for (Iterator joinEnum = joinedExpressionList.iterator(); joinEnum.hasNext();) {
QueryKeyExpression expression = (QueryKeyExpression)joinEnum.next();
while (!expression.getBaseExpression().isExpressionBuilder()) {
expression = (QueryKeyExpression)expression.getBaseExpression();
}
if (expression.getName().equals(attributeName)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* Iterate through a list of expressions searching for the given attribute name.
* Return true if it is found, false otherwise.
*/
protected boolean isAttributeNameInJoinedExpressionList(String attributeName, List joinedExpressionList) {
for (Iterator joinEnum = joinedExpressionList.iterator(); joinEnum.hasNext();) {
QueryKeyExpression expression = (QueryKeyExpression)joinEnum.next();
while (!expression.getBaseExpression().isExpressionBuilder()) {
expression = (QueryKeyExpression)expression.getBaseExpression();
}
if (expression.getName().equals(attributeName)) {
return true;
}
}
return false;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* Iterate through a list of expressions searching for the given attribute name.
* Return true if it is found, false otherwise.
*/
protected boolean isAttributeNameInJoinedExpressionList(String attributeName, List joinedExpressionList) {
for (Iterator joinEnum = joinedExpressionList.iterator(); joinEnum.hasNext();) {
QueryKeyExpression expression = (QueryKeyExpression)joinEnum.next();
while (!expression.getBaseExpression().isExpressionBuilder()) {
expression = (QueryKeyExpression)expression.getBaseExpression();
}
if (expression.getName().equals(attributeName)) {
return true;
}
}
return false;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
* Order by foreign key fields if a foreign key mapping (avoids joins).
*/
@Override
public List<Expression> getOrderByNormalizedExpressions(Expression base) {
if (this.foreignKeyFields.size() > 0) {
List<Expression> orderBys = new ArrayList(this.foreignKeyFields.size());
for (DatabaseField field : this.foreignKeyFields) {
orderBys.add(((QueryKeyExpression)base).getBaseExpression().getField(field));
}
return orderBys;
}
return super.getOrderByNormalizedExpressions(base);
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* Order by foreign key fields if a foreign key mapping (avoids joins).
*/
@Override
public List<Expression> getOrderByNormalizedExpressions(Expression base) {
if (this.foreignKeyFields.size() > 0) {
List<Expression> orderBys = new ArrayList(this.foreignKeyFields.size());
for (DatabaseField field : this.foreignKeyFields) {
orderBys.add(((QueryKeyExpression)base).getBaseExpression().getField(field));
}
return orderBys;
}
return super.getOrderByNormalizedExpressions(base);
}
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* Return if partial attribute.
*/
public boolean isPartialAttribute(String attributeName) {
if (this.partialAttributeExpressions == null) {
return false;
}
List<Expression> partialAttributeExpressions = getPartialAttributeExpressions();
int size = partialAttributeExpressions.size();
for (int index = 0; index < size; index++) {
QueryKeyExpression expression = (QueryKeyExpression)partialAttributeExpressions.get(index);
while (!expression.getBaseExpression().isExpressionBuilder()) {
expression = (QueryKeyExpression)expression.getBaseExpression();
}
if (expression.getName().equals(attributeName)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Returns the join criteria stored in the mapping selection query. This criteria
* is used to read reference objects across the tables from the database.
*/
public Expression getJoinCriteria(QueryKeyExpression exp) {
Expression selectionCriteria = getSelectionCriteria();
return exp.getBaseExpression().twist(selectionCriteria, exp);
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Return if partial attribute.
*/
public boolean isPartialAttribute(String attributeName) {
if (!hasPartialAttributeExpressions()) {
return false;
}
List<Expression> partialAttributeExpressions = getPartialAttributeExpressions();
int size = partialAttributeExpressions.size();
for (int index = 0; index < size; index++) {
QueryKeyExpression expression = (QueryKeyExpression)partialAttributeExpressions.get(index);
while (!expression.getBaseExpression().isExpressionBuilder()) {
expression = (QueryKeyExpression)expression.getBaseExpression();
}
if (expression.getName().equals(attributeName)) {
return true;
}
}
return false;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
* If there is root expression in the list then indicates whether it shouldUseOuterJoin,
* otherwise return false.
*/
protected boolean hasRootExpressionThatShouldUseOuterJoin(List expressions) {
for (Iterator expressionsEnum = expressions.iterator();
expressionsEnum.hasNext();) {
Expression next = (Expression)expressionsEnum.next();
// The expressionBuilder can be one of the locked expressions in
// the ForUpdateOfClause.
if (!next.isQueryKeyExpression()) {
continue;
}
QueryKeyExpression expression = (QueryKeyExpression)next;
if (expression.getBaseExpression().isExpressionBuilder() && expression.getName().equals(getAttributeName())) {
return expression.shouldUseOuterJoin();
}
}
return false;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* If there is root expression in the list then indicates whether it shouldUseOuterJoin,
* otherwise return false.
*/
protected boolean hasRootExpressionThatShouldUseOuterJoin(List expressions) {
for (Iterator expressionsEnum = expressions.iterator();
expressionsEnum.hasNext();) {
Expression next = (Expression)expressionsEnum.next();
// The expressionBuilder can be one of the locked expressions in
// the ForUpdateOfClause.
if (!next.isQueryKeyExpression()) {
continue;
}
QueryKeyExpression expression = (QueryKeyExpression)next;
if (expression.getBaseExpression().isExpressionBuilder() && expression.getName().equals(getAttributeName())) {
return expression.shouldUseOuterJoin();
}
}
return false;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Returns the join criteria stored in the mapping selection query. This criteria
* is used to read reference objects across the tables from the database.
*/
public Expression getJoinCriteria(QueryKeyExpression exp) {
Expression selectionCriteria = getSelectionCriteria();
Expression keySelectionCriteria = containerPolicy.getKeySelectionCriteria();
if (keySelectionCriteria != null){
selectionCriteria = selectionCriteria.and(keySelectionCriteria);
}
return exp.getBaseExpression().twist(selectionCriteria, exp);
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* Return the alias for our table
*/
protected DatabaseTable getAliasedTable() {
DataExpression base = (DataExpression)getBaseExpression();
DatabaseTable alias = base.aliasForTable(getField().getTable());
if (alias == null) {
return getField().getTable();
} else {
return alias;
}
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Join criteria is created to read target records (nested table) from the table.
*/
public Expression getJoinCriteria(QueryKeyExpression exp) {
ExpressionBuilder builder = new ExpressionBuilder();
Expression selectionCriteria = builder.ref().equal(builder.value());
return exp.getBaseExpression().twist(selectionCriteria, exp);
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
* Lookup the query key for this item.
* If an aggregate of foreign mapping is found it is traversed.
*/
protected QueryKey getLeafQueryKeyFor(DatabaseQuery query, Expression expression, ClassDescriptor rootDescriptor, AbstractSession session) throws QueryException {
// Check for database field expressions or place holder
if ((expression == null) || (expression.isFieldExpression())) {
return null;
}
if (!(expression.isQueryKeyExpression())) {
return null;
}
QueryKeyExpression qkExpression = (QueryKeyExpression)expression;
Expression baseExpression = qkExpression.getBaseExpression();
ClassDescriptor descriptor = baseExpression.getLeafDescriptor(query, rootDescriptor, session);
return descriptor.getQueryKeyNamed(qkExpression.getName());
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Rebuild myself against the base, with the values of parameters supplied by the context
* expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping)
* into part of some larger expression. You normally would not call this directly, instead calling twist
* See the comment there for more details"
*/
public Expression twistedForBaseAndContext(Expression newBase, Expression context) {
Expression twistedBase = getBaseExpression().twistedForBaseAndContext(newBase, context);
QueryKeyExpression result = (QueryKeyExpression)twistedBase.get(getName());
if (shouldUseOuterJoin) {
result.doUseOuterJoin();
}
if (shouldQueryToManyRelationship) {
result.doQueryToManyRelationship();
}
return result;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* Lookup the query key for this item.
* If an aggregate of foreign mapping is found it is traversed.
*/
protected QueryKey getLeafQueryKeyFor(DatabaseQuery query, Expression expression, ClassDescriptor rootDescriptor, AbstractSession session) throws QueryException {
// Check for database field expressions or place holder
if ((expression == null) || (expression.isFieldExpression())) {
return null;
}
if (!(expression.isQueryKeyExpression())) {
return null;
}
QueryKeyExpression qkExpression = (QueryKeyExpression)expression;
Expression baseExpression = qkExpression.getBaseExpression();
ClassDescriptor descriptor = baseExpression.getLeafDescriptor(query, rootDescriptor, session);
return descriptor.getQueryKeyNamed(qkExpression.getName());
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* Calculate the source table for based on the various QueryKeyExpression
* usages (join query keys, custom defined query keys, or query keys for
* mappings).
*
* Called from {@link SQLSelectStatement#appendFromClauseForOuterJoin}.
*
* @return DatabaseTable
*/
public DatabaseTable getSourceTable() {
if(getMapping() != null) {
// Grab the source table from the mapping not just the first table
// from the descriptor. In an joined inheritance hierarchy, the
// fk used in the outer join may be from a subclasses's table.
if (getMapping().isObjectReferenceMapping() && ((ObjectReferenceMapping) getMapping()).isForeignKeyRelationship()) {
return getMapping().getFields().firstElement().getTable();
} else {
return ((ObjectExpression)getBaseExpression()).getDescriptor().getTables().firstElement();
}
} else {
return ((ForeignReferenceQueryKey)getQueryKeyOrNull()).getSourceTable();
}
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* This expression is built on a different base than the one we want. Rebuild it and
* return the root of the new tree
*/
public Expression rebuildOn(Expression newBase) {
Expression newLocalBase = getBaseExpression().rebuildOn(newBase);
QueryKeyExpression result = null;
// For bug 3096634 rebuild outer joins correctly from the start.
if (shouldUseOuterJoin) {
result = (QueryKeyExpression)newLocalBase.getAllowingNull(getName());
} else {
result = (QueryKeyExpression)newLocalBase.get(getName());
}
if (shouldQueryToManyRelationship) {
result.doQueryToManyRelationship();
}
result.setSelectIfOrderedBy(selectIfOrderedBy());
return result;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Print java for project class generation
*/
public void printJava(ExpressionJavaPrinter printer) {
getBaseExpression().printJava(printer);
if (!shouldUseOuterJoin()) {
if (!shouldQueryToManyRelationship()) {
printer.printString(".get(");
} else {
printer.printString(".anyOf(");
}
} else {
if (!shouldQueryToManyRelationship()) {
printer.printString(".getAllowingNull(");
} else {
printer.printString(".anyOfAllowingNone(");
}
}
printer.printString("\"" + getName() + "\")");
}
内容来源于网络,如有侵权,请联系作者删除!