use of cwms.radar.api.graph.Graph in project cwms-radar-api by USACE.
the class NamedPgJsonFormatter method format.
@Override
public String format(CwmsDTO dto) {
String retVal;
try {
if (dto instanceof Basin) {
Basin basin = (Basin) dto;
Graph graph = new BasinConnectivityGraph.Builder(basin).build();
String name = basin.getBasinName();
retVal = formatNamedGraph(name, graph);
} else {
throw new FormattingException(dto.getClass().getSimpleName() + " is not currently supported for Named-PG-JSON format.");
}
} catch (JsonProcessingException e) {
throw new FormattingException(e.getMessage());
}
return retVal;
}
use of cwms.radar.api.graph.Graph in project cwms-radar-api by USACE.
the class PgJsonFormatter method format.
@Override
public String format(CwmsDTO dto) {
String retVal;
Graph graph;
if (dto instanceof Basin) {
Basin basin = (Basin) dto;
graph = new BasinConnectivityGraph.Builder(basin).build();
} else {
throw new FormattingException(dto.getClass().getSimpleName() + " is not currently supported for PG-JSON format.");
}
try {
retVal = formatGraph(graph);
} catch (JsonProcessingException e) {
throw new FormattingException(e.getMessage());
}
return retVal;
}
Aggregations