diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java index b5df2cb9d69e7441753c4a88e195f40fe2eb963e..5e15a0056363f553b6a2b44b14a0944ed8dcf4e6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/CommonServer.java @@ -2566,7 +2566,7 @@ public final class CommonServer extends AbstractCommonServer<ICommonServerForInt Sample sample = getSampleInfo(sessionToken, entityId).getParent(); try { - EntityHelper.updateSampleProperties(this, sessionToken, entityId, properties); + EntityHelper.updateSampleProperties(this, sessionToken, sample, properties); } catch (UserFailureException e) { throw wrapExceptionWithEntityIdentifier(e, sample); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceTest.java index 60a81a1b9f56cbf17b328bbfb3f16bae149b9842..6e7ef02da22a565a02c36d16795743ef111379a9 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceTest.java @@ -40,12 +40,10 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.builders.VocabularyTerm import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; /** - * - * * @author Franz-Josef Elmer */ -//PLEASE, if you add here a new test add also a system test to -//ch.systemsx.cisd.openbis.systemtest.api.v1.GeneralInformationChangingServiceTest +// PLEASE, if you add here a new test add also a system test to +// ch.systemsx.cisd.openbis.systemtest.api.v1.GeneralInformationChangingServiceTest public class GeneralInformationChangingServiceTest extends AbstractServerTestCase { private static final long SAMPLE_ID = 137; @@ -69,13 +67,15 @@ public class GeneralInformationChangingServiceTest extends AbstractServerTestCas public void testUpdateSampleProperties() { prepareGetSession(); - final RecordingMatcher<SampleUpdatesDTO> updateMatcher = new RecordingMatcher<SampleUpdatesDTO>(); + final RecordingMatcher<SampleUpdatesDTO> updateMatcher = + new RecordingMatcher<SampleUpdatesDTO>(); context.checking(new Expectations() { { one(commonServer).getSampleInfo(SESSION_TOKEN, new TechId(SAMPLE_ID)); SampleBuilder sample = new SampleBuilder("/P/S1:A03") + .id(SAMPLE_ID) .experiment( new ExperimentBuilder().identifier("/S/P/E") .getExperiment()) @@ -89,7 +89,7 @@ public class GeneralInformationChangingServiceTest extends AbstractServerTestCas SampleParentWithDerived sampleParentWithDerived = new SampleParentWithDerived(); sampleParentWithDerived.setParent(sample.getSample()); will(returnValue(sampleParentWithDerived)); - + one(commonServer).updateSample(with(SESSION_TOKEN), with(updateMatcher)); } }); @@ -97,7 +97,7 @@ public class GeneralInformationChangingServiceTest extends AbstractServerTestCas properties.put("age", "76"); properties.put("greetings", "hello"); properties.put("material", "B (Fluid)"); - + service.updateSampleProperties(SESSION_TOKEN, SAMPLE_ID, properties); SampleUpdatesDTO updatesDTO = updateMatcher.recordedObject(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected index 09c133053f47bde20eba67a08a441a86459ec4df..6ca2a81b02c2d4c39f41dff0ced8b4ab55ae6bcb 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java.expected @@ -103,6 +103,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewVocabulary; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyUpdates; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleAssignment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy.RoleCode; @@ -1360,27 +1361,39 @@ public interface ICommonServer extends IServer @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public String getDefaultPutDataStoreBaseURL(String sessionToken); + /** + * Updates properties of a data set with given id. + */ @Transactional @RolesAllowed(RoleWithHierarchy.SPACE_USER) - public void updateDataSetProperty(String sessionToken, + public void updateDataSetProperties(String sessionToken, @AuthorizationGuard(guardClass = DataSetTechIdPredicate.class) TechId entityId, - String propertyCode, String value); + List<PropertyUpdates> modifiedProperties); + /** + * Updates properties of an experiment with given id. + */ @Transactional @RolesAllowed(RoleWithHierarchy.SPACE_USER) - public void updateExperimentProperty(String sessionToken, + public void updateExperimentProperties(String sessionToken, @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) TechId entityId, - String propertyCode, String value); + List<PropertyUpdates> modifiedProperties); + /** + * Updates properties of a sample with given id. + */ @Transactional @RolesAllowed(RoleWithHierarchy.SPACE_USER) - public void updateSampleProperty(String sessionToken, + public void updateSampleProperties(String sessionToken, @AuthorizationGuard(guardClass = SampleTechIdPredicate.class) TechId entityId, - String propertyCode, String value); + List<PropertyUpdates> modifiedProperties); + /** + * Updates properties of a material with given id. + */ @Transactional @RolesAllowed(RoleWithHierarchy.INSTANCE_ADMIN) - public void updateMaterialProperty(String sessionToken, TechId entityId, String propertyCode, - String value); + public void updateMaterialProperties(String sessionToken, TechId entityId, + List<PropertyUpdates> modifiedProperties); }