com.ibm.ram.client
Class RAMAssetQueryBuilder

java.lang.Object
  extended by com.ibm.ram.common.data.SearchQuery
      extended by com.ibm.ram.client.RAMQueryBuilder
          extended by com.ibm.ram.client.RAMAssetQueryBuilder

public class RAMAssetQueryBuilder
extends RAMQueryBuilder

Constructs query strings to be used by the RAMSession.fetchAssets() method.

Since:
7.1
Author:
kbauer

Field Summary
 java.lang.String QUERY_ATTRIBUTE_NAME
          Adding this field will return results where assets match the field asset attribute name By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.
 java.lang.String QUERY_ATTRIBUTE_VALUE
          Adding this field will return results where assets match the field asset attribute value By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.
 java.lang.String QUERY_FIELD_ATTRIBUTE
          Adding this field will return results where assets match the field asset attribute key value pair For asset attributes your query value should be in the form attributeName=attributeValue For XML searching use the form element[attribute1Name=attributeValue and attribute2Name=attribute2Value] By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.
 java.lang.String QUERY_FIELD_DATE
          Adding this field will return results where assets match the Last modified date provided.
 java.lang.String QUERY_FIELD_DBID
          Adding this field will return results where assets match the internal database id provided.
 java.lang.String QUERY_FIELD_DESCRIPTION
          Adding this field will return results where assets match the description provided.
 java.lang.String QUERY_FIELD_GUID
          Adding this field will return results where assets match the GUID provided.
 java.lang.String QUERY_FIELD_NAME
          Adding this field will return results where assets match the name.
 java.lang.String QUERY_FIELD_OWNER
          Adding this field will return results where assets match the owner id provided.
 java.lang.String QUERY_FIELD_RATING
          Adding this field will return results where assets match the rating provided.
 java.lang.String QUERY_FIELD_STATE
          Adding this field will return results where assets match the state.
 java.lang.String QUERY_FIELD_VERSION
          Adding this field will return results where assets match the field version.
 java.lang.String SORT_BY_FIELD_COMMUNITY_NAME
          Constant used by the sortByField property to sort the search results by community name.
 java.lang.String SORT_BY_FIELD_GUID
          Constant used by the sortByField property to sort the search results by asset GUID.
 java.lang.String SORT_BY_FIELD_LAST_MODIFIED
          Constant used by the sortByField property to sort the search results by last modified date.
 java.lang.String SORT_BY_FIELD_NAME
          Constant used by the sortByField property to sort the search results by asset name.
 java.lang.String SORT_BY_FIELD_RATING
          Constant used by the sortByField property to sort the search results by asset rating.
 java.lang.String SORT_BY_FIELD_RELEVANCE
          Constant used by the sortByField property to sort the search results by relevance.
 java.lang.String SORT_BY_FIELD_STATE
          Constant used by the sortByField property to sort the search results by asset state.
 java.lang.String SORT_BY_FIELD_VERSION
          Constant used by the sortByField property to sort the search results by asset version.
 
Fields inherited from class com.ibm.ram.client.RAMQueryBuilder
AND_OPERATOR, OR_OPERATOR, QUERY_FIELD_TEXT, UNLIMITED_RESULTS
 
Fields inherited from class com.ibm.ram.common.data.SearchQuery
SEARCH_WITHIN_ARTIFACTS_FLAG, SEARCH_WITHIN_FORUMS_FLAG, SYNCHRONIZED_SEARCH_FLAG
 
Constructor Summary
RAMAssetQueryBuilder(RAMSession session)
          Construct a new QueryBuilder for a given RAMSession
 
Method Summary
 void addQueryField(java.lang.String queryField, java.lang.String value)
          Add a query field and and value to this search query.
 void addQueryTextField(java.lang.String queryText)
          Add a query text part The value will be escaped to pull out Lucene reserved characters.
 void addSearchFilter(AssetRating rating)
          Filter results to only assets that are in with a certain rating
 void addSearchFilter(AssetTag tag)
          Filter results to only assets that are in with a certain tag
 void addSearchFilter(AssetType assetType)
          Filter results to only assets that are in a certain asset type
 void addSearchFilter(CategorySchema categorySchema)
          Filter results to only assets that are categorized by a specific category schema
 void addSearchFilter(Category category, java.lang.String categorization)
          Filter results to only assets that have a certain categorization
 void addSearchFilter(CommunityInformation community)
          Filter results to only assets that are in a certain community
protected  void addSearchFilter(SearchFilterItem searchFilterItem)
           
 void addSearchFilter(State state)
          Filter results to only assets that are in a certain state
 void addSearchFilter(java.lang.String filterName, java.lang.String filterItem)
          Add a specific filter with the internal RAM filter id and the value for the filter.
 void addSearchFilter(SubCategory subcategory)
          Filter results to only assets that are in a sub-category.
 void clearQueryFields()
          Clear out the set query fields.
 void clearSearchFilters()
          Clear out the set search filters.
 java.lang.String createQueryFieldText(java.lang.String queryField, java.lang.String value)
          Creates a Search Text part that may be added to this query through the addQueryTextField() This method will escape the Lucene characters by default.
 RAMSearchFilter[] getAllSearchFilters()
          Return a list of search filters set on this query.
 java.lang.String getQueryString()
          Returns the search query as a String.
 RAMSearchFilter getSearchFilter(java.lang.String filterName)
          Returns a search filter with selectable items that may be selected to limit the search results
 SearchFilterItem[] getSelectedFilters()
          Return a list of the selected FilterItems in this Query.
protected  void invalidateQuery()
           
 java.lang.String toString()
           
 
Methods inherited from class com.ibm.ram.client.RAMQueryBuilder
isMatchAnyQueryField, setMatchAnyField, setQueryString
 
Methods inherited from class com.ibm.ram.common.data.SearchQuery
escapeLuceneCharacters, getMaxResults, getResultsStartIndex, getSearchModes, getSortByField, isSortAscending, isThisSearchRecorded, setMaxResults, setResultsStartIndex, setSearchModes, setSortAscending, setSortByField, setThisSearchRecorded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_FIELD_GUID

public java.lang.String QUERY_FIELD_GUID
Adding this field will return results where assets match the GUID provided. By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.

Since:
7.1

QUERY_FIELD_DATE

public java.lang.String QUERY_FIELD_DATE
Adding this field will return results where assets match the Last modified date provided. By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.

Since:
7.1

QUERY_FIELD_DBID

public java.lang.String QUERY_FIELD_DBID
Adding this field will return results where assets match the internal database id provided. By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.

Since:
7.1

QUERY_FIELD_DESCRIPTION

public java.lang.String QUERY_FIELD_DESCRIPTION
Adding this field will return results where assets match the description provided. By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.

Since:
7.1

QUERY_FIELD_NAME

public java.lang.String QUERY_FIELD_NAME
Adding this field will return results where assets match the name. By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.

Since:
7.1

QUERY_FIELD_OWNER

public java.lang.String QUERY_FIELD_OWNER
Adding this field will return results where assets match the owner id provided. By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.

Since:
7.1

QUERY_FIELD_RATING

public java.lang.String QUERY_FIELD_RATING
Adding this field will return results where assets match the rating provided. By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.

Since:
7.1

QUERY_FIELD_STATE

public java.lang.String QUERY_FIELD_STATE
Adding this field will return results where assets match the state. By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.

Since:
7.1

QUERY_FIELD_VERSION

public java.lang.String QUERY_FIELD_VERSION
Adding this field will return results where assets match the field version. By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.

Since:
7.1

QUERY_ATTRIBUTE_NAME

public java.lang.String QUERY_ATTRIBUTE_NAME
Adding this field will return results where assets match the field asset attribute name By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.


QUERY_ATTRIBUTE_VALUE

public java.lang.String QUERY_ATTRIBUTE_VALUE
Adding this field will return results where assets match the field asset attribute value By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.


QUERY_FIELD_ATTRIBUTE

public java.lang.String QUERY_FIELD_ATTRIBUTE
Adding this field will return results where assets match the field asset attribute key value pair For asset attributes your query value should be in the form attributeName=attributeValue For XML searching use the form element[attribute1Name=attributeValue and attribute2Name=attribute2Value] By default it will be anded with the other added search fields (only return results that match all the query fields) you may set the matchAnyField to or return results that match and query field.


SORT_BY_FIELD_COMMUNITY_NAME

public java.lang.String SORT_BY_FIELD_COMMUNITY_NAME
Constant used by the sortByField property to sort the search results by community name.

Since:
7.1
See Also:
SearchQuery.setSortByField(String), SearchQuery.getSortByField()

SORT_BY_FIELD_LAST_MODIFIED

public java.lang.String SORT_BY_FIELD_LAST_MODIFIED
Constant used by the sortByField property to sort the search results by last modified date.

Since:
7.1
See Also:
SearchQuery.setSortByField(String), SearchQuery.getSortByField()

SORT_BY_FIELD_NAME

public java.lang.String SORT_BY_FIELD_NAME
Constant used by the sortByField property to sort the search results by asset name.

Since:
7.1
See Also:
SearchQuery.setSortByField(String), SearchQuery.getSortByField()

SORT_BY_FIELD_GUID

public java.lang.String SORT_BY_FIELD_GUID
Constant used by the sortByField property to sort the search results by asset GUID.

Since:
7.1
See Also:
SearchQuery.setSortByField(String), SearchQuery.getSortByField()

SORT_BY_FIELD_RATING

public java.lang.String SORT_BY_FIELD_RATING
Constant used by the sortByField property to sort the search results by asset rating.

Since:
7.1
See Also:
SearchQuery.setSortByField(String), SearchQuery.getSortByField()

SORT_BY_FIELD_RELEVANCE

public java.lang.String SORT_BY_FIELD_RELEVANCE
Constant used by the sortByField property to sort the search results by relevance.

Since:
7.1
See Also:
SearchQuery.setSortByField(String), SearchQuery.getSortByField()

SORT_BY_FIELD_STATE

public java.lang.String SORT_BY_FIELD_STATE
Constant used by the sortByField property to sort the search results by asset state.

Since:
7.1
See Also:
SearchQuery.setSortByField(String), SearchQuery.getSortByField()

SORT_BY_FIELD_VERSION

public java.lang.String SORT_BY_FIELD_VERSION
Constant used by the sortByField property to sort the search results by asset version.

Since:
7.1
See Also:
SearchQuery.setSortByField(String), SearchQuery.getSortByField()
Constructor Detail

RAMAssetQueryBuilder

public RAMAssetQueryBuilder(RAMSession session)
Construct a new QueryBuilder for a given RAMSession

Parameters:
session -
Since:
7.1
Method Detail

addQueryTextField

public void addQueryTextField(java.lang.String queryText)
Add a query text part The value will be escaped to pull out Lucene reserved characters.

Parameters:
queryText -
Since:
7.1

addQueryField

public void addQueryField(java.lang.String queryField,
                          java.lang.String value)
Add a query field and and value to this search query. The value will be escaped to pull out Lucene reserved characters.

Parameters:
queryField -
value -
Since:
7.1

clearQueryFields

public void clearQueryFields()
Clear out the set query fields.

Since:
7.1

clearSearchFilters

public void clearSearchFilters()
Clear out the set search filters.

Since:
7.1

getQueryString

public java.lang.String getQueryString()
Returns the search query as a String. This String can be passed to RAMSession#createAssetQuery() to return a hydrated query.

Overrides:
getQueryString in class SearchQuery
Returns:
Returns the queryString.
Since:
7.1
See Also:
RAMSession.createAssetQuery(String)

getSelectedFilters

public SearchFilterItem[] getSelectedFilters()
Return a list of the selected FilterItems in this Query.

Since:
7.1

createQueryFieldText

public java.lang.String createQueryFieldText(java.lang.String queryField,
                                             java.lang.String value)
Creates a Search Text part that may be added to this query through the addQueryTextField() This method will escape the Lucene characters by default.

Parameters:
queryField -
value -
Returns:
Since:
7.1
See Also:
addQueryTextField(String), RAMAssetQueryBuilder#addQueryTextField(String, boolean)

getAllSearchFilters

public RAMSearchFilter[] getAllSearchFilters()
                                      throws RAMRuntimeException
Return a list of search filters set on this query.

Throws:
com.ibm.ram.client.RAMRuntimeException
RAMRuntimeException
Since:
7.1

getSearchFilter

public RAMSearchFilter getSearchFilter(java.lang.String filterName)
                                throws RAMRuntimeException
Returns a search filter with selectable items that may be selected to limit the search results

Parameters:
name -
Throws:
RAMRuntimeException
Since:
7.1

addSearchFilter

protected void addSearchFilter(SearchFilterItem searchFilterItem)

addSearchFilter

public void addSearchFilter(java.lang.String filterName,
                            java.lang.String filterItem)
Add a specific filter with the internal RAM filter id and the value for the filter.

Parameters:
filterName -
filterItem -
Since:
7.1

addSearchFilter

public void addSearchFilter(CategorySchema categorySchema)
Filter results to only assets that are categorized by a specific category schema

Parameters:
categorySchema -
Since:
7.1

addSearchFilter

public void addSearchFilter(Category category,
                            java.lang.String categorization)
Filter results to only assets that have a certain categorization

Parameters:
category -
categorization -
Since:
7.1

addSearchFilter

public void addSearchFilter(State state)
Filter results to only assets that are in a certain state

Parameters:
state -
Since:
7.1

addSearchFilter

public void addSearchFilter(AssetType assetType)
Filter results to only assets that are in a certain asset type

Parameters:
assetType -
Since:
7.1

addSearchFilter

public void addSearchFilter(CommunityInformation community)
Filter results to only assets that are in a certain community

Parameters:
community -
Since:
7.1

addSearchFilter

public void addSearchFilter(AssetTag tag)
Filter results to only assets that are in with a certain tag

Parameters:
tag -
Since:
7.1

addSearchFilter

public void addSearchFilter(AssetRating rating)
Filter results to only assets that are in with a certain rating

Parameters:
rating -
Since:
7.1

addSearchFilter

public void addSearchFilter(SubCategory subcategory)
Filter results to only assets that are in a sub-category.

Parameters:
subcategory -
Since:
7.1

invalidateQuery

protected void invalidateQuery()
Specified by:
invalidateQuery in class RAMQueryBuilder

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object