FileDocCategorySizeDatePackage
ConstructorReportItem.javaAPI DocGlassfish v2 API5912Tue May 22 16:54:50 BST 2007oracle.toplink.essentials.queryframework

ConstructorReportItem

public class ConstructorReportItem extends ReportItem
Purpose: An item specifying a class constructor method to be used in a ReportQuery's returned results. Example: ConstructorReportItem citem = new ConstructorReportItem("Employee"); citem.setResultType(Employee.class); citem.addAttribute("firstName", employees.get("firstName")); query.addConstructorReportItem(citem); when executed will return a collection of ReportQueryResults that contain Employee objects created using the new Employee(firstname) method.
author
Chris Delahunt
since
TopLink Essentials

Fields Summary
protected Class[]
constructorArgTypes
protected List
constructorMappings
public List
reportItems
Constructors Summary
public ConstructorReportItem()

    
public ConstructorReportItem(String name)
Method to add an expression to be used to return the parameter that is then passed into the constructor method. Similar to ReportQuery's addAttribute method, but a name is not needed

param
name - string used to look up this result in the ReportQueryResult

        super(name,null);
    
Methods Summary
public voidaddAttribute(oracle.toplink.essentials.expressions.Expression attributeExpression)
Method to add an expression to be used to return the parameter that is then passed into the constructor method. Similar to ReportQuery's addAttribute method, but a name is not needed

param
attributeExpression

        ReportItem item = new ReportItem(getName()+getReportItems().size(), attributeExpression);
        getReportItems().add(item);
    
public voidaddAttribute(java.lang.String attributeName, oracle.toplink.essentials.expressions.Expression attributeExpression, java.util.List joinedExpressions)

        ReportItem item = new ReportItem(attributeName, attributeExpression);
        item.getJoinedAttributeManager().setJoinedAttributeExpressions_(joinedExpressions);
        getReportItems().add(item);
    
public voidaddItem(oracle.toplink.essentials.internal.queryframework.ReportItem item)

        getReportItems().add(item);
    
public java.lang.Class[]getConstructorArgTypes()

        return constructorArgTypes;
    
public java.util.ListgetConstructorMappings()

        return constructorMappings;
    
public java.util.ListgetReportItems()

        if (reportItems==null){
            reportItems=new Vector();
        }
        return reportItems;
    
public voidinitialize(oracle.toplink.essentials.queryframework.ReportQuery query)
INTERNAL: Looks up mapping for attribute during preExecute of ReportQuery

        int size= getReportItems().size();
        List mappings = new Vector();
        for (int i=0;i<size;i++){
            ReportItem item = (ReportItem)reportItems.get(i);
            item.initialize(query);
            mappings.add(item.getMapping());
        }
        setConstructorMappings(mappings);
    
public booleanisContructorItem()

        return true;
    
public voidsetConstructorArgTypes(java.lang.Class[] constructorArgTypes)

        this.constructorArgTypes = constructorArgTypes;
    
public voidsetConstructorMappings(java.util.List constructorMappings)

        this.constructorMappings = constructorMappings;
    
public voidsetReportItems(java.util.List reportItems)

        this.reportItems = reportItems;
    
public java.lang.StringtoString()

        String string = "ConstructorReportItem(" + getName() + " -> [";
        //don't use getReportItems to avoid creating collection.  
        if (reportItems!=null){
            int size=reportItems.size();
            for(int i=0;i<size;i++){
                string =string + reportItems.get(i).toString();
            }
        }
        return string +"])";