Style Intelligence v12.0

inetsoft.uql.erm
Class ExpressionRef

java.lang.Object
  extended by inetsoft.uql.erm.AbstractDataRef
      extended by inetsoft.uql.erm.ExpressionRef
All Implemented Interfaces:
DataRef, inetsoft.util.DataSerializable, inetsoft.util.XMLSerializable, Serializable, Cloneable, Comparable
Direct Known Subclasses:
AliasDataRef, DateRangeRef, ExprAttributeRef, ExpressionRef2, NamedRangeRef, NumericRangeRef

public class ExpressionRef
extends AbstractDataRef

Class holding a reference to a formula expression that can be incorporated in a JDBC SQL query.

Since:
5.1
See Also:
Serialized Form

Nested Class Summary
 class ExpressionRef.AttributeEnumeration
          Enumeration of AttributeRef objects built from the field names in the expression string.
 
Field Summary
 
Fields inherited from class inetsoft.uql.erm.AbstractDataRef
chash, cname
 
Fields inherited from interface inetsoft.uql.erm.DataRef
AGG_CALC, CUBE, CUBE_DIMENSION, CUBE_MEASURE, CUBE_MODEL_DIMENSION, CUBE_MODEL_TIME_DIMENSION, CUBE_TIME_DIMENSION, DIMENSION, MEASURE, MODEL, NONE, TIME
 
Constructor Summary
ExpressionRef()
          Create a new instance of ExpressionRef.
ExpressionRef(String datasource, String name)
          Create a new instance of ExpressionRef.
ExpressionRef(String datasource, String entity, String name)
          Create a new instance of ExpressionRef.
 
Method Summary
 boolean equalsContent(Object obj)
          Check if equals another object content.
 String getAttribute()
          Get the referenced attribute.
 Enumeration getAttributes()
          Get a list of all attributes that are referenced by this object.
 Enumeration getCalcAttributes()
          Get a list of all attributes that are referenced by this object.
 String getDataSource()
          Get the name of the JDBC data source to which this reference refers.
 String getDBType()
          Get the database type.
 Enumeration getEntities()
          Get a list of all the entities referenced by this object.
 String getEntity()
          Get the attribute's parent entity.
 String getExpression()
          Get the SQL expression of this reference.
 String getName()
          Get the name of the field.
 int getRefType()
          Getter of ref type.
 String getScriptExpression()
          Get the script expression of this reference.
static String getScriptExpression(boolean sql, String exp)
          Get the script expression.
static String getSQLExpression(boolean sql, String exp)
          Get the sql expression.
 boolean isExpression()
          Check if the attribute is an expression.
 boolean isExpressionEditable()
          Check if expression is editable.
 boolean isOnAggregate()
          Check if the expression is calculate on aggregate value.
 boolean isSQL()
          Check if this expression is sql expression.
 boolean isVirtual()
          Check if the expression is a virtual expression.
protected  void parseAttributes(Element tag)
          Read in the definition of this object from an XML tag.
protected  void parseCDATA(Element tag)
          Read in the attribute of this object from an XML tag.
 void setDataSource(String datasource)
          Set the name of the JDBC data source to which this reference refers.
 void setDBType(String dbtype)
          Set the database type.
 void setEntity(String entity)
          Set the attribute's parent entity.
 void setExpression(String expression)
          Set the SQL expression of this reference.
 void setName(String name)
          Set the name of the field.
 void setOnAggregate(boolean onAggregate)
          Set if the expression is calculate on aggregate value.
 void setRefType(int rtype)
          Setter of ref type.
 void setVirtual(boolean virtual)
          Set whether the expression is a vritual expression.
 String toString()
          Get a String representation of this object.
 String toView()
          Get the view representation of this field.
protected  void writeAttributes(PrintWriter writer)
          Write an XML element representation of this object.
protected  void writeAttributes2(DataOutputStream dos)
          Write the attributes of this object.
protected  void writeCDATA(PrintWriter writer)
          Write the CDATA of this object.
protected  void writeCDATA2(DataOutputStream dos)
          Write the CDATA of this object.
 
Methods inherited from class inetsoft.uql.erm.AbstractDataRef
addr, clone, compareTo, createDataRef, equals, equals, getClass, getDataType, getDefaultFormula, getTypeNode, hashCode, isEmpty, isEntityBlank, parseContents, parseData, parseXML, writeContents, writeContents2, writeData, writeXML
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpressionRef

public ExpressionRef()
Create a new instance of ExpressionRef. This constructor is for internal use only.


ExpressionRef

public ExpressionRef(String datasource,
                     String name)
Create a new instance of ExpressionRef.

Parameters:
datasource - the name of the JDBC data source to which the object refers
name - the name of the reference

ExpressionRef

public ExpressionRef(String datasource,
                     String entity,
                     String name)
Create a new instance of ExpressionRef.

Parameters:
datasource - the name of the JDBC data source to which the object refers
entity - the entity
name - the name of the reference
Method Detail

getScriptExpression

public static final String getScriptExpression(boolean sql,
                                               String exp)
Get the script expression. For a sql expression, script expression might be embedded as commented out segment.


getSQLExpression

public static final String getSQLExpression(boolean sql,
                                            String exp)
Get the sql expression. For a sql expression, script expression might be embedded as commented out segment.


getDBType

public String getDBType()
Get the database type.

Returns:
the database type.

setDBType

public void setDBType(String dbtype)
Set the database type.

Parameters:
dbtype - the specified database type.

setRefType

public void setRefType(int rtype)
Setter of ref type.

Parameters:
rtype - the type of the ref, NONE, DIMENSION or MEASURE.

getRefType

public int getRefType()
Getter of ref type.

Returns:
the ref type, one of NONE, DIMENSION and MEASURE.

isExpression

public boolean isExpression()
Check if the attribute is an expression.

Returns:
true if is an expression, false otherwise

getDataSource

public String getDataSource()
Get the name of the JDBC data source to which this reference refers.

Returns:
the name of a JDBC data source

setDataSource

public void setDataSource(String datasource)
Set the name of the JDBC data source to which this reference refers.

Parameters:
datasource - the name of a JDBC data source

getExpression

public String getExpression()
Get the SQL expression of this reference.

Returns:
a SQL expression

getScriptExpression

public String getScriptExpression()
Get the script expression of this reference.

Returns:
a script expression

setExpression

public void setExpression(String expression)
Set the SQL expression of this reference.

Parameters:
expression - a SQL expression

getName

public String getName()
Get the name of the field.

Specified by:
getName in interface DataRef
Overrides:
getName in class AbstractDataRef
Returns:
the name of the field

setName

public void setName(String name)
Set the name of the field.

Parameters:
name - the name of the field

isVirtual

public boolean isVirtual()
Check if the expression is a virtual expression.


setVirtual

public void setVirtual(boolean virtual)
Set whether the expression is a vritual expression.


isOnAggregate

public boolean isOnAggregate()
Check if the expression is calculate on aggregate value.


setOnAggregate

public void setOnAggregate(boolean onAggregate)
Set if the expression is calculate on aggregate value.


isSQL

public boolean isSQL()
Check if this expression is sql expression.

Returns:
true if is, false otherwise

isExpressionEditable

public boolean isExpressionEditable()
Check if expression is editable.

Returns:
true if editable, false otherwise

getEntity

public String getEntity()
Get the attribute's parent entity.

Returns:
the name of the entity

setEntity

public void setEntity(String entity)
Set the attribute's parent entity.

Parameters:
entity - the name of the entity

getEntities

public Enumeration getEntities()
Get a list of all the entities referenced by this object.

Specified by:
getEntities in interface DataRef
Overrides:
getEntities in class AbstractDataRef
Returns:
an Enumeration containing the entity names

getAttribute

public String getAttribute()
Get the referenced attribute.

Returns:
the name of the attribute

getAttributes

public Enumeration getAttributes()
Get a list of all attributes that are referenced by this object.

Specified by:
getAttributes in interface DataRef
Overrides:
getAttributes in class AbstractDataRef
Returns:
an Enumeration containing AttributeRef objects

getCalcAttributes

public Enumeration getCalcAttributes()
Get a list of all attributes that are referenced by this object.

Returns:
an Enumeration containing AttributeRef objects

writeAttributes

protected void writeAttributes(PrintWriter writer)
Write an XML element representation of this object.

Specified by:
writeAttributes in class AbstractDataRef
Parameters:
writer - the output stream to which to write the XML data

writeAttributes2

protected void writeAttributes2(DataOutputStream dos)
Write the attributes of this object.

Overrides:
writeAttributes2 in class AbstractDataRef
Parameters:
dos - the output stream to which to write the XML data.

writeCDATA

protected void writeCDATA(PrintWriter writer)
Write the CDATA of this object.

Overrides:
writeCDATA in class AbstractDataRef
Parameters:
writer - the output stream to which to write the XML data

writeCDATA2

protected void writeCDATA2(DataOutputStream dos)
Write the CDATA of this object.

Overrides:
writeCDATA2 in class AbstractDataRef
Parameters:
dos - the output stream to which to write the OutputStream data.

parseAttributes

protected void parseAttributes(Element tag)
                        throws Exception
Read in the definition of this object from an XML tag.

Specified by:
parseAttributes in class AbstractDataRef
Parameters:
tag - the XML Element representing this object
Throws:
Exception

parseCDATA

protected void parseCDATA(Element tag)
                   throws DOMException
Read in the attribute of this object from an XML tag.

Overrides:
parseCDATA in class AbstractDataRef
Parameters:
tag - the XML Element representing this object
Throws:
DOMException

toString

public String toString()
Get a String representation of this object.

Overrides:
toString in class AbstractDataRef
Returns:
a String representation of this object

toView

public String toView()
Get the view representation of this field.

Returns:
the view representation of this field.

equalsContent

public boolean equalsContent(Object obj)
Check if equals another object content.

Parameters:
obj - the specified object.
Returns:
true if equals, false otherwise.

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.