org.makumba.list.engine.valuecomputer
Class ValueComputer

java.lang.Object
  extended by org.makumba.list.engine.valuecomputer.ValueComputer
Direct Known Subclasses:
QueryValueComputer

public class ValueComputer
extends Object

Every ValueTag will build a ValueComputer at page analysis, which it then retrieves and uses at page running

Version:
$Id
Author:
Cristian Bogdan

Field Summary
(package private)  String expr
          The queryProjection expression
(package private)  MultipleKey parentKey
          The key of the parentList
(package private)  int projectionIndex
          The queryProjection index in the currentListData
protected  FieldDefinition type
          The queryProjection type
 
Constructor Summary
ValueComputer()
           
ValueComputer(MultipleKey listKey, String expr, PageCache pageCache)
          A special ValueComputer made by mak:lists who want to select extra expressions
 
Method Summary
 void doEndAnalyze(PageCache pageCache)
          Computes the queryProjection index in the currentListData, and the queryProjection type.
 String getFormattedValue(ValueTag running, PageCache pageCache)
           
 int getProjectionIndex()
           
(package private)  MultipleKey getQueryKey()
          The key of the query in which this value is a projection.
 FieldDefinition getType()
           
 Object getValue(PageContext pc)
          Gets the value of from the QueryExecution based on the projectionIndex
static ValueComputer getValueComputerAtAnalysis(boolean isValue, MultipleKey parentListKey, String expr, PageCache pageCache)
          Determines if 'analyzed' is a queryMak:value or a nonQueryMak:value
static boolean isPointer(PageCache pageCache, MultipleKey parentListKey, String expr)
           
 void print(ValueTag running, PageCache pageCache)
          Formats the value of the queryProjection from the currentListData of the enclosing query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentKey

MultipleKey parentKey
The key of the parentList


projectionIndex

int projectionIndex
The queryProjection index in the currentListData


expr

String expr
The queryProjection expression


type

protected FieldDefinition type
The queryProjection type

Constructor Detail

ValueComputer

ValueComputer()

ValueComputer

ValueComputer(MultipleKey listKey,
              String expr,
              PageCache pageCache)
A special ValueComputer made by mak:lists who want to select extra expressions

Parameters:
listKey - the key of the list
parentListKey - the key of the parent list
expr - the extra expression
pageCache - the page cache
Method Detail

getValueComputerAtAnalysis

public static ValueComputer getValueComputerAtAnalysis(boolean isValue,
                                                       MultipleKey parentListKey,
                                                       String expr,
                                                       PageCache pageCache)
Determines if 'analyzed' is a queryMak:value or a nonQueryMak:value

Parameters:
isValue - whether this value computer is called from a value evaluator (mak:value expr, EL Value)
parentListKey - the key of the parent list
expr - the expression passed in the tag
pageCache - the page cache of the page

getQueryKey

MultipleKey getQueryKey()
The key of the query in which this value is a projection.

Returns:
The key of the parent of the value

doEndAnalyze

public void doEndAnalyze(PageCache pageCache)
Computes the queryProjection index in the currentListData, and the queryProjection type.

Parameters:
pageCache - the page cache

getValue

public Object getValue(PageContext pc)
                throws LogicException
Gets the value of from the QueryExecution based on the projectionIndex

Parameters:
pc - the page context
Returns:
the computed value
Throws:
LogicException

print

public void print(ValueTag running,
                  PageCache pageCache)
           throws JspException,
                  LogicException
Formats the value of the queryProjection from the currentListData of the enclosing query. Sets the var and the printVar values.

Parameters:
running - the tag that is currently running
pageCache - the page cache of the current page
Throws:
JspException
LogicException

getFormattedValue

public String getFormattedValue(ValueTag running,
                                PageCache pageCache)
                         throws JspException,
                                LogicException
Throws:
JspException
LogicException

getType

public FieldDefinition getType()

getProjectionIndex

public int getProjectionIndex()

isPointer

public static boolean isPointer(PageCache pageCache,
                                MultipleKey parentListKey,
                                String expr)