com.iphrase.onestep.beans
Class ValueHandler

java.lang.Object
  |
  +--com.iphrase.onestep.beans.ValueHandler
Direct Known Subclasses:
TallyValueHandler

public class ValueHandler
extends java.lang.Object

The ValueHandler is a helper bean used to make it easier for JSP programmers to access various properties of OneStep data types. It supports all data types (both summarized and non-summarized values). The support for all data types is achieved through the use of multiple sub-classes (one for each data type). For each of these sub-classes, ValueHandler has only one member variable with a non-null value. For example, the boolValue member variable (the instance of the ValueHandler.BooleanValue sub-class) is the only non-null member variable of the ValueHandler that contains the FeatureMetaData.BaseTypes.BOOL data type.


Inner Class Summary
 class ValueHandler.BaseValue
          A super class for all xxxValue sub-classes.
 class ValueHandler.BooleanValue
          A container for the FeatureMetaData.BaseTypes.BOOL OneStep value.
 class ValueHandler.CustomValue
          A container for the FeatureMetaData.BaseTypes.CUSTOM OneStep value.
 class ValueHandler.DateTimeValue
          A container for the FeatureMetaData.BaseTypes.DATE_TIME OneStep value.
 class ValueHandler.FloatValue
          A container for the FeatureMetaData.BaseTypes.FLOAT OneStep value.
 class ValueHandler.ImageUrlValue
          A container for the FeatureMetaData.BaseTypes.IMAGE_URL OneStep value.
 class ValueHandler.IntValue
          A container for the FeatureMetaData.BaseTypes.INT OneStep value.
 class ValueHandler.LinkValue
          A container for the FeatureMetaData.BaseTypes.LINK OneStep value.
 class ValueHandler.TaxonomyValue
          A container for the FeatureMetaData.BaseTypes.TAXONOMY OneStep value.
 class ValueHandler.TextExtractValue
          A container for the FeatureMetaData.BaseTypes.TEXT_EXTRACT OneStep value.
 class ValueHandler.TextValue
          A container for the FeatureMetaData.BaseTypes.TEXT OneStep value.
 
Constructor Summary
ValueHandler(java.lang.Object value)
          Constructs an instance of the ValueHandler class when its type is not available.
ValueHandler(java.lang.Object obj, int type, boolean summarized, java.lang.String featureId, boolean logClickThrough)
          Constructs an instance of the ValueHandler class.
 
Method Summary
static ValueHandler CreateInstance(com.iphrase.runtime.query.result.FeatureMetaData feature, java.lang.Object obj)
          Creates an instance of the ValueHandler for the specified FeatureMetaData and OneStep Runtime API object
static java.lang.String escapeHTML(java.lang.String s)
           
 ValueHandler.BooleanValue getBool()
          Gets the ValueHandler.BooleanValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.BOOL type.
 com.iphrase.runtime.query.constraint.Constraint getConstraint()
          Gets the value's Constraint.
 java.lang.String getConstraintLabel()
          Gets the (optional) constraint label.
 ValueHandler.CustomValue getCustom()
          Gets the ValueHandler.CustomValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.CUSTOM type.
 ValueHandler.DateTimeValue getDateTime()
          Gets the ValueHandler.DateTimeValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.DATE_TIME type.
 java.lang.String getFeatureId()
          Gets the feature ID for the particular value, or an empty string if it's not available.
 java.lang.Object getFeatureValue()
          Gets the actual OneStep value
 ValueHandler.FloatValue getFloat()
          Gets the ValueHandler.FloatValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.FLOAT type.
 ValueHandler.ImageUrlValue getImageUrl()
          Gets the ValueHandler.ImageUrlValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.IMAGE_URL type.
 ValueHandler.IntValue getInt()
          Gets the ValueHandler.IntValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.INT type.
 boolean getIsNull()
          Checks if the object contains a valid value
 boolean getIsSummarized()
          Checks if the object contains a summarized value
 boolean getIsTallied()
          Checks if the object is a tallied value.
 ValueHandler.LinkValue getLink()
          Gets the ValueHandler.LinkValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.LINK type.
 boolean getMatchesConstraint()
          Returns true if the value's constraint is a one of constraints used to get the current query results.
 boolean getShouldEscape()
          Returns true if the attribute 'mimetype' in FeatureMetaData is not text/html.
 int getTallyCount()
          Gets the value's tally count.
 ValueHandler.TaxonomyValue getTaxonomy()
          Gets the ValueHandler.TaxonomyValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.TAXONOMY type.
 ValueHandler.TextValue getText()
          Gets the ValueHandler.TextValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.TEXT type.
 ValueHandler.TextExtractValue getTextExtract()
          Gets the ValueHandler.TextExtractValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.TEXT_EXTRACT type.
 ValueHandler.BaseValue getValue()
          Gets the value's ValueHandler.BaseValue member
 void InitConstraint(com.iphrase.runtime.query.constraint.Constraint constraint, boolean matchesConstraint)
          Sets the constraint property.
 boolean isNull()
          Returns true if the OneStep value object is null Overrides ValueHandler.BaseValue.isNull().
 void setTallyCount(int tallyCount)
          Sets the value's tally count.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueHandler

public ValueHandler(java.lang.Object obj,
                    int type,
                    boolean summarized,
                    java.lang.String featureId,
                    boolean logClickThrough)
Constructs an instance of the ValueHandler class.
Parameters:
obj - OneStep Runtime API object
type - one of FeatureMetaData.BaseTypes
summarized - true if the value represents a summarized value
featureId - feature ID
logClickThrough - true if the clicks-through should be logged

ValueHandler

public ValueHandler(java.lang.Object value)
Constructs an instance of the ValueHandler class when its type is not available. The type of the object is identified using the Java language's instanceof operator.
Parameters:
value - OneStep Runtime API object
Method Detail

CreateInstance

public static ValueHandler CreateInstance(com.iphrase.runtime.query.result.FeatureMetaData feature,
                                          java.lang.Object obj)
Creates an instance of the ValueHandler for the specified FeatureMetaData and OneStep Runtime API object
Parameters:
feature - FeatureMetaData
obj - OneStep Runtime API object
Returns:
a new instance of the ValueHandler object

getTallyCount

public int getTallyCount()
Gets the value's tally count.
Returns:
tallyCount property

getFeatureId

public java.lang.String getFeatureId()
Gets the feature ID for the particular value, or an empty string if it's not available.
Returns:
featureId property

setTallyCount

public void setTallyCount(int tallyCount)
Sets the value's tally count.
Parameters:
tallyCount - value's tally count.

getValue

public ValueHandler.BaseValue getValue()
Gets the value's ValueHandler.BaseValue member
Returns:
value property

getFeatureValue

public java.lang.Object getFeatureValue()
Gets the actual OneStep value
Returns:
featureValue property

getIsNull

public boolean getIsNull()
Checks if the object contains a valid value
Returns:
isNull property

getIsTallied

public boolean getIsTallied()
Checks if the object is a tallied value. This is overridden by the derived class. Base implementation always returns false
Returns:
false

getIsSummarized

public boolean getIsSummarized()
Checks if the object contains a summarized value
Returns:
isSummarized property

getBool

public ValueHandler.BooleanValue getBool()
Gets the ValueHandler.BooleanValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.BOOL type.
Returns:
bool property

getDateTime

public ValueHandler.DateTimeValue getDateTime()
Gets the ValueHandler.DateTimeValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.DATE_TIME type.
Returns:
dateTime property

getFloat

public ValueHandler.FloatValue getFloat()
Gets the ValueHandler.FloatValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.FLOAT type.
Returns:
float property

getInt

public ValueHandler.IntValue getInt()
Gets the ValueHandler.IntValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.INT type.
Returns:
int property

getTaxonomy

public ValueHandler.TaxonomyValue getTaxonomy()
Gets the ValueHandler.TaxonomyValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.TAXONOMY type.
Returns:
taxonomy property

getTextExtract

public ValueHandler.TextExtractValue getTextExtract()
Gets the ValueHandler.TextExtractValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.TEXT_EXTRACT type.
Returns:
textExtract property

getText

public ValueHandler.TextValue getText()
Gets the ValueHandler.TextValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.TEXT type.
Returns:
text property

getLink

public ValueHandler.LinkValue getLink()
Gets the ValueHandler.LinkValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.LINK type.
Returns:
link property

getImageUrl

public ValueHandler.ImageUrlValue getImageUrl()
Gets the ValueHandler.ImageUrlValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.IMAGE_URL type.
Returns:
imageUrl property

getCustom

public ValueHandler.CustomValue getCustom()
Gets the ValueHandler.CustomValue object or returns null if the contained object is not of the FeatureMetaData.BaseTypes.CUSTOM type.
Returns:
custom property

escapeHTML

public static java.lang.String escapeHTML(java.lang.String s)

getConstraint

public com.iphrase.runtime.query.constraint.Constraint getConstraint()
Gets the value's Constraint.
Returns:
constraint property

getMatchesConstraint

public boolean getMatchesConstraint()
Returns true if the value's constraint is a one of constraints used to get the current query results.
Returns:
constraint property

InitConstraint

public void InitConstraint(com.iphrase.runtime.query.constraint.Constraint constraint,
                           boolean matchesConstraint)
Sets the constraint property.
Parameters:
constraint - value's Constraint
matchesConstraint - true if value has a matching constraint

getShouldEscape

public boolean getShouldEscape()
Returns true if the attribute 'mimetype' in FeatureMetaData is not text/html.
Returns:
shouldEscape property

getConstraintLabel

public java.lang.String getConstraintLabel()
Gets the (optional) constraint label.
Returns:
constraintLabel property

isNull

public boolean isNull()
Returns true if the OneStep value object is null Overrides ValueHandler.BaseValue.isNull().
Returns:
isNull property

© Copyright 2005, 2006. IBM Corporation. All rights reserved.