diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/Common.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/Common.java index 49d4302..64b3a3f 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/Common.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/Common.java @@ -29,7 +29,7 @@ public class Common extends Base{ @JsonProperty("data_owner") @CustomField(key="Data owner") @Tag - private String dataOwner; + private List dataOwner; @JsonProperty("database_sources") @CkanResource @@ -61,11 +61,15 @@ public class Common extends Base{ @JsonProperty("reporting_year") @CustomField(key="Reporting year") - private List reportingYear; + @TimeSeries + @Valid + private List> reportingYear; @JsonProperty("reference_year") @CustomField(key="Reference year") - private List referenceYear; + @TimeSeries + @Valid + private List> referenceYear; // automatically compiled @JsonProperty("grsf_type") @@ -112,16 +116,16 @@ public class Common extends Base{ * @param catches * @param landings * @param species - * @param faoState */ - public Common(String dataOwner, List> databaseSources, + public Common(List dataOwner, + List> databaseSources, List> sourceOfInformation, List refersTo, String shortTitle, - Boolean traceabilityFlag, Status status, List reportingYear, - List referenceYear, String grsfType, String sourceType, - List> catches, - List> landings, - List species, List> faoState) { + Boolean traceabilityFlag, Status status, + List> reportingYear, + List> referenceYear, String grsfType, + String sourceType, List> catches, + List> landings, List species) { super(); this.dataOwner = dataOwner; this.databaseSources = databaseSources; @@ -143,22 +147,18 @@ public class Common extends Base{ return grsfType; } - public void setGrsfType(String grsfType) { this.grsfType = grsfType; } - public String getSourceType() { return sourceType; } - public void setSourceType(String sourceType) { this.sourceType = sourceType; } - public Boolean getTraceabilityFlag() { return traceabilityFlag; } @@ -171,14 +171,18 @@ public class Common extends Base{ this.refersTo = refersTo; } - public List getReportingYear() { + public List> getReportingYear() { return reportingYear; } - public void setReportingYear(List reportingYear) { + public void setReportingYear(List> reportingYear) { this.reportingYear = reportingYear; } + public void setReferenceYear(List> referenceYear) { + this.referenceYear = referenceYear; + } + public List> getDatabaseSources() { return databaseSources; } @@ -195,14 +199,6 @@ public class Common extends Base{ this.sourceOfInformation = sourceOfInformation; } - public String getDataOwner() { - return dataOwner; - } - - public void setDataOwner(String dataOwner) { - this.dataOwner = dataOwner; - } - public String getShortTitle() { return shortTitle; } @@ -251,12 +247,12 @@ public class Common extends Base{ this.landings = landings; } - public List getReferenceYear() { - return referenceYear; + public List getDataOwner() { + return dataOwner; } - public void setReferenceYear(List referenceYear) { - this.referenceYear = referenceYear; + public void setDataOwner(List dataOwner) { + this.dataOwner = dataOwner; } @Override diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/StockRecord.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/StockRecord.java index 80a491b..fb0f422 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/StockRecord.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/StockRecord.java @@ -11,7 +11,6 @@ import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group; import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag; import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.TimeSeries; import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Abundance_Level; -import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Exploitation_Rate; import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Fishing_Pressure; import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Stock_Type; @@ -56,19 +55,6 @@ public class StockRecord extends Common{ @CustomField(key="State of marine resources") private String stateOfMarineResource; - @JsonProperty("standard_exploitation_rate") - @CustomField(key="Standard Exploitation Rate") - //@Tag - @TimeSeries - @Valid - private List> exploitationRateStandard; - - @JsonProperty("exploitation_rate") - @CustomField(key="Exploitation Rate") - @TimeSeries - @Valid - private List> exploitationRate; - @JsonProperty("standard_abundance_level") @CustomField(key="Standard Abundance Level") @TimeSeries @@ -95,11 +81,19 @@ public class StockRecord extends Common{ @JsonProperty("narrative_state") @CustomField(key="Narrative state") + @TimeSeries + @Valid private List> narrativeState; + @JsonProperty("fao_state") + @CustomField(key="Fao State") + @TimeSeries + @Valid + private List> faoState; + @JsonProperty("scientific_advice") @CustomField(key="Scientific advice") - private String scientificAdvice; + private List scientificAdvice; @JsonProperty("assessor") @CustomField(key="Assessor") @@ -120,12 +114,6 @@ public class StockRecord extends Common{ @Group private Stock_Type type; - @JsonProperty("fao_state") - @CustomField(key="Fao State") - @TimeSeries - @Valid - private List> faoState; - public StockRecord() { super(); } @@ -138,19 +126,17 @@ public class StockRecord extends Common{ * @param managementEntity * @param assessmentMethods * @param stateOfMarineResource - * @param exploitationRateStandard - * @param exploitationRate * @param abundanceLevelStandard * @param abundanceLevel * @param fishingPressureStandard * @param fishingPressure * @param narrativeState + * @param faoState * @param scientificAdvice * @param assessor * @param stockUri * @param waterArea * @param type - * @param faoState */ public StockRecord( String stockName, @@ -160,16 +146,14 @@ public class StockRecord extends Common{ String managementEntity, List assessmentMethods, String stateOfMarineResource, - List> exploitationRateStandard, - List> exploitationRate, List> abundanceLevelStandard, List> abundanceLevel, List> fishingPressureStandard, List> fishingPressure, List> narrativeState, - String scientificAdvice, String assessor, String stockUri, - List waterArea, Stock_Type type, - List> faoState) { + List> faoState, + List scientificAdvice, String assessor, String stockUri, + List waterArea, Stock_Type type) { super(); this.stockName = stockName; this.stockId = stockId; @@ -178,23 +162,19 @@ public class StockRecord extends Common{ this.managementEntity = managementEntity; this.assessmentMethods = assessmentMethods; this.stateOfMarineResource = stateOfMarineResource; - this.exploitationRateStandard = exploitationRateStandard; - this.exploitationRate = exploitationRate; this.abundanceLevelStandard = abundanceLevelStandard; this.abundanceLevel = abundanceLevel; this.fishingPressureStandard = fishingPressureStandard; this.fishingPressure = fishingPressure; this.narrativeState = narrativeState; + this.faoState = faoState; this.scientificAdvice = scientificAdvice; this.assessor = assessor; this.stockUri = stockUri; this.waterArea = waterArea; this.type = type; - this.faoState = faoState; } - - public void setAssessmentMethods(List assessmentMethods) { this.assessmentMethods = assessmentMethods; } @@ -289,15 +269,6 @@ public class StockRecord extends Common{ this.stateOfMarineResource = stateOfMarineResource; } - public List> getExploitationRateStandard() { - return exploitationRateStandard; - } - - public void setExploitationRateStandard( - List> exploitationRateStandard) { - this.exploitationRateStandard = exploitationRateStandard; - } - public List> getAbundanceLevelStandard() { return abundanceLevelStandard; } @@ -324,11 +295,11 @@ public class StockRecord extends Common{ this.narrativeState = narrativeState; } - public String getScientificAdvice() { + public List getScientificAdvice() { return scientificAdvice; } - public void setScientificAdvice(String scientificAdvice) { + public void setScientificAdvice(List scientificAdvice) { this.scientificAdvice = scientificAdvice; } @@ -340,15 +311,6 @@ public class StockRecord extends Common{ this.assessor = assessor; } - public List> getExploitationRate() { - return exploitationRate; - } - - public void setExploitationRate( - List> exploitationRate) { - this.exploitationRate = exploitationRate; - } - public List> getFaoState() { return faoState; } @@ -368,8 +330,6 @@ public class StockRecord extends Common{ + ", managementEntity=" + managementEntity + ", assessmentMethods=" + assessmentMethods + ", stateOfMarineResource=" + stateOfMarineResource - + ", exploitationRateStandard=" + exploitationRateStandard - + ", exploitationRate=" + exploitationRate + ", abundanceLevelStandard=" + abundanceLevelStandard + ", abundanceLevel=" + abundanceLevel + ", fishingPressureStandard=" + fishingPressureStandard diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/TimeSeriesBean.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/TimeSeriesBean.java index e548471..cf4de68 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/TimeSeriesBean.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/json/input/TimeSeriesBean.java @@ -6,8 +6,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; /** - * A time series bean that contains elements < year, T, T1 >. - * Unit can be contained too. + * A time series bean that contains elements < year, T, T1 , source >. + * Year is the only required element. * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) * @param the first type value of the series * @param the second type value of the series (optional) @@ -15,26 +15,40 @@ import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class TimeSeriesBean implements Comparable>{ - @JsonProperty("year") + public static final String YEAR_FIELD = "year"; + public static final String VALUE_FIELD = "value"; + public static final String UNIT_FIELD = "unit"; + public static final String SOURCE_FIELD = "source"; + + @JsonProperty(YEAR_FIELD) @NotNull(message="year of a time series cannot be null") private Long year; - @JsonProperty("value") - @NotNull(message="value of a time series cannot be null") + @JsonProperty(SOURCE_FIELD) + private String source; + + @JsonProperty(VALUE_FIELD) private T value; - @JsonProperty("unit") + @JsonProperty(UNIT_FIELD) private T1 unit; public TimeSeriesBean() { super(); } - public TimeSeriesBean(T value, Long year, T1 unit) { + /** + * @param year + * @param value + * @param unit + * @param source + */ + public TimeSeriesBean(Long year, T value, T1 unit, String source) { super(); - this.value = value; this.year = year; + this.value = value; this.unit = unit; + this.source = source; } public T getValue() { @@ -61,19 +75,40 @@ public class TimeSeriesBean implements Comparable>{ this.unit = unit; } + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + @Override public String toString() { - if(this.unit != null && !this.unit.getClass().equals(Void.class) - && !this.unit.toString().isEmpty()) // e.g., catches and landings - return year + "-" + value + "-" + unit; - else - return year + "-" + value; + String firstPart = "" + year; + String secondPart = (value != null ? " - " + value : "") + + (unit != null ? " - " + unit : "") + + (source != null ? " (" + source + ")" : ""); + return firstPart + (secondPart != null && !secondPart.isEmpty() ? secondPart : ""); } + public boolean isSourcePresent(){ + return source != null; + } + + public boolean isUnitPresent(){ + return unit != null && !unit.getClass().equals(Void.class); + } + + public boolean isValuePresent(){ + return value != null ; + } + @Override public int compareTo(TimeSeriesBean o) { return (int) (this.year - o.year); // ascending.. low to highest } + } diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/CommonServiceUtils.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/CommonServiceUtils.java index fd580ce..c8117ad 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/CommonServiceUtils.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/CommonServiceUtils.java @@ -195,7 +195,6 @@ public class CommonServiceUtils { // check if it is a time series, in this take the last X elements if(asList.get(0).getClass().equals(TimeSeriesBean.class)){ elementsToConsider = Math.min(elementsToConsider, TIME_SERIES_TAKE_LAST_VALUES); - for (int i = (asList.size() - elementsToConsider); i < asList.size(); i++) { String finalTag = asList.get(i).toString().trim().replaceAll(REGEX_TAGS, ""); tags.add(finalTag); @@ -271,7 +270,7 @@ public class CommonServiceUtils { } // add the record among the source group (check for grsf-group) - groups.add(source.equals(Sources.GRSF) ? "grsf-group" : source.getOrigName().toLowerCase()); + groups.add(source.equals(Sources.GRSF) ? CommonServiceUtils.GRSF_GROUP_NAME : source.getOrigName().toLowerCase()); } /** diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java index 311f5df..ed3e951 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherFisheryService.java @@ -505,12 +505,12 @@ public class GrsfPublisherFisheryService { contextServlet, false); status = Status.OK; }else{ - status = Status.INTERNAL_SERVER_ERROR; throw new Exception("There was an error during the item updated, sorry"); } } }catch(Exception e){ logger.error("Failed to create fishery record" + e); + status = Status.INTERNAL_SERVER_ERROR; responseBean.setError(e.getMessage()); } return Response.status(status).entity(responseBean).build(); diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java index 209c29d..5faa53f 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/services/GrsfPublisherStockService.java @@ -513,12 +513,12 @@ public class GrsfPublisherStockService { status = Status.OK; }else{ - status = Status.INTERNAL_SERVER_ERROR; throw new Exception("There was an error during the item updated, sorry"); } } }catch(Exception e){ logger.error("Failed to create fishery record" + e); + status = Status.INTERNAL_SERVER_ERROR; responseBean.setError(e.getMessage()); } return Response.status(status).entity(responseBean).build(); diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CSVHelpers.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CSVHelpers.java index 4c2a6f1..17fb3a2 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CSVHelpers.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/CSVHelpers.java @@ -21,9 +21,6 @@ public class CSVHelpers { private static final String UPLOAD_LOCATION_LOCAL = System.getProperty("java.io.tmpdir"); private static final String GRSF_SUB_PATH = "GRSF_TIME_SERIES"; public static final String CSV_EXTENSION = ".csv"; - private static final String YEAR_FIELD = "year"; - private static final String VALUE_FIELD = "value"; - private static final String UNIT_FIELD = "unit"; /** * Write a time series to a csv file, and returns the file reference.
@@ -47,23 +44,30 @@ public class CSVHelpers { FileOutputStream fo = new FileOutputStream(file); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fo, "UTF-8")); - boolean isUnitPresent = false; + // discover how the header will look like + boolean isUnitPresent = timeSeries.get(0).isUnitPresent(); + boolean isValuePresent = timeSeries.get(0).isValuePresent(); + boolean isSourcePresent = timeSeries.get(0).isSourcePresent(); StringBuffer headerLine = new StringBuffer(); + headerLine.append(TimeSeriesBean.YEAR_FIELD); - headerLine.append(YEAR_FIELD); - headerLine.append(CSV_SEPARATOR); - headerLine.append(VALUE_FIELD); - - // first line is csv header, check the type of object - if(timeSeries.get(0).getUnit() != null && !timeSeries.get(0).getUnit().getClass().equals(Void.class)){ - - isUnitPresent = true; + if(isValuePresent){ headerLine.append(CSV_SEPARATOR); - headerLine.append(UNIT_FIELD); - + headerLine.append(TimeSeriesBean.VALUE_FIELD); } - + + if(isUnitPresent){ + headerLine.append(CSV_SEPARATOR); + headerLine.append(TimeSeriesBean.UNIT_FIELD); + } + + if(isSourcePresent){ + headerLine.append(CSV_SEPARATOR); + headerLine.append(TimeSeriesBean.SOURCE_FIELD); + } + + bw.write(headerLine.toString()); bw.newLine(); bw.flush(); @@ -73,21 +77,29 @@ public class CSVHelpers { { StringBuffer oneLine = new StringBuffer(); oneLine.append(bean.getYear()); - oneLine.append(CSV_SEPARATOR); - oneLine.append(bean.getValue()); + + if(isValuePresent){ + oneLine.append(CSV_SEPARATOR); + oneLine.append(bean.getValue() != null? bean.getValue() : ""); + } if(isUnitPresent){ oneLine.append(CSV_SEPARATOR); oneLine.append(bean.getUnit() != null? bean.getUnit() : ""); } + if(isSourcePresent){ + oneLine.append(CSV_SEPARATOR); + oneLine.append(bean.getSource() != null? bean.getSource() : ""); + } + bw.write(oneLine.toString()); bw.newLine(); + bw.flush(); } - - bw.flush(); + bw.close(); - + // file created logger.debug("CSV file created correctly on this machine!"); @@ -100,4 +112,5 @@ public class CSVHelpers { return null; } } + } \ No newline at end of file diff --git a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JJerseyTest.java b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JJerseyTest.java index a8618fe..faa19d6 100644 --- a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JJerseyTest.java +++ b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JJerseyTest.java @@ -1,6 +1,7 @@ package org.gcube.data_catalogue.grsf_publish_ws; import java.util.ArrayList; +import java.util.Arrays; import javax.ws.rs.client.Entity; import javax.ws.rs.core.Application; @@ -34,7 +35,7 @@ public class JJerseyTest extends JerseyTest{ recordFishery.setAuthor("Costantino Perciante"); recordFishery.setAuthorContact("costantino.perciante@isti.cnr.it"); recordFishery.setLicense("a caso una lincense"); - recordFishery.setDataOwner("data owner"); + recordFishery.setDataOwner(Arrays.asList("data owner")); recordFishery.setType(Fishery_Type.Fishing_Description); recordFishery.setDatabaseSources(new ArrayList>(1)); recordFishery.setSourceOfInformation(new ArrayList>(1)); diff --git a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java index 45e0147..4924fa5 100644 --- a/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java +++ b/src/test/java/org/gcube/data_catalogue/grsf_publish_ws/JTests.java @@ -225,60 +225,11 @@ public class JTests { // time series List> timeSeries = new ArrayList>(); - timeSeries.add(new TimeSeriesBean("Value A", 2001L, null)); - timeSeries.add(new TimeSeriesBean("Value B", 2231L, null)); - timeSeries.add(new TimeSeriesBean("Value C", 1943L, null)); - timeSeries.add(new TimeSeriesBean("Value D", 1054L, null)); - timeSeries.add(new TimeSeriesBean("Value E", 3422L, null)); - timeSeries.add(new TimeSeriesBean("Value F", 2121L, null)); - timeSeries.add(new TimeSeriesBean("Value G", 2454L, null)); - timeSeries.add(new TimeSeriesBean("Value H", 1213L, null)); - timeSeries.add(new TimeSeriesBean("Value I", 2213L, null)); - timeSeries.add(new TimeSeriesBean("Value A", 2001L, null)); - timeSeries.add(new TimeSeriesBean("Value B", 2231L, null)); - timeSeries.add(new TimeSeriesBean("Value C", 1943L, null)); - timeSeries.add(new TimeSeriesBean("Value D", 1054L, null)); - timeSeries.add(new TimeSeriesBean("Value E", 3422L, null)); - timeSeries.add(new TimeSeriesBean("Value F", 2121L, null)); - timeSeries.add(new TimeSeriesBean("Value G", 2454L, null)); - timeSeries.add(new TimeSeriesBean("Value H", 1213L, null)); - timeSeries.add(new TimeSeriesBean("Value I", 2213L, null)); - timeSeries.add(new TimeSeriesBean("Value A", 2001L, null)); - timeSeries.add(new TimeSeriesBean("Value B", 2231L, null)); - timeSeries.add(new TimeSeriesBean("Value C", 1943L, null)); - timeSeries.add(new TimeSeriesBean("Value D", 1054L, null)); - timeSeries.add(new TimeSeriesBean("Value E", 3422L, null)); - timeSeries.add(new TimeSeriesBean("Value F", 2121L, null)); - timeSeries.add(new TimeSeriesBean("Value G", 2454L, null)); - timeSeries.add(new TimeSeriesBean("Value H", 1213L, null)); - timeSeries.add(new TimeSeriesBean("Value I", 2213L, null)); - timeSeries.add(new TimeSeriesBean("Value A", 2001L, null)); - timeSeries.add(new TimeSeriesBean("Value B", 2231L, null)); - timeSeries.add(new TimeSeriesBean("Value C", 1943L, null)); - timeSeries.add(new TimeSeriesBean("Value D", 1054L, null)); - timeSeries.add(new TimeSeriesBean("Value E", 3422L, null)); - timeSeries.add(new TimeSeriesBean("Value F", 2121L, null)); - timeSeries.add(new TimeSeriesBean("Value G", 2454L, null)); - timeSeries.add(new TimeSeriesBean("Value H", 1213L, null)); - timeSeries.add(new TimeSeriesBean("Value I", 2213L, null)); - timeSeries.add(new TimeSeriesBean("Value A", 2001L, null)); - timeSeries.add(new TimeSeriesBean("Value B", 2231L, null)); - timeSeries.add(new TimeSeriesBean("Value C", 1943L, null)); - timeSeries.add(new TimeSeriesBean("Value D", 1054L, null)); - timeSeries.add(new TimeSeriesBean("Value E", 3422L, null)); - timeSeries.add(new TimeSeriesBean("Value F", 2121L, null)); - timeSeries.add(new TimeSeriesBean("Value G", 2454L, null)); - timeSeries.add(new TimeSeriesBean("Value H", 1213L, null)); - timeSeries.add(new TimeSeriesBean("Value I", 2213L, null)); - timeSeries.add(new TimeSeriesBean("Value A", 2001L, null)); - timeSeries.add(new TimeSeriesBean("Value B", 2231L, null)); - timeSeries.add(new TimeSeriesBean("Value C", 1943L, null)); - timeSeries.add(new TimeSeriesBean("Value D", 1054L, null)); - timeSeries.add(new TimeSeriesBean("Value E", 3422L, null)); - timeSeries.add(new TimeSeriesBean("Value F", 2121L, null)); - timeSeries.add(new TimeSeriesBean("Value G", 2454L, null)); - timeSeries.add(new TimeSeriesBean("Value H", 1213L, null)); - timeSeries.add(new TimeSeriesBean("Value I", 2213L, null)); + timeSeries.add(new TimeSeriesBean(2001L, "Value A", null, null)); + timeSeries.add(new TimeSeriesBean(2231L, "Value B", null, null)); + timeSeries.add(new TimeSeriesBean(1943L, "Value C", null, null)); + timeSeries.add(new TimeSeriesBean(1054L, "Value D", null, null)); + timeSeries.add(new TimeSeriesBean(3422L, "Value E", null, null)); Collections.sort(timeSeries);