org.refcodes.web.OauthTokenAccessor
, org.refcodes.web.OauthTokenAccessor.OauthTokenBuilder<HalClient>
, org.refcodes.web.OauthTokenAccessor.OauthTokenMutator
, org.refcodes.web.OauthTokenAccessor.OauthTokenProperty
HalClientImpl
public interface HalClient extends org.refcodes.web.OauthTokenAccessor.OauthTokenProperty, org.refcodes.web.OauthTokenAccessor.OauthTokenBuilder<HalClient>
HalClient
lets you comfortably introspect and manage (in terms of
CRUD) HAL resources. You may use it reflect the data structures of entities
accessible by remote HAL endpoints as well as apply CRUD operations on the
introspected entities. This means that you interact completely dynamically
with the HAL resource at runtime instead of having to provide static data
structures at compile time. Still you may go wit static data types as we use
the CanonicalMap
(as well as the CanonicalMap.CanonicalMapBuilder
) to
operate upon the dynamic data structures. Implementations may use the
HttpRestServer
and it's implementations such as the
HttpRestServerImpl
. See also
"https://en.wikipedia.org/wiki/Hypertext_Application_Language".org.refcodes.web.OauthTokenAccessor.OauthTokenBuilder<B extends org.refcodes.web.OauthTokenAccessor.OauthTokenBuilder<B>>, org.refcodes.web.OauthTokenAccessor.OauthTokenMutator, org.refcodes.web.OauthTokenAccessor.OauthTokenProperty
Modifier and Type | Method | Description |
---|---|---|
default HalData |
create(String aEntity,
Object aObj) |
Creates a new entitie's element (row) at the HAL resource consisting of
the properties as of the provided
CanonicalMap . |
HalData |
create(String aEntity,
HalData aProperties) |
Creates a new entitie's element (row) at the HAL resource consisting of
the properties as of the provided
CanonicalMap . |
boolean |
delete(String aEntity,
String aId) |
Deletes an entitie's element (row) from the HAL resource.
|
String[] |
entities() |
Determines the entities provided by the HAL resource.
|
String[] |
getExcludeEntities() |
Gets the names of the entities to be excluded by the
HalClient . |
String[] |
getIncludeEntities() |
Gets the names of the entities to be included by the
HalClient . |
default HalStruct |
introspect(String aEntity) |
Introspects the provided entity at the HAL resource and returns an
instance of the
CanonicalMap representing the reflected data
structure. |
HalStruct |
introspect(String aEntity,
TraversalMode aMode) |
Introspects the provided entity at the HAL resource and returns an
instance of the
CanonicalMap representing the reflected data
structure. |
default HalData |
read(String aEntity,
Long aId) |
Retrieves the properties with the according values for the given entity
with the given TID from the HAL resource.
|
default HalData |
read(String aEntity,
Long aId,
TraversalMode aMode) |
Retrieves the properties with the according values for the given entity
with the given TID from the HAL resource.
|
HalData |
read(String aEntity,
Long aId,
TraversalMode aMode,
org.refcodes.web.FormFields aQueryFields) |
Retrieves the properties with the according values for the given entity
with the given TID from the HAL resource.
|
default HalData |
read(String aEntity,
Long aId,
org.refcodes.web.FormFields aQueryFields) |
Retrieves the properties with the according values for the given entity
with the given TID from the HAL resource.
|
default HalDataPage |
readAll(String aEntity) |
Retrieves the properties with the according values of all elements (rows)
for the given entity from the HAL resource.
|
default HalDataPage |
readAll(String aEntity,
TraversalMode aMode) |
Retrieves the properties with the according values of all elements (rows)
for the given entity from the HAL resource.
|
HalDataPage |
readAll(String aEntity,
TraversalMode aMode,
org.refcodes.web.FormFields aQueryFields) |
Retrieves the properties with the according values of all elements (rows)
for the given entity from the HAL resource.
|
default HalDataPage |
readAll(String aEntity,
org.refcodes.web.FormFields aQueryFields) |
Retrieves the properties with the according values of all elements (rows)
for the given entity from the HAL resource.
|
default HalDataPage |
readPage(String aEntity,
int aPage,
int aPageSize) |
Retrieves the properties with the according values of all elements (rows)
for the given entity from the HAL resource.
|
default HalDataPage |
readPage(String aEntity,
int aPage,
int aPageSize,
TraversalMode aMode) |
Retrieves the properties with the according values of all elements (rows)
for the given entity from the HAL resource.
|
default HalDataPage |
readPage(String aEntity,
int aPage,
int aPageSize,
TraversalMode aMode,
org.refcodes.web.FormFields aQueryFields) |
Retrieves the properties with the according values of all elements (rows)
for the given entity from the HAL resource.
|
default HalDataPage |
readPage(String aEntity,
int aPage,
int aPageSize,
org.refcodes.web.FormFields aQueryFields) |
Retrieves the properties with the according values of all elements (rows)
for the given entity from the HAL resource.
|
void |
setExcludeEntities(String[] entities) |
Sets the names of the entities to be excluded by the
HalClient . |
void |
setIncludeEntities(String[] entities) |
Sets the names of the entities to be included by the
HalClient . |
default HalData |
update(String aEntity,
Object aObj) |
Creates a new entitie's element (row) at the HAL resource consisting of
the properties as of the provided
CanonicalMap . |
HalData |
update(String aEntity,
String aId,
HalData aProperties) |
Updates an existing entitie's element (row) at the HAL resource using the
properties as of the provided
CanonicalMap . |
default HalClient |
withExcludeEntities(String[] entities) |
Sets the names of the entities to be excluded by the
HalClient . |
default HalClient |
withIncludeEntities(String[] entities) |
Sets the names of the entities to be included by the
HalClient . |
default HalClient |
withOAuthToken(org.refcodes.web.OauthToken aOauthToken) |
default HalClient withOAuthToken(org.refcodes.web.OauthToken aOauthToken)
withOAuthToken
in interface org.refcodes.web.OauthTokenAccessor.OauthTokenBuilder<HalClient>
String[] getExcludeEntities()
HalClient
.void setExcludeEntities(String[] entities)
HalClient
.entities
- The entities to be excluded.default HalClient withExcludeEntities(String[] entities)
HalClient
.entities
- The entities to be excluded.String[] getIncludeEntities()
HalClient
.void setIncludeEntities(String[] entities)
HalClient
.entities
- The entities to be included.default HalClient withIncludeEntities(String[] entities)
HalClient
.entities
- The entities to be included.String[] entities() throws org.refcodes.web.HttpStatusException
String
array with the according entity names.org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalStruct introspect(String aEntity) throws org.refcodes.web.HttpStatusException
CanonicalMap
representing the reflected data
structure. By default, Meta-Data is included in the result. If otherwise
required, use introspect(String, TraversalMode)
.aEntity
- The entity to be introspected.CanonicalMap
instance representing the structure of the
entity, e.g. providing the attribute names and the data types as
well as other constraints representing the layout of the entity
(think of a class defining the layout of its instances).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.HalStruct introspect(String aEntity, TraversalMode aMode) throws org.refcodes.web.HttpStatusException
CanonicalMap
representing the reflected data
structure.aEntity
- The entity to be introspected.aMode
- The mode of operation whilst introspecting an entity: You
may include MetaData as of
TraversalMode.IMPORT_CHILDREN_KEEP_DANGLING_HREFS
or just
retrieve the plain data structure without Meta-Data as of
TraversalMode.IMPORT_CHILDREN
.CanonicalMap
instance representing the structure of the
entity, e.g. providing the attribute names and the data types as
well as other constraints representing the layout of the entity
(think of a class defining the layout of its instances).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.HalData create(String aEntity, HalData aProperties) throws org.refcodes.web.HttpStatusException
CanonicalMap
.aEntity
- The entity for which to create the element (row).aProperties
- The CanonicalMap
containing the properties of
the entity be created.HalData
with the newly created element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalData create(String aEntity, Object aObj) throws org.refcodes.web.HttpStatusException
CanonicalMap
.aEntity
- The entity for which to create the element (row).aObj
- The Object
from which the properties are retrieved by
means of reflection for the entity be created.HalData
with the newly created element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalData read(String aEntity, Long aId) throws org.refcodes.web.HttpStatusException
TraversalMode.IMPORT_CHILDREN_KEEP_DANGLING_HREFS
.aEntity
- The entity for which to retrieve the properties.aId
- The TID of the entity for which to retrieve the properties.CanonicalMap
with the property names assigned to the
according values.org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalData read(String aEntity, Long aId, org.refcodes.web.FormFields aQueryFields) throws org.refcodes.web.HttpStatusException
TraversalMode.IMPORT_CHILDREN_KEEP_DANGLING_HREFS
.aEntity
- The entity for which to retrieve the properties.aId
- The TID of the entity for which to retrieve the properties.aQueryFields
- The query fields to be appended to the requesting
URL.CanonicalMap
with the property names assigned to the
according values.org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalData read(String aEntity, Long aId, TraversalMode aMode) throws org.refcodes.web.HttpStatusException
aEntity
- The entity for which to retrieve the properties.aId
- The TID of the entity for which to retrieve the properties.aMode
- The mode for handling HREF resources, e.g. load them as well
or ignore them.CanonicalMap
with the property names assigned to the
according values.org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.HalData read(String aEntity, Long aId, TraversalMode aMode, org.refcodes.web.FormFields aQueryFields) throws org.refcodes.web.HttpStatusException
aEntity
- The entity for which to retrieve the properties.aId
- The TID of the entity for which to retrieve the properties.aMode
- The mode for handling HREF resources, e.g. load them as well
or ignore them.aQueryFields
- The query fields to be appended to the requesting
URL.CanonicalMap
with the property names assigned to the
according values.org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalDataPage readAll(String aEntity) throws org.refcodes.web.HttpStatusException
TraversalMode.IMPORT_CHILDREN_KEEP_DANGLING_HREFS
.aEntity
- The entity for which to retrieve the properties of all
elements (rows).HalData
list of type HalDataPage
containing one
HalData
instance per element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalDataPage readAll(String aEntity, org.refcodes.web.FormFields aQueryFields) throws org.refcodes.web.HttpStatusException
TraversalMode.IMPORT_CHILDREN_KEEP_DANGLING_HREFS
.aEntity
- The entity for which to retrieve the properties of all
elements (rows).aQueryFields
- The query fields to be appended to the requesting
URL.HalData
list of type HalDataPage
containing one
HalData
instance per element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalDataPage readAll(String aEntity, TraversalMode aMode) throws org.refcodes.web.HttpStatusException
aEntity
- The entity for which to retrieve the properties of all
elements (rows).aMode
- The mode for handling HREF resources, e.g. load them as well
or ignore them.HalData
list of type HalDataPage
containing one
HalData
instance per element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.HalDataPage readAll(String aEntity, TraversalMode aMode, org.refcodes.web.FormFields aQueryFields) throws org.refcodes.web.HttpStatusException
aEntity
- The entity for which to retrieve the properties of all
elements (rows).aMode
- The mode for handling HREF resources, e.g. load them as well
or ignore them.aQueryFields
- The query fields to be appended to the requesting
URL.HalData
list of type HalDataPage
containing one
HalData
instance per element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalDataPage readPage(String aEntity, int aPage, int aPageSize) throws org.refcodes.web.HttpStatusException
TraversalMode.IMPORT_CHILDREN_KEEP_DANGLING_HREFS
. The
HAL-Browser must support pagination for the requested result set's page
number and a page's size to function as intended. In Spring Boot you
usually use a repository of type PagingAndSortingRepository
.aEntity
- The entity for which to retrieve the properties of all
elements (rows).aPage
- The page as of pagination to retrieve.aPageSize
- The page's size as of pagination for the page to
retrieve.HalData
list of type HalDataPage
containing one
HalData
instance per element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalDataPage readPage(String aEntity, int aPage, int aPageSize, TraversalMode aMode) throws org.refcodes.web.HttpStatusException
PagingAndSortingRepository
.aEntity
- The entity for which to retrieve the properties of all
elements (rows).aPage
- The page as of pagination to retrieve.aPageSize
- The page's size as of pagination for the page to
retrieve.aMode
- The mode for handling HREF resources, e.g. load them as well
or ignore them.HalData
list of type HalDataPage
containing one
HalData
instance per element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalDataPage readPage(String aEntity, int aPage, int aPageSize, org.refcodes.web.FormFields aQueryFields) throws org.refcodes.web.HttpStatusException
TraversalMode.IMPORT_CHILDREN_KEEP_DANGLING_HREFS
. The
HAL-Browser must support pagination for the requested result set's page
number and a page's size to function as intended. In Spring Boot you
usually use a repository of type PagingAndSortingRepository
.aEntity
- The entity for which to retrieve the properties of all
elements (rows).aPage
- The page as of pagination to retrieve.aPageSize
- The page's size as of pagination for the page to
retrieve.aQueryFields
- The query fields to be appended to the requesting
URL.HalData
list of type HalDataPage
containing one
HalData
instance per element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalDataPage readPage(String aEntity, int aPage, int aPageSize, TraversalMode aMode, org.refcodes.web.FormFields aQueryFields) throws org.refcodes.web.HttpStatusException
PagingAndSortingRepository
.aEntity
- The entity for which to retrieve the properties of all
elements (rows).aPage
- The page as of pagination to retrieve.aPageSize
- The page's size as of pagination for the page to
retrieve.aMode
- The mode for handling HREF resources, e.g. load them as well
or ignore them.aQueryFields
- The query fields to be appended to the requesting
URL.HalData
list of type HalDataPage
containing one
HalData
instance per element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.default HalData update(String aEntity, Object aObj) throws org.refcodes.web.HttpStatusException
CanonicalMap
.aEntity
- The entity for which to create the element (row).aObj
- The Object
from which the properties are retrieved by
means of reflection for the entity be created.HalData
with the newly created element (row).org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.HalData update(String aEntity, String aId, HalData aProperties) throws org.refcodes.web.HttpStatusException
CanonicalMap
.aEntity
- The entity for which to update the element (row).aId
- The TID of the element (row) of the entity to be updated.aProperties
- The CanonicalMap
containing the properties of
the entity to be updated.org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.boolean delete(String aEntity, String aId) throws org.refcodes.web.HttpStatusException
aEntity
- The entity for which to delete the element (row).aId
- The TID of the element (row) of the entity to be deleted.org.refcodes.web.HttpStatusException
- Thrown in case a HTTP response was of an
erroneous status.Copyright © 2021. All rights reserved.