com.webmethods.caf.faces.data.dir
Class PeopleSearchProvider

java.lang.Object
  extended by com.webmethods.caf.faces.bean.PageFlowScopeAdapter
      extended by com.webmethods.caf.faces.data.object.ListTableContentProvider
          extended by com.webmethods.caf.faces.data.object.SelectableListTableContentProvider
              extended by com.webmethods.caf.faces.data.dir.PeopleSearchProvider
All Implemented Interfaces:
IPageFlowScopeAdapter, IAddressableTableContentProvider, IContentProvider, IRefreshable, IRefreshableContentProvider, IReorderableTableContentProvider, ISelectableTableContentProvider, ISortableTableContentProvider, ITableContentProvider, IUpdateableContentProvider, IUpdateableTableContentProvider, Serializable

public class PeopleSearchProvider
extends SelectableListTableContentProvider

Search Provider for searching on users/groups/roles principles The provider extends a list Table content provider.

Since:
8.0
See Also:
Serialized Form

Nested Class Summary
 class PeopleSearchProvider.DirectoryPagingIterator
          Paging iterator from directory service.
protected  class PeopleSearchProvider.PrincipalSortComparator
          Comparator that simply reverses the result of a standard compare (for descending key sorts)
protected  class PeopleSearchProvider.SortEntry
          Sort utility class.
 
Nested classes/interfaces inherited from class com.webmethods.caf.faces.data.object.SelectableListTableContentProvider
SelectableListTableContentProvider.Row, SelectableListTableContentProvider.RowComparator
 
Field Summary
protected  List fExcludePrincipalsList
           
protected  ISearchQuery fSearchQuery
           
 
Fields inherited from class com.webmethods.caf.faces.data.object.SelectableListTableContentProvider
m_autoIdCounter, m_map, m_originalList, m_selectableHelper
 
Fields inherited from class com.webmethods.caf.faces.data.object.ListTableContentProvider
m_array, m_canTemplateRow, m_index, m_list, m_onCreateRow, m_onDeleteRow, m_rowId, m_rowType, m_sort, m_templateRow, m_var
 
Fields inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
fExpireWithPageFlow
 
Constructor Summary
PeopleSearchProvider()
          Default constructor that sets the row variable and row Id binding for the selectable list table content provider parent class.
 
Method Summary
protected  boolean filterPrincipalByAttribute(IDirPrincipal dirPrincipal, PrincipalAttributeValueSource papValueSrc, List attribFilterRegexList)
          Filter the principal by its attributes.
protected  int getAsInt(Object o, int defaultValue)
          Get an integer for the object or use the default value.
protected  String getAsString(Object o, String defaultValue)
          Get a String for the object or use the default value.
 String getDirService()
          Get the directory service for the search query.
 Integer getMaxResults()
          Get the maximum number of results allowed in the search results.
 String getQueryString()
          Deprecated. Use field on fSearchQuery instead.
 ISearchQuery getSearchQuery()
          Initialize and cache the search query from the default search query factory.
 Integer getSearchType()
          Get the principal type to search for.
static String getSortValue(Object obj, String propertyExpression)
          Get the value of the property used to sort the principal.
protected  boolean isPrincipleExcluded(IDirPrincipal principal)
          Is the directory principal in the list of excluded principals.
protected  boolean isPrincipleExcluded(IURI principalURI)
          Is the principal URI in the list of excluded principals.
 void refresh()
          Refresh the list of search results.
 void setDirService(String dirService)
          Set the directory service in the search query.
 void setExcludePrincipalsList(List excludePrincipalsList)
          Set the list of principals to exclude.
 void setMaxResults(Integer maxResults)
          Deprecated. Use field on fSearchQuery instead.
 void setQueryString(String queryString)
          Deprecated. Use field on fSearchQuery instead.
 void setSearchQuery(ISearchQuery searchQuery)
          Manually set the search query.
 void setSearchType(Integer searchType)
          Set the principal type to search for.
 void setSort(ISortInfo sort)
          Set the sort information for this provider.
protected  void sort()
          Sort is handled by the refresh method.
 
Methods inherited from class com.webmethods.caf.faces.data.object.SelectableListTableContentProvider
createRow, deleteRow, getCurrentRow, getList, getNeedRefresh, getRowId, getRowSelectedCount, getRowSelectedIds, getRowUnselectedIds, getSelectedRows, getUseUnselectedModel, isAddressable, isAutoRefresh, isRowSelected, moveTo, setAutoRefresh, setCurrentRow, setList, setNeedRefresh, setRowById, setRowSelected, setRowSelectedIds, setRowUnselectedIds, setRowVariable, setTemplateRow, supportsAutoRefresh, updateOriginalList
 
Methods inherited from class com.webmethods.caf.faces.data.object.ListTableContentProvider
calculateRowId, calculateRowId, getArray, getCanTemplateRow, getOnCreateRow, getOnDeleteRow, getPropertyKeys, getRowCount, getRowIdBinding, getRowIndex, getRowType, getRowVariable, getSort, getType, getValue, hasProperty, isReadOnly, isReorderable, isRowAvailable, isTemplateRow, newRow, setArray, setCanTemplateRow, setOnCreateRow, setOnDeleteRow, setRowId, setRowIdBinding, setRowIndex, setRowType, setValue, toString
 
Methods inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
getExpireWithPageFlow, setExpireWithPageFlow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.webmethods.caf.faces.data.ITableContentProvider
getRowCount, getRowIndex, getRowVariable, isRowAvailable, setRowIndex
 
Methods inherited from interface com.webmethods.caf.faces.data.IContentProvider
getPropertyKeys, getType, getValue, hasProperty, toString
 

Field Detail

fExcludePrincipalsList

protected List fExcludePrincipalsList

fSearchQuery

protected ISearchQuery fSearchQuery
Constructor Detail

PeopleSearchProvider

public PeopleSearchProvider()
Default constructor that sets the row variable and row Id binding for the selectable list table content provider parent class. The row variable is set to "row". The row Id binding is set to the value binding for #{row.principalURI}".

See Also:
ListTableContentProvider.setRowIdBinding(ValueBinding), SelectableListTableContentProvider.setRowVariable(String)
Method Detail

getSearchQuery

public ISearchQuery getSearchQuery()
Initialize and cache the search query from the default search query factory.

Returns:
The SearchQuery object for the SearchBar control.
See Also:
DefaultSearchQueryFactory#createSearchQuery()

setSearchQuery

public void setSearchQuery(ISearchQuery searchQuery)
Manually set the search query. Overwrites the cached value.

Parameters:
searchQuery - The searchQuery to set

getDirService

public String getDirService()
Get the directory service for the search query.

Returns:
The dirService.

setDirService

public void setDirService(String dirService)
Set the directory service in the search query.

Parameters:
dirService - The dirService to set.

getMaxResults

public Integer getMaxResults()
Get the maximum number of results allowed in the search results.

Returns:
the maxResults

setMaxResults

public void setMaxResults(Integer maxResults)
Deprecated. Use field on fSearchQuery instead.

Set the maximum number of results allowed in the search results.

Parameters:
maxResults - The maxResults to set.

getQueryString

public String getQueryString()
Deprecated. Use field on fSearchQuery instead.

Gets the raw value of the query string.

Returns:
the queryString
See Also:
ISearchQuery.getKeywordField()

setQueryString

public void setQueryString(String queryString)
Deprecated. Use field on fSearchQuery instead.

Set the raw value of the query string.

Parameters:
queryString - the queryString to set.
See Also:
ISearchQuery.getKeywordField()

getSearchType

public Integer getSearchType()
Get the principal type to search for.

Returns:
The searchType is -1 (null), IDirConstants.TYPE_USER, IDirConstants.TYPE_ROLE, or IDirConstants.TYPE_GROUP.

setSearchType

public void setSearchType(Integer searchType)
Set the principal type to search for.

Parameters:
searchType - The searchType is null, IDirConstants.TYPE_USER, IDirConstants.TYPE_ROLE, or IDirConstants.TYPE_GROUP.

setExcludePrincipalsList

public void setExcludePrincipalsList(List excludePrincipalsList)
Set the list of principals to exclude.

Parameters:
excludePrincipalsList - the excludePrincipalsList to set

sort

protected void sort()
Sort is handled by the refresh method.

Overrides:
sort in class SelectableListTableContentProvider
See Also:
ListTableContentProvider.setSort(ISortInfo)

setSort

public void setSort(ISortInfo sort)
Set the sort information for this provider. If it has changed then refresh the list of search results.

Specified by:
setSort in interface ISortableTableContentProvider
Overrides:
setSort in class ListTableContentProvider
Parameters:
sort - The table sort information.
See Also:
ListTableContentProvider.setSort(com.webmethods.caf.faces.data.ISortInfo)

isPrincipleExcluded

protected boolean isPrincipleExcluded(IURI principalURI)
                               throws PortalException
Is the principal URI in the list of excluded principals.

Parameters:
principalURI - The principal URI to check.
Returns:
True if in the list excluded principal list. Otherwise false.
Throws:
PortalException

isPrincipleExcluded

protected boolean isPrincipleExcluded(IDirPrincipal principal)
                               throws PortalException
Is the directory principal in the list of excluded principals.

Parameters:
principal - The directory principal to check.
Returns:
True if in the list excluded principal list. Otherwise false.
Throws:
PortalException

refresh

public void refresh()
Refresh the list of search results.

Specified by:
refresh in interface IRefreshable
Overrides:
refresh in class SelectableListTableContentProvider
See Also:
SelectableListTableContentProvider.refresh()

filterPrincipalByAttribute

protected boolean filterPrincipalByAttribute(IDirPrincipal dirPrincipal,
                                             PrincipalAttributeValueSource papValueSrc,
                                             List attribFilterRegexList)
                                      throws PortalException
Filter the principal by its attributes. Use the principal URI and attribute name to obtain the attribute value. The value is then compared against the list of regex patterns to find a match. The principal attribute value source must contain a valid attribute name. If the principal attribute value source contains a valid provider URI then the directory principal is ignored. Otherwise the directory principal is used as a source for the provider URI.

Parameters:
dirPrincipal -
papValueSrc - The value source
attribFilterRegexList - The regex list to filter the attribute value.
Returns:
True if the one of the regex patterns is a match to the attribute value. False otherwise.
Throws:
PortalException

getSortValue

public static String getSortValue(Object obj,
                                  String propertyExpression)
Get the value of the property used to sort the principal.

Parameters:
obj - The target to evaluate.
propertyExpression - The value expression (ie '{name}').

getAsString

protected String getAsString(Object o,
                             String defaultValue)
Get a String for the object or use the default value. If the object is not null then get the to string value.

Parameters:
o -
defaultValue - The value to return if o is null.
Returns:
The parsed or default value.

getAsInt

protected int getAsInt(Object o,
                       int defaultValue)
Get an integer for the object or use the default value. If the object is a Sting or Integer try to convert the object to an int.

Parameters:
o -
defaultValue - The value to return if o is not a String or Integer.
Returns:
The parsed or default value.