Search in sources :

Example 1 with EndPoint_endpointSecurityDTO

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

the class MappingUtil method toEndPointDTO.

/**
 * Convert Endpoint to EndPointDTO
 *
 * @param endpoint endpoint model instance
 * @return EndPointDTO instance containing endpoint data
 */
public static EndPointDTO toEndPointDTO(Endpoint endpoint) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    EndPointDTO endPointDTO = new EndPointDTO();
    endPointDTO.setId(endpoint.getId());
    endPointDTO.setName(endpoint.getName());
    endPointDTO.setEndpointConfig(endpoint.getEndpointConfig());
    EndPoint_endpointSecurityDTO endpointSecurityDTO = mapper.readValue(endpoint.getSecurity(), EndPoint_endpointSecurityDTO.class);
    if (endpointSecurityDTO.getEnabled()) {
        endpointSecurityDTO.setPassword("");
    }
    endPointDTO.setEndpointSecurity(endpointSecurityDTO);
    endPointDTO.setMaxTps(endpoint.getMaxTps());
    endPointDTO.setType(endpoint.getType());
    return endPointDTO;
}
Also used : EndPoint_endpointSecurityDTO(org.wso2.carbon.apimgt.rest.api.publisher.dto.EndPoint_endpointSecurityDTO) EndPointDTO(org.wso2.carbon.apimgt.rest.api.publisher.dto.EndPointDTO) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 EndPointDTO (org.wso2.carbon.apimgt.rest.api.publisher.dto.EndPointDTO)1 EndPoint_endpointSecurityDTO (org.wso2.carbon.apimgt.rest.api.publisher.dto.EndPoint_endpointSecurityDTO)1