Class QueryUriBuilder
- java.lang.Object
-
- com.sodius.oslc.core.process.query.QueryUriBuilder
-
public class QueryUriBuilder extends Object
A builder that adds OSLC query parameters to URIs.- Since:
- 3.6.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryWhereBuilder
and(String property)
Creates a builder to append the given property, represented as String URI, with aand
operator in the currentoslc.where
expression.QueryWhereBuilder
and(URI property)
Creates a builder to append the given property with aand
operator in the currentoslc.where
expression.QueryWhereBuilder
and(QName property)
Creates a builder to append the given property with aand
operator in the currentoslc.where
expression.URI
build(URI baseUri)
Builds a URI, by completing the given base URI with OSLC query parameters registered on this builder instance.URI
build(UriBuilder builder)
Builds a URI, by completing the given URI builder with OSLC query parameters registered on this builder instance.String
buildPostEntity()
Builds aapplication/x-www-form-urlencoded
body that contains the OSLC query parameters registered on this builder instance.static QueryUriBuilder
create()
Creates a new builder instance.static QueryUriBuilder
create(OslcNamespaces namespaces)
Creates a new builder instance based on the given namespaces.QueryUriBuilder
orderBy(String property, OrderByType type)
Adds a property, represented as a String URI, in theoslc.orderBy
parameter.QueryUriBuilder
orderBy(URI property, OrderByType type)
Adds a property, represented as a URI, in theoslc.orderBy
parameter.QueryUriBuilder
orderBy(QName property, OrderByType type)
Adds a property in theoslc.orderBy
parameter.QueryUriBuilder
pageSize(int pageSize)
Defines the desired page size asoslc.pageSize
parameter.QueryUriBuilder
paging(boolean paging)
Indicates whether paging is to use asoslc.paging
parameter.QueryUriBuilder
prefix(Namespace... namespaces)
Registers prefixes to associate to namespaces, to inject in theoslc.prefix
parameter.QueryUriBuilder
prefix(String prefix, String namespace)
Registers a prefix to associate to a namespace, to inject in theoslc.prefix
parameter.QueryUriBuilder
properties(String... properties)
Adds properties, represented as String URIs, in theoslc.properties
parameter.QueryUriBuilder
properties(URI... properties)
Adds properties, represented as URIs, in theoslc.properties
parameter.QueryUriBuilder
properties(QName... properties)
Adds properties in theoslc.properties
parameter.QueryUriBuilder
searchTerms(String... terms)
Adds search terms in theoslc.searchTerms
parameter.QueryUriBuilder
select(String... properties)
Adds properties, represented as String URIs, in theoslc.select
parameter.QueryUriBuilder
select(URI... properties)
Adds properties, represented as URIs, in theoslc.select
parameter.QueryUriBuilder
select(QName... properties)
Adds properties in theoslc.select
parameter.QueryWhereBuilder
where(String property)
Creates anoslc.where
builder with the given property, represented as String URI.QueryWhereBuilder
where(URI property)
Creates anoslc.where
builder with the given property.QueryWhereBuilder
where(QName property)
Creates anoslc.where
builder with the given property.
-
-
-
Field Detail
-
WILDCARD
public static final QName WILDCARD
The wildcard property ("*"
) that may be used inoslc.select
,oslc.properties
andoslc.where
parameters.
-
-
Method Detail
-
create
public static QueryUriBuilder create()
Creates a new builder instance. The builder will use well-known namespaces for theoslc.prefix
parameter if namespace bindings are not added.- Returns:
- a URI builder
- See Also:
OslcNamespaces.wellKnown()
-
create
public static QueryUriBuilder create(OslcNamespaces namespaces)
Creates a new builder instance based on the given namespaces. The namespaces are used for theoslc.prefix
parameter if namespace bindings are not added.- Parameters:
namespaces
- namespaces to used for theoslc.prefix
parameter- Returns:
- a URI builder
- Throws:
NullPointerException
- if namespaces is null
-
prefix
public QueryUriBuilder prefix(String prefix, String namespace)
Registers a prefix to associate to a namespace, to inject in theoslc.prefix
parameter.- Parameters:
prefix
- the prefix to associate to a namespacenamespace
- a namespace- Returns:
- this builder instance
- Throws:
NullPointerException
- if prefix or namespace is null
-
prefix
public QueryUriBuilder prefix(Namespace... namespaces)
Registers prefixes to associate to namespaces, to inject in theoslc.prefix
parameter.- Parameters:
namespaces
- prefix/namespace bindings- Returns:
- this builder instance
-
where
public QueryWhereBuilder where(QName property)
Creates anoslc.where
builder with the given property.The property must contain a namespace and a local part. It may also contain a prefix which, if present, is automatically registered in the
oslc.prefix
parameter. The property may also beWILDCARD
to match all properties.Calling this method is for initializing the
oslc.where
parameter. Useand(QName)
for adding anotherwhere
term in the expression.- Parameters:
property
- the property to use in inoslc.where
parameter- Returns:
- a new term builder instance
- Throws:
NullPointerException
- if property is null
-
where
public QueryWhereBuilder where(URI property)
Creates anoslc.where
builder with the given property.Calling this method is for initializing the
oslc.where
parameter. Useand(QName)
for adding anotherwhere
term in the expression.- Parameters:
property
- the property to use in inoslc.where
parameter- Returns:
- a new term builder instance
- Throws:
NullPointerException
- if property is nullIllegalArgumentException
- if the URI is not absolute
-
where
public QueryWhereBuilder where(String property)
Creates anoslc.where
builder with the given property, represented as String URI. The property may also be a wildcard ("*"
)Calling this method is for initializing the
oslc.where
parameter. Useand(String)
for adding anotherwhere
term in the expression.- Parameters:
property
- the property to use in inoslc.where
parameter- Returns:
- a new term builder instance
- Throws:
NullPointerException
- if property is nullIllegalArgumentException
- if the URI is not absolute
-
and
public QueryWhereBuilder and(QName property)
Creates a builder to append the given property with aand
operator in the currentoslc.where
expression.The property must contain a namespace and a local part. It may also contain a prefix which, if present, is automatically registered in the
oslc.prefix
parameter.- Parameters:
property
- the property to use in inoslc.where
parameter- Returns:
- a new term builder instance
- Throws:
NullPointerException
- if property is nullIllegalArgumentException
- ifwhere(QName)
was not called first to record a term
-
and
public QueryWhereBuilder and(URI property)
Creates a builder to append the given property with aand
operator in the currentoslc.where
expression.- Parameters:
property
- the property to use in inoslc.where
parameter- Returns:
- a new term builder instance
- Throws:
NullPointerException
- if property is nullIllegalArgumentException
- if the URI is not absolute orwhere(URI)
was not called first to record a term
-
and
public QueryWhereBuilder and(String property)
Creates a builder to append the given property, represented as String URI, with aand
operator in the currentoslc.where
expression. The property may also be a wildcard ("*"
)- Parameters:
property
- the property to use in inoslc.where
parameter- Returns:
- a new term builder instance
- Throws:
NullPointerException
- if property is nullIllegalArgumentException
- if the URI is not absolute orwhere(String)
was not called first to record a term
-
searchTerms
public QueryUriBuilder searchTerms(String... terms)
Adds search terms in theoslc.searchTerms
parameter.- Parameters:
terms
- search terms- Returns:
- this builder instance
-
orderBy
public QueryUriBuilder orderBy(QName property, OrderByType type)
Adds a property in theoslc.orderBy
parameter.The property must contain a namespace and a local part. It may also contain a prefix which, if present, is automatically registered in the
oslc.prefix
parameter.- Parameters:
property
- the property to use inoslc.orderBy
type
- the type of ordering- Returns:
- this builder instance
- Throws:
NullPointerException
- if property or type is null
-
orderBy
public QueryUriBuilder orderBy(URI property, OrderByType type)
Adds a property, represented as a URI, in theoslc.orderBy
parameter.- Parameters:
property
- the property to add inoslc.orderBy
type
- the type of ordering- Returns:
- this builder instance
- Throws:
NullPointerException
- if property or type is nullIllegalArgumentException
- if the URI is not absolute
-
orderBy
public QueryUriBuilder orderBy(String property, OrderByType type)
Adds a property, represented as a String URI, in theoslc.orderBy
parameter.- Parameters:
property
- the property to add inoslc.orderBy
type
- the type of ordering- Returns:
- this builder instance
- Throws:
NullPointerException
- if property or type is nullIllegalArgumentException
- if the URI is not absolute
-
properties
public QueryUriBuilder properties(QName... properties)
Adds properties in theoslc.properties
parameter.The property must contain a namespace and a local part. It may also contain a prefix which, if present, is automatically registered in the
oslc.prefix
parameter. The property may also beWILDCARD
to select all properties.- Parameters:
properties
- properties to add inoslc.properties
- Returns:
- this builder instance
- Throws:
IllegalArgumentException
- if the QNames do not have a namespace and local part
-
properties
public QueryUriBuilder properties(URI... properties)
Adds properties, represented as URIs, in theoslc.properties
parameter.- Parameters:
properties
- properties to add inoslc.properties
- Returns:
- this builder instance
- Throws:
IllegalArgumentException
- if the URIs are not absolute
-
properties
public QueryUriBuilder properties(String... properties)
Adds properties, represented as String URIs, in theoslc.properties
parameter. The property may also be a wildcard ("*"
)- Parameters:
properties
- properties to add inoslc.properties
- Returns:
- this builder instance
- Throws:
IllegalArgumentException
- if the URIs are not absolute
-
select
public QueryUriBuilder select(QName... properties)
Adds properties in theoslc.select
parameter.The property must contain a namespace and a local part. It may also contain a prefix which, if present, is automatically registered in the
oslc.prefix
parameter. The property may also beWILDCARD
to select all properties.- Parameters:
properties
- properties to add inoslc.select
- Returns:
- this builder instance
- Throws:
IllegalArgumentException
- if the QNames do not have a namespace and local part
-
select
public QueryUriBuilder select(URI... properties)
Adds properties, represented as URIs, in theoslc.select
parameter.- Parameters:
properties
- properties to add inoslc.select
- Returns:
- this builder instance
- Throws:
IllegalArgumentException
- if the URIs are not absolute
-
select
public QueryUriBuilder select(String... properties)
Adds properties, represented as String URIs, in theoslc.select
parameter. The property may also be a wildcard ("*"
)- Parameters:
properties
- properties to add inoslc.select
- Returns:
- this builder instance
- Throws:
IllegalArgumentException
- if the URIs are not absolute
-
paging
public QueryUriBuilder paging(boolean paging)
Indicates whether paging is to use asoslc.paging
parameter. Settingfalse
removes the current page size, if any.- Parameters:
paging
-true
to use paging,false
otherwise- Returns:
- this builder instance
-
pageSize
public QueryUriBuilder pageSize(int pageSize)
Defines the desired page size asoslc.pageSize
parameter. Setting a page size also setsoslc.paging
totrue
.- Parameters:
pageSize
- the desired page size.- Returns:
- this builder instance
-
build
public URI build(URI baseUri)
Builds a URI, by completing the given base URI with OSLC query parameters registered on this builder instance.- Parameters:
baseUri
- the URI on which to append query parameters- Returns:
- the URI including OSLC query parameters.
- Throws:
NullPointerException
- if baseUri is null- See Also:
ExecuteQuery.get(com.sodius.oslc.client.OslcClient, URI, Class)
-
build
public URI build(UriBuilder builder)
Builds a URI, by completing the given URI builder with OSLC query parameters registered on this builder instance.- Parameters:
builder
- the builder on which to append query parameters- Returns:
- the URI including OSLC query parameters.
- Throws:
NullPointerException
- if builder is null- See Also:
ExecuteQuery.get(com.sodius.oslc.client.OslcClient, URI, Class)
-
buildPostEntity
public String buildPostEntity()
Builds aapplication/x-www-form-urlencoded
body that contains the OSLC query parameters registered on this builder instance. This body is to be used as aPOST
request entity on a query capability, when parameters are too long for aGET
request.- Returns:
- a
application/x-www-form-urlencoded
body including OSLC query parameters. - See Also:
ExecuteQuery.post(com.sodius.oslc.client.OslcClient, URI, String, Class)
-
-