com.fatwire.agent
Class Query

java.lang.Object
  extended by com.fatwire.agent.Query

public class Query
extends java.lang.Object

Query class.

Queries are used to search for items in repositories. The following example retrieves the first level of folders inside a repository (assume session is a valid reference to IProviderSession).

      IRepository repository = session.GetRepositoryByID("1");
      QueryPtr query = new Query(0, QueryItemType.Folders);
      List items = repository.getTopFolder().search(query);
 


Constructor Summary
Query()
          Constructor.
Query(int depth, QueryItemType type)
          Constructor.
Query(java.lang.String keywords, boolean allwords, int depth, QueryItemType type)
          Constructs a query to search items by keywords of certain type from certain depth.
 
Method Summary
 void addAssetType(java.lang.String assettypeid, java.util.List<java.lang.String> descriptors)
          Adds a new asset type with all descriptors into this query.
 java.util.List<java.lang.String> getAssetTypes()
          Retrieves the list of asset type in this Query object.
 int getDepth()
          Gets query search depth: 0 means just the upper level of items, 1 means two levels and so on.
 java.util.List<java.lang.String> getDescriptors(java.lang.String assettypeid)
          Retrieves the list of descriptors belonging to the asset type specified.
 QueryItemType getItemType()
          Item type to search for: asset, folders or both.
 java.lang.String getKeywords()
          Search words.
 boolean isAllwords()
          Whether to search for all words within a query or for just one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Query

public Query()
Constructor. Constructs an empty query.


Query

public Query(int depth,
             QueryItemType type)
Constructor. Constructs a query to retrieve items of certain type from certain depth.

Parameters:
depth - depth to query. 0 means just one level, 1 means two levels and so on.
type - type of items to return: assets, folders or both.

Query

public Query(java.lang.String keywords,
             boolean allwords,
             int depth,
             QueryItemType type)
Constructs a query to search items by keywords of certain type from certain depth.

Parameters:
keywords - used to limit the number of items by words in their metadata.
allwords - if true to search for occurences of all words within keywords or for just one.
depth - depth to query. 0 means just one level, 1 means two levels and so on.
type - type of items to return: assets, folders or both.
Method Detail

getDepth

public int getDepth()
Gets query search depth: 0 means just the upper level of items, 1 means two levels and so on.

Returns:
search depth.

getItemType

public QueryItemType getItemType()
Item type to search for: asset, folders or both.

Returns:
query item type.

getKeywords

public java.lang.String getKeywords()
Search words.

Returns:
query search words.

isAllwords

public boolean isAllwords()
Whether to search for all words within a query or for just one.

Returns:
whether all words are searched.

addAssetType

public void addAssetType(java.lang.String assettypeid,
                         java.util.List<java.lang.String> descriptors)
Adds a new asset type with all descriptors into this query. This asset type (with its descriptors) will be used when {@link IItem. method is performed against an externals system instead of a default one. The primary benefit if such a behavior is to limit the number of descriptors retrieved or specify asset type definitions for those systems where we can't deduce that.

Parameters:
assettypeid - identifier of an asset type.
descriptors - descritor identifiers belonging to this asset type.

getAssetTypes

public java.util.List<java.lang.String> getAssetTypes()
Retrieves the list of asset type in this Query object. These asset types can be passed to getDescriptors() method to retrieve descriptors. See addAssetType() method for further details.

Returns:
the list of asset types.

getDescriptors

public java.util.List<java.lang.String> getDescriptors(java.lang.String assettypeid)
                                                throws NotFoundException
Retrieves the list of descriptors belonging to the asset type specified. This asset type is retrieved by getAssetTypes() method. See addAssetType() method for further details.

Parameters:
assettypeid - asset type identifier.
Returns:
the list of descriptors.
Throws:
NotFoundException - if the requested asset type is not present in this query.