com.fatwire.assetapi.query
Interface Query

All Known Implementing Classes:
SimpleQuery

public interface Query

Query is an abstract construct that defines user's request for asset's data, just like SQL, expect that Query is an object oriented representation.

Using Query one would be able to specify Conditions or matching criterion to limit the assets returned as well as the sorting order in which the results are to be read. A Query also limits the number of attributes to be read. Limiting the Query to contain only a few attributes limit the limits the amount of data that has to be read into memory.

Query also contains an accessory set of properties, QueryProperties. QueryProperties can be used, among other things, to specify the type of query algorithm to use.

Two different algorithms exist in Asset framework, one using the generic asset infrastructure (called ‘generic/basic query’) and another using AssetSets and Search States (called flex query). Please note that it is possible to use the generic/basic search for flex assets as well as basic assets, however flex query only works for flex assets.

Each of these algorithms have specific capabilities and limitations. Although Asset API seeks to unify the querying mechanism and eventually let the API user not be concerned about the choice of this algorithm. However at the present time, since there is no equivalence between these algorithms, user needs to specify the algorithm in order to use a specific capability. Reasonable defauls exist based on the type of asset.

QueryProperties.setIsBasicSearch( true ) sets the search algorithm to generic/basic search for this query. It is set to false by default. For basic assets, this setting does not matter.

Very simply put, if you want to search for basic attributes of a flex asset type, use basic/generic search. Otherwise use default.

While the above rule works for most queries one encounters, the following section gives more precise considerations.

Basic/generic query:


Flex query:

Depending on the type of query being performed, there are further restrictions on what type of operation is allowed for a given data type.

In general, flex type query (which is the default for flex assets) only allows the following OpTypeEnums; LIKE, EQUALS, BETWEEN and RICHTEXT. Note that these are the same operations available from AssetSet/SearchState tags.

If you want to use other OpTypeEnums, you have to use basic/generic query (by setting QueryProperties.setIsBasicSearch( true )). Such a query of course has to adhere to the basic query rules above.

Here is the allowed set of operations per data type (single valued or multi valued) for basic/generic query.
Operations permitted for basic/generic query:

EQUALS
NOT_EQUALS
LIKE
GREATER_THAN LESS_THAN
BETWEEN
RICHTEXT
INT
Y
Y
N
Y
Y
N
N
FLOAT
Y
Y
N
Y
Y
N
N
STRING
Y
Y
Y
Y
Y
N
N
DATE
Y
Y
N
Y
Y
N
N
MONEY
Y
Y
N
Y
Y
N
N
LONG
Y
Y
N
Y
Y
N
N
LARGE_TEXT
N
N
Y
N
N
N
N
ASSET
Y
Y
N
N
N
N
N
BLOB
N
N
N
N
N
N
N

Operations permitted for flex query:

EQUALS
NOT_EQUALS
LIKE
GREATER_THAN LESS_THAN
BETWEEN
RICHTEXT
INT
Y
N
N
N
N
Y
N
FLOAT
Y
N
N
N
N
Y
N
STRING
Y
N
Y
N
N
Y
N
DATE
Y
N
N
N
N
Y
N
MONEY
Y
N
N
N
N
Y
N
LONG
Y
N
N
N
N
Y
N
LARGE_TEXT
N
N
Y
N
N
N
Y
ASSET
Y
N
N
N
N
Y
N
BLOB
N
N
N
N
N
N
Y


Method Summary
 java.lang.String getAssetType()
          Returns asset type this query is built for
 java.util.List<java.lang.String> getAttributeNames()
          Lists name of the attributes requested in the Query
 Condition getCondition()
          Returns Condition for this Query, if any,
 QueryProperties getProperties()
          Returns properties associated with Query
 java.util.List<SortOrder> getSortOrder()
          Returns list of SortOrders.
 java.lang.String getSubtype()
           
 

Method Detail

getAssetType

java.lang.String getAssetType()
Returns asset type this query is built for

Returns:
Name of the asset type this Query is built for

getSubtype

java.lang.String getSubtype()
Returns:
subtype

getCondition

Condition getCondition()
Returns Condition for this Query, if any,

Returns:
Condition used to build this Query

getAttributeNames

java.util.List<java.lang.String> getAttributeNames()
Lists name of the attributes requested in the Query

Returns:
List of attribute names

getSortOrder

java.util.List<SortOrder> getSortOrder()
Returns list of SortOrders.

Returns:
List of SortOrders

getProperties

QueryProperties getProperties()
Returns properties associated with Query

Returns:
arbitrary properties associated with Query