Search in sources :

Example 1 with WSDLValidationResponseWsdlInfoEndpointsDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.WSDLValidationResponseWsdlInfoEndpointsDTO in project carbon-apimgt by wso2.

the class APIMappingUtil method fromEndpointsMapToWSDLValidationResponseEndpointsDTO.

/**
 * Converts the provided WSDL endpoint map to REST API DTO.
 *
 * @param endpoints endpoint map
 * @return converted map to DTO
 */
private static List<WSDLValidationResponseWsdlInfoEndpointsDTO> fromEndpointsMapToWSDLValidationResponseEndpointsDTO(Map<String, String> endpoints) {
    List<WSDLValidationResponseWsdlInfoEndpointsDTO> endpointsDTOList = new ArrayList<>();
    for (String endpointName : endpoints.keySet()) {
        WSDLValidationResponseWsdlInfoEndpointsDTO endpointDTO = new WSDLValidationResponseWsdlInfoEndpointsDTO();
        endpointDTO.setName(endpointName);
        endpointDTO.setLocation(endpoints.get(endpointName));
        endpointsDTOList.add(endpointDTO);
    }
    return endpointsDTOList;
}
Also used : ArrayList(java.util.ArrayList) WSDLValidationResponseWsdlInfoEndpointsDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.WSDLValidationResponseWsdlInfoEndpointsDTO)

Example 2 with WSDLValidationResponseWsdlInfoEndpointsDTO

use of org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.WSDLValidationResponseWsdlInfoEndpointsDTO in project carbon-apimgt by wso2.

the class APIMappingUtil method fromWSDLValidationResponseToDTO.

/**
 * Converts a WSDL validation response model to DTO.
 *
 * @param validationResponse validation response model
 * @return Converted WSDL validation response model to DTO
 */
public static WSDLValidationResponseDTO fromWSDLValidationResponseToDTO(WSDLValidationResponse validationResponse) {
    WSDLValidationResponseDTO wsdlValidationResponseDTO = new WSDLValidationResponseDTO();
    WSDLInfo wsdlInfo;
    if (validationResponse.isValid()) {
        wsdlValidationResponseDTO.setIsValid(true);
        wsdlInfo = validationResponse.getWsdlInfo();
        WSDLValidationResponseWsdlInfoDTO wsdlInfoDTO = new WSDLValidationResponseWsdlInfoDTO();
        wsdlInfoDTO.setVersion(wsdlInfo.getVersion());
        List<WSDLValidationResponseWsdlInfoEndpointsDTO> endpointsDTOList = fromEndpointsMapToWSDLValidationResponseEndpointsDTO(wsdlInfo.getEndpoints());
        wsdlInfoDTO.setEndpoints(endpointsDTOList);
        wsdlValidationResponseDTO.setWsdlInfo(wsdlInfoDTO);
    } else {
        wsdlValidationResponseDTO.setIsValid(false);
        wsdlValidationResponseDTO.setErrors(getErrorListItemsDTOsFromErrorHandler(validationResponse.getError()));
    }
    return wsdlValidationResponseDTO;
}
Also used : WSDLInfo(org.wso2.carbon.apimgt.impl.wsdl.model.WSDLInfo) WSDLValidationResponseDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.WSDLValidationResponseDTO) WSDLValidationResponseWsdlInfoEndpointsDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.WSDLValidationResponseWsdlInfoEndpointsDTO) WSDLValidationResponseWsdlInfoDTO(org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.WSDLValidationResponseWsdlInfoDTO)

Aggregations

WSDLValidationResponseWsdlInfoEndpointsDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.WSDLValidationResponseWsdlInfoEndpointsDTO)2 ArrayList (java.util.ArrayList)1 WSDLInfo (org.wso2.carbon.apimgt.impl.wsdl.model.WSDLInfo)1 WSDLValidationResponseDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.WSDLValidationResponseDTO)1 WSDLValidationResponseWsdlInfoDTO (org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.WSDLValidationResponseWsdlInfoDTO)1