return information about the plotted sequences

this information can be used for tests
This commit is contained in:
2017-04-01 18:27:43 +02:00
parent 2875237272
commit 46ce445010
8 changed files with 84 additions and 55 deletions

View File

@@ -1,7 +1,5 @@
package org.lucares.pdbui;
import java.io.File;
import java.nio.file.Path;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@@ -19,8 +17,10 @@ import org.lucares.pdbui.domain.AutocompleteResponse;
import org.lucares.pdbui.domain.PlotRequest;
import org.lucares.pdbui.domain.PlotResponse;
import org.lucares.performance.db.CollectionUtils;
import org.lucares.recommind.logs.DataSeries;
import org.lucares.recommind.logs.InternalPlottingException;
import org.lucares.recommind.logs.NoDataPointsException;
import org.lucares.recommind.logs.PlotResult;
import org.lucares.recommind.logs.Plotter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,13 +73,12 @@ public class PdbController implements HardcodedValues, CollectionUtils {
final PlotSettings plotSettings = PlotSettingsTransformer.toSettings(request);
try {
final File image = plotter.plot(plotSettings);
final PlotResult result = plotter.plot(plotSettings);
final Path relativeImagePath = plotter.getOutputDir().relativize(image.toPath());
final String relativeImgUrl = relativeImagePath.toString().replace('\\', '/');
final String imageUrl = WEB_IMAGE_OUTPUT_PATH + "/" + relativeImgUrl;
final String imageUrl = WEB_IMAGE_OUTPUT_PATH + "/" + result.getImageName();
LOGGER.trace("image url: {}", imageUrl);
return new PlotResponse(imageUrl);
return new PlotResponse(DataSeries.toMap(result.getDataSeries()), imageUrl);
} catch (final NoDataPointsException e) {
throw new NotFoundException(e);
}