T - the type of resource.public abstract class AbstractResources<T extends DataObjectRestRep> extends java.lang.Object implements Resources<T>
Resources.getByIds(Collection, ResourceFilter) that looks up each resource in the collection one by one.| Constructor and Description |
|---|
AbstractResources(RestClient client,
java.lang.Class<T> resourceClass,
java.lang.String baseUrl) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTags(java.net.URI id,
java.util.Set<java.lang.String> add)
Adds a set of tags to the tags for a given resource.
|
T |
get(RelatedResourceRep ref)
Gets a resource by a reference.
|
T |
get(java.net.URI id)
Gets a resource by ID.
|
java.util.List<T> |
getByIds(java.util.Collection<java.net.URI> ids)
Fetches the resource values for the given IDs.
|
java.util.List<T> |
getByIds(java.util.Collection<java.net.URI> ids,
ResourceFilter<T> filter)
Fetches the resource values for the given IDs, optionally filtering the results as they are returned.
|
java.util.List<T> |
getByRefs(java.util.Collection<? extends RelatedResourceRep> resources)
Fetches the resource values for the given references.
|
java.util.List<T> |
getByRefs(java.util.Collection<? extends RelatedResourceRep> refs,
ResourceFilter<T> filter)
Fetches the resource values for the given references, optionally filtering the results as they are returned.
|
java.util.Set<java.lang.String> |
getTags(java.net.URI id)
Gets the set of all tags assigned to the given resource.
|
java.util.List<SearchResultResourceRep> |
performSearch(java.util.Map<java.lang.String,java.lang.Object> params)
Performs a search for resources matching the given parameters.
|
java.util.List<SearchResultResourceRep> |
performSearchBy(java.lang.String name,
java.lang.Object value)
Performs a search for resources matching the a single search parameter.
|
void |
removeTags(java.net.URI id,
java.util.Set<java.lang.String> remove)
Removes a set of tags to the tags for a given resource.
|
SearchBuilder<T> |
search()
Creates a builder for building up search queries.
|
void |
updateTags(java.net.URI id,
TagAssignment tags)
Updates the tags for a given resource.
|
AbstractResources<T> |
withInactive(boolean inactive)
Configures the fetch operations to include inactive resources.
|
AbstractResources<T> |
withInternal(boolean internal)
Configures the fetch operations to include internal resources.
|
public AbstractResources(RestClient client, java.lang.Class<T> resourceClass, java.lang.String baseUrl)
public AbstractResources<T> withInactive(boolean inactive)
inactive - whether to include inactive resources.public AbstractResources<T> withInternal(boolean internal)
internal - whether to include internal resources.public T get(java.net.URI id)
ResourcesGets a resource by ID.
API Call: GET /RESOURCE_PATH/{id}
get in interface Resources<T extends DataObjectRestRep>id - the resource ID.public T get(RelatedResourceRep ref)
ResourcesGets a resource by a reference.
Convenience method for calling get(ref.getId()).
get in interface Resources<T extends DataObjectRestRep>ref - the resource reference.public java.util.List<T> getByIds(java.util.Collection<java.net.URI> ids)
ResourcesFetches the resource values for the given IDs.
API Call: GET /RESOURCE_PATH/{id}
getByIds in interface Resources<T extends DataObjectRestRep>ids - the resource IDs.public java.util.List<T> getByIds(java.util.Collection<java.net.URI> ids, ResourceFilter<T> filter)
ResourcesFetches the resource values for the given IDs, optionally filtering the results as they are returned.
API Call: GET /RESOURCE_PATH/{id}
getByIds in interface Resources<T extends DataObjectRestRep>ids - the resource IDs.filter - the resource filter to apply to the results as they are returned (optional).public java.util.List<T> getByRefs(java.util.Collection<? extends RelatedResourceRep> resources)
ResourcesFetches the resource values for the given references.
Convenience method for calling getByIds(*resources.id).
getByRefs in interface Resources<T extends DataObjectRestRep>resources - the resource references.public java.util.List<T> getByRefs(java.util.Collection<? extends RelatedResourceRep> refs, ResourceFilter<T> filter)
ResourcesFetches the resource values for the given references, optionally filtering the results as they are returned.
Convenience method for calling getByIds(*resources.id, filter).
getByRefs in interface Resources<T extends DataObjectRestRep>refs - the resource references.filter - the resource filter to apply to the results as they are returned (optional).public java.util.Set<java.lang.String> getTags(java.net.URI id)
ResourcesgetTags in interface Resources<T extends DataObjectRestRep>id - the ID of the resource.public void addTags(java.net.URI id,
java.util.Set<java.lang.String> add)
ResourcesaddTags in interface Resources<T extends DataObjectRestRep>id - the ID of the resource.add - the tags to add.public void removeTags(java.net.URI id,
java.util.Set<java.lang.String> remove)
ResourcesremoveTags in interface Resources<T extends DataObjectRestRep>id - the ID of the resource.remove - the tags to remove.public void updateTags(java.net.URI id,
TagAssignment tags)
ResourcesupdateTags in interface Resources<T extends DataObjectRestRep>id - the ID of the resource.tags - the tags to add/remove.public SearchBuilder<T> search()
ResourcesCreates a builder for building up search queries.
search in interface Resources<T extends DataObjectRestRep>public java.util.List<SearchResultResourceRep> performSearchBy(java.lang.String name, java.lang.Object value)
name - the parameter name.value - the parameter value.public java.util.List<SearchResultResourceRep> performSearch(java.util.Map<java.lang.String,java.lang.Object> params)
params - the search query parameters.