com.plumtree.portaluiinfrastructure.condition
Class AConditionType

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.condition.AConditionType
Direct Known Subclasses:
AGuestConditionType, ARegularConditionType

public abstract class AConditionType
extends java.lang.Object

Condition Type interface. Condition Types are needed for two reasons: 1) To determine whether whether a condition of its type is met. This involves finding the current value and comparing it to the condition's value. For example: Checking to see whether a condition the user's IP address involves getting the current user's IP Address from the http request and checking to see if it matches the IP Address stored in the expression. 2) Display the conditions of its type that have been created. Each expression contains a list of conditions, one for each condition type. The list for conditions of a certain type could have a display as simple as a textbox with the condition value inside, or more elaborate involving a tree picker and row icons.

Author:
dustina

Field Summary
static java.lang.String CONDITION_LIST_CONSTANT
           
protected static OpenLogger log
           
static int PHASE_TYPE_GUEST
           
static int PHASE_TYPE_REGULAR
           
protected static OpenLogger ruleDebugger
           
 
Constructor Summary
AConditionType()
           
 
Method Summary
abstract  void AddItemToMyConditionsList(java.lang.Object objItem, ExpListModel myListModel, IPTSession ptSession)
          This method is almost like the opposite of the GetConditionValue() method.
 java.lang.String GetConditionTypeIdentifier()
          This method combines the CONDITION_LIST_CONSTANT variable with it's type ID to come up with a unique string that can be used to store this condition type's list of conditions in the activityspace.
abstract  java.lang.Object GetConditionValue(int nRow, IPTGrowableSortedArrayWrapperRO saData)
          To return the condition value, we have to retrieve the data from the list using the nRow and saData variables.
abstract  int GetConditionValueType()
          Each condition type has an expectation of what type of value they are to receive.
abstract  java.lang.String GetDescriptionString(IValue ConditionValue, IPTSession ptSession)
          Constructs the string to be set in an expression's description.
abstract  java.lang.String GetMyConditionsListAddLabel(XPResourceManager xpRM, java.lang.String strLanguage)
          The Add label specifies what text will be displayed on the Add button.
abstract  PTImageType GetMyConditionsListIcon()
          This method specifies what icon will be displayed on the add button.
abstract  java.lang.String GetMyConditionsListSectionSubTitle(XPResourceManager xpRM, java.lang.String strLanguage)
          This method specifies what text will be displayed on the section sub title.
abstract  java.lang.String GetMyConditionsListSectionTitle(XPResourceManager xpRM, java.lang.String strLanguage)
          This method specifies what text will be displayed on the section title.
abstract  int GetPhaseType()
          Method to retrieve the phase type of this condition type.
abstract  java.lang.String GetValidationFailedString(XPResourceManager xpRM, java.lang.String strLanguage)
          If a ValidationFailedException occurs, the RulesEditorModel will call this method to retrieve the appropriete error message.
 void InitializeMyConditionsList(ExpListModel myListModel, java.lang.String strLanguage)
          This method initializes the expandable list registered by the RegisterMyConditionsList method.
 void RegisterMyConditionsList(AActivitySpace asCurrentSpace)
          This method will register the type of Expandable List that this condition type will use to display its list of conditions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static OpenLogger log

ruleDebugger

protected static final OpenLogger ruleDebugger

CONDITION_LIST_CONSTANT

public static final java.lang.String CONDITION_LIST_CONSTANT
See Also:
Constant Field Values

PHASE_TYPE_GUEST

public static final int PHASE_TYPE_GUEST
See Also:
Constant Field Values

PHASE_TYPE_REGULAR

public static final int PHASE_TYPE_REGULAR
See Also:
Constant Field Values
Constructor Detail

AConditionType

public AConditionType()
Method Detail

GetPhaseType

public abstract int GetPhaseType()
Method to retrieve the phase type of this condition type. There are currently two phases: guest phase and regular phase.

See Also:
AGuestConditionType, ARegularConditionType

GetConditionTypeIdentifier

public java.lang.String GetConditionTypeIdentifier()
This method combines the CONDITION_LIST_CONSTANT variable with it's type ID to come up with a unique string that can be used to store this condition type's list of conditions in the activityspace.

Returns:
A String the uniquely identifies this condition type

RegisterMyConditionsList

public void RegisterMyConditionsList(AActivitySpace asCurrentSpace)
This method will register the type of Expandable List that this condition type will use to display its list of conditions. The expandable list is registered using the condition type's unique identifier. The Expandable List itself is merely an abstract class that needs to be extended. There are two list objects that have extended the Expandable List: 1) Growable List under package com.plumtree.uiinfrastructure.expandablelist.growablelist. This is a vary simple, but useful extenstion of the Expandable List consisting of an input box per row. Adding a new condition is as easy as inputting the condition value in the text box. Check out com.plumtree.portalpages.condition.conditiontypes.ConditionTypeURLDomain as an example of how to use the Growable List. 2) Select PTObject List under package com.plumtree.portaluiinfrastructure.expandablelist.selectptobject. The Select PTObject List allows users to select ptobjects easily. It comes set up with a pop up tree picker where you can select more than one object at a time, and it displays the name of the objects selected in the rows. Check out com.plumtree.portalpages.condition.conditiontypes.ConditionTypeCommunityID as an example of how to use the Select PTObject List. If neither of the two lists above suits your need, another option would be to create a new list by extending either of the two lists mentioned above, or extending Expandable List itself. Registering the chosen list involves registering a list model, a list view, and a list control. To register the model, use the RegiserModel() method of the ActivitySpace: asCurrentSpace.RegisterModel(MyListModel.STR_MVC_CLASS_NAME, GetConditionTypeIdentifier()); The registered list model is needed to register the view and the control, therefore, we need to get back the Model we just registered using this condition type's identifier: IModel myListModel = asCurrentSpace.GetModel(GetConditionTypeIdentifier()); Now that we have the model, we can continue to register the list view and the list control: asCurrentSpace.RegisterView(MyListListView.STR_MVC_CLASS_NAME, GetConditionTypeIdentifier(), myListModel); asCurrentSpace.RegisterControl(ExpListControl.STR_MVC_CLASS_NAME, GetConditionTypeIdentifier(), myListModel); It is very likely that the ExpListControl is sufficient to use and will not need to be extended. In such a case, simply register the ExpListControl as your list control.

Parameters:
asCurrentSpace - - the activityspace the expandable list will be registered to

GetMyConditionsListSectionTitle

public abstract java.lang.String GetMyConditionsListSectionTitle(XPResourceManager xpRM,
                                                                 java.lang.String strLanguage)
This method specifies what text will be displayed on the section title. Use the Resource Manager and the string language to localize. NOTE: The string returned by this method is not HTMLEncoded Examples:

Parameters:
xpRM - - the resource manager which can be used to localize strings.
strLanguage - - current user's language locale
See Also:
"The base URL is ANY of the following URLs:", "The user's IP is ANY of the following IPs:", "The user is in ANY of the following Communities:", "The user is in ANY of the following Groups:"

GetMyConditionsListSectionSubTitle

public abstract java.lang.String GetMyConditionsListSectionSubTitle(XPResourceManager xpRM,
                                                                    java.lang.String strLanguage)
This method specifies what text will be displayed on the section sub title. Use the Resource Manager and the string language to localize. NOTE: The string returned by this method is not HTMLEncoded Examples:

Parameters:
xpRM - - the resource manager which can be used to localize strings.
strLanguage - - current user's language locale
See Also:
"URL Domains", "Client IP Addresses", "Community Name", "Group Name"

GetMyConditionsListAddLabel

public abstract java.lang.String GetMyConditionsListAddLabel(XPResourceManager xpRM,
                                                             java.lang.String strLanguage)
The Add label specifies what text will be displayed on the Add button. Use the Resource Manager and the string language to localize. NOTE: The string returned by this method is not HTMLEncoded Examples:

Parameters:
xpRM - - the resource manager which can be used to localize strings.
strLanguage - - current user's language locale
See Also:
"Add URL", "Add an IP Address", "Add Communities", "Add Groups"

GetMyConditionsListIcon

public abstract PTImageType GetMyConditionsListIcon()
This method specifies what icon will be displayed on the add button. Use the PTImageType class to select an icon.


InitializeMyConditionsList

public void InitializeMyConditionsList(ExpListModel myListModel,
                                       java.lang.String strLanguage)
This method initializes the expandable list registered by the RegisterMyConditionsList method. This method simply calls the expandable list's initialize method located in the list's model. The name of the initialize method depends on which type of expandable list was registered. Initializing the expandable list simply involves specifying display items like the list's title, or the add label. Use the methods above: GetMyConditionsListSectionTitle(), GetMyConditionsListSectionSubTitle(), GetMyConditionsListAddLabel(), GetMyConditionsListIcon() to help initialize the list.

Parameters:
myListModel - - the model of the expandable list registered with this condition type. The list's initialization method resides in the model. To be able to call the correct initialization method, casting the ExpListModel to the correct type may be needed.
strLanguage - - this is the laguange of the current user that is trying to create or edit an expression.

GetConditionValueType

public abstract int GetConditionValueType()
Each condition type has an expectation of what type of value they are to receive. A condition on url domain most likey will expect its value type to be of string, while a condition on community ID would have a value of type integer.

Returns:
the condition value type that is expected by this condition type. The condition value types are specified in the ValueTypeEnum class.

GetConditionValue

public abstract java.lang.Object GetConditionValue(int nRow,
                                                   IPTGrowableSortedArrayWrapperRO saData)
To return the condition value, we have to retrieve the data from the list using the nRow and saData variables. Then it needs to be converted to the value type that is expected. The default list used is the Growable List, which is what the URL condition type uses. To retrieve the data from the Growable List, use the GrowableListModel.EXPLIST_SORTEDARRAY_PROPID_INPUTTEXT constant: Object result = saData.GetItem(nRow, GrowableListModel.EXPLIST_SORTEDARRAY_PROPID_INPUTTEXT); At this point, the result has been retrieved as a String. The next step would be to convert the string object to the type returned by GetConditionValueType(). This method is also where validation of the value occurs. If the value is suppose to be an integer, validate that it is and throw a ValidationFailedException if it's not.

Parameters:
nRow - - the row index of the object wanted
saData - - the list containing the object
Returns:
- the object at row nRow of saData formatted to the condition type's value type
See Also:
ConditionTypeURLDomain

GetValidationFailedString

public abstract java.lang.String GetValidationFailedString(XPResourceManager xpRM,
                                                           java.lang.String strLanguage)
If a ValidationFailedException occurs, the RulesEditorModel will call this method to retrieve the appropriete error message. NOTE: The string returned by this method is not HTMLEncoded

Parameters:
xpRM - - the resource manager which can be used to localize strings.
strLanguage - - current user's language locale
Returns:
the string that will be displayed as the error message

AddItemToMyConditionsList

public abstract void AddItemToMyConditionsList(java.lang.Object objItem,
                                               ExpListModel myListModel,
                                               IPTSession ptSession)
This method is almost like the opposite of the GetConditionValue() method. It takes the objItem, which is the server version of the condition value, and converts it to the UI version. The variable objItem is currently of the type returned by GetConditionValueType(). It now needs to be converted to the type that the ExpListModel understands. If you are using the default Growable List, then the objItem simply needs to be converted to a string. Then, add it to a String[], and call the AddRowsToList(String[]) method.

Parameters:
objItem - - the condition value that needs to be added to the list.
myListModel - - the list model which holds the data of items in the list
ptSession - - the current user's session is provided in case it is needed
See Also:
ConditionTypeURLDomain

GetDescriptionString

public abstract java.lang.String GetDescriptionString(IValue ConditionValue,
                                                      IPTSession ptSession)
Constructs the string to be set in an expression's description. Simply return a string describing the current condition. NOTE: The string returned by this method will be HTMLEncoded Example:

Parameters:
ConditionValue - - the condition value for this condition type
ptSession - - the current user's session is provided in case it is needed
Returns:
string containing the condition type's name and condition value name
See Also:
"URL Domain contains xxx", "Client IP Address matches xxx.xxx.xxx.xxx", "User is in Community: xxx", "User part of Group: xxx"



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.