diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/AbstractSearchMethodExecutor.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/AbstractSearchMethodExecutor.java index dfcd8f01801f14638dd981d788d0bb3d16f1091b..8960b2e870c1595a196fce455c3e9d24d36aec08 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/AbstractSearchMethodExecutor.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/api/v3/executor/method/AbstractSearchMethodExecutor.java @@ -293,8 +293,13 @@ public abstract class AbstractSearchMethodExecutor<OBJECT, OBJECT_PE, CRITERION @Override public void cleanup() { - operationLog.info("Clean up cached search result on logout."); - getCache().evict(key); + ValueWrapper wrapper = getCache().get(key); + + if (wrapper != null) + { + operationLog.info("Clean up cached search result on logout."); + getCache().evict(key); + } } } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSet.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSet.java index d21529a0d1132a20911be055233afc0de3256d0a..a9180b27105e85d81233809f12bf4eda97b9fe84 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSet.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSet.java @@ -19,9 +19,11 @@ 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; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.history.HistoryEntry; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModifierHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IParentChildrenHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPropertiesHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; @@ -46,7 +48,7 @@ import java.util.Set; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.dataset.DataSet") -public class DataSet implements Serializable, ITagsHolder, IRegistrationDateHolder, IPropertiesHolder, IModifierHolder, IParentChildrenHolder<DataSet>, IModificationDateHolder, IRegistratorHolder +public class DataSet implements Serializable, ICodeHolder, ITagsHolder, IRegistrationDateHolder, IPermIdHolder, IPropertiesHolder, IModifierHolder, IParentChildrenHolder<DataSet>, IModificationDateHolder, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -131,6 +133,7 @@ public class DataSet implements Serializable, ITagsHolder, IRegistrationDateHold // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public DataSetPermId getPermId() { return permId; @@ -144,6 +147,7 @@ public class DataSet implements Serializable, ITagsHolder, IRegistrationDateHold // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSetType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSetType.java index 25e5f20adeb386b55ddc5786cc40bc3f7a3d27af..a886c56d702e680067197eac36923601aca702f0 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSetType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/DataSetType.java @@ -16,7 +16,9 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.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.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.DataSetTypeFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.exceptions.NotFetchedException; @@ -30,7 +32,7 @@ import java.util.Date; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.dataset.DataSetType") -public class DataSetType implements Serializable, IModificationDateHolder +public class DataSetType implements Serializable, ICodeHolder, IPermIdHolder, IModificationDateHolder { private static final long serialVersionUID = 1L; @@ -67,6 +69,7 @@ public class DataSetType implements Serializable, IModificationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public EntityTypePermId getPermId() { return permId; @@ -93,6 +96,7 @@ public class DataSetType implements Serializable, IModificationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/FileFormatType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/FileFormatType.java index 3112af041025f9c4aa2988a108780ba53a7fe856..35ed2344258c195a7b7ad342b2e61d39f13f6511 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/FileFormatType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/FileFormatType.java @@ -15,6 +15,7 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.FileFormatTypeFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.exceptions.NotFetchedException; import ch.systemsx.cisd.base.annotation.JsonObject; @@ -26,7 +27,7 @@ import java.io.Serializable; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.dataset.FileFormatType") -public class FileFormatType implements Serializable +public class FileFormatType implements Serializable, ICodeHolder { private static final long serialVersionUID = 1L; @@ -54,6 +55,7 @@ public class FileFormatType implements Serializable // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/LocatorType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/LocatorType.java index 923545be373f300b37cfbfe24dcbd1392514c8da..449dd02a73dd22b39baf7ca9f113e48d032fa796 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/LocatorType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/dataset/LocatorType.java @@ -15,6 +15,7 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset.LocatorTypeFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.exceptions.NotFetchedException; import ch.systemsx.cisd.base.annotation.JsonObject; @@ -26,7 +27,7 @@ import java.io.Serializable; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.dataset.LocatorType") -public class LocatorType implements Serializable +public class LocatorType implements Serializable, ICodeHolder { private static final long serialVersionUID = 1L; @@ -54,6 +55,7 @@ public class LocatorType implements Serializable // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/Experiment.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/Experiment.java index ba33e30ea448bbd8152fe50318c56aac7cad0e50..b5849166e04ee2d527a24106f762b4b4bfa52e18 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/Experiment.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/Experiment.java @@ -20,8 +20,10 @@ 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.ExperimentType; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.history.HistoryEntry; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IAttachmentsHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModifierHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPropertiesHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; @@ -48,7 +50,7 @@ import java.util.Set; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.experiment.Experiment") -public class Experiment implements Serializable, ITagsHolder, IRegistrationDateHolder, IAttachmentsHolder, IPropertiesHolder, IModifierHolder, IModificationDateHolder, IRegistratorHolder +public class Experiment implements Serializable, ICodeHolder, ITagsHolder, IRegistrationDateHolder, IAttachmentsHolder, IPermIdHolder, IPropertiesHolder, IModifierHolder, IModificationDateHolder, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -118,6 +120,7 @@ public class Experiment implements Serializable, ITagsHolder, IRegistrationDateH // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public ExperimentPermId getPermId() { return permId; @@ -144,6 +147,7 @@ public class Experiment implements Serializable, ITagsHolder, IRegistrationDateH // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/ExperimentType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/ExperimentType.java index c694435675910016193c5afd6d05c5caca508978..957c015a480fd9ab12fbd52d6c00bc06e6cca788 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/ExperimentType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/experiment/ExperimentType.java @@ -15,7 +15,9 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment.ExperimentTypeFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.exceptions.NotFetchedException; @@ -29,7 +31,7 @@ import java.util.Date; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.experiment.ExperimentType") -public class ExperimentType implements Serializable, IModificationDateHolder +public class ExperimentType implements Serializable, ICodeHolder, IPermIdHolder, IModificationDateHolder { private static final long serialVersionUID = 1L; @@ -63,6 +65,7 @@ public class ExperimentType implements Serializable, IModificationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public EntityTypePermId getPermId() { return permId; @@ -76,6 +79,7 @@ public class ExperimentType implements Serializable, IModificationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/interfaces/ICodeHolder.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/interfaces/ICodeHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..bb1810a6a9cc4c2f2b181bc9ee8a0ba80c091c8f --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/interfaces/ICodeHolder.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces; + +/** + * @author pkupczyk + */ +public interface ICodeHolder +{ + + String getCode(); + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/interfaces/IPermIdHolder.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/interfaces/IPermIdHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..68e25e2f7c8cdea3f9d1efaec7ce35f218352508 --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/interfaces/IPermIdHolder.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces; + +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.IObjectId; + +/** + * @author pkupczyk + */ +public interface IPermIdHolder +{ + + IObjectId getPermId(); + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/Material.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/Material.java index 787dcd8959e8fc2bba5f03513b4afde469ef5d17..7925f8722f452119f6b3d3e118d1a5e0db0b5842 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/Material.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/Material.java @@ -16,7 +16,9 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.history.HistoryEntry; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPropertiesHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; @@ -41,7 +43,7 @@ import java.util.Set; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.material.Material") -public class Material implements Serializable, ITagsHolder, IRegistrationDateHolder, IPropertiesHolder, IModificationDateHolder, IRegistratorHolder +public class Material implements Serializable, ICodeHolder, ITagsHolder, IRegistrationDateHolder, IPermIdHolder, IPropertiesHolder, IModificationDateHolder, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -93,6 +95,7 @@ public class Material implements Serializable, ITagsHolder, IRegistrationDateHol // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public MaterialPermId getPermId() { return permId; @@ -106,6 +109,7 @@ public class Material implements Serializable, ITagsHolder, IRegistrationDateHol // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/MaterialType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/MaterialType.java index e361711b079ea19401422bbd392bf2c3210b53ba..1f8116bbfdaba7908e8280ae1240cea56d244d16 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/MaterialType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/material/MaterialType.java @@ -15,7 +15,9 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material.MaterialTypeFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.exceptions.NotFetchedException; @@ -29,7 +31,7 @@ import java.util.Date; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.material.MaterialType") -public class MaterialType implements Serializable, IModificationDateHolder +public class MaterialType implements Serializable, ICodeHolder, IPermIdHolder, IModificationDateHolder { private static final long serialVersionUID = 1L; @@ -63,6 +65,7 @@ public class MaterialType implements Serializable, IModificationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public EntityTypePermId getPermId() { return permId; @@ -76,6 +79,7 @@ public class MaterialType implements Serializable, IModificationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/person/Person.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/person/Person.java index 26270a0bfe3906f80f68815ea99dd25141acb3f9..89aa3e43e67e016a926fbd15d1a5b175ac682d2d 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/person/Person.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/person/Person.java @@ -15,6 +15,7 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.person; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ISpaceHolder; @@ -33,7 +34,7 @@ import java.util.Date; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.person.Person") -public class Person implements Serializable, IRegistrationDateHolder, ISpaceHolder, IRegistratorHolder +public class Person implements Serializable, IRegistrationDateHolder, IPermIdHolder, ISpaceHolder, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -82,6 +83,7 @@ public class Person implements Serializable, IRegistrationDateHolder, ISpaceHold // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public PersonPermId getPermId() { return permId; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/project/Project.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/project/Project.java index 9de55398d9c94e89aa8fec175085bdaabd34ddf2..c1f4d08fe9e3351c52906472f47838af3d81cf56 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/project/Project.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/project/Project.java @@ -19,8 +19,10 @@ import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.attachment.Attachmen import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.history.HistoryEntry; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IAttachmentsHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModifierHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ISpaceHolder; @@ -41,7 +43,7 @@ import java.util.List; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.project.Project") -public class Project implements Serializable, IRegistrationDateHolder, IAttachmentsHolder, ISpaceHolder, IModifierHolder, IModificationDateHolder, IRegistratorHolder +public class Project implements Serializable, ICodeHolder, IRegistrationDateHolder, IAttachmentsHolder, IPermIdHolder, ISpaceHolder, IModifierHolder, IModificationDateHolder, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -102,6 +104,7 @@ public class Project implements Serializable, IRegistrationDateHolder, IAttachme // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public ProjectPermId getPermId() { return permId; @@ -128,6 +131,7 @@ public class Project implements Serializable, IRegistrationDateHolder, IAttachme // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; 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 e6aa3967df440e45ab3c3346208998bbc3ee1414..1c46e5968d584aedbed4d5a3e1dfb23f0f900ada 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 @@ -20,9 +20,11 @@ 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.history.HistoryEntry; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IAttachmentsHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModifierHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IParentChildrenHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPropertiesHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; @@ -51,7 +53,7 @@ import java.util.Set; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.sample.Sample") -public class Sample implements Serializable, ITagsHolder, IRegistrationDateHolder, IAttachmentsHolder, IPropertiesHolder, ISpaceHolder, IModifierHolder, IModificationDateHolder, IParentChildrenHolder<Sample>, IRegistratorHolder +public class Sample implements Serializable, ICodeHolder, ITagsHolder, IRegistrationDateHolder, IAttachmentsHolder, IPermIdHolder, IPropertiesHolder, ISpaceHolder, IModifierHolder, IModificationDateHolder, IParentChildrenHolder<Sample>, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -133,6 +135,7 @@ public class Sample implements Serializable, ITagsHolder, IRegistrationDateHolde // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public SamplePermId getPermId() { return permId; @@ -159,6 +162,7 @@ public class Sample implements Serializable, ITagsHolder, IRegistrationDateHolde // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/SampleType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/SampleType.java index 749544fa6f63acf6c46660ff5b788d1bf7e7957c..5d05b6fbe5f622eccb5f03ac11616c76b43aa59b 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/SampleType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/sample/SampleType.java @@ -15,7 +15,9 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample.SampleTypeFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.entitytype.EntityTypePermId; import ch.ethz.sis.openbis.generic.shared.api.v3.exceptions.NotFetchedException; @@ -29,7 +31,7 @@ import java.util.Date; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.sample.SampleType") -public class SampleType implements Serializable, IModificationDateHolder +public class SampleType implements Serializable, ICodeHolder, IPermIdHolder, IModificationDateHolder { private static final long serialVersionUID = 1L; @@ -78,6 +80,7 @@ public class SampleType implements Serializable, IModificationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public EntityTypePermId getPermId() { return permId; @@ -91,6 +94,7 @@ public class SampleType implements Serializable, IModificationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/space/Space.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/space/Space.java index 1c0368b90332816720c87a6cf514d4cad4b9f478..e632923a570a3f49d8d4a8b502bf4d5e86e75f59 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/space/Space.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/space/Space.java @@ -15,6 +15,9 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.space; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.person.Person; @@ -34,7 +37,7 @@ import java.util.List; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.space.Space") -public class Space implements Serializable, IRegistrationDateHolder, IRegistratorHolder +public class Space implements Serializable, ICodeHolder, IRegistrationDateHolder, IPermIdHolder, IModificationDateHolder, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -53,6 +56,9 @@ public class Space implements Serializable, IRegistrationDateHolder, IRegistrato @JsonProperty private Date registrationDate; + @JsonProperty + private Date modificationDate; + @JsonProperty private Person registrator; @@ -77,6 +83,7 @@ public class Space implements Serializable, IRegistrationDateHolder, IRegistrato // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public SpacePermId getPermId() { return permId; @@ -90,6 +97,7 @@ public class Space implements Serializable, IRegistrationDateHolder, IRegistrato // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; @@ -128,6 +136,20 @@ public class Space implements Serializable, IRegistrationDateHolder, IRegistrato this.registrationDate = registrationDate; } + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} + @JsonIgnore + @Override + public Date getModificationDate() + { + return modificationDate; + } + + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} + public void setModificationDate(Date modificationDate) + { + this.modificationDate = modificationDate; + } + // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore @Override diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/tag/Tag.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/tag/Tag.java index 8fd851982c9d81634556f543ed3170c0fe180e71..3b4a2006ea9b1e364f419fd4bf8ac7b4afcc7f4b 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/tag/Tag.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/tag/Tag.java @@ -15,6 +15,8 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.tag; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.person.Person; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.tag.TagFetchOptions; @@ -30,7 +32,7 @@ import java.util.Date; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.tag.Tag") -public class Tag implements Serializable, IRegistrationDateHolder +public class Tag implements Serializable, ICodeHolder, IRegistrationDateHolder, IPermIdHolder { private static final long serialVersionUID = 1L; @@ -70,6 +72,7 @@ public class Tag implements Serializable, IRegistrationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public TagPermId getPermId() { return permId; @@ -83,6 +86,7 @@ public class Tag implements Serializable, IRegistrationDateHolder // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/Vocabulary.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/Vocabulary.java index 201183d2a8be5beb3ec7f9e2ecf9a35077a99917..dabc8ccb0dd1e04755f2d6fedaa4a2ee797d8cbf 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/Vocabulary.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/Vocabulary.java @@ -15,6 +15,7 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; @@ -31,7 +32,7 @@ import java.util.Date; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.vocabulary.Vocabulary") -public class Vocabulary implements Serializable, IRegistrationDateHolder, IModificationDateHolder, IRegistratorHolder +public class Vocabulary implements Serializable, ICodeHolder, IRegistrationDateHolder, IModificationDateHolder, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -68,6 +69,7 @@ public class Vocabulary implements Serializable, IRegistrationDateHolder, IModif // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/VocabularyTerm.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/VocabularyTerm.java index 0c723dd22f443281653325caca6dc7724a5f781a..5c6be89ef774cdb3a39f0eaacbebd249b33c3aef 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/VocabularyTerm.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/entity/vocabulary/VocabularyTerm.java @@ -15,6 +15,7 @@ */ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; @@ -32,7 +33,7 @@ import java.util.Date; * Class automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} */ @JsonObject("dto.entity.vocabulary.VocabularyTerm") -public class VocabularyTerm implements Serializable, IRegistrationDateHolder, IModificationDateHolder, IRegistratorHolder +public class VocabularyTerm implements Serializable, ICodeHolder, IRegistrationDateHolder, IModificationDateHolder, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -81,6 +82,7 @@ public class VocabularyTerm implements Serializable, IRegistrationDateHolder, IM // Method automatically generated with {@link ch.ethz.sis.openbis.generic.shared.api.v3.dto.generators.DtoGenerator} @JsonIgnore + @Override public String getCode() { return code; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentSortOptions.java index 5246cafb6d24da01697350530290256dde189a46..a3341a5a9bee5cc6a0573b85af401052d34f8ef8 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/attachment/AttachmentSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.attachment; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.attachment.Attachment; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class AttachmentSortOptions extends SortOptions<Attachment> private static final long serialVersionUID = 1L; - @Override - public Comparator<Attachment> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetSortOptions.java index 14685162d7098f8b43d679c57fe5d5f87d96c6be..a2202e344247a4d53d51d29ab5eb76a3d7b8c46b 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetSortOptions.java @@ -16,23 +16,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSet; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.EntitySortOptions; /** * @author pkupczyk */ -public class DataSetSortOptions extends SortOptions<DataSet> +public class DataSetSortOptions extends EntitySortOptions<DataSet> { private static final long serialVersionUID = 1L; - @Override - public Comparator<DataSet> getComparator(String field) - { - return null; - } - } \ No newline at end of file diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeSortOptions.java index 414253140d96a9941fa6b872fec3257456a63e5f..6655db67e52edf45f7a14f9a1050f5ae3df412d1 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/DataSetTypeSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.DataSetType; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class DataSetTypeSortOptions extends SortOptions<DataSetType> private static final long serialVersionUID = 1L; - @Override - public Comparator<DataSetType> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataSortOptions.java index e770bc5a6fbede402f0e8bdbc99d007fcd5d8998..eb8725413a3e7c565587866a425780f3595cf62f 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/ExternalDataSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.ExternalData; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class ExternalDataSortOptions extends SortOptions<ExternalData> private static final long serialVersionUID = 1L; - @Override - public Comparator<ExternalData> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeSortOptions.java index ccd5be8675b4a411594483908de85df5e7dc8109..4fa067cb672c160c9842a6cbbc79f5c7d40317ff 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/FileFormatTypeSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.FileFormatType; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class FileFormatTypeSortOptions extends SortOptions<FileFormatType> private static final long serialVersionUID = 1L; - @Override - public Comparator<FileFormatType> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeSortOptions.java index c139479e2baf5c8a1f2c15850cd76b00c4321074..c8838f1dd66ca7fd8007d34d4a61daeb9216977b 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/dataset/LocatorTypeSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.dataset; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.dataset.LocatorType; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class LocatorTypeSortOptions extends SortOptions<LocatorType> private static final long serialVersionUID = 1L; - @Override - public Comparator<LocatorType> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionSortOptions.java index 46a240d6fbe36b0899e427c334c0fee1a8033dfd..54e8fa18391722c7bafcfac30100eed1458ebeba 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/deletion/DeletionSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.deletion; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.deletion.Deletion; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class DeletionSortOptions extends SortOptions<Deletion> private static final long serialVersionUID = 1L; - @Override - public Comparator<Deletion> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentSortOptions.java index 839f916dce8d7c36cb0f72ffff46b777c25c1953..ee7f35a5f5060f2111a1a8dc655d614084299002 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentSortOptions.java @@ -16,23 +16,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.EntitySortOptions; /** * @author pkupczyk */ -public class ExperimentSortOptions extends SortOptions<Experiment> +public class ExperimentSortOptions extends EntitySortOptions<Experiment> { private static final long serialVersionUID = 1L; - @Override - public Comparator<Experiment> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeSortOptions.java index 6b552db0b8187f983709e11dc3a4a0bde41239b0..23bbbbddb6d3b21e852c72b5ad2b6cebd7bbe5b0 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/experiment/ExperimentTypeSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.experiment; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.ExperimentType; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class ExperimentTypeSortOptions extends SortOptions<ExperimentType> private static final long serialVersionUID = 1L; - @Override - public Comparator<ExperimentType> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntrySortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntrySortOptions.java index 0fa7f134c163c6c87b82062de45172d9e9507d69..7e183fe925ab0fc8fd4502a3655de02ae52f8091 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntrySortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/history/HistoryEntrySortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.history; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.history.HistoryEntry; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class HistoryEntrySortOptions extends SortOptions<HistoryEntry> private static final long serialVersionUID = 1L; - @Override - public Comparator<HistoryEntry> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialSortOptions.java index 97cb3048be37f76c5bb1a9dacd491134030ede12..65806bf1794bab95e11aa1bf4affcb1d9b1255da 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialSortOptions.java @@ -16,82 +16,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.Material; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.AbstractComparator; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOrder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.EntitySortOptions; /** * @author pkupczyk */ -public class MaterialSortOptions extends SortOptions<Material> +public class MaterialSortOptions extends EntitySortOptions<Material> { private static final long serialVersionUID = 1L; - private static final String CODE = "CODE"; - - private static final String REGISTRATION_DATE = "REGISTRATION_DATE"; - - private static final Map<String, Comparator<Material>> comparators = new HashMap<>(); - - static - { - comparators.put(CODE, new CodeComparator()); - comparators.put(REGISTRATION_DATE, new RegistrationDateComparator()); - } - - public SortOrder code() - { - return getOrCreateSorting(CODE); - } - - public SortOrder getCode() - { - return getSorting(CODE); - } - - public SortOrder registrationDate() - { - return getOrCreateSorting(REGISTRATION_DATE); - } - - public SortOrder getRegistrationDate() - { - return getSorting(REGISTRATION_DATE); - } - - private static class CodeComparator extends AbstractComparator<Material, String> - { - - @Override - protected String getValue(Material o) - { - return o.getCode(); - } - - } - - private static class RegistrationDateComparator extends AbstractComparator<Material, Date> - { - - @Override - protected Date getValue(Material o) - { - return o.getRegistrationDate(); - } - - } - - @Override - public Comparator<Material> getComparator(String field) - { - return comparators.get(field); - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeSortOptions.java index aa5593f5bdd4565da648d5837b6e5c3fdb093033..6f11673ccf5040bfde51a2ae4d8ae2d5d91d865a 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/material/MaterialTypeSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.material; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.material.MaterialType; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class MaterialTypeSortOptions extends SortOptions<MaterialType> private static final long serialVersionUID = 1L; - @Override - public Comparator<MaterialType> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonSortOptions.java index 337b95db8df3770d4bc17bbaadd7e2e8d231e060..c65b540336bbf090aeb10971abf42a54d8ec746f 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/person/PersonSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.person; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.person.Person; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class PersonSortOptions extends SortOptions<Person> private static final long serialVersionUID = 1L; - @Override - public Comparator<Person> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectSortOptions.java index d804307d145c93f264457d0e8809e4229e2389d4..0bd96227909f11df3117167314db6c9fa136bf3a 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/project/ProjectSortOptions.java @@ -16,23 +16,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.project; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.project.Project; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.EntitySortOptions; /** * @author pkupczyk */ -public class ProjectSortOptions extends SortOptions<Project> +public class ProjectSortOptions extends EntitySortOptions<Project> { private static final long serialVersionUID = 1L; - @Override - public Comparator<Project> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleSortOptions.java index 05322bc53480fc7a57b053cbbf7f6295b3d5a7ac..ab02ed19b931421d04be21ee73fa72d796dfeb95 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleSortOptions.java @@ -16,23 +16,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.Sample; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.EntitySortOptions; /** * @author pkupczyk */ -public class SampleSortOptions extends SortOptions<Sample> +public class SampleSortOptions extends EntitySortOptions<Sample> { private static final long serialVersionUID = 1L; - @Override - public Comparator<Sample> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeSortOptions.java index 9a230c639e693e9c2574c18b83a5c002fff3a8b3..2fb085f485fa2bd5bff008429ba3e5dd1c001422 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sample/SampleTypeSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.sample.SampleType; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class SampleTypeSortOptions extends SortOptions<SampleType> private static final long serialVersionUID = 1L; - @Override - public Comparator<SampleType> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/EntitySortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/EntitySortOptions.java new file mode 100644 index 0000000000000000000000000000000000000000..d2048ec17977409e3f5ab02c232e7a094f4f6df2 --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/EntitySortOptions.java @@ -0,0 +1,79 @@ +/* + * Copyright 2015 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort; + +import static ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.CodeComparator.CODE; +import static ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.ModificationDateComparator.MODIFICATION_DATE; +import static ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.RegistrationDateComparator.REGISTRATION_DATE; + +import java.util.Comparator; +import java.util.Map; + +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.CodeComparator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.ModificationDateComparator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.RegistrationDateComparator; + +/** + * @author pkupczyk + */ +public class EntitySortOptions<OBJECT extends ICodeHolder & IRegistrationDateHolder & IModificationDateHolder> extends SortOptions<OBJECT> +{ + + private static final long serialVersionUID = 1L; + + public SortOrder code() + { + return getOrCreateSorting(CODE); + } + + public SortOrder getCode() + { + return getSorting(CODE); + } + + public SortOrder registrationDate() + { + return getOrCreateSorting(REGISTRATION_DATE); + } + + public SortOrder getRegistrationDate() + { + return getSorting(REGISTRATION_DATE); + } + + public SortOrder modificationDate() + { + return getOrCreateSorting(MODIFICATION_DATE); + } + + public SortOrder getModificationDate() + { + return getSorting(MODIFICATION_DATE); + } + + @Override + public void addComparators(Map<String, Comparator<OBJECT>> map) + { + map.put(CODE, new CodeComparator<OBJECT>()); + map.put(REGISTRATION_DATE, new RegistrationDateComparator<OBJECT>()); + map.put(MODIFICATION_DATE, new ModificationDateComparator<OBJECT>()); + } + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java index 6a5d0d6d2d82b00755f2dd1fdd7f1f145525b887..87801758c9a04fb50497ae3800f273a6de5f832b 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortAndPage.java @@ -28,6 +28,9 @@ import java.util.Set; import java.util.TreeSet; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.FetchOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.view.AbstractCollectionView; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.view.ListView; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.view.SetView; /** * @author pkupczyk diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOptions.java index dda6ef69d81fbd48053c470f820597dba94c19e7..d20b0914239ed18fb9ea6ef183e1f0babf1ada49 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SortOptions.java @@ -18,8 +18,10 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort; import java.io.Serializable; import java.util.Comparator; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; /** * @author pkupczyk @@ -29,9 +31,25 @@ public abstract class SortOptions<OBJECT> implements Serializable private static final long serialVersionUID = 1L; + private transient Map<String, Comparator<OBJECT>> comparators; + private List<Sorting> sortings = new LinkedList<>(); - public abstract Comparator<OBJECT> getComparator(String field); + protected void addComparators(Map<String, Comparator<OBJECT>> map) + { + } + + public final Comparator<OBJECT> getComparator(String field) + { + if (comparators == null) + { + Map<String, Comparator<OBJECT>> map = new HashMap<String, Comparator<OBJECT>>(); + addComparators(map); + comparators = map; + } + + return comparators.get(field); + } protected SortOrder getOrCreateSorting(String field) { diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractComparator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/AbstractComparator.java similarity index 98% rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractComparator.java rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/AbstractComparator.java index ebf18ba023370da6077069d2233c3e920d9467f0..abab698dbf3671e710febd72695c67f929d32379 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractComparator.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/AbstractComparator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort; +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator; import java.util.Comparator; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/CodeComparator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/CodeComparator.java new file mode 100644 index 0000000000000000000000000000000000000000..f4bdd276445def490403a124cd89efeee0a70105 --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/CodeComparator.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator; + +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; + +/** + * @author pkupczyk + */ +public class CodeComparator<OBJECT extends ICodeHolder> extends AbstractComparator<OBJECT, String> +{ + + public static final String CODE = "CODE"; + + @Override + protected String getValue(ICodeHolder o) + { + return o.getCode(); + } + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/ModificationDateComparator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/ModificationDateComparator.java new file mode 100644 index 0000000000000000000000000000000000000000..0ca8a07eebc5424925a7006fb94950001490829e --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/ModificationDateComparator.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator; + +import java.util.Date; + +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; + +/** + * @author pkupczyk + */ +public class ModificationDateComparator<OBJECT extends IModificationDateHolder> extends AbstractComparator<OBJECT, Date> +{ + + public static final String MODIFICATION_DATE = "MODIFICATION_DATE"; + + @Override + protected Date getValue(IModificationDateHolder o) + { + return o.getModificationDate(); + } + +} \ No newline at end of file diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/RegistrationDateComparator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/RegistrationDateComparator.java new file mode 100644 index 0000000000000000000000000000000000000000..efc8ad5c8c0c966b92f97d59c2e5562ee4ac00fd --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/comparator/RegistrationDateComparator.java @@ -0,0 +1,37 @@ +/* + * Copyright 2015 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator; + +import java.util.Date; + +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; + +/** + * @author pkupczyk + */ +public class RegistrationDateComparator<OBJECT extends IRegistrationDateHolder> extends AbstractComparator<OBJECT, Date> +{ + + public static final String REGISTRATION_DATE = "REGISTRATION_DATE"; + + @Override + protected Date getValue(IRegistrationDateHolder o) + { + return o.getRegistrationDate(); + } + +} \ No newline at end of file diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractCollectionView.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/AbstractCollectionView.java similarity index 99% rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractCollectionView.java rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/AbstractCollectionView.java index a27f8bf59b33ac3d6c3548b33c5d420da97cf573..2dabf1fc370d45e3de409e95daeca16c2aa720ae 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/AbstractCollectionView.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/AbstractCollectionView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort; +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.view; import java.io.Serializable; import java.util.Collection; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/ListView.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/ListView.java similarity index 99% rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/ListView.java rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/ListView.java index 2eaa1cfcad323a1cb300aa8744435bf19579e504..be5aa5ed33dd1c2f6874ad92f3a05cd3247b129f 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/ListView.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/ListView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort; +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.view; import java.util.ArrayList; import java.util.Collection; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SetView.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/SetView.java similarity index 99% rename from openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SetView.java rename to openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/SetView.java index c7b1778d4a739ae23b9c083566796938884eead0..3bd6369aed1aa1f0b0762fecb1be27c27174d3af 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/SetView.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/sort/view/SetView.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort; +package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.view; import java.util.Collection; import java.util.Collections; diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceSortOptions.java index 68d29b97f8751de9c9d1680ac4fea91434601d41..ec8037fb80f17b65ae700c85672b6a7f6e7fcd37 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/space/SpaceSortOptions.java @@ -16,23 +16,15 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.space; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.space.Space; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.EntitySortOptions; /** * @author pkupczyk */ -public class SpaceSortOptions extends SortOptions<Space> +public class SpaceSortOptions extends EntitySortOptions<Space> { private static final long serialVersionUID = 1L; - @Override - public Comparator<Space> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagSortOptions.java index bc8626ca79dce2773028d99df182f70a46749d12..9cf4a015777e7179b598632fef6524d87feac621 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/tag/TagSortOptions.java @@ -16,15 +16,17 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.tag; +import static ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.CodeComparator.CODE; +import static ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.RegistrationDateComparator.REGISTRATION_DATE; + import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; import java.util.Map; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.tag.Tag; -import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.AbstractComparator; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOrder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.CodeComparator; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.comparator.RegistrationDateComparator; /** * @author pkupczyk @@ -34,18 +36,6 @@ public class TagSortOptions extends SortOptions<Tag> private static final long serialVersionUID = 1L; - private static final String CODE = "CODE"; - - private static final String REGISTRATION_DATE = "REGISTRATION_DATE"; - - private static final Map<String, Comparator<Tag>> comparators = new HashMap<>(); - - static - { - comparators.put(CODE, new CodeComparator()); - comparators.put(REGISTRATION_DATE, new RegistrationDateComparator()); - } - public SortOrder code() { return getOrCreateSorting(CODE); @@ -66,32 +56,10 @@ public class TagSortOptions extends SortOptions<Tag> return getSorting(REGISTRATION_DATE); } - private static class CodeComparator extends AbstractComparator<Tag, String> - { - - @Override - protected String getValue(Tag o) - { - return o.getCode(); - } - - } - - private static class RegistrationDateComparator extends AbstractComparator<Tag, Date> - { - - @Override - protected Date getValue(Tag o) - { - return o.getRegistrationDate(); - } - - } - @Override - public Comparator<Tag> getComparator(String field) + public void addComparators(Map<String, Comparator<Tag>> map) { - return comparators.get(field); + map.put(CODE, new CodeComparator<Tag>()); + map.put(REGISTRATION_DATE, new RegistrationDateComparator<Tag>()); } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularySortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularySortOptions.java index 48b9784847395d6ee1979204bbf3301635a9ec59..c23e71730f1600f2a81858d1d0a61e8c1bacd476 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularySortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularySortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary.Vocabulary; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class VocabularySortOptions extends SortOptions<Vocabulary> private static final long serialVersionUID = 1L; - @Override - public Comparator<Vocabulary> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermSortOptions.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermSortOptions.java index 258388987d4e5c607604cf50c141479e59359e26..22c25f8f275a187f61acf86f1bdd15565ffe1357 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermSortOptions.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/fetchoptions/vocabulary/VocabularyTermSortOptions.java @@ -16,8 +16,6 @@ package ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.vocabulary; -import java.util.Comparator; - import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.vocabulary.VocabularyTerm; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sort.SortOptions; @@ -29,10 +27,4 @@ public class VocabularyTermSortOptions extends SortOptions<VocabularyTerm> private static final long serialVersionUID = 1L; - @Override - public Comparator<VocabularyTerm> getComparator(String field) - { - return null; - } - } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/AbstractGenerator.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/AbstractGenerator.java index 5905d413f5b7382cb685023233c616c4dc22fa0b..1a85fdeeaecba31b4a75f05745990389f6ad8043 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/AbstractGenerator.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/shared/api/v3/dto/generators/AbstractGenerator.java @@ -8,8 +8,10 @@ import java.util.Set; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.attachment.Attachment; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.experiment.Experiment; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IAttachmentsHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IModifierHolder; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IPropertiesHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.entity.interfaces.IRegistratorHolder; @@ -28,6 +30,7 @@ import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.property.Prope import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.sample.SampleFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.space.SpaceFetchOptions; import ch.ethz.sis.openbis.generic.shared.api.v3.dto.fetchoptions.tag.TagFetchOptions; +import ch.ethz.sis.openbis.generic.shared.api.v3.dto.id.IObjectId; public class AbstractGenerator { @@ -56,7 +59,12 @@ public class AbstractGenerator public static void addCode(DtoGenerator gen) { - gen.addSimpleField(String.class, "code"); + gen.addSimpleField(String.class, "code").withInterface(ICodeHolder.class); + } + + public static void addPermId(DtoGenerator gen, Class<? extends IObjectId> permIdClass) + { + gen.addSimpleField(permIdClass, "permId").withInterface(IPermIdHolder.class); } public static void addExperiment(DtoGenerator gen) 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 970e793ffd38049e3a730160845a2e4fffbc8524..f597709ef9eb1db2ba2d04c2c7b229e05bf87fd1 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 @@ -67,7 +67,7 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("sample", "Sample", SampleFetchOptions.class); - gen.addSimpleField(SamplePermId.class, "permId"); + addPermId(gen, SamplePermId.class); gen.addSimpleField(SampleIdentifier.class, "identifier"); addCode(gen); addRegistrationDate(gen); @@ -111,7 +111,7 @@ public class Generator extends AbstractGenerator DtoGenerator gen = new DtoGenerator("sample", "SampleType", SampleTypeFetchOptions.class); - gen.addSimpleField(EntityTypePermId.class, "permId"); + addPermId(gen, EntityTypePermId.class); addCode(gen); addDescription(gen); gen.addBooleanField("listable"); @@ -121,7 +121,7 @@ public class Generator extends AbstractGenerator gen.addStringField("generatedCodePrefix"); addModificationDate(gen); - + gen.setToStringMethod("\"SampleType \" + code"); return gen; @@ -153,7 +153,7 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("experiment", "Experiment", ExperimentFetchOptions.class); - gen.addSimpleField(ExperimentPermId.class, "permId"); + addPermId(gen, ExperimentPermId.class); gen.addSimpleField(ExperimentIdentifier.class, "identifier"); addCode(gen); addRegistrationDate(gen); @@ -186,13 +186,13 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("experiment", "ExperimentType", ExperimentTypeFetchOptions.class); - gen.addSimpleField(EntityTypePermId.class, "permId"); + addPermId(gen, EntityTypePermId.class); addCode(gen); addDescription(gen); addModificationDate(gen); gen.setToStringMethod("\"ExperimentType \" + code"); - + // TODO add property definitions // TODO add validation script @@ -203,7 +203,7 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("dataset", "DataSet", DataSetFetchOptions.class); - gen.addSimpleField(DataSetPermId.class, "permId"); + addPermId(gen, DataSetPermId.class); addCode(gen); gen.addDateField("accessDate"); @@ -235,7 +235,7 @@ public class Generator extends AbstractGenerator addExperiment(gen); addSample(gen); addProperties(gen); - + gen.setToStringMethod("\"DataSet \" + code"); return gen; @@ -245,14 +245,14 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("dataset", "DataSetType", DataSetTypeFetchOptions.class); - gen.addSimpleField(EntityTypePermId.class, "permId"); + addPermId(gen, EntityTypePermId.class); gen.addSimpleField(DataSetKind.class, "kind"); addCode(gen); addDescription(gen); addModificationDate(gen); gen.setToStringMethod("\"DataSetType \" + code"); - + // TODO add property definitions // TODO add validation script @@ -274,7 +274,7 @@ public class Generator extends AbstractGenerator gen.addBooleanField("presentInArchive"); gen.addBooleanField("storageConfirmation"); gen.addSimpleField(Integer.class, "speedHint"); - + gen.setToStringMethod("\"ExternalData \" + location"); return gen; @@ -284,9 +284,9 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("dataset", "FileFormatType", FileFormatTypeFetchOptions.class); - gen.addStringField("code"); + addCode(gen); gen.addStringField("description"); - + gen.setToStringMethod("\"FileFormatType \" + code"); return gen; @@ -296,9 +296,9 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("dataset", "LocatorType", LocatorTypeFetchOptions.class); - gen.addStringField("code"); + addCode(gen); gen.addStringField("description"); - + gen.setToStringMethod("\"LocatorType \" + code"); return gen; @@ -310,9 +310,9 @@ public class Generator extends AbstractGenerator gen.addSimpleField(IDeletionId.class, "id"); gen.addStringField("reason"); gen.addPluralFetchedField("List<DeletedObject>", List.class.getName(), "deletedObjects", "Deleted objects", DeletionFetchOptions.class); - + gen.setToStringMethod("\"Deletion \" + id"); - + return gen; } @@ -325,7 +325,7 @@ public class Generator extends AbstractGenerator addRegistrationDate(gen); addRegistrator(gen); addModificationDate(gen); - + gen.setToStringMethod("\"Vocabulary \" + code"); return gen; @@ -344,7 +344,7 @@ public class Generator extends AbstractGenerator addRegistrationDate(gen); addRegistrator(gen); addModificationDate(gen); - + gen.setToStringMethod("\"VocabularyTerm \" + code"); return gen; @@ -354,7 +354,7 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("person", "Person", PersonFetchOptions.class); - gen.addSimpleField(PersonPermId.class, "permId"); + addPermId(gen, PersonPermId.class); gen.addStringField("userId"); gen.addStringField("firstName"); gen.addStringField("lastName"); @@ -364,7 +364,7 @@ public class Generator extends AbstractGenerator addSpace(gen); addRegistrator(gen); - + gen.setToStringMethod("\"Person \" + userId"); return gen; @@ -374,7 +374,7 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("project", "Project", ProjectFetchOptions.class); - gen.addSimpleField(ProjectPermId.class, "permId"); + addPermId(gen, ProjectPermId.class); gen.addSimpleField(ProjectIdentifier.class, "identifier"); addCode(gen); addDescription(gen); @@ -392,7 +392,7 @@ public class Generator extends AbstractGenerator gen.addFetchedField(Person.class, "leader", "Leader", PersonFetchOptions.class); addAttachments(gen); - + gen.setToStringMethod("\"Project \" + permId"); return gen; @@ -402,18 +402,19 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("space", "Space", SpaceFetchOptions.class); - gen.addSimpleField(SpacePermId.class, "permId"); + addPermId(gen, SpacePermId.class); addCode(gen); addDescription(gen); addRegistrationDate(gen); + addModificationDate(gen); addRegistrator(gen); gen.addPluralFetchedField("List<Sample>", List.class.getName(), "samples", "Samples", SampleFetchOptions.class); gen.addClassForImport(Sample.class); gen.addPluralFetchedField("List<Project>", List.class.getName(), "projects", "Projects", ProjectFetchOptions.class); gen.addClassForImport(Project.class); - + gen.setToStringMethod("\"Space \" + permId"); - + return gen; } @@ -421,14 +422,14 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("tag", "Tag", TagFetchOptions.class); - gen.addSimpleField(TagPermId.class, "permId"); - gen.addStringField("code"); + addPermId(gen, TagPermId.class); + addCode(gen); addDescription(gen); gen.addSimpleField(Boolean.class, "private", "isPrivate"); addRegistrationDate(gen); gen.addFetchedField(Person.class, "owner", "Owner", PersonFetchOptions.class); - + gen.setToStringMethod("\"Tag \" + code"); return gen; @@ -437,7 +438,7 @@ public class Generator extends AbstractGenerator private static DtoGenerator createMaterialGenerator() { DtoGenerator gen = new DtoGenerator("material", "Material", MaterialFetchOptions.class); - gen.addSimpleField(MaterialPermId.class, "permId"); + addPermId(gen, MaterialPermId.class); addCode(gen); gen.addFetchedField(MaterialType.class, "type", "Material type", MaterialTypeFetchOptions.class); @@ -449,9 +450,9 @@ public class Generator extends AbstractGenerator addModificationDate(gen); addProperties(gen); addTags(gen); - + gen.setToStringMethod("\"Material \" + code"); - + return gen; } @@ -459,13 +460,13 @@ public class Generator extends AbstractGenerator { DtoGenerator gen = new DtoGenerator("material", "MaterialType", MaterialTypeFetchOptions.class); - gen.addSimpleField(EntityTypePermId.class, "permId"); + addPermId(gen, EntityTypePermId.class); addCode(gen); addDescription(gen); addModificationDate(gen); - + gen.setToStringMethod("\"MaterialType \" + code"); - + return gen; } @@ -475,9 +476,9 @@ public class Generator extends AbstractGenerator gen.addSimpleField(Date.class, "validFrom"); gen.addSimpleField(Date.class, "validTo"); gen.addFetchedField(Person.class, "author", "Author", PersonFetchOptions.class); - + gen.setToStringMethod("\"HistoryEntry from: \" + validFrom + \", to: \" + validTo"); - + return gen; }