Search in sources :

Example 1 with URLMappingDTO

use of org.wso2.carbon.apimgt.rest.api.gateway.dto.URLMappingDTO in project carbon-apimgt by wso2.

the class SubscriptionValidationDataUtil method fromAPItoDTO.

private static APIDTO fromAPItoDTO(API model) {
    APIDTO apidto = null;
    if (model != null) {
        apidto = new APIDTO();
        apidto.setUuid(model.getApiUUID());
        apidto.setApiId(model.getApiId());
        apidto.setVersion(model.getVersion());
        apidto.setName(model.getName());
        apidto.setContext(model.getContext());
        apidto.setPolicy(model.getPolicy());
        apidto.setProvider(model.getProvider());
        apidto.setApiType(model.getApiType());
        apidto.setName(model.getName());
        apidto.setStatus(model.getStatus());
        apidto.setIsDefaultVersion(model.isDefaultVersion());
        Map<String, URLMapping> urlMappings = model.getAllResources();
        List<URLMappingDTO> urlMappingsDTO = new ArrayList<>();
        for (URLMapping urlMapping : urlMappings.values()) {
            URLMappingDTO urlMappingDTO = new URLMappingDTO();
            urlMappingDTO.setAuthScheme(urlMapping.getAuthScheme());
            urlMappingDTO.setHttpMethod(urlMapping.getHttpMethod());
            urlMappingDTO.setThrottlingPolicy(urlMapping.getThrottlingPolicy());
            urlMappingDTO.setUrlPattern(urlMapping.getUrlPattern());
            urlMappingDTO.setScopes(urlMapping.getScopes());
            urlMappingsDTO.add(urlMappingDTO);
        }
        apidto.setUrlMappings(urlMappingsDTO);
    }
    return apidto;
}
Also used : APIDTO(org.wso2.carbon.apimgt.internal.service.dto.APIDTO) URLMapping(org.wso2.carbon.apimgt.api.model.subscription.URLMapping) ArrayList(java.util.ArrayList) URLMappingDTO(org.wso2.carbon.apimgt.internal.service.dto.URLMappingDTO)

Example 2 with URLMappingDTO

use of org.wso2.carbon.apimgt.rest.api.gateway.dto.URLMappingDTO in project carbon-apimgt by wso2.

the class SubscriptionValidationDataUtil method fromAPIToAPIListDTO.

public static APIListDTO fromAPIToAPIListDTO(API model) {
    APIListDTO apiListdto = new APIListDTO();
    if (model != null) {
        APIDTO apidto = new APIDTO();
        apidto.setUuid(model.getApiUUID());
        apidto.setApiId(model.getApiId());
        apidto.setVersion(model.getVersion());
        apidto.setContext(model.getContext());
        apidto.setPolicy(model.getPolicy());
        apidto.setProvider(model.getProvider());
        apidto.setApiType(model.getApiType());
        apidto.setName(model.getName());
        apidto.setStatus(model.getStatus());
        apidto.setIsDefaultVersion(model.isDefaultVersion());
        Map<String, URLMapping> urlMappings = model.getAllResources();
        List<URLMappingDTO> urlMappingsDTO = new ArrayList<>();
        for (URLMapping urlMapping : urlMappings.values()) {
            URLMappingDTO urlMappingDTO = new URLMappingDTO();
            urlMappingDTO.setAuthScheme(urlMapping.getAuthScheme());
            urlMappingDTO.setHttpMethod(urlMapping.getHttpMethod());
            urlMappingDTO.setThrottlingPolicy(urlMapping.getThrottlingPolicy());
            urlMappingDTO.setUrlPattern(urlMapping.getUrlPattern());
            urlMappingDTO.setScopes(urlMapping.getScopes());
            urlMappingsDTO.add(urlMappingDTO);
        }
        apidto.setUrlMappings(urlMappingsDTO);
        apiListdto.setCount(1);
        apiListdto.getList().add(apidto);
    } else {
        apiListdto.setCount(0);
    }
    return apiListdto;
}
Also used : APIDTO(org.wso2.carbon.apimgt.internal.service.dto.APIDTO) URLMapping(org.wso2.carbon.apimgt.api.model.subscription.URLMapping) ArrayList(java.util.ArrayList) APIListDTO(org.wso2.carbon.apimgt.internal.service.dto.APIListDTO) URLMappingDTO(org.wso2.carbon.apimgt.internal.service.dto.URLMappingDTO)

Example 3 with URLMappingDTO

use of org.wso2.carbon.apimgt.rest.api.gateway.dto.URLMappingDTO in project carbon-apimgt by wso2.

the class GatewayUtils method convertUriTemplate.

private static List<URLMappingDTO> convertUriTemplate(List<URLMapping> resources) {
    List<URLMappingDTO> urlMappingDTOList = new ArrayList<>();
    for (URLMapping resource : resources) {
        URLMappingDTO urlMappingDTO = new URLMappingDTO().urlPattern(resource.getUrlPattern()).authScheme(resource.getAuthScheme()).httpMethod(resource.getHttpMethod()).throttlingPolicy(resource.getThrottlingPolicy()).scopes(resource.getScopes());
        urlMappingDTOList.add(urlMappingDTO);
    }
    return urlMappingDTOList;
}
Also used : URLMapping(org.wso2.carbon.apimgt.api.model.subscription.URLMapping) ArrayList(java.util.ArrayList) URLMappingDTO(org.wso2.carbon.apimgt.rest.api.gateway.dto.URLMappingDTO)

Aggregations

ArrayList (java.util.ArrayList)3 URLMapping (org.wso2.carbon.apimgt.api.model.subscription.URLMapping)3 APIDTO (org.wso2.carbon.apimgt.internal.service.dto.APIDTO)2 URLMappingDTO (org.wso2.carbon.apimgt.internal.service.dto.URLMappingDTO)2 APIListDTO (org.wso2.carbon.apimgt.internal.service.dto.APIListDTO)1 URLMappingDTO (org.wso2.carbon.apimgt.rest.api.gateway.dto.URLMappingDTO)1