Search in sources :

Example 16 with ApplicationDTO

use of org.wso2.carbon.apimgt.rest.api.core.dto.ApplicationDTO in project carbon-apimgt by wso2.

the class MappingUtil method toApplicationDto.

/**
 * This method convert Application model to ApplicationEvent
 * @param application Contains application data
 * @return DTO containing application data
 */
public static ApplicationDTO toApplicationDto(Application application) {
    ApplicationDTO applicationDTO = new ApplicationDTO();
    applicationDTO.setApplicationId(application.getId());
    applicationDTO.setDescription(application.getDescription());
    applicationDTO.setName(application.getName());
    applicationDTO.setSubscriber(application.getCreatedUser());
    if (application.getPolicy() != null) {
        applicationDTO.setThrottlingTier(application.getPolicy().getPolicyName());
    }
    return applicationDTO;
}
Also used : ApplicationDTO(org.wso2.carbon.apimgt.rest.api.publisher.dto.ApplicationDTO)

Aggregations

Application (org.wso2.carbon.apimgt.core.models.Application)11 ApplicationDTO (org.wso2.carbon.apimgt.rest.api.store.dto.ApplicationDTO)11 ArrayList (java.util.ArrayList)8 APIStore (org.wso2.carbon.apimgt.core.api.APIStore)7 Test (org.junit.Test)6 ApplicationKeysDTO (org.wso2.carbon.apimgt.rest.api.store.dto.ApplicationKeysDTO)6 WorkflowResponse (org.wso2.carbon.apimgt.core.api.WorkflowResponse)5 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)5 ApplicationCreationResponse (org.wso2.carbon.apimgt.core.workflow.ApplicationCreationResponse)5 ApplicationTokenDTO (org.wso2.carbon.apimgt.rest.api.store.dto.ApplicationTokenDTO)5 Response (javax.ws.rs.core.Response)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 GeneralWorkflowResponse (org.wso2.carbon.apimgt.core.workflow.GeneralWorkflowResponse)4 Request (org.wso2.msf4j.Request)4 HashMap (java.util.HashMap)3 ErrorDTO (org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO)3 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 Test (org.testng.annotations.Test)2 ErrorHandler (org.wso2.carbon.apimgt.core.exception.ErrorHandler)2