Search in sources :

Example 11 with ApplicationInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationInfoDTO in project carbon-apimgt by wso2.

the class ApplicationMappingUtil method fromApplicationToInfoDTO.

/**
 * Create an ApplicationInfoDTO from an Application object.
 *
 * @param application Application object
 * @return ApplicationInfoDTO containing application information
 */
public static ApplicationInfoDTO fromApplicationToInfoDTO(Application application) {
    ApplicationInfoDTO applicationInfoDTO = new ApplicationInfoDTO();
    applicationInfoDTO.setApplicationId(application.getUUID());
    applicationInfoDTO.setDescription(application.getDescription());
    applicationInfoDTO.setName(application.getName());
    applicationInfoDTO.setSubscriber(application.getSubscriber().getName());
    applicationInfoDTO.setSubscriptionCount(application.getSubscriptionCount());
    return applicationInfoDTO;
}
Also used : ApplicationInfoDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.ApplicationInfoDTO)

Example 12 with ApplicationInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationInfoDTO in project carbon-apimgt by wso2.

the class GatewayUtils method generateApplicationList.

public static ApplicationListDTO generateApplicationList(List<Application> applicationList, SubscriptionDataStore subscriptionDataStore) {
    ApplicationListDTO applicationListDTO = new ApplicationListDTO();
    List<ApplicationInfoDTO> applicationInfoDTOList = new ArrayList<>();
    for (Application application : applicationList) {
        ApplicationInfoDTO applicationInfoDTO = new ApplicationInfoDTO().id(application.getId()).name(application.getName()).policy(application.getPolicy()).attributes(application.getAttributes()).subName(application.getSubName()).uuid(application.getUUID()).tokenType(application.getTokenType()).keys(convertToApplicationKeyMapping(application.getId(), subscriptionDataStore));
        applicationInfoDTOList.add(applicationInfoDTO);
    }
    applicationListDTO.setList(applicationInfoDTOList);
    applicationListDTO.setCount(applicationInfoDTOList.size());
    return applicationListDTO;
}
Also used : ArrayList(java.util.ArrayList) ApplicationInfoDTO(org.wso2.carbon.apimgt.rest.api.gateway.dto.ApplicationInfoDTO) Application(org.wso2.carbon.apimgt.keymgt.model.entity.Application) ApplicationListDTO(org.wso2.carbon.apimgt.rest.api.gateway.dto.ApplicationListDTO)

Example 13 with ApplicationInfoDTO

use of org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationInfoDTO in project carbon-apimgt by wso2.

the class ApplicationMappingUtil method fromApplicationsToDTO.

public static ApplicationListDTO fromApplicationsToDTO(Application[] applications) {
    ApplicationListDTO applicationListDTO = new ApplicationListDTO();
    List<ApplicationInfoDTO> applicationInfoDTOs = applicationListDTO.getList();
    if (applicationInfoDTOs == null) {
        applicationInfoDTOs = new ArrayList<>();
        applicationListDTO.setList(applicationInfoDTOs);
    }
    for (Application application : applications) {
        applicationInfoDTOs.add(fromApplicationToInfoDTO(application));
    }
    applicationListDTO.setCount(applicationInfoDTOs.size());
    return applicationListDTO;
}
Also used : ApplicationInfoDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ApplicationInfoDTO) Application(org.wso2.carbon.apimgt.api.model.Application) ApplicationListDTO(org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ApplicationListDTO)

Aggregations

Application (org.wso2.carbon.apimgt.api.model.Application)5 ApplicationInfoDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.ApplicationInfoDTO)5 APIConsumer (org.wso2.carbon.apimgt.api.APIConsumer)3 ArrayList (java.util.ArrayList)2 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)2 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)2 Tier (org.wso2.carbon.apimgt.api.model.Tier)2 Application (org.wso2.carbon.apimgt.keymgt.model.entity.Application)2 ApplicationInfoDTO (org.wso2.carbon.apimgt.rest.api.admin.v1.dto.ApplicationInfoDTO)2 ApplicationInfoDTO (org.wso2.carbon.apimgt.rest.api.gateway.dto.ApplicationInfoDTO)2 ApplicationInfoDTO (org.wso2.carbon.apimgt.rest.api.store.dto.ApplicationInfoDTO)2 APIInfoDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.APIInfoDTO)2 SubscriptionDTO (org.wso2.carbon.apimgt.rest.api.store.v1.dto.SubscriptionDTO)2 Gson (com.google.gson.Gson)1 JsonElement (com.google.gson.JsonElement)1 JsonParser (com.google.gson.JsonParser)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1