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

feat: Add source to time series, fix conversion error

parent d98fb466
Branches
No related tags found
1 merge request!173ObservationDataSchema for eplevikler and ObservationTimeSeries
...@@ -50,9 +50,10 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ ...@@ -50,9 +50,10 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ
private String name; private String name;
private String description; private String description;
private Date created; private Date created;
private Date lastModified;
private Integer userId; private Integer userId;
private VipsLogicUser user; // Transient private VipsLogicUser user; // Transient
private String source;
private Date lastModified;
private Integer lastModifiedBy; private Integer lastModifiedBy;
private VipsLogicUser lastModifiedByUser; // Transient private VipsLogicUser lastModifiedByUser; // Transient
private Integer locationPointOfInterestId; private Integer locationPointOfInterestId;
...@@ -63,6 +64,10 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ ...@@ -63,6 +64,10 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ
public ObservationTimeSeries() { public ObservationTimeSeries() {
} }
public ObservationTimeSeries(String source) {
this.source = source;
}
/** /**
* @return the id of the observation time series * @return the id of the observation time series
*/ */
...@@ -237,8 +242,20 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ ...@@ -237,8 +242,20 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ
} }
/** /**
* @return the id of the user who last modified the observation time series * @return from where the observation time series originally was created, either WEB or APP
*/
@Column(name = "source")
public String getSource() {
return source;
}
/**
* @param source From where the observation time series originally was created
*/ */
public void setSource(String source) {
this.source = source;
}
@Column(name = "last_modified_by") @Column(name = "last_modified_by")
public Integer getLastModifiedBy() { public Integer getLastModifiedBy() {
return lastModifiedBy; return lastModifiedBy;
...@@ -353,9 +370,10 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ ...@@ -353,9 +370,10 @@ public class ObservationTimeSeries implements Serializable, no.nibio.vips.observ
", name='" + name + '\'' + ", name='" + name + '\'' +
", description='" + description + '\'' + ", description='" + description + '\'' +
", created=" + created + ", created=" + created +
", lastModified=" + lastModified +
", userId=" + userId + ", userId=" + userId +
", user=" + user + ", user=" + user +
", source=" + source +
", lastModified=" + lastModified +
", lastModifiedBy=" + lastModifiedBy + ", lastModifiedBy=" + lastModifiedBy +
", lastModifiedByUser=" + lastModifiedByUser + ", lastModifiedByUser=" + lastModifiedByUser +
", locationPointOfInterestId=" + locationPointOfInterestId + ", locationPointOfInterestId=" + locationPointOfInterestId +
......
...@@ -207,7 +207,7 @@ public class ObservationTimeSeriesService { ...@@ -207,7 +207,7 @@ public class ObservationTimeSeriesService {
return Response.status(Response.Status.NOT_FOUND).build(); return Response.status(Response.Status.NOT_FOUND).build();
} }
} else { } else {
otsToSave = new ObservationTimeSeries(); otsToSave = new ObservationTimeSeries("APP");
otsToSave.setUserId(user.getUserId()); otsToSave.setUserId(user.getUserId());
otsToSave.setCreated(currentDate); otsToSave.setCreated(currentDate);
} }
...@@ -246,6 +246,12 @@ public class ObservationTimeSeriesService { ...@@ -246,6 +246,12 @@ public class ObservationTimeSeriesService {
Object value = map.get(key); Object value = map.get(key);
if (clazz.isInstance(value)) { if (clazz.isInstance(value)) {
return clazz.cast(value); return clazz.cast(value);
} else if (clazz == Integer.class && value instanceof String) {
try {
return clazz.cast(Integer.parseInt((String) value));
} catch (NumberFormatException e) {
return null;
}
} }
return clazz == Boolean.class ? clazz.cast(false) : null; return clazz == Boolean.class ? clazz.cast(false) : null;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment