com.endeca.portal.metadata.query
Class MetadataQuery<T extends com.liferay.portal.model.BaseModel>

java.lang.Object
  extended by com.endeca.portal.metadata.query.MetadataQuery<T>
Type Parameters:
T - the class of the Liferay record(s) to be retrieved
Direct Known Subclasses:
MetadataObjectQuery, MetadataPropertyQuery

public abstract class MetadataQuery<T extends com.liferay.portal.model.BaseModel>
extends java.lang.Object

Base abstract class for issuing metadata queries to the portal database. This class provides basic getters and setters for all metadata fields with the following abstract methods intended to be implemented by a subclass:

Author:
Endeca Technologies, Inc.

Field Summary
static java.lang.String FIELD_NAME_DESCRIPTION
           
static java.lang.String FIELD_NAME_FEATURE
           
static java.lang.String FIELD_NAME_KEY
           
static java.lang.String FIELD_NAME_LAST_UPDATED
           
static java.lang.String FIELD_NAME_LOCALE
           
static java.lang.String FIELD_NAME_OBJECT_ID
           
static java.lang.String FIELD_NAME_REL
           
static java.lang.String FIELD_NAME_SOURCE
           
static java.lang.String FIELD_NAME_TYPE
           
static java.lang.String FIELD_NAME_VALUE
           
protected  com.liferay.portal.kernel.dao.orm.DynamicQuery query
           
 
Constructor Summary
MetadataQuery()
          Constructs an empty metadata query
 
Method Summary
abstract  java.util.List<T> execute()
          Executes the DynamicQuery and return objects that are instances of a class extending Liferay's base record model class BaseModel.
abstract  void initDynamicQuery()
          Initializes the DynamicQuery with the name of a backing Liferay record class.
 void setDescription(java.lang.String description)
          Adds criteria to the query: the value of the "description" field TODO: wildcard/text search possible and useful?
 void setFeature(java.lang.String feature)
          Adds criteria to the query: the value of the "feature" field
 void setKey(java.lang.String key)
          Adds criteria to the query: the value of the "key" field
 void setLocale(java.lang.String locale)
          Adds criteria to the query: the value of the "locale" field
 void setObjectId(long objectId)
          Adds criteria to the query: the value of the "metadataObjectID" field
 void setOrderAsc(java.lang.String orderField)
          Orders this query ascending by the specified field; use one of the field constants on this class as the orderField
 void setOrderDesc(java.lang.String orderField)
          Orders this query descending by the specified field; use one of the field constants on this class as the orderField
 void setRel(java.lang.String rel)
          Adds criteria to the query: the value of the "rel" field
 void setSource(java.lang.String source)
          Adds criteria to the query: the value of the "source" field
 void setType(java.lang.String type)
          Adds criteria to the query: the value of the "type" field
 void setValue(java.lang.String value)
          Adds criteria to the query: the value of the "value" field
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELD_NAME_OBJECT_ID

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

FIELD_NAME_KEY

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

FIELD_NAME_REL

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

FIELD_NAME_VALUE

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

FIELD_NAME_FEATURE

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

FIELD_NAME_TYPE

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

FIELD_NAME_LOCALE

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

FIELD_NAME_SOURCE

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

FIELD_NAME_DESCRIPTION

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

FIELD_NAME_LAST_UPDATED

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

query

protected com.liferay.portal.kernel.dao.orm.DynamicQuery query
Constructor Detail

MetadataQuery

public MetadataQuery()
Constructs an empty metadata query

Method Detail

initDynamicQuery

public abstract void initDynamicQuery()
Initializes the DynamicQuery with the name of a backing Liferay record class. For example: super.query = DynamicQueryFactoryUtil.forClass(MetadataRecord.class, PortalClassLoaderUtil.getClassLoader());


execute

public abstract java.util.List<T> execute()
                                                                              throws MetadataQueryException
Executes the DynamicQuery and return objects that are instances of a class extending Liferay's base record model class BaseModel.

Returns:
a list of Liferay records
Throws:
MetadataQueryException

setObjectId

public void setObjectId(long objectId)
Adds criteria to the query: the value of the "metadataObjectID" field

Parameters:
objectId - the object ID to look for

setKey

public void setKey(java.lang.String key)
Adds criteria to the query: the value of the "key" field

Parameters:
key - the key to look for

setRel

public void setRel(java.lang.String rel)
Adds criteria to the query: the value of the "rel" field

Parameters:
rel - the rel to look for

setValue

public void setValue(java.lang.String value)
Adds criteria to the query: the value of the "value" field

Parameters:
value - the value to look for

setFeature

public void setFeature(java.lang.String feature)
Adds criteria to the query: the value of the "feature" field

Parameters:
feature - the feature to look for

setType

public void setType(java.lang.String type)
Adds criteria to the query: the value of the "type" field

Parameters:
type - the type to look for

setLocale

public void setLocale(java.lang.String locale)
Adds criteria to the query: the value of the "locale" field

Parameters:
locale - the locale to look for

setSource

public void setSource(java.lang.String source)
Adds criteria to the query: the value of the "source" field

Parameters:
source - the source to look for

setDescription

public void setDescription(java.lang.String description)
Adds criteria to the query: the value of the "description" field TODO: wildcard/text search possible and useful?

Parameters:
description - the description to look for

setOrderAsc

public void setOrderAsc(java.lang.String orderField)
Orders this query ascending by the specified field; use one of the field constants on this class as the orderField

Parameters:
orderField - the field to use for ordering

setOrderDesc

public void setOrderDesc(java.lang.String orderField)
Orders this query descending by the specified field; use one of the field constants on this class as the orderField

Parameters:
orderField - the field to use for ordering