Search in sources :

Example 1 with ApplicationTemplatesList

use of org.wso2.carbon.identity.api.server.application.management.v1.ApplicationTemplatesList in project identity-api-server by wso2.

the class ServerApplicationManagementService method listApplicationTemplates.

/**
 * List all the application templates of the tenant.
 *
 * @param limit  maximum number of items to be returned.
 * @param offset number of records to skip for pagination.
 * @return ApplicationTemplatesList containing the list of templates.
 */
public ApplicationTemplatesList listApplicationTemplates(Integer limit, Integer offset, SearchContext searchContext) {
    validatePaginationSupport(limit, offset);
    try {
        List<Template> templateList = getTemplateManager().listTemplates(TemplateMgtConstants.TemplateType.APPLICATION_TEMPLATE.toString(), null, null, getSearchCondition(TemplateMgtConstants.TemplateType.APPLICATION_TEMPLATE.toString(), ContextLoader.getTenantDomainFromContext(), searchContext));
        List<ApplicationTemplatesListItem> applicationTemplateList = templateList.stream().map(new TemplateToApplicationTemplateListItem()).collect(Collectors.toList());
        ApplicationTemplatesList applicationTemplates = new ApplicationTemplatesList();
        applicationTemplates.setTemplates(applicationTemplateList);
        return applicationTemplates;
    } catch (TemplateManagementException e) {
        throw handleTemplateManagementException(e, "Error while listing application templates.");
    }
}
Also used : ApplicationTemplatesList(org.wso2.carbon.identity.api.server.application.management.v1.ApplicationTemplatesList) TemplateManagementException(org.wso2.carbon.identity.template.mgt.exception.TemplateManagementException) ApplicationTemplatesListItem(org.wso2.carbon.identity.api.server.application.management.v1.ApplicationTemplatesListItem) ApplicationTemplateApiModelToTemplate(org.wso2.carbon.identity.api.server.application.management.v1.core.functions.template.ApplicationTemplateApiModelToTemplate) Template(org.wso2.carbon.identity.template.mgt.model.Template) TemplateToApplicationTemplate(org.wso2.carbon.identity.api.server.application.management.v1.core.functions.template.TemplateToApplicationTemplate) TemplateToApplicationTemplateListItem(org.wso2.carbon.identity.api.server.application.management.v1.core.functions.template.TemplateToApplicationTemplateListItem)

Aggregations

ApplicationTemplatesList (org.wso2.carbon.identity.api.server.application.management.v1.ApplicationTemplatesList)1 ApplicationTemplatesListItem (org.wso2.carbon.identity.api.server.application.management.v1.ApplicationTemplatesListItem)1 ApplicationTemplateApiModelToTemplate (org.wso2.carbon.identity.api.server.application.management.v1.core.functions.template.ApplicationTemplateApiModelToTemplate)1 TemplateToApplicationTemplate (org.wso2.carbon.identity.api.server.application.management.v1.core.functions.template.TemplateToApplicationTemplate)1 TemplateToApplicationTemplateListItem (org.wso2.carbon.identity.api.server.application.management.v1.core.functions.template.TemplateToApplicationTemplateListItem)1 TemplateManagementException (org.wso2.carbon.identity.template.mgt.exception.TemplateManagementException)1 Template (org.wso2.carbon.identity.template.mgt.model.Template)1