public class QueryImpl extends Object implements Query, ResourceInstance
Constructor and Description |
---|
QueryImpl(Map<Resource.Type,String> keyValueMap,
ResourceDefinition resourceDefinition,
ClusterController clusterController)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addLocalProperty(String property)
Add a local (not sub-resource) property to the query.
|
void |
addProperty(String propertyId,
TemporalInfo temporalInfo)
Add a property to the query.
|
protected Map<String,QueryImpl> |
ensureSubResources()
Get the map of sub-resources.
|
boolean |
equals(Object o) |
Result |
execute()
Execute the query.
|
protected Map<Resource,Set<Map<String,Object>>> |
getJoinedResourceProperties(Set<String> propertyIds,
Resource parentResource,
String category)
Get a map of property sets keyed by the resources associated with this query.
|
Map<Resource.Type,String> |
getKeyValueMap()
Obtain the primary and foreign key properties for the resource.
|
Predicate |
getPredicate()
Return the predicate used to identify the associated resource.
|
Set<String> |
getProperties()
Obtain the properties of the query.
|
Query |
getQuery()
Return the query associated with the resource.
|
ResourceDefinition |
getResourceDefinition()
Return the resource definition for this resource type.
|
Map<String,ResourceInstance> |
getSubResources()
Return all sub-resource instances.
|
int |
hashCode() |
boolean |
isCollectionResource()
Determine if resource is a collection resource.
|
void |
setKeyValueMap(Map<Resource.Type,String> keyValueMap)
Set the values of the parent foreign keys.
|
void |
setPageRequest(PageRequest pageRequest)
Set the page request information for this query.
|
void |
setRenderer(Renderer renderer)
Set the corresponding renderer.
|
void |
setUserPredicate(Predicate predicate)
Set the user provided predicated on this query.
|
public QueryImpl(Map<Resource.Type,String> keyValueMap, ResourceDefinition resourceDefinition, ClusterController clusterController)
keyValueMap
- the map of key valuesresourceDefinition
- the resource definitionclusterController
- the cluster controllerpublic void addProperty(String propertyId, TemporalInfo temporalInfo)
Query
addProperty
in interface Query
propertyId
- the property idtemporalInfo
- temporal information for the propertypublic void addLocalProperty(String property)
Query
addLocalProperty
in interface Query
property
- the property id which contains the group, property name
and whether the property is temporalpublic Result execute() throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException
Query
execute
in interface Query
UnsupportedPropertyException
- if the query or query predicate contains invalid non-existent propertiesSystemException
- an internal error occurredNoSuchResourceException
- the query didn't match any resourcesNoSuchParentResourceException
- a specified parent resource doesn't existpublic Predicate getPredicate()
Query
getPredicate
in interface Query
public Set<String> getProperties()
Query
getProperties
in interface Query
public void setUserPredicate(Predicate predicate)
Query
setUserPredicate
in interface Query
predicate
- the user provided predicatepublic void setPageRequest(PageRequest pageRequest)
Query
setPageRequest
in interface Query
pageRequest
- the page request informationpublic void setRenderer(Renderer renderer)
Query
setRenderer
in interface Query
renderer
- renderer for the querypublic void setKeyValueMap(Map<Resource.Type,String> keyValueMap)
ResourceInstance
setKeyValueMap
in interface ResourceInstance
keyValueMap
- map of all parent foreign keys. Map from resource type to id value.public Map<Resource.Type,String> getKeyValueMap()
ResourceInstance
getKeyValueMap
in interface ResourceInstance
public Query getQuery()
ResourceInstance
getQuery
in interface ResourceInstance
public ResourceDefinition getResourceDefinition()
ResourceInstance
getResourceDefinition
in interface ResourceInstance
public boolean isCollectionResource()
ResourceInstance
isCollectionResource
in interface ResourceInstance
public Map<String,ResourceInstance> getSubResources()
ResourceInstance
getSubResources
in interface ResourceInstance
protected Map<String,QueryImpl> ensureSubResources()
protected Map<Resource,Set<Map<String,Object>>> getJoinedResourceProperties(Set<String> propertyIds, Resource parentResource, String category) throws SystemException, UnsupportedPropertyException, NoSuchParentResourceException, NoSuchResourceException
propertyIds
- the requested propertiesparentResource
- the parent resource; may be nullcategory
- the sub-resource category; may be nullSystemException
UnsupportedPropertyException
NoSuchParentResourceException
NoSuchResourceException
Copyright © 2017. All rights reserved.