Class UserPortalContentApiImpl
- java.lang.Object
-
- de.xima.fc.user_portal.api.provider.impl.UserPortalContentApiImpl
-
- All Implemented Interfaces:
IUserPortalContentsApi
public class UserPortalContentApiImpl extends Object implements IUserPortalContentsApi
High-level methods for interacting with portal contents.- Since:
- 8.6.0
- Author:
- XIMA MEDIA GmbH
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOG
-
Constructor Summary
Constructors Constructor Description UserPortalContentApiImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static <Page,Item>
List<Item>all(IUserPortalInvocationContext ctx, int pageSize, de.xima.fc.user_portal.api.provider.impl.PagedReader<Page,Item> reader)Reads all items from a pages resource.IUserPortalResponse<BaseUserPortalContentResource>byUuid(IUserPortalInvocationContext ctx, UUID userPortalUuid, UUID userPortalContentUuid)Reads a content by its UUID.IUserPortalResponse<List<BaseUserPortalContentTagResource>>getAllTags(IUserPortalInvocationContext ctx, UUID userPortalUuid)Reads all tags of a given portal.protected static <Page,Item>
PagegetPage(IUserPortalInvocationContext ctx, PagingDataModel pagingDataModel, de.xima.fc.user_portal.api.provider.impl.PagedReader<Page,Item> reader)Reads a single page from the REST API.IUserPortalResponse<Integer>getUserPortalContentsCount(IUserPortalInvocationContext ctx, UUID userPortalUuid, UserPortalContentsQueryModel queryModel)Reads the count of contents of a given portal.IUserPortalResponse<BaseUserPortalContentResourcePage>getUserPortalContentsPage(IUserPortalInvocationContext ctx, UUID userPortalUuid, PagingDataModel pagingDataModel, UserPortalContentsQueryModel queryModel)Reads a page of contents of a given portal.protected static booleanis2xx(int code)Checks whether the given status code is a 2xx status code.protected static booleanis4xx(int code)Checks whether the given status code is a 3xx status code.protected static booleanis5xx(int code)Checks whether the given status code is a 5xx status code.protected static Stringlang(IUserPortalInvocationContext ctx)Gets the language tag for the given context.
-
-
-
Method Detail
-
byUuid
public IUserPortalResponse<BaseUserPortalContentResource> byUuid(IUserPortalInvocationContext ctx, UUID userPortalUuid, UUID userPortalContentUuid)
Description copied from interface:IUserPortalContentsApiReads a content by its UUID.- Specified by:
byUuidin interfaceIUserPortalContentsApi- Parameters:
ctx- Invocation context for communicating with the user portal REST API.userPortalUuid- UUID of the user portal to read.userPortalContentUuid- UUID of the user portal content to read.- Returns:
- The form with the given UUID,
nullif no such form exists.
-
getUserPortalContentsPage
public IUserPortalResponse<BaseUserPortalContentResourcePage> getUserPortalContentsPage(IUserPortalInvocationContext ctx, UUID userPortalUuid, PagingDataModel pagingDataModel, UserPortalContentsQueryModel queryModel)
Description copied from interface:IUserPortalContentsApiReads a page of contents of a given portal.- Specified by:
getUserPortalContentsPagein interfaceIUserPortalContentsApi- Parameters:
ctx- Invocation context for communicating with the user portal REST API.userPortalUuid- UUID of the user portal for which to retrieve contents.pagingDataModel- Paging data for the contents to retrieve.queryModel- Query to filter contents by.- Returns:
- A page of contents of the given portal.
-
getUserPortalContentsCount
public IUserPortalResponse<Integer> getUserPortalContentsCount(IUserPortalInvocationContext ctx, UUID userPortalUuid, UserPortalContentsQueryModel queryModel)
Description copied from interface:IUserPortalContentsApiReads the count of contents of a given portal.- Specified by:
getUserPortalContentsCountin interfaceIUserPortalContentsApi- Parameters:
ctx- Invocation context for communicating with the user portal REST API.userPortalUuid- UUID of the user portal for which to retrieve contents.queryModel- Query to filter contents by.- Returns:
- The count of contents of the given portal.
-
getAllTags
public IUserPortalResponse<List<BaseUserPortalContentTagResource>> getAllTags(IUserPortalInvocationContext ctx, UUID userPortalUuid)
Description copied from interface:IUserPortalContentsApiReads all tags of a given portal.- Specified by:
getAllTagsin interfaceIUserPortalContentsApi- Parameters:
ctx- Invocation context for communicating with the user portal REST API.userPortalUuid- UUID of the user portal for which to retrieve tags.- Returns:
- A list of tags of the given portal.
-
all
protected static <Page,Item> List<Item> all(IUserPortalInvocationContext ctx, int pageSize, de.xima.fc.user_portal.api.provider.impl.PagedReader<Page,Item> reader) throws UserPortalApiException
Reads all items from a pages resource. Saves quite some amount of boilerplate, you only need to give a reader that can read an individual page.- Type Parameters:
Page- Type of single page with a list of items.Item- Type of the individual items.- Parameters:
ctx- Context for accessing the user portal REST API.pageSize- Number of items to read per page. The returned result is the same regardless of this value, but this controls how many requests are made.reader- Reader that can read a single page.- Returns:
- A list with all items.
- Throws:
UserPortalApiException
-
getPage
protected static <Page,Item> Page getPage(IUserPortalInvocationContext ctx, PagingDataModel pagingDataModel, de.xima.fc.user_portal.api.provider.impl.PagedReader<Page,Item> reader) throws UserPortalApiException
Reads a single page from the REST API.- Type Parameters:
Page- Type of single page with a list of items.Item- Type of the individual items.- Parameters:
ctx- Context for accessing the user portal REST API.pagingDataModel- Paging data for the page to read.reader- Reader that can read a single page.- Returns:
- A list with all items on the page.
- Throws:
UserPortalApiException- If the page could not be read.
-
is2xx
protected static boolean is2xx(int code)
Checks whether the given status code is a 2xx status code.- Parameters:
code- Status code to check.- Returns:
trueif the status code is at least 200 and no less than 300.
-
is4xx
protected static boolean is4xx(int code)
Checks whether the given status code is a 3xx status code.- Parameters:
code- Status code to check.- Returns:
trueif the status code is at least 300 and less than 400.
-
is5xx
protected static boolean is5xx(int code)
Checks whether the given status code is a 5xx status code.- Parameters:
code- Status code to check.- Returns:
trueif the status code is at least 400 and less than 500.
-
lang
protected static String lang(IUserPortalInvocationContext ctx)
Gets the language tag for the given context.- Parameters:
ctx- Context to get the language tag for.- Returns:
- The language tag.
-
-