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