Skip to content

Commit 5ed904f

Browse files
authored
Merge pull request #47 from EBISPOT/dev
add cohorts to studies apis
2 parents 057410a + c113770 commit 5ed904f

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

goci-core/goci-model/src/main/java/uk/ac/ebi/spot/goci/model/Study.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
import com.fasterxml.jackson.annotation.JsonIgnore;
5+
import com.fasterxml.jackson.annotation.JsonInclude;
56
import com.fasterxml.jackson.annotation.JsonManagedReference;
67
import com.fasterxml.jackson.annotation.JsonProperty;
78
import org.hibernate.annotations.Where;
@@ -19,6 +20,20 @@ public class Study implements Trackable {
1920
@JsonIgnore
2021
private Long id;
2122

23+
@Transient
24+
@JsonInclude(JsonInclude.Include.NON_NULL)
25+
private String cohort;
26+
27+
@OneToOne(mappedBy = "study")
28+
@JsonIgnore
29+
private StudyExtension studyExtension;
30+
31+
@PostLoad
32+
private void onLoad() {
33+
if (this.studyExtension != null)
34+
this.cohort = studyExtension.getCohort();
35+
}
36+
2237
private String initialSampleSize;
2338

2439
@JsonProperty("replicationSampleSize")
@@ -189,6 +204,10 @@ public void setId(Long id) {
189204
this.id = id;
190205
}
191206

207+
public String getCohort() {
208+
return cohort;
209+
}
210+
192211
public String getInitialSampleSize() {
193212
return initialSampleSize;
194213
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package uk.ac.ebi.spot.goci.model;
2+
3+
import lombok.Data;
4+
5+
import javax.persistence.*;
6+
import java.util.Collection;
7+
8+
@Entity
9+
@Data
10+
public class StudyExtension {
11+
12+
@Id
13+
@GeneratedValue
14+
private Long id;
15+
16+
@OneToOne
17+
@JoinColumn(name = "study_id", unique = true)
18+
private Study study;
19+
20+
private String statisticalModel;
21+
22+
private String cohort;
23+
24+
private String cohortSpecificReference;
25+
26+
private String summaryStatisticsFile;
27+
28+
private String summaryStatisticsAssembly;
29+
30+
private String studyDescription;
31+
}

0 commit comments

Comments
 (0)