Fields Summary |
---|
protected Expression | attributeExpressionExpression (partial) describing the attribute wanted |
protected String | nameName given for item, can be used to retieve value from result. Useful if same field retrieved multipe times |
protected DatabaseMapping | mappingMapping which relates field to attribute, used to convert value and determine reference descriptor |
protected ClassDescriptor | descriptorDesriptor for object result that is not based on an expression |
protected Class | resultTypeResult type for this report item. |
protected JoinedAttributeManager | joinManagerStores the Join information for this item |
protected int | resultIndexStores the row index for this item, given multiple results and joins |
Methods Summary |
---|
public oracle.toplink.essentials.expressions.Expression | getAttributeExpression()
return attributeExpression;
|
public oracle.toplink.essentials.descriptors.ClassDescriptor | getDescriptor()
return this.descriptor;
|
public oracle.toplink.essentials.internal.queryframework.JoinedAttributeManager | getJoinedAttributeManager()INTERNAL:
Set the list of expressions that represent elements that are joined because of their
mapping for this query.
return this.joinManager;
|
public oracle.toplink.essentials.mappings.DatabaseMapping | getMapping()
return mapping;
|
public java.lang.String | getName()
return name;
|
public int | getResultIndex()
return resultIndex;
|
public java.lang.Class | getResultType()
return resultType;
|
public void | initialize(oracle.toplink.essentials.queryframework.ReportQuery query)INTERNAL:
Looks up mapping for attribute during preExecute of ReportQuery
if (getMapping() == null) {
DatabaseMapping mapping = query.getLeafMappingFor(getAttributeExpression(), query.getDescriptor());
if (mapping == null){
if (getAttributeExpression() != null){
if (getAttributeExpression().isExpressionBuilder()) {
Class resultClass = ((ExpressionBuilder)getAttributeExpression()).getQueryClass();
if (resultClass == null){
resultClass = query.getReferenceClass();
}
setDescriptor(query.getSession().getDescriptor(resultClass));
if (getDescriptor().hasInheritance()){
((ExpressionBuilder)getAttributeExpression()).setShouldUseOuterJoinForMultitableInheritance(true);
}
}
}
}else{
//Bug4942640 Widen the check to support collection mapping too
if (mapping.isForeignReferenceMapping()){
setDescriptor(mapping.getReferenceDescriptor());
if (getDescriptor().hasInheritance()){
((QueryKeyExpression)getAttributeExpression()).setShouldUseOuterJoinForMultitableInheritance(true);
}
} else if (mapping.isAbstractDirectMapping()){
setMapping((DatabaseMapping)mapping);
} else {
throw QueryException.invalidExpressionForQueryItem(getAttributeExpression(), query);
}
}
this.joinManager.setDescriptor(this.descriptor);
this.joinManager.setBaseQuery(query);
if (getAttributeExpression() != null){
if (getAttributeExpression().getBuilder().wasQueryClassSetInternally()){
//rebuild if class was not set by user this ensures the query has the same base
this.attributeExpression = getAttributeExpression().rebuildOn(query.getExpressionBuilder());
}
this.joinManager.setBaseExpressionBuilder(this.attributeExpression.getBuilder());
}else{
this.joinManager.setBaseExpressionBuilder(query.getExpressionBuilder());
}
this.joinManager.prepareJoinExpressions(query.getSession());
}
|
public boolean | isContructorItem()
return false;
|
public boolean | isPlaceHolder()
return getAttributeExpression() == null;
|
public void | setDescriptor(oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
this.descriptor = descriptor;
|
public void | setMapping(oracle.toplink.essentials.mappings.DatabaseMapping mapping)
this.mapping = mapping;
|
public void | setResultIndex(int resultIndex)
this.resultIndex = resultIndex;
this.joinManager.setParentResultIndex(resultIndex);
|
public void | setResultType(java.lang.Class resultType)
this.resultType = resultType;
// Set it on the attribute expression as well if it is a function.
if (getAttributeExpression()!=null && getAttributeExpression().isFunctionExpression()) {
((FunctionExpression) getAttributeExpression()).setResultType(resultType);
}
|
public java.lang.String | toString()
return "ReportQueryItem(" + getName() + " -> " + getAttributeExpression() + ")";
|