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.");
}
}
Aggregations