Skip to content
Snippets Groups Projects
Commit 52ec939c authored by Lene Wasskog's avatar Lene Wasskog
Browse files

feat: Add year to ObservationTimeSeries

parent 2bddc61e
Branches
No related tags found
1 merge request!173ObservationDataSchema for eplevikler and ObservationTimeSeries
...@@ -46,6 +46,7 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ ...@@ -46,6 +46,7 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ
private Integer observationTimeSeriesId; private Integer observationTimeSeriesId;
private Organism cropOrganism; private Organism cropOrganism;
private Organism organism; private Organism organism;
private Integer year;
private String name; private String name;
private String description; private String description;
private Date created; private Date created;
...@@ -139,6 +140,21 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ ...@@ -139,6 +140,21 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ
return this.getOrganism() != null ? this.getOrganism().getOrganismId() : null; return this.getOrganism() != null ? this.getOrganism().getOrganismId() : null;
} }
/**
* @return the year of the observation time series
*/
@Column(name = "year")
public Integer getYear() {
return year;
}
/**
* @param year the observation time series year to set
*/
public void setYear(Integer year) {
this.year = year;
}
/** /**
* @return the name of the observation time series * @return the name of the observation time series
*/ */
...@@ -351,13 +367,6 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ ...@@ -351,13 +367,6 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ
this.polygonService = polygonService; this.polygonService = polygonService;
} }
@Override
@Transient
public Date getTimeOfLastObservation() {
// TODO Find date of latest observation within series
return new Date();
}
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
...@@ -379,6 +388,7 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ ...@@ -379,6 +388,7 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ
"observationTimeSeriesId=" + observationTimeSeriesId + "observationTimeSeriesId=" + observationTimeSeriesId +
", cropOrganism=" + cropOrganism + ", cropOrganism=" + cropOrganism +
", organism=" + organism + ", organism=" + organism +
", year=" + year +
", name='" + name + '\'' + ", name='" + name + '\'' +
", description='" + description + '\'' + ", description='" + description + '\'' +
", created=" + created + ", created=" + created +
...@@ -399,8 +409,8 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ ...@@ -399,8 +409,8 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ
@Override @Override
public int compareTo(no.nibio.vips.observation.ObservationTimeSeries other) { public int compareTo(no.nibio.vips.observation.ObservationTimeSeries other) {
if (this.getTimeOfLastObservation() != null && other.getTimeOfLastObservation() != null) { if (this.getYear() != null && other.getYear() != null) {
return other.getTimeOfLastObservation().compareTo(this.getTimeOfLastObservation()); return other.getYear().compareTo(this.getYear());
} }
return this.getName().compareTo(other.getName()); return this.getName().compareTo(other.getName());
} }
......
...@@ -13,6 +13,7 @@ import no.nibio.vips.logic.entity.VipsLogicUser; ...@@ -13,6 +13,7 @@ import no.nibio.vips.logic.entity.VipsLogicUser;
import no.nibio.vips.logic.entity.rest.PointMappingResponse; import no.nibio.vips.logic.entity.rest.PointMappingResponse;
import no.nibio.vips.logic.entity.rest.ReferencedPoint; import no.nibio.vips.logic.entity.rest.ReferencedPoint;
import no.nibio.vips.logic.util.GISEntityUtil; import no.nibio.vips.logic.util.GISEntityUtil;
import no.nibio.vips.logic.util.SystemTime;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.wololo.geojson.Feature; import org.wololo.geojson.Feature;
...@@ -43,6 +44,7 @@ public class ObservationTimeSeriesService { ...@@ -43,6 +44,7 @@ public class ObservationTimeSeriesService {
private static final String CROP_ORGANISM_ID = "cropOrganismId"; private static final String CROP_ORGANISM_ID = "cropOrganismId";
private static final String USER_ID = "userId"; private static final String USER_ID = "userId";
private static final String LOCATION_POINT_OF_INTEREST_ID = "locationPointOfInterestId"; private static final String LOCATION_POINT_OF_INTEREST_ID = "locationPointOfInterestId";
private static final String YEAR = "year";
private static final String NAME = "name"; private static final String NAME = "name";
private static final String DESCRIPTION = "description"; private static final String DESCRIPTION = "description";
private static final String LOCATION_IS_PRIVATE = "locationIsPrivate"; private static final String LOCATION_IS_PRIVATE = "locationIsPrivate";
...@@ -221,6 +223,7 @@ public class ObservationTimeSeriesService { ...@@ -221,6 +223,7 @@ public class ObservationTimeSeriesService {
otsToSave.setOrganism(organismBean.getOrganism(getValueFromMap(mapFromApp, ORGANISM_ID, Integer.class))); otsToSave.setOrganism(organismBean.getOrganism(getValueFromMap(mapFromApp, ORGANISM_ID, Integer.class)));
otsToSave.setGeoInfoList(getValueFromMap(mapFromApp, GEO_INFO, String.class)); otsToSave.setGeoInfoList(getValueFromMap(mapFromApp, GEO_INFO, String.class));
otsToSave.setLocationPointOfInterestId(getValueFromMap(mapFromApp, LOCATION_POINT_OF_INTEREST_ID, Integer.class)); otsToSave.setLocationPointOfInterestId(getValueFromMap(mapFromApp, LOCATION_POINT_OF_INTEREST_ID, Integer.class));
otsToSave.setYear(getValueFromMap(mapFromApp, YEAR, Integer.class));
otsToSave.setName(getValueFromMap(mapFromApp, NAME, String.class)); otsToSave.setName(getValueFromMap(mapFromApp, NAME, String.class));
otsToSave.setDescription(getValueFromMap(mapFromApp, DESCRIPTION, String.class)); otsToSave.setDescription(getValueFromMap(mapFromApp, DESCRIPTION, String.class));
otsToSave.setLocationIsPrivate(getValueFromMap(mapFromApp, LOCATION_IS_PRIVATE, Boolean.class)); otsToSave.setLocationIsPrivate(getValueFromMap(mapFromApp, LOCATION_IS_PRIVATE, Boolean.class));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment