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;
}
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;
}
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;
}
Aggregations