Class UserPortalContentApiImpl

    • Field Detail

      • LOG

        protected static final org.slf4j.Logger LOG
    • Constructor Detail

      • UserPortalContentApiImpl

        public UserPortalContentApiImpl()
    • Method Detail

      • 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:
        true if 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:
        true if 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:
        true if 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.