From e35dc351985a1962722b2c84053d100dea03da68 Mon Sep 17 00:00:00 2001 From: dert1129 Date: Fri, 8 Nov 2024 15:50:41 -0500 Subject: [PATCH] move jsonproperties to display file --- .../SpatialViewerExternalLinkDataset.java | 40 +++---- ...atialViewerExternalLinkDatasetDisplay.java | 105 +++++++++++++++++- 2 files changed, 120 insertions(+), 25 deletions(-) diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java index 3cf8267..51e62ca 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java @@ -161,7 +161,7 @@ public void setRace(String race) { this.race = race; } - @JsonProperty("externallink") + public String getExternalLink() { return externalLink; } @@ -170,7 +170,6 @@ public void setExternalLink(String externalLink) { this.externalLink = externalLink; } - @JsonProperty("configtype") public String getConfigType() { return configType; } @@ -179,7 +178,7 @@ public void setConfigType(String configType) { this.configType = configType; } - @JsonProperty("imagetype") + public String getImageType() { return imageType; } @@ -188,7 +187,7 @@ public void setImageType(String imageType) { this.imageType = imageType; } - @JsonProperty("datatype") + public String getDataType() { return dataType; } @@ -197,8 +196,7 @@ public void setDataType(String dataType) { this.dataType = dataType; } - @Nullable - @JsonProperty("spectracksampleid") + public String getSpectrackSampleId() { return spectrackSampleId; } @@ -207,8 +205,7 @@ public void setSpectrackSampleId(String spectrackSampleId) { this.spectrackSampleId = spectrackSampleId; } - @Nullable - @JsonProperty("redcapid") + public String getRedcapId() { return redcapId; } @@ -217,7 +214,7 @@ public void setRedcapId(String redcapId) { this.redcapId = redcapId; } - @JsonProperty("participantid") + public int getParticipantId() { return participantId; } @@ -226,8 +223,7 @@ public void setParticipantId(int participantId) { this.participantId = participantId; } - @Nullable - @JsonProperty("age") + public String getAge() { return age; } @@ -236,8 +232,7 @@ public void setAge(String age) { this.age = age; } - @Nullable - @JsonProperty("protocol") + public String getProtocol() { return protocol; } @@ -246,8 +241,7 @@ public void setProtocol(String protocol) { this.protocol = protocol; } - @Nullable - @JsonProperty("sampletype") + public String getSampleType() { return sampleType; } @@ -256,8 +250,7 @@ public void setSampleType(String sampleType) { this.sampleType = sampleType; } - @Nullable - @JsonProperty("sex") + public String getSex() { return sex; } @@ -266,8 +259,7 @@ public void setSex(String sex) { this.sex = sex; } - @Nullable - @JsonProperty("tissuesource") + public String getTissueSource() { return tissueSource; } @@ -276,8 +268,7 @@ public void setTissueSource(String tissueSource) { this.tissueSource = tissueSource; } - @Nullable - @JsonProperty("enrollmentcategory") + public String getEnrollmentCategory(){ return enrollmentCategory; } @@ -286,7 +277,7 @@ public void setEnrollmentCategory(String enrollmentCategory){ this.enrollmentCategory = enrollmentCategory; } - @JsonIgnore + public Double getReleaseVersion(){ return releaseVersion; } @@ -295,7 +286,7 @@ public void setReleaseVersion(Double releaseVersion){ this.releaseVersion = releaseVersion; } - @JsonProperty("releaseversion") + public String getReleaseVersionDisplay() { return releaseVersionDisplay; } @@ -304,10 +295,11 @@ public void setReleaseVersionDisplay(String releaseVersionDisplay) { this.releaseVersionDisplay = releaseVersionDisplay; } - @JsonProperty("dlfileid") + public String getDlFileId() { return null; } + @Nullable @JsonProperty("relatedfiles") public List getRelatedFiles() { diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplay.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplay.java index 5f5a792..bc63a64 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplay.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplay.java @@ -1,7 +1,15 @@ package org.kpmp.spatialViewerDataset; +import java.util.ArrayList; +import java.util.List; import java.util.Set; +import org.kpmp.file.File; +import org.springframework.lang.Nullable; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + public class SpatialViewerExternalLinkDatasetDisplay { private String externalLink; private String configType; @@ -9,6 +17,8 @@ public class SpatialViewerExternalLinkDatasetDisplay { private String dataType; private String spectrackSampleId; private int participantId; + private Double releaseVersion; + private String releaseVersionDisplay; private Set redcapId; private Set age; private Set protocol; @@ -95,7 +105,81 @@ public SpatialViewerExternalLinkDatasetDisplay(SpatialViewerExternalLinkDataset } + @JsonProperty("image_type_sort") + public String getImageTypeSort() { + return imageType.toLowerCase(); + } + + @JsonProperty("participant_id_sort") + public String getParticipantIdSort() { + if (redcapId.size() == 1) { + return redcapId.toString().replace("-", "").replace("[", "").replace("]", ""); + } else { + return "Multiple Participants"; + } + } + + @JsonIgnore + public int getFileId() { + return (Integer) null; + } + @JsonIgnore + + public Long getFileSize() { + return null; + } + @JsonIgnore + + public String getPackageId() { + return null; + } + @JsonIgnore + + public String getLevel() { + return null; + } + + @JsonIgnore + public String getFileName() { + return null; + } + @JsonIgnore + + public String getFileNameSort() { + return null; + } + + @Nullable + @JsonProperty("relatedfiles") + public List getRelatedFiles() { + return new ArrayList<>(); + } + + @JsonProperty("dlfileid") + public String getDlFileId() { + return null; + } + + @JsonProperty("releaseversion") + public String getReleaseVersionDisplay() { + return releaseVersionDisplay; + } + + public void setReleaseVersionDisplay(String releaseVersionDisplay){ + this.releaseVersionDisplay = releaseVersionDisplay; + } + + @JsonIgnore + public Double getReleaseVersion() { + return releaseVersion; + } + + public void setReleaseVersion(Double releaseVersion){ + this.releaseVersion = releaseVersion; + } + + @JsonProperty("externallink") public String getExternalLink() { return this.externalLink; } @@ -104,6 +188,7 @@ public void setExternalLink(String externalLink) { this.externalLink = externalLink; } + @JsonProperty("configtype") public String getConfigType() { return this.configType; } @@ -112,6 +197,7 @@ public void setConfigType(String configType) { this.configType = configType; } + @JsonProperty("imagetype") public String getImageType() { return this.imageType; } @@ -120,6 +206,7 @@ public void setImageType(String imageType) { this.imageType = imageType; } + @JsonProperty("datatype") public String getDataType() { return this.dataType; } @@ -128,6 +215,8 @@ public void setDataType(String dataType) { this.dataType = dataType; } + @Nullable + @JsonProperty("spectracksampleid") public String getSpectrackSampleId() { return this.spectrackSampleId; } @@ -136,6 +225,7 @@ public void setSpectrackSampleId(String spectrackSampleId) { this.spectrackSampleId = spectrackSampleId; } + @JsonProperty("participantid") public int getParticipantId() { return this.participantId; } @@ -144,7 +234,8 @@ public void setParticipantId(int participantId) { this.participantId = participantId; } - + @Nullable + @JsonProperty("redcapid") public Set getRedcapId() { if(redcapId.isEmpty()){ return null; @@ -157,6 +248,8 @@ public void setRedcapId(Set redcapId) { this.redcapId = redcapId; } + @Nullable + @JsonProperty("age") public Set getAge() { if(redcapId.isEmpty()){ return null; @@ -169,6 +262,8 @@ public void setAge(Set age) { this.age = age; } + @Nullable + @JsonProperty("protocol") public Set getProtocol() { if(protocol.isEmpty()) { return null; @@ -181,6 +276,8 @@ public void setProtocol(Set protocol) { this.protocol = protocol; } + @Nullable + @JsonProperty("sampletype") public Set getSampleType() { if(sampleType.isEmpty()){ return null; @@ -193,6 +290,8 @@ public void setSampleType(Set sampleType) { this.sampleType = sampleType; } + @Nullable + @JsonProperty("sex") public Set getSex() { if(sex.isEmpty()){ return null; @@ -205,6 +304,8 @@ public void setSex(Set sex) { this.sex = sex; } + @Nullable + @JsonProperty("tissuesource") public Set getTissueSource() { if(tissueSource.isEmpty()){ return null; @@ -217,6 +318,8 @@ public void setTissueSource(Set tissueSource) { this.tissueSource = tissueSource; } + @Nullable + @JsonProperty("enrollmentcategory") public Set getEnrollmentCategory() { if(enrollmentCategory.isEmpty()){ return null;