Class EntitiesRequests
java.lang.Object
cz.zcu.fav.kiv.mjakubas.saf.request.EntitiesRequests
Entities HTTP request to back-end.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EntitiesRequestResult
delete
(@NotNull RequestConfig config, @NotNull String path) DELETE HTTP request.static <T> EntitiesRequestResult
get
(@NotNull RequestConfig config, @NotNull String path, @NotNull Class<T> entity) GET HTTP request.static EntitiesRequestResult[]
MULTI POST HTTP request.static EntitiesRequestResult[]
post
(@NotNull RequestConfig config, @NotNull String path, @NotNull Object[] entities) POST HTTP request.static EntitiesRequestResult
put
(@NotNull RequestConfig config, @NotNull String path, @NotNull Object entity) PUT HTTP request.
-
Field Details
-
OK_RESULT
public static final int OK_RESULT- See Also:
-
-
Constructor Details
-
EntitiesRequests
public EntitiesRequests()
-
-
Method Details
-
get
public static <T> EntitiesRequestResult get(@NotNull @NotNull RequestConfig config, @NotNull @NotNull String path, @NotNull @NotNull Class<T> entity) throws RequestErrorException GET HTTP request. Gets all entities of certain type.- Type Parameters:
T
- entity type class- Parameters:
config
- request configpath
- REST back-end path addressentity
- fetched entity class- Returns:
- fetched entities
- Throws:
RequestErrorException
- if any exception happens
-
post
public static EntitiesRequestResult[] post(@NotNull @NotNull RequestConfig config, @NotNull @NotNull String path, @NotNull @NotNull Object[] entities) throws RequestErrorException POST HTTP request. Posts all entities of certain type.- Parameters:
config
- request configpath
- REST back-end path addressentities
- post entities- Returns:
- result of posting entities
- Throws:
RequestErrorException
- if any exception happens
-
multiPost
public static EntitiesRequestResult[] multiPost(@NotNull @NotNull RequestConfig config, Map<String, List<Object>> map) throws RequestErrorExceptionMULTI POST HTTP request. Post multiple entities of different types.- Parameters:
config
- request configmap
- map of all entities and their base post address- Returns:
- result of multi post
- Throws:
RequestErrorException
- if any exception happens
-
put
public static EntitiesRequestResult put(@NotNull @NotNull RequestConfig config, @NotNull @NotNull String path, @NotNull @NotNull Object entity) throws RequestErrorException PUT HTTP request. Put entity and modifies it in back-end.- Parameters:
config
- request configpath
- put addressentity
- modified entities- Returns:
- put result
- Throws:
RequestErrorException
- if any exception happens
-
delete
public static EntitiesRequestResult delete(@NotNull @NotNull RequestConfig config, @NotNull @NotNull String path) throws RequestErrorException DELETE HTTP request. Deletes entity from back-end.- Parameters:
config
- request configpath
- delete REST path address- Returns:
- delete result
- Throws:
RequestErrorException
- if any exception happens
-