diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/AbstractGenerator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/AbstractGenerator.java index f8b6b6730d19c96e136cdaa5e231e71b900a249e..dbd22aee43b99536263e1cb5d2712b5940c199da 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/AbstractGenerator.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/AbstractGenerator.java @@ -17,6 +17,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModificationD import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModifierHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPermIdHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertiesHolder; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertyAssignmentsHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IRegistratorHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ISampleHolder; @@ -144,7 +145,7 @@ public class AbstractGenerator public static void addPropertyAssignments(DtoGenerator gen) { gen.addPluralFetchedField("List<PropertyAssignment>", List.class.getName(), "propertyAssignments", - "Property assigments", PropertyAssignmentFetchOptions.class); + "Property assigments", PropertyAssignmentFetchOptions.class).withInterface(IPropertyAssignmentsHolder.class); gen.addClassForImport(PropertyAssignment.class); } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/Generator.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/Generator.java index ee5f67a306b141c7e08f8cf0ae063beff5d5bd1a..7acc7067642bf6898c96431f01451f1033d38493 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/Generator.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/asapi/v3/helper/generators/Generator.java @@ -16,6 +16,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IOwnerHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IParentChildrenHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IProjectHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IProjectsHolder; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertyTypeHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ISamplesHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.ArchivingStatus; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.Complete; @@ -645,7 +646,8 @@ public class Generator extends AbstractGenerator gen.addStringField("section"); gen.addSimpleField(Integer.class, "ordinal"); - gen.addFetchedField(PropertyType.class, "propertyType", "Property type", PropertyTypeFetchOptions.class); + gen.addFetchedField(PropertyType.class, "propertyType", "Property type", PropertyTypeFetchOptions.class) + .withInterface(IPropertyTypeHolder.class); gen.addBooleanField("mandatory"); gen.addBooleanField("showInEditView"); gen.addBooleanField("showRawValueInForms"); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/common/interfaces/IPropertyAssignmentsHolder.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/common/interfaces/IPropertyAssignmentsHolder.js new file mode 100644 index 0000000000000000000000000000000000000000..8df2e3d5f9020b50a616d8e540dac3e5d0f2cb35 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/common/interfaces/IPropertyAssignmentsHolder.js @@ -0,0 +1,10 @@ +define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) { + var IPropertyAssignmentsHolder = function() { + }; + stjs.extend(IPropertyAssignmentsHolder, null, [], function(constructor, prototype) { + prototype.getPropertyAssignments = function() { + throw new exceptions.RuntimeException("Interface method."); + }; + }, {}); + return IPropertyAssignmentsHolder; +}) \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/common/interfaces/IPropertyTypeHolder.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/common/interfaces/IPropertyTypeHolder.js new file mode 100644 index 0000000000000000000000000000000000000000..9a4251a6f6a5505449a90f12a5b4b07ed3032e07 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/as/dto/common/interfaces/IPropertyTypeHolder.js @@ -0,0 +1,10 @@ +define([ "stjs", "util/Exceptions" ], function(stjs, exceptions) { + var IPropertyTypeHolder = function() { + }; + stjs.extend(IPropertyTypeHolder, null, [], function(constructor, prototype) { + prototype.getPropertyType = function() { + throw new exceptions.RuntimeException("Interface method."); + }; + }, {}); + return IPropertyTypeHolder; +}) \ No newline at end of file diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractTest.java index 23e6c865dfe773d93294eaa3504047ac8a904a2e..742fa422aee9588fa2d23ff27cefe599f68641cf 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractTest.java @@ -62,6 +62,8 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IParentChildre import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IProjectHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IProjectsHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertiesHolder; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertyAssignmentsHolder; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertyTypeHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IRegistratorHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ISampleHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ISamplesHolder; @@ -74,6 +76,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.Material; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.id.MaterialPermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.Project; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.Sample; import ch.ethz.sis.openbis.generic.asapi.v3.dto.space.Space; import ch.ethz.sis.openbis.generic.asapi.v3.dto.tag.Tag; @@ -320,6 +323,18 @@ public class AbstractTest extends SystemTestCase }); } + protected void assertPropertyTypeNotFetched(final IPropertyTypeHolder propertyTypeHolder) + { + assertNotFetched(new IDelegatedAction() + { + @Override + public void execute() + { + propertyTypeHolder.getPropertyType(); + } + }); + } + protected void assertPropertiesNotFetched(final IPropertiesHolder propertiesHolder) { assertNotFetched(new IDelegatedAction() @@ -332,6 +347,18 @@ public class AbstractTest extends SystemTestCase }); } + protected void assertPropertyAssignmentsNotFetched(final IPropertyAssignmentsHolder propertyAssignmentsHolder) + { + assertNotFetched(new IDelegatedAction() + { + @Override + public void execute() + { + propertyAssignmentsHolder.getPropertyAssignments(); + } + }); + } + protected void assertContainerNotFetched(final Sample sample) { assertNotFetched(new IDelegatedAction() @@ -512,6 +539,30 @@ public class AbstractTest extends SystemTestCase }); } + protected void assertVocabularyNotFetched(final PropertyType propertyType) + { + assertNotFetched(new IDelegatedAction() + { + @Override + public void execute() + { + propertyType.getVocabulary(); + } + }); + } + + protected void assertMaterialTypeNotFetched(final PropertyType propertyType) + { + assertNotFetched(new IDelegatedAction() + { + @Override + public void execute() + { + propertyType.getMaterialType(); + } + }); + } + protected void assertNotFetched(final IDelegatedAction action) { try diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/GetExperimentTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/GetExperimentTest.java index f2dbb9490a23f7c3eafa24eae02ba90c1138dd50..94efe804c64c739cb552f2d7abce1e88ed0f5129 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/GetExperimentTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/GetExperimentTest.java @@ -19,6 +19,7 @@ package ch.ethz.sis.openbis.systemtest.asapi.v3; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import java.text.SimpleDateFormat; @@ -59,6 +60,9 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectIdentifier; import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectPermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.DataType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyType; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyTypeFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.Sample; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.create.SampleCreation; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SamplePermId; @@ -330,6 +334,8 @@ public class GetExperimentTest extends AbstractExperimentTest assertEquals(type.getCode(), "SIRNA_HCS"); assertEquals(type.getDescription(), "Small Interfering RNA High Content Screening"); assertNotNull(type.getModificationDate()); + assertPropertyAssignmentsNotFetched(type); + assertEquals(type.getFetchOptions().hasPropertyAssignments(), false); assertProjectNotFetched(experiment); assertPropertiesNotFetched(experiment); @@ -337,12 +343,63 @@ public class GetExperimentTest extends AbstractExperimentTest assertRegistratorNotFetched(experiment); assertModifierNotFetched(experiment); assertAttachmentsNotFetched(experiment); - assertEquals(type.getFetchOptions().hasPropertyAssignments(), false); v3api.logout(sessionToken); } @Test - public void testGetWithTypeAndPropertyAssignments() + public void testGetWithTypeWithPropertyAssignments() + { + String sessionToken = v3api.login(TEST_USER, PASSWORD); + ExperimentFetchOptions fetchOptions = new ExperimentFetchOptions(); + fetchOptions.withType().withPropertyAssignments(); + ExperimentPermId permId = new ExperimentPermId("200811050951882-1028"); + + Map<IExperimentId, Experiment> map = v3api.getExperiments(sessionToken, Arrays.asList(permId), fetchOptions); + + assertEquals(1, map.size()); + Experiment experiment = map.get(permId); + ExperimentType type = experiment.getType(); + assertEquals(type.getCode(), "SIRNA_HCS"); + + assertEquals(type.getFetchOptions().hasPropertyAssignments(), true); + List<PropertyAssignment> propertyAssignments = type.getPropertyAssignments(); + assertEquals(propertyAssignments.size(), 3); + + // DESCRIPTION + PropertyAssignment propertyAssignment0 = propertyAssignments.get(0); + assertEquals(propertyAssignment0.getOrdinal(), Integer.valueOf(1)); + assertEquals(propertyAssignment0.isMandatory(), Boolean.TRUE); + assertEquals(propertyAssignment0.isShowInEditView(), Boolean.TRUE); + assertEquals(propertyAssignment0.isShowRawValueInForms(), Boolean.FALSE); + assertEqualsDate(propertyAssignment0.getRegistrationDate(), "2008-11-05 09:18:00"); + + // PURCHASE_DATE + PropertyAssignment propertyAssignment1 = propertyAssignments.get(1); + assertEquals(propertyAssignment1.getOrdinal(), Integer.valueOf(2)); + assertEquals(propertyAssignment1.isMandatory(), Boolean.FALSE); + assertEquals(propertyAssignment1.isShowInEditView(), Boolean.TRUE); + assertEquals(propertyAssignment1.isShowRawValueInForms(), Boolean.FALSE); + assertEqualsDate(propertyAssignment1.getRegistrationDate(), "2008-11-05 09:18:24"); + + // GENDER + PropertyAssignment propertyAssignment2 = propertyAssignments.get(2); + assertEquals(propertyAssignment2.getOrdinal(), Integer.valueOf(3)); + assertEquals(propertyAssignment2.isMandatory(), Boolean.FALSE); + assertEquals(propertyAssignment2.isShowInEditView(), Boolean.TRUE); + assertEquals(propertyAssignment2.isShowRawValueInForms(), Boolean.FALSE); + assertEqualsDate(propertyAssignment2.getRegistrationDate(), "2008-11-05 09:21:53"); + + for (PropertyAssignment propertyAssignment : propertyAssignments) + { + assertPropertyTypeNotFetched(propertyAssignment); + assertRegistratorNotFetched(propertyAssignment); + } + + v3api.logout(sessionToken); + } + + @Test + public void testGetWithTypeWithPropertyAssignmentsWithImplicitPropertyTypeFromSorting() { String sessionToken = v3api.login(TEST_USER, PASSWORD); ExperimentFetchOptions fetchOptions = new ExperimentFetchOptions(); @@ -355,17 +412,119 @@ public class GetExperimentTest extends AbstractExperimentTest Experiment experiment = map.get(permId); ExperimentType type = experiment.getType(); assertEquals(type.getCode(), "SIRNA_HCS"); + assertEquals(type.getFetchOptions().hasPropertyAssignments(), true); List<PropertyAssignment> propertyAssignments = type.getPropertyAssignments(); + assertEquals(propertyAssignments.size(), 3); + assertEquals(propertyAssignments.get(0).getPropertyType().getCode(), "PURCHASE_DATE"); - assertEquals(propertyAssignments.get(0).getPropertyType().getLabel(), "Purchased"); - assertEquals(propertyAssignments.get(0).getPropertyType().getDescription(), "When material has been bought"); - assertEquals(propertyAssignments.get(0).getPropertyType().isInternalNameSpace(), Boolean.FALSE); - assertEquals(propertyAssignments.get(0).getPropertyType().getDataType(), DataType.TIMESTAMP); - assertEquals(propertyAssignments.get(0).isMandatory(), Boolean.FALSE); assertEquals(propertyAssignments.get(1).getPropertyType().getCode(), "GENDER"); assertEquals(propertyAssignments.get(2).getPropertyType().getCode(), "DESCRIPTION"); + + for (PropertyAssignment propertyAssignment : propertyAssignments) + { + assertRegistratorNotFetched(propertyAssignment); + } + + v3api.logout(sessionToken); + } + + @Test + public void testGetWithTypeWithPropertyAssignmentsWithExplicitPropertyType() + { + String sessionToken = v3api.login(TEST_USER, PASSWORD); + + ExperimentFetchOptions fetchOptions = new ExperimentFetchOptions(); + PropertyAssignmentFetchOptions propertyAssignmentFetchOptions = fetchOptions.withType().withPropertyAssignments(); + propertyAssignmentFetchOptions.withPropertyType(); + propertyAssignmentFetchOptions.withRegistrator(); + + ExperimentPermId permId = new ExperimentPermId("200811050951882-1028"); + Map<IExperimentId, Experiment> map = v3api.getExperiments(sessionToken, Arrays.asList(permId), fetchOptions); + + assertEquals(1, map.size()); + Experiment experiment = map.get(permId); + ExperimentType type = experiment.getType(); + assertEquals(type.getCode(), "SIRNA_HCS"); + + assertEquals(type.getFetchOptions().hasPropertyAssignments(), true); + List<PropertyAssignment> propertyAssignments = type.getPropertyAssignments(); assertEquals(propertyAssignments.size(), 3); + + PropertyType propertyType0 = propertyAssignments.get(0).getPropertyType(); + assertEquals(propertyType0.getCode(), "DESCRIPTION"); + assertEquals(propertyType0.getLabel(), "Description"); + assertEquals(propertyType0.getDescription(), "A Description"); + assertEquals(propertyType0.isInternalNameSpace(), Boolean.FALSE); + assertEquals(propertyType0.isManagedInternally(), Boolean.FALSE); + assertEquals(propertyType0.getDataType(), DataType.VARCHAR); + assertEqualsDate(propertyType0.getRegistrationDate(), "2008-11-05 09:18:00"); + + PropertyType propertyType1 = propertyAssignments.get(1).getPropertyType(); + assertEquals(propertyType1.getCode(), "PURCHASE_DATE"); + assertEquals(propertyType1.getLabel(), "Purchased"); + assertEquals(propertyType1.getDescription(), "When material has been bought"); + assertEquals(propertyType1.isInternalNameSpace(), Boolean.FALSE); + assertEquals(propertyType1.isManagedInternally(), Boolean.FALSE); + assertEquals(propertyType1.getDataType(), DataType.TIMESTAMP); + assertEqualsDate(propertyType1.getRegistrationDate(), "2008-11-05 09:18:16"); + + PropertyType propertyType2 = propertyAssignments.get(2).getPropertyType(); + assertEquals(propertyType2.getCode(), "GENDER"); + assertEquals(propertyType2.getLabel(), "Gender"); + assertEquals(propertyType2.getDescription(), "The gender of the living organism"); + assertEquals(propertyType2.isInternalNameSpace(), Boolean.FALSE); + assertEquals(propertyType2.isManagedInternally(), Boolean.FALSE); + assertEquals(propertyType2.getDataType(), DataType.CONTROLLEDVOCABULARY); + assertEqualsDate(propertyType2.getRegistrationDate(), "2008-11-05 09:18:31"); + + assertEquals(propertyAssignments.get(0).getRegistrator().getUserId(), "system"); + assertEquals(propertyAssignments.get(1).getRegistrator().getUserId(), "test"); + assertEquals(propertyAssignments.get(2).getRegistrator().getUserId(), "test"); + + for (PropertyAssignment propertyAssignment : propertyAssignments) + { + PropertyType propertyType = propertyAssignment.getPropertyType(); + assertVocabularyNotFetched(propertyType); + assertMaterialTypeNotFetched(propertyType); + assertRegistratorNotFetched(propertyType); + } + + v3api.logout(sessionToken); + } + + @Test + public void testGetWithTypeWithPropertyAssignmentsWithExplicitPropertyTypeWithAllOptions() + { + String sessionToken = v3api.login(TEST_USER, PASSWORD); + + ExperimentFetchOptions fetchOptions = new ExperimentFetchOptions(); + PropertyTypeFetchOptions propertyTypeFetchOptions = fetchOptions.withType().withPropertyAssignments().withPropertyType(); + propertyTypeFetchOptions.withVocabulary(); + propertyTypeFetchOptions.withMaterialType(); + propertyTypeFetchOptions.withRegistrator(); + + ExperimentPermId permId = new ExperimentPermId("200811050951882-1028"); + Map<IExperimentId, Experiment> map = v3api.getExperiments(sessionToken, Arrays.asList(permId), fetchOptions); + + assertEquals(1, map.size()); + Experiment experiment = map.get(permId); + ExperimentType type = experiment.getType(); + assertEquals(type.getCode(), "SIRNA_HCS"); + + assertEquals(type.getFetchOptions().hasPropertyAssignments(), true); + List<PropertyAssignment> propertyAssignments = type.getPropertyAssignments(); + assertEquals(propertyAssignments.size(), 3); + + assertEquals(propertyAssignments.get(0).getPropertyType().getCode(), "DESCRIPTION"); + assertEquals(propertyAssignments.get(1).getPropertyType().getCode(), "PURCHASE_DATE"); + assertEquals(propertyAssignments.get(2).getPropertyType().getCode(), "GENDER"); + + PropertyType propertyType = propertyAssignments.get(2).getPropertyType(); + assertEquals(propertyType.getVocabulary().getCode(), "GENDER"); + assertNull(propertyType.getMaterialType()); + assertEquals(propertyType.getRegistrator().getUserId(), "test"); + v3api.logout(sessionToken); } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/interfaces/IPropertyAssignmentsHolder.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/interfaces/IPropertyAssignmentsHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..a524b73c58013ca30811b940df22a6458490954f --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/interfaces/IPropertyAssignmentsHolder.java @@ -0,0 +1,33 @@ +/* + * 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.asapi.v3.dto.common.interfaces; + +import java.util.List; + +import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; +import ch.systemsx.cisd.base.annotation.JsonObject; + +/** + * @author pkupczyk + */ +@JsonObject("as.dto.common.interfaces.IPropertyAssignmentsHolder") +public interface IPropertyAssignmentsHolder +{ + + public List<PropertyAssignment> getPropertyAssignments(); + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/interfaces/IPropertyTypeHolder.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/interfaces/IPropertyTypeHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..dce18bd8afa9b41720e03feb7ac6e286caf887fb --- /dev/null +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/common/interfaces/IPropertyTypeHolder.java @@ -0,0 +1,31 @@ +/* + * 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.asapi.v3.dto.common.interfaces; + +import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyType; +import ch.systemsx.cisd.base.annotation.JsonObject; + +/** + * @author pkupczyk + */ +@JsonObject("as.dto.common.interfaces.IPropertyTypeHolder") +public interface IPropertyTypeHolder +{ + + public PropertyType getPropertyType(); + +} diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/DataSetType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/DataSetType.java index 2a8f9c78a79abb7260aa70aaa85ce8907041fa11..a1dabc1cd944903abc51171b37125c49d172814a 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/DataSetType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/dataset/DataSetType.java @@ -18,6 +18,7 @@ package ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPermIdHolder; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertyAssignmentsHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetKind; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions.DataSetTypeFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; @@ -34,7 +35,7 @@ import java.util.List; * Class automatically generated with DtoGenerator */ @JsonObject("as.dto.dataset.DataSetType") -public class DataSetType implements Serializable, ICodeHolder, IModificationDateHolder, IPermIdHolder +public class DataSetType implements Serializable, ICodeHolder, IModificationDateHolder, IPermIdHolder, IPropertyAssignmentsHolder { private static final long serialVersionUID = 1L; @@ -142,6 +143,7 @@ public class DataSetType implements Serializable, ICodeHolder, IModificationDate // Method automatically generated with DtoGenerator @JsonIgnore + @Override public List<PropertyAssignment> getPropertyAssignments() { if (getFetchOptions() != null && getFetchOptions().hasPropertyAssignments()) diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/ExperimentType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/ExperimentType.java index f0810b910e83b6ec4802a9317719d8f783a728ab..0c19bf0af5cdb4b7c82d60bedbed547f4331b675 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/ExperimentType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/experiment/ExperimentType.java @@ -18,6 +18,7 @@ package ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPermIdHolder; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertyAssignmentsHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions.ExperimentTypeFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; @@ -33,7 +34,7 @@ import java.util.List; * Class automatically generated with DtoGenerator */ @JsonObject("as.dto.experiment.ExperimentType") -public class ExperimentType implements Serializable, ICodeHolder, IModificationDateHolder, IPermIdHolder +public class ExperimentType implements Serializable, ICodeHolder, IModificationDateHolder, IPermIdHolder, IPropertyAssignmentsHolder { private static final long serialVersionUID = 1L; @@ -125,6 +126,7 @@ public class ExperimentType implements Serializable, ICodeHolder, IModificationD // Method automatically generated with DtoGenerator @JsonIgnore + @Override public List<PropertyAssignment> getPropertyAssignments() { if (getFetchOptions() != null && getFetchOptions().hasPropertyAssignments()) diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/MaterialType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/MaterialType.java index 4010318e4e2a8198b42a55217f84f8381ca10856..920afb96f605e4d8b7b2073227a1c0bbeef15583 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/MaterialType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/material/MaterialType.java @@ -18,6 +18,7 @@ package ch.ethz.sis.openbis.generic.asapi.v3.dto.material; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPermIdHolder; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertyAssignmentsHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.fetchoptions.MaterialTypeFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; @@ -33,7 +34,7 @@ import java.util.List; * Class automatically generated with DtoGenerator */ @JsonObject("as.dto.material.MaterialType") -public class MaterialType implements Serializable, ICodeHolder, IModificationDateHolder, IPermIdHolder +public class MaterialType implements Serializable, ICodeHolder, IModificationDateHolder, IPermIdHolder, IPropertyAssignmentsHolder { private static final long serialVersionUID = 1L; @@ -125,6 +126,7 @@ public class MaterialType implements Serializable, ICodeHolder, IModificationDat // Method automatically generated with DtoGenerator @JsonIgnore + @Override public List<PropertyAssignment> getPropertyAssignments() { if (getFetchOptions() != null && getFetchOptions().hasPropertyAssignments()) diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyAssignment.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyAssignment.java index f2cbaa57d72e4be4327af19927a247f349de3b15..c55f1319b9ebc4312a516ace361c3ba4d5a02d01 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyAssignment.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyAssignment.java @@ -15,6 +15,7 @@ */ package ch.ethz.sis.openbis.generic.asapi.v3.dto.property; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertyTypeHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IRegistrationDateHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IRegistratorHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.person.Person; @@ -31,7 +32,7 @@ import java.util.Date; * Class automatically generated with DtoGenerator */ @JsonObject("as.dto.property.PropertyAssignment") -public class PropertyAssignment implements Serializable, IRegistrationDateHolder, IRegistratorHolder +public class PropertyAssignment implements Serializable, IPropertyTypeHolder, IRegistrationDateHolder, IRegistratorHolder { private static final long serialVersionUID = 1L; @@ -103,6 +104,7 @@ public class PropertyAssignment implements Serializable, IRegistrationDateHolder // Method automatically generated with DtoGenerator @JsonIgnore + @Override public PropertyType getPropertyType() { if (getFetchOptions() != null && getFetchOptions().hasPropertyType()) diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyType.java index 1b9f3f74df47f8d6309403cd56f16ffc38d77925..dc49b53b8ccdcb9ce4ee6416999974b135719d4b 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/property/PropertyType.java @@ -176,7 +176,8 @@ public class PropertyType implements Serializable, ICodeHolder, IRegistrationDat if (getFetchOptions() != null && getFetchOptions().hasVocabulary()) { return vocabulary; - } else + } + else { throw new NotFetchedException("Vocabulary has not been fetched."); } @@ -195,7 +196,8 @@ public class PropertyType implements Serializable, ICodeHolder, IRegistrationDat if (getFetchOptions() != null && getFetchOptions().hasMaterialType()) { return materialType; - } else + } + else { throw new NotFetchedException("Material type has not been fetched."); } @@ -241,7 +243,8 @@ public class PropertyType implements Serializable, ICodeHolder, IRegistrationDat if (getFetchOptions() != null && getFetchOptions().hasRegistrator()) { return registrator; - } else + } + else { throw new NotFetchedException("Registrator has not been fetched."); } diff --git a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/SampleType.java b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/SampleType.java index 358cdda7d7ca6d8f1f718e999a0d66dad61d83e9..101de6390f479180ec5aea48f06333a0f2e9cca1 100644 --- a/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/SampleType.java +++ b/openbis_api/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/sample/SampleType.java @@ -18,6 +18,7 @@ package ch.ethz.sis.openbis.generic.asapi.v3.dto.sample; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.ICodeHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IModificationDateHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPermIdHolder; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IPropertyAssignmentsHolder; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleTypeFetchOptions; @@ -33,7 +34,7 @@ import java.util.List; * Class automatically generated with DtoGenerator */ @JsonObject("as.dto.sample.SampleType") -public class SampleType implements Serializable, ICodeHolder, IModificationDateHolder, IPermIdHolder +public class SampleType implements Serializable, ICodeHolder, IModificationDateHolder, IPermIdHolder, IPropertyAssignmentsHolder { private static final long serialVersionUID = 1L; @@ -205,6 +206,7 @@ public class SampleType implements Serializable, ICodeHolder, IModificationDateH // Method automatically generated with DtoGenerator @JsonIgnore + @Override public List<PropertyAssignment> getPropertyAssignments() { if (getFetchOptions() != null && getFetchOptions().hasPropertyAssignments()) diff --git a/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt index b3ff9ebf41d833f578794497ba9d0ad1fa709a0f..ab0557a1a1863b59603a711dad37427e0c6325a9 100644 --- a/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt +++ b/openbis_api/sourceTest/java/ch/ethz/sis/openbis/generic/sharedapi/v3/dictionary.txt @@ -1217,4 +1217,6 @@ set Transformation with Material Type with Material Type Using with Property Type -with Property Type Using \ No newline at end of file +with Property Type Using +I Property Assignments Holder +I Property Type Holder \ No newline at end of file