Search in sources :

Example 6 with APICategoryListDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.APICategoryListDTO in project carbon-apimgt by wso2.

the class ApiCategoriesApiServiceImpl method getAllAPICategories.

public Response getAllAPICategories(MessageContext messageContext) {
    try {
        String tenantDomain = RestApiCommonUtil.getLoggedInUserTenantDomain();
        List<APICategory> categoryList = APIUtil.getAllAPICategoriesOfOrganization(tenantDomain);
        APICategoryListDTO categoryListDTO = APICategoryMappingUtil.fromCategoryListToCategoryListDTO(categoryList);
        return Response.ok().entity(categoryListDTO).build();
    } catch (APIManagementException e) {
        String errorMessage = "Error while retrieving API categories";
        RestApiUtil.handleInternalServerError(errorMessage, e, log);
    }
    return null;
}
Also used : APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) APICategory(org.wso2.carbon.apimgt.api.model.APICategory) APICategoryListDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APICategoryListDTO)

Example 7 with APICategoryListDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.APICategoryListDTO in project carbon-apimgt by wso2.

the class APICategoryMappingUtil method fromCategoryListToCategoryListDTO.

/**
 * Convert list of API Categories to CategoryListDTO.
 *
 * @param categories List of api categories
 * @return CategoryListDTO list containing api category data
 */
public static APICategoryListDTO fromCategoryListToCategoryListDTO(List<APICategory> categories) {
    APICategoryListDTO categoryListDTO = new APICategoryListDTO();
    categoryListDTO.setCount(categories.size());
    categoryListDTO.setList(fromCategoryListToCategoryDTOList(categories));
    return categoryListDTO;
}
Also used : APICategoryListDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APICategoryListDTO)

Example 8 with APICategoryListDTO

use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.APICategoryListDTO in project carbon-apimgt by wso2.

the class APICategoryMappingUtil method fromCategoryListToCategoryListDTO.

/**
 * Convert list of API Categories to CategoryListDTO
 *
 * @param categories List of api categories
 * @return CategoryListDTO list containing api category data
 */
public static APICategoryListDTO fromCategoryListToCategoryListDTO(List<APICategory> categories) {
    APICategoryListDTO categoryListDTO = new APICategoryListDTO();
    categoryListDTO.setCount(categories.size());
    categoryListDTO.setList(fromCategoryListToCategoryDTOList(categories));
    return categoryListDTO;
}
Also used : APICategoryListDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.APICategoryListDTO)

Aggregations

APICategory (org.wso2.carbon.apimgt.api.model.APICategory)5 APICategoryListDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.APICategoryListDTO)4 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)3 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 APICategoryListDTO (org.wso2.carbon.apimgt.rest.api.admin.v1.dto.APICategoryListDTO)2 APICategoryListDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APICategoryListDTO)2 APICategoryDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.APICategoryDTO)2 APIAdmin (org.wso2.carbon.apimgt.api.APIAdmin)1 APIAdminImpl (org.wso2.carbon.apimgt.impl.APIAdminImpl)1