diff --git a/openbis_api/.gitignore b/openbis_api/.gitignore index ee9dbf196317640553d4095a9ec1147176d1d571..f19b37d7547f617f65dc7ed3f5191300168edbd3 100644 --- a/openbis_api/.gitignore +++ b/openbis_api/.gitignore @@ -1,2 +1,3 @@ targets/ /bin +/build diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/Sample.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/Sample.java index 8f64bafeb950735f34003b783d237e75e23a6e56..145f3b7d71f226b0b1c1e1d9f1c086b9d17c5aab 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/Sample.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/Sample.java @@ -16,6 +16,7 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.attachment.Attachment; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.person.Person; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.Sample; @@ -85,6 +86,9 @@ public class Sample implements Serializable @JsonProperty private List<Sample> contained; + @JsonProperty + private List<DataSet> dataSets; + @JsonProperty private Set<Tag> tags; @@ -335,6 +339,26 @@ public class Sample implements Serializable this.contained = contained; } + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} + @JsonIgnore + public List<DataSet> getDataSets() + { + if (getFetchOptions().hasDataSets()) + { + return dataSets; + } + else + { + throw new NotFetchedException("Data sets has not been fetched."); + } + } + + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} + public void setDataSets(List<DataSet> dataSets) + { + this.dataSets = dataSets; + } + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore public Set<Tag> getTags() diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleFetchOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleFetchOptions.java index 2169ff1b6b38ebba780f05948686fb9aa513d5f9..66949d00e4a3045a3fdef5cad9a4967c6c59f8e9 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleFetchOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleFetchOptions.java @@ -16,6 +16,7 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.attachment.AttachmentFetchOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment.ExperimentFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person.PersonFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.property.PropertyFetchOptions; @@ -59,6 +60,9 @@ public class SampleFetchOptions implements Serializable @JsonProperty private SampleFetchOptions contained; + @JsonProperty + private DataSetFetchOptions dataSets; + @JsonProperty private TagFetchOptions tags; @@ -247,6 +251,28 @@ public class SampleFetchOptions implements Serializable return contained != null; } + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} + public DataSetFetchOptions withDataSets() + { + if (dataSets == null) + { + dataSets = new DataSetFetchOptions(); + } + return dataSets; + } + + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} + public DataSetFetchOptions withDataSetsUsing(DataSetFetchOptions fetchOptions) + { + return dataSets = fetchOptions; + } + + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} + public boolean hasDataSets() + { + return dataSets != null; + } + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} public TagFetchOptions withTags() { diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/DtoGenerator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/DtoGenerator.java index 28095a14f8a25120e437db50ff750c540e7c4655..0629fc6e1e81c78c31b0bae3e92c5186f1445ba1 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/DtoGenerator.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/DtoGenerator.java @@ -241,7 +241,7 @@ public class DtoGenerator printPackage("entity." + subPackage); printImports(); - printClassHeader(className); + printClassHeader(className, "entity." + subPackage); startBlock(); printFields(); @@ -305,7 +305,7 @@ public class DtoGenerator printPackage("fetchoptions." + subPackage); printImportsForFetchOptions(); - printClassHeader(fetchOptionsClass.getSimpleName()); + printClassHeader(fetchOptionsClass.getSimpleName(), "fetchoptions." + subPackage); startBlock(); printFetchOptionsFields(); @@ -552,12 +552,12 @@ public class DtoGenerator print(""); } - private void printClassHeader(String className) + private void printClassHeader(String className, String jsonPackage) { print("/**"); print(" * Class automatically generated with {@link %s}", this.getClass().getName()); print(" */"); - print("@JsonObject(\"%s\")", className); + print("@JsonObject(\"dto.%s.%s\")", jsonPackage, className); print("public class %s implements Serializable", className); } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/Generator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/Generator.java index 369aa5751a1d7abc7cf2b481b4debebdb4f7e957..d587c5d2e2ab83a394010437575164216bd2f7a3 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/Generator.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/Generator.java @@ -7,6 +7,7 @@ import java.util.List; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.attachment.Attachment; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ArchivingStatus; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.Complete; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetKind; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetType; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ExternalData; @@ -68,6 +69,8 @@ public class Generator extends AbstractGenerator gen.addFetchedField("List<Sample>", List.class.getName(), "children", "Children", SampleFetchOptions.class); gen.addFetchedField(Sample.class, "container", "Container sample", SampleFetchOptions.class); gen.addFetchedField("List<Sample>", List.class.getName(), "contained", "Contained samples", SampleFetchOptions.class); + gen.addFetchedField("List<DataSet>", List.class.getName(), "dataSets", "Data sets", DataSetFetchOptions.class); + gen.addClassForImport(DataSet.class); addTags(gen); addRegistrator(gen); addModifier(gen);