atg.svc.ui.formhandlers
Class ListChooserFormHandler

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.droplet.EmptyFormHandler
              extended by atg.droplet.GenericFormHandler
                  extended by atg.droplet.TransactionalFormHandler
                      extended by atg.web.formhandlers.ApplicationFormHandler
                          extended by atg.svc.ui.formhandlers.test.TreeTableDelegatingFormHandler
                              extended by atg.svc.ui.formhandlers.ListChooserFormHandler
All Implemented Interfaces:
atg.droplet.DropletFormHandler, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, TreeTableFormHandler, Listable, Selectable, java.util.EventListener
Direct Known Subclasses:
OrgChooserFormHandler, UserChooserListFormHandler

@Service(requiredProperties={"optionService","segmentService","solutionService"})
public class ListChooserFormHandler
extends atg.svc.ui.formhandlers.test.TreeTableDelegatingFormHandler
implements Listable, Selectable

Data source for TreeTable displaying list to be used in List Constraint Editor. Works with different data sources depending from editorField value:

Allows filtering by starting letters. By default, gets values from "SolutionStatus" repository view of ServiceSharedRepository. Allows changing repository, view (items), filtering RQLWhere condition by Nucleus properties file. Returns viewItems as List of DynamicBeanMap items around repository items retrieved.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String CONSTRAINT_LANGUAGE
           
static java.lang.String CONSTRAINT_SELFSERVICE_AUDIENCE
           
protected  java.lang.String editorField
           
protected  java.lang.String mAdminField
           
protected  java.lang.String mBaseValue
           
protected  java.lang.String mFilterKeyword
           
protected  java.lang.String mItemKey
           
protected  atg.repository.Repository mRepository
           
protected  java.lang.String mRepositoryView
          If this property is specified, use this view to get list of items to display.
protected  atg.svc.repository.service.SegmentService mSegmentService
           
protected  java.util.Map mSelectedKeys
          Currently selected keys are mapped to Boolean.TRUE values for easy determining in JSP if given key is selected.
protected  SolutionService mSolutionService
           
protected  java.util.List mViewItems
          visible list items
static java.lang.String PROPERTY_DISPLAY_NAME
           
static java.lang.String PROPERTY_REPOSITORY_ID
           
protected static java.lang.String STATUS_FILTER_RQL
          Text of RQL query to filter solution status values (by displayName property).
static java.lang.String STATUS_VIEW
          Name of repository view to get statuses list from.
 
Fields inherited from class atg.svc.ui.formhandlers.test.TreeTableDelegatingFormHandler
mOperation, mParameters, mState, mTreeTableId, mView
 
Fields inherited from class atg.web.formhandlers.ApplicationFormHandler
EQUALS, PARAM_DELIMITER, QUERY_DELIMITER, STATUS_ERROR_REDIRECT, STATUS_ERROR_STAY, STATUS_SUCCESS
 
Fields inherited from class atg.droplet.GenericFormHandler
PARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDS
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.svc.ui.treetable.Selectable
SELECT_MULTIPLE, SELECT_NONE, SELECT_SINGLE
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
ListChooserFormHandler()
           
 
Method Summary
 void doStartService()
           
static void fillSelectedFromState(java.util.Map pSelectedKeys, StateContainer pState)
          Fill the map provided with Boolean.TRUE values for each itemKey in "pState.selected"
protected  java.util.Collection<atg.repository.RepositoryItem> filterListValues(java.util.Collection<atg.repository.RepositoryItem> src)
          Filters list values by mFilterKeyword
protected  StateContainer findStateContainer()
           
 java.lang.String getAdminField()
          fieldName, used in admin global field defn
 java.lang.String getAllRQLWhere()
          Text of RQL query to get all values in proper order.
 java.lang.String getBaseValue()
          Semicolon-separated list of item repository Ids that are initially selected
 java.lang.String getEditorConstraintType()
           
 java.lang.String getEditorField()
          Name of the constraint attribute or field.
 java.lang.String getFilterKeyword()
          Keywords starts with constraint values
 java.lang.String getFilterRQLWhere()
          Text of RQL query to filter values: STATUS_FILTER_RQL if editorField is "status",
 java.lang.String getItemKey()
           
 java.lang.String getItemName()
           
 java.lang.String getLanguageProperty()
           
protected  java.util.List getLanguages()
           
 atg.svc.repository.service.OptionService getOptionService()
           
 atg.repository.Repository getRepository()
          Repository containing views "SolutionStatus" and "FieldDefinition" or specified specific view.
 java.lang.String getRepositoryView()
          Name of this repository view will be used to extract full or filtered list of items.
protected  java.util.List getSegmentItems()
          Retrieve items from segment
 atg.svc.repository.service.SegmentService getSegmentService()
          Provides internal Groups for "selfServiceAudience" value of editorField.
 java.util.List<java.lang.String> getSelectedItemsList()
          Display names of all selected items.
 java.util.Map getSelectedKeys()
          Currently selected keys are mapped to Boolean.TRUE values for easy determining in JSP if given key is selected.
 java.util.List<java.lang.String> getSelectedKeysList()
          Made to preserve sorting of mViewItems
 SolutionService getSolutionService()
           
 int getTotalItemCount()
          Same as getTotalItemCount().
 int getViewItemCount()
           
 java.util.List getViewItems()
          Create collection of visible list items.
 boolean handleList(atg.servlet.DynamoHttpServletRequest request, atg.servlet.DynamoHttpServletResponse response)
          Prepare for rendering of TreeTable
 boolean isStatusField()
           
protected  java.util.List<java.lang.String> prepareSelectedList(java.util.Collection pViewItems, java.lang.String propertyName)
           
protected  void resetListValue(atg.servlet.DynamoHttpServletRequest pRequest)
          Called on reset and refresh operations Cleans up the selection and initializes selected keys from the base value
protected  void saveStateContainer(StateContainer pStateContainer)
           
 void select(java.lang.Object pItemKey, java.lang.String pMode)
          Implementation of Selectable interface.
 void setAdminField(java.lang.String adminField)
          fieldName, used in admin global field defn
 void setBaseValue(java.lang.String pBaseValue)
          Semicolon-separated list of item repository Ids that are initially selected
 void setEditorConstraintType(java.lang.String pEditorConstraintType)
           
 void setEditorField(java.lang.String editorField)
          Name of the constraint attribute or field.
 void setFilterKeyword(java.lang.String filterKeyword)
          Keywords starts with constraint values
 void setItemKey(java.lang.String itemKey)
           
 void setLanguageProperty(java.lang.String pLanguageProperty)
           
 void setOptionService(atg.svc.repository.service.OptionService pOptionService)
           
 void setRepository(atg.repository.Repository repository)
          Repository containing views "SolutionStatus" and "FieldDefinition" or specified specific view.
 void setRepositoryView(java.lang.String pRepositoryView)
           
 void setSegmentService(atg.svc.repository.service.SegmentService pSegmentService)
          Provides internal Groups for "selfServiceAudience" value of editorField.
 void setSolutionService(SolutionService pSolutionService)
           
 void setState(java.lang.String pState)
          Remember treetable state, remember keys of already selected items in the List.
 void setViewItems(java.util.List viewItems)
          Use this method in JSP to set items to be shown
protected  java.util.List uploadRepositoryItems()
          Retrieve items from specified repository and view.
protected  java.util.List uploadViewItems()
          Retrieve items from canned list, or from SegmentService specified, or from repository.
static java.util.List wrapArray(java.lang.Object[] pItems)
          Make array of objects (usually RepositoryItem's) to be a list of DynamicBeanMap (recursively wrapped).
static java.util.List wrapCollection(java.util.Collection children)
          Make list of arbitrary JavaBean objects to be list of DynamicBeanMap (recursively wrapped).
static java.util.List<java.util.Map<java.lang.String,java.lang.String>> wrapProfileGroups(java.util.List<atg.repository.RepositoryItemGroup> children)
          Make list of ProfileGroups objects to be list of Map having repositoryId and displayName.
static java.util.List<java.util.Map<java.lang.String,java.lang.String>> wrapSelfServiceAudienceCollection(java.util.Collection<atg.svc.repository.beans.OrganizationValue> children)
          Make list of Organization objects to be list of Map having repositoryId and displayName.
 
Methods inherited from class atg.svc.ui.formhandlers.test.TreeTableDelegatingFormHandler
getOperation, getParameters, getState, getTreeTableId, getView, handleResponse, setOperation, setParameters, setTreeTableId, setView, validate
 
Methods inherited from class atg.web.formhandlers.ApplicationFormHandler
addParameterToURLString, beforeGet, beforeSet, checkFormError, checkFormRedirect, checkFormSuccess, formHandlerBeforeGet, formHandlerBeforeSet, formHandlerInit, getDefaultLocale, getErrorURL, getRedirectDelayMS, getString, getString, getString, getSuccessURL, getUserLocale, getUserMessagesResourceBundle, handleCancel, isUseRequestLocale, processException, processException, processExceptionAndLog, processExceptionAndLog, redirect, setDefaultLocale, setErrorURL, setRedirectDelayMS, setSuccessURL, setUseRequestLocale, setUserMessagesResourceBundle
 
Methods inherited from class atg.droplet.TransactionalFormHandler
afterSet, commitTransaction, getTransactionDemarcation, getTransactionStatus, isEnsureTransaction, isRollbackTransaction, isRollbackTransactionOnUnhandledException, isTransactionMarkedAsRollback, setEnsureTransaction, setRollbackTransaction, setRollbackTransactionOnUnhandledException, setTransactionDemarcation
 
Methods inherited from class atg.droplet.GenericFormHandler
addFormException, addUncheckedFormException, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, getUncheckedFormExceptions, handleFormException, handleUncheckedFormException, hasUncheckedFormExceptions, isDeferForwardsAndRedirects, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, resetFormExceptions, setCancelURL, setCheckForValidSession, setDeferForwardsAndRedirects, setFormName, setMessagePort, setMessageSource, setMessageType, setRestorableForm, setSendMessages, setUseForwards
 
Methods inherited from class atg.droplet.EmptyFormHandler
afterGet
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


STATUS_VIEW

public static final java.lang.String STATUS_VIEW
Name of repository view to get statuses list from. Used when editorField property is "status".

See Also:
Constant Field Values

CONSTRAINT_LANGUAGE

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

CONSTRAINT_SELFSERVICE_AUDIENCE

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

PROPERTY_DISPLAY_NAME

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

PROPERTY_REPOSITORY_ID

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

mSegmentService

protected atg.svc.repository.service.SegmentService mSegmentService

mSolutionService

protected SolutionService mSolutionService

mFilterKeyword

protected java.lang.String mFilterKeyword

editorField

protected java.lang.String editorField

mAdminField

protected java.lang.String mAdminField

mBaseValue

protected java.lang.String mBaseValue

mRepository

protected atg.repository.Repository mRepository

mRepositoryView

protected java.lang.String mRepositoryView
If this property is specified, use this view to get list of items to display.


STATUS_FILTER_RQL

protected static java.lang.String STATUS_FILTER_RQL
Text of RQL query to filter solution status values (by displayName property).


mViewItems

protected java.util.List mViewItems
visible list items


mItemKey

protected java.lang.String mItemKey

mSelectedKeys

protected java.util.Map mSelectedKeys
Currently selected keys are mapped to Boolean.TRUE values for easy determining in JSP if given key is selected.

Constructor Detail

ListChooserFormHandler

public ListChooserFormHandler()
Method Detail

getOptionService

public atg.svc.repository.service.OptionService getOptionService()

setOptionService

public void setOptionService(atg.svc.repository.service.OptionService pOptionService)

getSegmentService

public atg.svc.repository.service.SegmentService getSegmentService()
Provides internal Groups for "selfServiceAudience" value of editorField.


setSegmentService

public void setSegmentService(atg.svc.repository.service.SegmentService pSegmentService)
Provides internal Groups for "selfServiceAudience" value of editorField.


getSolutionService

public SolutionService getSolutionService()

setSolutionService

public void setSolutionService(SolutionService pSolutionService)

getFilterKeyword

public java.lang.String getFilterKeyword()
Keywords starts with constraint values


setFilterKeyword

public void setFilterKeyword(java.lang.String filterKeyword)
Keywords starts with constraint values


getEditorField

public java.lang.String getEditorField()
Name of the constraint attribute or field.


setEditorField

public void setEditorField(java.lang.String editorField)
Name of the constraint attribute or field.


getEditorConstraintType

public java.lang.String getEditorConstraintType()

setEditorConstraintType

public void setEditorConstraintType(java.lang.String pEditorConstraintType)

getAdminField

public java.lang.String getAdminField()
fieldName, used in admin global field defn


setAdminField

public void setAdminField(java.lang.String adminField)
fieldName, used in admin global field defn


getBaseValue

public java.lang.String getBaseValue()
Semicolon-separated list of item repository Ids that are initially selected


setBaseValue

public void setBaseValue(java.lang.String pBaseValue)
Semicolon-separated list of item repository Ids that are initially selected


getRepository

public atg.repository.Repository getRepository()
Repository containing views "SolutionStatus" and "FieldDefinition" or specified specific view.


setRepository

public void setRepository(atg.repository.Repository repository)
Repository containing views "SolutionStatus" and "FieldDefinition" or specified specific view.


getRepositoryView

public java.lang.String getRepositoryView()
Name of this repository view will be used to extract full or filtered list of items.

Returns:
STATUS_VIEW if editorField is "status", "FieldDefinition" if mRepositoryView is not specified and mRepositoryView if specified.

setRepositoryView

public void setRepositoryView(java.lang.String pRepositoryView)
Parameters:
pRepositoryView - Name of the repository view that will be used to extract full or filtered list of items.

isStatusField

public boolean isStatusField()
Returns:
boolean value, which means whether statuses list should be extracted or not.

getFilterRQLWhere

public java.lang.String getFilterRQLWhere()
Text of RQL query to filter values: STATUS_FILTER_RQL if editorField is "status",

Returns:

getAllRQLWhere

public java.lang.String getAllRQLWhere()
Text of RQL query to get all values in proper order.

Returns:

getLanguageProperty

public java.lang.String getLanguageProperty()

setLanguageProperty

public void setLanguageProperty(java.lang.String pLanguageProperty)

getLanguages

protected java.util.List getLanguages()
Returns:
list of language repository item imitations (maps)

doStartService

public void doStartService()
                    throws atg.nucleus.ServiceException
Overrides:
doStartService in class atg.nucleus.GenericService
Throws:
atg.nucleus.ServiceException

getViewItems

public java.util.List getViewItems()
Create collection of visible list items.

Specified by:
getViewItems in interface Listable
Returns:
created collection of list items.

setViewItems

public void setViewItems(java.util.List viewItems)
Use this method in JSP to set items to be shown

Parameters:
viewItems -

getViewItemCount

public int getViewItemCount()
Specified by:
getViewItemCount in interface Listable
Returns:
Number of all items visible to user at this time (taking into account filtering).

getTotalItemCount

public int getTotalItemCount()
Same as getTotalItemCount().

Specified by:
getTotalItemCount in interface Listable
Returns:
Number of all items visible to user at this time (taking into account filtering).

getItemKey

public java.lang.String getItemKey()

setItemKey

public void setItemKey(java.lang.String itemKey)

getItemName

public java.lang.String getItemName()

getSelectedKeys

public java.util.Map getSelectedKeys()
Currently selected keys are mapped to Boolean.TRUE values for easy determining in JSP if given key is selected.

Returns:

getSelectedKeysList

public java.util.List<java.lang.String> getSelectedKeysList()
Made to preserve sorting of mViewItems

Returns:
keys of all selected items to allow iteration.

getSelectedItemsList

public java.util.List<java.lang.String> getSelectedItemsList()
Display names of all selected items.

Returns:

prepareSelectedList

protected java.util.List<java.lang.String> prepareSelectedList(java.util.Collection pViewItems,
                                                               java.lang.String propertyName)
Parameters:
pViewItems -
propertyName -
Returns:
Display names of specified items.

setState

public void setState(java.lang.String pState)
Remember treetable state, remember keys of already selected items in the List.

Specified by:
setState in interface TreeTableFormHandler
Overrides:
setState in class atg.svc.ui.formhandlers.test.TreeTableDelegatingFormHandler
Parameters:
pState - serialized string for TreeTable component state stored on client

fillSelectedFromState

public static void fillSelectedFromState(java.util.Map pSelectedKeys,
                                         StateContainer pState)
Fill the map provided with Boolean.TRUE values for each itemKey in "pState.selected"

Parameters:
pSelectedKeys - map to update
pState - Tree state that holds all the selected items

select

public void select(java.lang.Object pItemKey,
                   java.lang.String pMode)
Implementation of Selectable interface. Called when user selects some new item. Add this new key to List of already selected.

Specified by:
select in interface Selectable
Parameters:
pItemKey - key of the newly selected item

handleList

public boolean handleList(atg.servlet.DynamoHttpServletRequest request,
                          atg.servlet.DynamoHttpServletResponse response)
                   throws java.lang.Exception
Prepare for rendering of TreeTable

Parameters:
request -
response -
Returns:
Throws:
java.lang.Exception

resetListValue

protected void resetListValue(atg.servlet.DynamoHttpServletRequest pRequest)
Called on reset and refresh operations Cleans up the selection and initializes selected keys from the base value

Parameters:
pRequest -

uploadViewItems

protected java.util.List uploadViewItems()
Retrieve items from canned list, or from SegmentService specified, or from repository.

Returns:
actual items to show

getSegmentItems

protected java.util.List getSegmentItems()
Retrieve items from segment

Returns:
wrapped segment items

uploadRepositoryItems

protected java.util.List uploadRepositoryItems()
Retrieve items from specified repository and view.

Returns:
wrapped repository items
See Also:
#getRepositoryView()} for details what repository view is used., #wrapArray(java.lang.Object[])} how wrapping works.

filterListValues

protected java.util.Collection<atg.repository.RepositoryItem> filterListValues(java.util.Collection<atg.repository.RepositoryItem> src)
Filters list values by mFilterKeyword

Parameters:
src - source collection
Returns:
collection of list values starting with mFilterKeyword

wrapCollection

public static java.util.List wrapCollection(java.util.Collection children)
Make list of arbitrary JavaBean objects to be list of DynamicBeanMap (recursively wrapped).

Parameters:
children - collection to wrap
Returns:
ArrayList having Map objects

wrapSelfServiceAudienceCollection

public static java.util.List<java.util.Map<java.lang.String,java.lang.String>> wrapSelfServiceAudienceCollection(java.util.Collection<atg.svc.repository.beans.OrganizationValue> children)
Make list of Organization objects to be list of Map having repositoryId and displayName.

Parameters:
children - collection to wrap
Returns:
List having Map objects
See Also:
#getRepItemImitation(java.lang.String, java.lang.String)} how items are wrapping

wrapProfileGroups

public static java.util.List<java.util.Map<java.lang.String,java.lang.String>> wrapProfileGroups(java.util.List<atg.repository.RepositoryItemGroup> children)
Make list of ProfileGroups objects to be list of Map having repositoryId and displayName.

Parameters:
children - collection to wrap
Returns:
ArrayList having Map objects
See Also:
#getRepItemImitation(java.lang.String, java.lang.String)} how items are wrapping

wrapArray

public static java.util.List wrapArray(java.lang.Object[] pItems)
Make array of objects (usually RepositoryItem's) to be a list of DynamicBeanMap (recursively wrapped).

Parameters:
pItems - array to wrap
Returns:
list having DynamicBeanMap objects.

findStateContainer

protected StateContainer findStateContainer()

saveStateContainer

protected void saveStateContainer(StateContainer pStateContainer)