org.gcube.opensearch.opensearchlibrary.query.extensions.sru
Class SRUQueryBuilder
java.lang.Object
org.gcube.opensearch.opensearchlibrary.query.QueryBuilderDecorator
org.gcube.opensearch.opensearchlibrary.query.extensions.sru.SRUQueryBuilder
- All Implemented Interfaces:
- QueryBuilder
public class SRUQueryBuilder
- extends QueryBuilderDecorator
| Methods inherited from class org.gcube.opensearch.opensearchlibrary.query.QueryBuilderDecorator |
getOptionalParameters, getParameterValue, getRawTemplate, getRequiredParameters, getStartIndexDef, getStartPageDef, getUnsetParameters, hasParameter, isParameterSet, isQueryComplete, setParameter |
SRUQueryBuilder
public SRUQueryBuilder(QueryBuilder qb)
throws Exception
- Throws:
Exception
clone
public QueryBuilder clone()
- Description copied from interface:
QueryBuilder
- Returns a copy of this query builder
- Specified by:
clone in interface QueryBuilder- Overrides:
clone in class QueryBuilderDecorator
- Returns:
- A new query builder whose state is the same as this instance
setParameter
public SRUQueryBuilder setParameter(String name,
String value)
throws NonExistentParameterException,
Exception
- Assigns a string value to a parameter of the query builder
- Specified by:
setParameter in interface QueryBuilder- Overrides:
setParameter in class QueryBuilderDecorator
- Parameters:
name - The qualified name of the parametervalue - The value to be assigned to the parameter
- Returns:
- The query builder with the parameter value assigned to the parameter
- Throws:
NonExistentParameterException - If the parameter is not contained in the parameter set of the query builder
Exception - In case of other error- See Also:
QueryBuilder.setParameter(String, String)
setParameters
public SRUQueryBuilder setParameters(List<String> names,
List<Object> values)
throws NonExistentParameterException,
Exception
- Assigns to each parameter contained in the list of the first argument the respective value contained in the list of the secord argument
- Specified by:
setParameters in interface QueryBuilder- Overrides:
setParameters in class QueryBuilderDecorator
- Parameters:
names - A list of parameter qualified namesvalues - A list of parameter values to be assigned to the respective parameter
- Returns:
- The query builder with the values assigned to the parameters
- Throws:
NonExistentParameterException - If a parameter of the list is not contained in the parameter of the query builder
Exception - In case of other error- See Also:
QueryBuilder.setParameters(List, List)
getQuery
public String getQuery()
throws IncompleteQueryException,
MalformedQueryException,
Exception
- Retrieves the search query corresponding to the current state of the query builder
- Specified by:
getQuery in interface QueryBuilder- Overrides:
getQuery in class QueryBuilderDecorator
- Returns:
- The search query
- Throws:
IncompleteQueryException - If the query is not complete, i.e. there still exist unset required parameters
MalformedQueryException - If the query is malformed, e.g. if a parameter value is not of the correct form
Exception - In case of other error- See Also:
QueryBuilder.getQuery()
setParameters
public QueryBuilder setParameters(QueryElement queryEl)
throws NonExistentParameterException,
Exception
- Sets all parameters of the query builder that are also contained in the QueryElement provided with the values contained in the QueryElement
- Specified by:
setParameters in interface QueryBuilder- Overrides:
setParameters in class QueryBuilderDecorator
- Parameters:
queryEl - The query element which will be used to assign values to the parameters of the query builder
- Returns:
- The query builder with the QueryElement's values assigned
- Throws:
Exception - In case of error
NonExistentParameterException- See Also:
QueryBuilder.setParameters(QueryElement)
main
public static void main(String[] args)
throws Exception
- Throws:
Exception
Copyright © 2013. All Rights Reserved.