org.gcube.opensearch.opensearchlibrary.query
Class BasicURLTemplate

java.lang.Object
  extended by org.gcube.opensearch.opensearchlibrary.query.BasicURLTemplate
All Implemented Interfaces:
URLTemplate

public class BasicURLTemplate
extends Object
implements URLTemplate

Class implementing the URLTemplate interface

Author:
gerasimos.farantatos

Nested Class Summary
protected static class BasicURLTemplate.Parameter
          Class representing a query parameter, containing the qualified name of the parameter and information about whether the parameter is required or not
 
Field Summary
protected  List<BasicURLTemplate.Parameter> parameters
           
protected  String template
           
 
Constructor Summary
BasicURLTemplate(String template, Map<String,String> nsPrefixes)
          Creates a new BasicURLTemplate object
 
Method Summary
 List<String> getOptionalParameters()
          Returns a list containing the qualified names of all optional parameters contained in the template
 List<String> getRequiredParameters()
          Returns a list containing the qualified names of all required parameters contained in the template
 String getTemplate()
          Returns the query template
 boolean hasParameter(String name)
          Determines if the template contains a parameter with a given qualified name
 boolean isParameterRequired(String name)
          Determines if a parameter with a given qualified name is a required parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

template

protected String template

parameters

protected List<BasicURLTemplate.Parameter> parameters
Constructor Detail

BasicURLTemplate

public BasicURLTemplate(String template,
                        Map<String,String> nsPrefixes)
                 throws Exception
Creates a new BasicURLTemplate object

Parameters:
template - The query template that will be used
nsPrefixes - The mapping from namespace URIs to namespace prefixes for all namespaces contained in a description document
Throws:
Exception - If a parameter namespace URI is not present in the description document or in case of other error
Method Detail

getRequiredParameters

public List<String> getRequiredParameters()
Returns a list containing the qualified names of all required parameters contained in the template

Specified by:
getRequiredParameters in interface URLTemplate
Returns:
A list of all required parameters of the template
See Also:
URLTemplate.getRequiredParameters()

getOptionalParameters

public List<String> getOptionalParameters()
Returns a list containing the qualified names of all optional parameters contained in the template

Specified by:
getOptionalParameters in interface URLTemplate
Returns:
A list of all optional parameters of the template
See Also:
URLTemplate.getOptionalParameters()

isParameterRequired

public boolean isParameterRequired(String name)
                            throws NonExistentParameterException
Determines if a parameter with a given qualified name is a required parameter

Specified by:
isParameterRequired in interface URLTemplate
Parameters:
name - The qualified name of the parameter
Returns:
true if the parameter is required, false otherwise
Throws:
NonExistentParameterException - If the parameter is not found among the parameters contained in the template
See Also:
URLTemplate.isParameterRequired(String)

hasParameter

public boolean hasParameter(String name)
Determines if the template contains a parameter with a given qualified name

Specified by:
hasParameter in interface URLTemplate
Parameters:
name - The qualified name of the parameter
Returns:
true if the parameter is contained in the template, false otherwise
See Also:
URLTemplate.hasParameter(String)

getTemplate

public String getTemplate()
Returns the query template

Specified by:
getTemplate in interface URLTemplate
Returns:
The query template
See Also:
URLTemplate.getTemplate()


Copyright © 2013. All Rights Reserved.