diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/RelationshipService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/RelationshipService.java index fc959ee771a5e0bd554dd1b7913f6288585413b0..4949b04103e2e458b28fa3bf70c2565d942f6147 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/RelationshipService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/RelationshipService.java @@ -22,7 +22,6 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.DAOFactory; import ch.systemsx.cisd.openbis.generic.shared.IRelationshipService; import ch.systemsx.cisd.openbis.generic.shared.basic.BasicConstant; import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; -import ch.systemsx.cisd.openbis.generic.shared.dto.DatabaseInstancePE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.IAuthSession; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; @@ -31,11 +30,6 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.RelationshipTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleRelationshipPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.DatabaseInstanceIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier; /** * The unique {@link IRelationshipService} implementation. @@ -44,24 +38,6 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier; */ public class RelationshipService implements IRelationshipService { - private static final String ERR_EXPERIMENT_NOT_FOUND = - "Experiment '%s' not found"; - - private static final String ERR_PROJECT_NOT_FOUND = - "Project '%s' not found"; - - private static final String ERR_SPACE_NOT_FOUND = - "Space '%s' not found"; - - private static final String ERR_DATABASE_NOT_FOUND = - "Database '%s' not found"; - - private static final String ERR_SAMPLE_NOT_FOUND = - "Sample '%s' not found"; - - private static final String ERR_DATASET_NOT_FOUND = - "Sample '%s' not found"; - private static final String ERR_SAMPLE_PARENT_RELATIONSHIP_NOT_FOUND = "Sample '%s' did not have parent '%s'"; @@ -130,47 +106,37 @@ public class RelationshipService implements IRelationshipService } @Override - public void assignDataSetToExperiment(IAuthSession session, String dataSetCode, - ExperimentIdentifier experimentId) + public void assignDataSetToExperiment(IAuthSession session, DataPE data, + ExperimentPE experiment) { - DataPE data = findDataSet(dataSetCode); - ExperimentPE experiment = findExperiment(experimentId); data.setExperiment(experiment); data.setSample(null); } @Override - public void assignDataSetToSample(IAuthSession session, String dataSetCode, - SampleIdentifier sampleId) + public void assignDataSetToSample(IAuthSession session, DataPE data, SamplePE sample) { - DataPE data = findDataSet(dataSetCode); - SamplePE sample = findSample(sampleId); data.setExperiment(sample.getExperiment()); data.setSample(sample); } @Override - public void addParentToSample(IAuthSession session, SampleIdentifier sampleId, - SampleIdentifier parentId) + public void addParentToSample(IAuthSession session, SamplePE sample, + SamplePE parent) { PersonPE actor = session.tryGetPerson(); RelationshipTypePE relationshipType = daoFactory.getRelationshipTypeDAO().tryFindRelationshipTypeByCode( BasicConstant.PARENT_CHILD_INTERNAL_RELATIONSHIP); - SamplePE sample = findSample(sampleId); - SamplePE parent = findSample(parentId); - sample.addParentRelationship(new SampleRelationshipPE(parent, sample, relationshipType, actor)); } @Override - public void removeParentFromSample(IAuthSession session, SampleIdentifier sampleId, - SampleIdentifier parentId) + public void removeParentFromSample(IAuthSession session, SamplePE sample, + SamplePE parent) { - SamplePE sample = findSample(sampleId); - SamplePE parent = findSample(parentId); for (SampleRelationshipPE relationship : sample.getParentRelationships()) { if (relationship.getParentSample().equals(parent)) @@ -179,117 +145,22 @@ public class RelationshipService implements IRelationshipService return; } } - throw UserFailureException.fromTemplate(ERR_SAMPLE_PARENT_RELATIONSHIP_NOT_FOUND, sampleId, - parentId); + throw UserFailureException.fromTemplate(ERR_SAMPLE_PARENT_RELATIONSHIP_NOT_FOUND, sample + .getCode(), parent.getCode()); } @Override - public void assignSampleToContainer(IAuthSession session, SampleIdentifier sampleId, - SamplePE sample, - SampleIdentifier containerId, SamplePE container) + public void assignSampleToContainer(IAuthSession session, SamplePE sample, SamplePE container) { - // SamplePE sample = findSample(sampleId); - // SamplePE container = findSample(containerId); sample.setContainer(container); } @Override - public void removeSampleFromContainer(IAuthSession session, SampleIdentifier sampleId, - SamplePE sample) + public void removeSampleFromContainer(IAuthSession session, SamplePE sample) { - // SamplePE sample = findSample(sampleId); sample.setContainer(null); } - private DataPE findDataSet(String dataSetCode) - { - DataPE data = daoFactory.getDataDAO().tryToFindDataSetByCode(dataSetCode); - if (data == null) - { - throw UserFailureException.fromTemplate(ERR_DATASET_NOT_FOUND, dataSetCode); - } - return data; - } - - private SamplePE findSample(SampleIdentifier sampleId) - { - SamplePE sample; - if (sampleId.getDatabaseInstanceLevel() != null) - { - DatabaseInstancePE dbin = findDatabaseInstance(sampleId.getDatabaseInstanceLevel()); - sample = daoFactory.getSampleDAO().tryFindByCodeAndDatabaseInstance( - sampleId.getSampleCode(), - dbin); - } else - { - SpacePE space = findSpace(sampleId.getSpaceLevel()); - sample = - daoFactory.getSampleDAO() - .tryFindByCodeAndSpace(sampleId.getSampleCode(), space); - } - - if (sample == null) - { - throw UserFailureException.fromTemplate(ERR_SAMPLE_NOT_FOUND, sampleId); - } - - return sample; - } - - private ExperimentPE findExperiment(ExperimentIdentifier experimentId) - { - ProjectPE project = findProject(experimentId); - ExperimentPE experiment = - daoFactory.getExperimentDAO().tryFindByCodeAndProject(project, - experimentId.getExperimentCode()); - if (experiment == null) - { - throw UserFailureException.fromTemplate(ERR_EXPERIMENT_NOT_FOUND, experimentId); - } - - return experiment; - } - - private ProjectPE findProject(ProjectIdentifier projectId) - { - ProjectPE project = - daoFactory.getProjectDAO().tryFindProject(projectId.getDatabaseInstanceCode(), - projectId.getSpaceCode(), projectId.getProjectCode()); - - if (project == null) - { - throw UserFailureException.fromTemplate(ERR_PROJECT_NOT_FOUND, projectId); - } - return project; - } - - private SpacePE findSpace(SpaceIdentifier spaceId) - { - DatabaseInstancePE dbin = findDatabaseInstance(spaceId); - SpacePE space = - daoFactory.getSpaceDAO().tryFindSpaceByCodeAndDatabaseInstance( - spaceId.getSpaceCode(), dbin); - if (space == null) - { - throw UserFailureException.fromTemplate(ERR_SPACE_NOT_FOUND, spaceId); - } - - return space; - } - - private DatabaseInstancePE findDatabaseInstance(DatabaseInstanceIdentifier dbinId) - { - DatabaseInstancePE dbin = - daoFactory.getDatabaseInstanceDAO().tryFindDatabaseInstanceByCode( - dbinId.getDatabaseInstanceCode()); - - if (dbin == null) - { - throw UserFailureException.fromTemplate(ERR_DATABASE_NOT_FOUND, dbinId); - } - return dbin; - } - public void setDaoFactory(DAOFactory daoFactory) { this.daoFactory = daoFactory; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractDataSetBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractDataSetBusinessObject.java index 506ba7ddb7cb3070f9f9a7b3389aa9438c851b4d..ebf5d549087bc6f3f71482ece46a8f0a902caf91 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractDataSetBusinessObject.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractDataSetBusinessObject.java @@ -42,7 +42,6 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; import ch.systemsx.cisd.openbis.generic.shared.dto.Session; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.IdentifierHelper; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; @@ -126,8 +125,7 @@ public abstract class AbstractDataSetBusinessObject extends AbstractSampleIdenti "the new sample is not connected to any experiment"); } - relationshipService.assignDataSetToSample(session, data.getCode(), IdentifierHelper - .sample(newSample)); + relationshipService.assignDataSetToSample(session, data, newSample); } protected void updateExperiment(DataPE data, ExperimentIdentifier experimentIdentifier) @@ -141,8 +139,7 @@ public abstract class AbstractDataSetBusinessObject extends AbstractSampleIdenti { if (experiment.equals(data.getExperiment()) == false) { - relationshipService.assignDataSetToExperiment(session, data.getCode(), IdentifierHelper - .createExperimentIdentifier(experiment)); + relationshipService.assignDataSetToExperiment(session, data, experiment); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java index 133f45e8b502f56730cf380e3b4a2f449aade36b..274f6ccade13b3263b69b8c463a19d0084e4afd1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java @@ -222,14 +222,10 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi if (containerPE == null) { - relationshipService.removeSampleFromContainer(session, IdentifierHelper - .sample(samplePE), samplePE); + relationshipService.removeSampleFromContainer(session, samplePE); } else { - relationshipService.assignSampleToContainer(session, IdentifierHelper - .sample(samplePE), samplePE, - IdentifierHelper - .sample(containerPE), containerPE); + relationshipService.assignSampleToContainer(session, samplePE, containerPE); } } @@ -278,29 +274,15 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi newParents.remove(r.getParentSample()); } else { - relationshipService.removeParentFromSample(session, IdentifierHelper.sample(child), - IdentifierHelper.sample(r.getParentSample())); + relationshipService.removeParentFromSample(session, child, r.getParentSample()); } } - SampleIdentifier childId = IdentifierHelper.sample(child); - if (this.tryToGetSampleByIdentifier(childId) == null) // new sample + for (SamplePE newParent : newParents) { - PersonPE actor = findPerson(); - RelationshipTypePE relationship = tryFindParentChildRelationshipType(); - for (SamplePE newParent : newParents) - { - child.addParentRelationship(new SampleRelationshipPE(newParent, child, - relationship, actor)); - } - } else - { - for (SamplePE newParent : newParents) - { - relationshipService.addParentToSample(session, childId, - IdentifierHelper.sample(newParent)); - } + relationshipService.addParentToSample(session, child, newParent); } + } protected RelationshipTypePE tryFindParentChildRelationshipType() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IRelationshipService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IRelationshipService.java index 34f7e6a3825c8d5eee8e1c135e43aa39ff2e5e91..7b849ae39b9959bae5c82590386605b292b162d8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IRelationshipService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IRelationshipService.java @@ -22,21 +22,18 @@ import org.springframework.transaction.annotation.Transactional; import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.AuthorizationGuard; import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.Capability; import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RolesAllowed; -import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.DataSetCodePredicate; +import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.DataPEPredicate; import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.ExperimentPEPredicate; import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.ProjectPEPredicate; -import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.SampleOwnerIdentifierPredicate; import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.SamplePEPredicate; -import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.SpaceIdentifierPredicate; import ch.systemsx.cisd.openbis.generic.shared.authorization.predicate.SpacePEPredicate; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.IAuthSession; import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; /** * Definition of an internal service through which entity relationships can be changed and deleted. @@ -117,51 +114,49 @@ public interface IRelationshipService { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ASSIGN_DATASET_TO_EXPERIMENT") public void assignDataSetToExperiment(IAuthSession session, - @AuthorizationGuard(guardClass = DataSetCodePredicate.class) - String dataSetCode, - @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) - ExperimentIdentifier experiment); + @AuthorizationGuard(guardClass = DataPEPredicate.class) + DataPE dataSet, + @AuthorizationGuard(guardClass = ExperimentPEPredicate.class) + ExperimentPE experiment); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ASSIGN_DATASET_TO_SAMPLE") public void assignDataSetToSample(IAuthSession session, - @AuthorizationGuard(guardClass = DataSetCodePredicate.class) - String dataSetCode, - @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) - SampleIdentifier sample); + @AuthorizationGuard(guardClass = DataPEPredicate.class) + DataPE dataSet, + @AuthorizationGuard(guardClass = SamplePEPredicate.class) + SamplePE sample); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ADD_PARENT_TO_SAMPLE") public void addParentToSample(IAuthSession session, - @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) - SampleIdentifier sample, - @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) - SampleIdentifier parent); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) + SamplePE sample, + @AuthorizationGuard(guardClass = SamplePEPredicate.class) + SamplePE parent); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("REMOVE_PARENT_FROM_SAMPLE") public void removeParentFromSample(IAuthSession session, - @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) - SampleIdentifier sample, - @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) - SampleIdentifier parent); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) + SamplePE sample, + @AuthorizationGuard(guardClass = SamplePEPredicate.class) + SamplePE parent); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ADD_CONTAINER_TO_SAMPLE") public void assignSampleToContainer(IAuthSession session, - @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) - SampleIdentifier sampleId, + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample, - @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) - SampleIdentifier containerId, + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE container); @Transactional(propagation = Propagation.MANDATORY) @@ -169,8 +164,7 @@ public interface IRelationshipService { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("REMOVE_CONTAINER_FROM_SAMPLE") public void removeSampleFromContainer(IAuthSession session, - @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) - SampleIdentifier sampleId, + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java index 1c44a0d5002359f65a11169d9593547782caab11..df809c833fb91bef234a3d5a62a059172a558b8c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java @@ -39,7 +39,6 @@ import ch.systemsx.cisd.common.exceptions.AuthorizationFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.server.business.ManagerTestTool; import ch.systemsx.cisd.openbis.generic.shared.CommonTestUtils; -import ch.systemsx.cisd.openbis.generic.shared.basic.BasicConstant; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; @@ -52,7 +51,6 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; import ch.systemsx.cisd.openbis.generic.shared.dto.DatabaseInstancePE; import ch.systemsx.cisd.openbis.generic.shared.dto.IAuthSession; import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; -import ch.systemsx.cisd.openbis.generic.shared.dto.RelationshipTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePropertyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePE; @@ -195,8 +193,7 @@ public final class SampleBOTest extends AbstractBOTest will(returnValue(null)); allowing(relationshipService).removeSampleFromContainer( - with(any(IAuthSession.class)), with(any(SampleIdentifier.class)), - with(any(SamplePE.class))); + with(any(IAuthSession.class)), with(any(SamplePE.class))); BaseMatcher<SamplePE> matcher = new BaseMatcher<SamplePE>() { @@ -285,12 +282,6 @@ public final class SampleBOTest extends AbstractBOTest allowing(daoFactory).getRelationshipTypeDAO(); will(returnValue(relationshipTypeDAO)); - one(relationshipTypeDAO).tryFindRelationshipTypeByCode( - BasicConstant.PARENT_CHILD_INTERNAL_RELATIONSHIP); - RelationshipTypePE result = new RelationshipTypePE(); - result.setCode(BasicConstant.PARENT_CHILD_INTERNAL_RELATIONSHIP); - will(returnValue(result)); - allowing(daoFactory).getSampleDAO(); will(returnValue(sampleDAO)); @@ -322,9 +313,12 @@ public final class SampleBOTest extends AbstractBOTest one(permIdDAO).createPermId(); will(returnValue("2009010112341234-1")); - allowing(relationshipService).assignSampleToContainer( - with(any(IAuthSession.class)), with(any(SampleIdentifier.class)), - with(any(SamplePE.class)), with(any(SampleIdentifier.class)), + one(relationshipService).assignSampleToContainer( + with(any(IAuthSession.class)), with(any(SamplePE.class)), + with(any(SamplePE.class))); + + one(relationshipService).addParentToSample( + with(any(IAuthSession.class)), with(any(SamplePE.class)), with(any(SamplePE.class))); } }); @@ -333,11 +327,8 @@ public final class SampleBOTest extends AbstractBOTest sampleBO.define(newSample); final SamplePE sample = sampleBO.getSample(); - // / assertEquals(sampleIdentifier.toString(), sample.getSampleIdentifier().toString()); assertEquals(EXAMPLE_PERSON, sample.getRegistrator()); assertSame(sampleType, sample.getSampleType()); - // assertEquals(container, sample.getContainer()); - assertEquals(generatedFrom, sample.getGeneratedFrom()); context.assertIsSatisfied(); } @@ -404,11 +395,6 @@ public final class SampleBOTest extends AbstractBOTest allowing(daoFactory).getRelationshipTypeDAO(); will(returnValue(relationshipTypeDAO)); - exactly(1).of(relationshipTypeDAO).tryFindRelationshipTypeByCode( - BasicConstant.PARENT_CHILD_INTERNAL_RELATIONSHIP); - RelationshipTypePE relationship = new RelationshipTypePE(); - relationship.setCode(BasicConstant.PARENT_CHILD_INTERNAL_RELATIONSHIP); - will(returnValue(relationship)); allowing(databaseInstanceDAO).tryFindDatabaseInstanceByCode( EXAMPLE_DATABASE_INSTANCE.getCode()); will(returnValue(EXAMPLE_DATABASE_INSTANCE)); @@ -431,7 +417,10 @@ public final class SampleBOTest extends AbstractBOTest with(any(IAuthSession.class)), with(any(SamplePE.class))); allowing(relationshipService).removeSampleFromContainer( - with(any(IAuthSession.class)), with(any(SampleIdentifier.class)), + with(any(IAuthSession.class)), with(any(SamplePE.class))); + + one(relationshipService).addParentToSample( + with(any(IAuthSession.class)), with(any(SamplePE.class)), with(any(SamplePE.class))); } @@ -443,9 +432,6 @@ public final class SampleBOTest extends AbstractBOTest new SampleUpdatesDTO(SAMPLE_TECH_ID, null, null, Collections .<NewAttachment> emptyList(), now, IdentifierHelper.sample(sample), null, modifiedParents)); - SamplePE newParent = sample.getGeneratedFrom(); - assertNotNull(newParent); - assertEquals(parent, newParent); context.assertIsSatisfied(); } @@ -469,11 +455,6 @@ public final class SampleBOTest extends AbstractBOTest allowing(daoFactory).getRelationshipTypeDAO(); will(returnValue(relationshipTypeDAO)); - exactly(1).of(relationshipTypeDAO).tryFindRelationshipTypeByCode( - BasicConstant.PARENT_CHILD_INTERNAL_RELATIONSHIP); - RelationshipTypePE relationship = new RelationshipTypePE(); - relationship.setCode(BasicConstant.PARENT_CHILD_INTERNAL_RELATIONSHIP); - will(returnValue(relationship)); allowing(databaseInstanceDAO).tryFindDatabaseInstanceByCode( EXAMPLE_DATABASE_INSTANCE.getCode()); will(returnValue(EXAMPLE_DATABASE_INSTANCE)); @@ -511,7 +492,10 @@ public final class SampleBOTest extends AbstractBOTest with(any(IAuthSession.class)), with(any(SamplePE.class))); allowing(relationshipService).removeSampleFromContainer( - with(any(IAuthSession.class)), with(any(SampleIdentifier.class)), + with(any(IAuthSession.class)), with(any(SamplePE.class))); + + atLeast(3).of(relationshipService).addParentToSample( + with(any(IAuthSession.class)), with(any(SamplePE.class)), with(any(SamplePE.class))); } @@ -525,12 +509,6 @@ public final class SampleBOTest extends AbstractBOTest new SampleUpdatesDTO(SAMPLE_TECH_ID, null, null, Collections .<NewAttachment> emptyList(), now, IdentifierHelper.sample(sample), null, modifiedParents)); - List<SamplePE> parents = sample.getParents(); - assertEquals(3, parents.size()); - Collections.sort(parents); - assertEquals(parent1Group1, parents.get(0)); - assertEquals(parent2Group1, parents.get(1)); - assertEquals(parent3Group2, parents.get(2)); context.assertIsSatisfied(); } @@ -585,9 +563,8 @@ public final class SampleBOTest extends AbstractBOTest will(returnValue(sample)); oneOf(relationshipService).assignSampleToContainer( - with(any(IAuthSession.class)), with(any(SampleIdentifier.class)), - with(any(SamplePE.class)), - with(any(SampleIdentifier.class)), with(any(SamplePE.class))); + with(any(IAuthSession.class)), with(any(SamplePE.class)), + with(any(SamplePE.class))); } }); @@ -644,9 +621,8 @@ public final class SampleBOTest extends AbstractBOTest will(returnValue(sample)); oneOf(relationshipService).assignSampleToContainer( - with(any(IAuthSession.class)), with(any(SampleIdentifier.class)), - with(any(SamplePE.class)), - with(any(SampleIdentifier.class)), with(any(SamplePE.class))); + with(any(IAuthSession.class)), with(any(SamplePE.class)), + with(any(SamplePE.class))); } }); assertNull(sample.getContainer()); @@ -840,8 +816,7 @@ public final class SampleBOTest extends AbstractBOTest will(returnValue(null)); allowing(relationshipService).removeSampleFromContainer( - with(any(IAuthSession.class)), with(any(SampleIdentifier.class)), - with(any(SamplePE.class))); + with(any(IAuthSession.class)), with(any(SamplePE.class))); } }); try diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentTest.java index 5d89216f947d403287392b2071e1d1e5eebbaa74..fa8dfd62d7840b14021a5a9c3230e08794612aea 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentTest.java @@ -183,6 +183,12 @@ public class AssignDataSetToExperimentTest extends BaseTest assertThat(serverSays(component), is(inExperiment(sourceExperiment))); } + Space unrelatedAdmin; + + Space unrelatedObserver; + + Space unrelatedNone; + @Test(dataProvider = "rolesAllowedToAssignDataSetToExperiment", groups = "authorization") public void assigningDataSetToAnotherExperimentIsAllowedFor( RoleWithHierarchy sourceSpaceRole, @@ -191,8 +197,12 @@ public class AssignDataSetToExperimentTest extends BaseTest { ExternalData dataset = create(aDataSet().inExperiment(sourceExperiment)); String user = - create(aSession().withSpaceRole(sourceSpaceRole, sourceSpace).withSpaceRole( - destinationSpaceRole, destinationSpace).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(sourceSpaceRole, sourceSpace) + .withSpaceRole(destinationSpaceRole, destinationSpace) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(dataset).toExperiment(destinationExperiment).as(user)); } @@ -206,8 +216,12 @@ public class AssignDataSetToExperimentTest extends BaseTest { ExternalData dataset = create(aDataSet().inExperiment(sourceExperiment)); String user = - create(aSession().withSpaceRole(sourceSpaceRole, sourceSpace).withSpaceRole( - destinationSpaceRole, destinationSpace).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(sourceSpaceRole, sourceSpace) + .withSpaceRole(destinationSpaceRole, destinationSpace) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(dataset).toExperiment(destinationExperiment).as(user)); } @@ -222,6 +236,10 @@ public class AssignDataSetToExperimentTest extends BaseTest destinationSpace = create(aSpace()); Project destinationProject = create(aProject().inSpace(destinationSpace)); destinationExperiment = create(anExperiment().inProject(destinationProject)); + + unrelatedAdmin = create(aSpace()); + unrelatedObserver = create(aSpace()); + unrelatedNone = create(aSpace()); } GuardedDomain source; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToSampleTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToSampleTest.java index 45fbc384c3752b9a6c66a7c46944b4cd74088aed..12751d8f5a13763131e834e09b9bcbf27eefaa7b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToSampleTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToSampleTest.java @@ -46,7 +46,6 @@ import ch.systemsx.cisd.openbis.systemtest.base.auth.SpaceDomain; */ public class AssignDataSetToSampleTest extends BaseTest { - Sample sourceSample; Sample destinationSample; @@ -201,6 +200,12 @@ public class AssignDataSetToSampleTest extends BaseTest assertThat(serverSays(component), is(inSample(sourceSample))); } + Space unrelatedAdmin; + + Space unrelatedObserver; + + Space unrelatedNone; + @Test(dataProvider = "rolesAllowedToAssignDataSetToSample", groups = "authorization") public void assigningDataSetToSampleIsAllowedFor( RoleWithHierarchy sourceSpaceRole, @@ -209,8 +214,12 @@ public class AssignDataSetToSampleTest extends BaseTest { ExternalData dataset = create(aDataSet().inSample(sourceSample)); String user = - create(aSession().withSpaceRole(sourceSpaceRole, sourceSpace).withSpaceRole( - destinationSpaceRole, destinationSpace).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(sourceSpaceRole, sourceSpace) + .withSpaceRole(destinationSpaceRole, destinationSpace) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(dataset).toSample(destinationSample).as(user)); } @@ -224,8 +233,12 @@ public class AssignDataSetToSampleTest extends BaseTest { ExternalData dataset = create(aDataSet().inSample(sourceSample)); String user = - create(aSession().withSpaceRole(sourceSpaceRole, sourceSpace).withSpaceRole( - destinationSpaceRole, destinationSpace).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(sourceSpaceRole, sourceSpace) + .withSpaceRole(destinationSpaceRole, destinationSpace) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(dataset).toSample(destinationSample).as(user)); } @@ -242,6 +255,10 @@ public class AssignDataSetToSampleTest extends BaseTest Project destinationProject = create(aProject().inSpace(destinationSpace)); destinationExperiment = create(anExperiment().inProject(destinationProject)); destinationSample = create(aSample().inExperiment(destinationExperiment)); + + unrelatedAdmin = create(aSpace()); + unrelatedObserver = create(aSpace()); + unrelatedNone = create(aSpace()); } GuardedDomain source; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/RelationshipServiceAuthorizationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/RelationshipServiceAuthorizationTest.java index 050ecb5cf3c0c0d0a58dd4109649734bbb62cdf3..c3a9a13e9b0f0f1ce948808d299784e8c7b29d11 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/RelationshipServiceAuthorizationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/RelationshipServiceAuthorizationTest.java @@ -33,6 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Space; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; @@ -366,8 +367,8 @@ public class RelationshipServiceAuthorizationTest extends BaseTest destinationSpaceRole, destinationSpace).withInstanceRole(instanceRole)); relationshipService.assignDataSetToExperiment(sessionManager.getSession(session), - dataSet.getCode(), - id(destinationExperiment)); + pe(dataSet), + pe(destinationExperiment)); } private void assignDataSetToSample(RoleWithHierarchy sourceSpaceRole, @@ -380,8 +381,8 @@ public class RelationshipServiceAuthorizationTest extends BaseTest destinationSpaceRole, destinationSpace).withInstanceRole(instanceRole)); relationshipService.assignDataSetToSample(sessionManager.getSession(session), - dataSet.getCode(), - id(destinationSample)); + pe(dataSet), + pe(destinationSample)); } private void addParentToSample(RoleWithHierarchy sourceSpaceRole, @@ -392,8 +393,8 @@ public class RelationshipServiceAuthorizationTest extends BaseTest create(aSession().withSpaceRole(sourceSpaceRole, sourceSpace).withSpaceRole( destinationSpaceRole, destinationSpace).withInstanceRole(instanceRole)); - relationshipService.addParentToSample(sessionManager.getSession(session), id(sourceSample), - id(destinationSample)); + relationshipService.addParentToSample(sessionManager.getSession(session), pe(sourceSample), + pe(destinationSample)); } @@ -406,8 +407,8 @@ public class RelationshipServiceAuthorizationTest extends BaseTest destinationSpaceRole, destinationSpace).withInstanceRole(instanceRole)); relationshipService.removeParentFromSample(sessionManager.getSession(session), - id(childSample), - id(parentSample)); + pe(childSample), + pe(parentSample)); } @DataProvider(name = "rolesAllowedToAssignExperimentToProject") @@ -607,6 +608,11 @@ public class RelationshipServiceAuthorizationTest extends BaseTest return daoFactory.getSampleDAO().tryToFindByPermID(sample.getPermId()); } + private DataPE pe(ExternalData data) + { + return daoFactory.getDataDAO().tryToFindDataSetByCode(data.getCode()); + } + public static RoleWithHierarchy[][] toNestedArray(Collection<List<RoleWithHierarchy>> input) { RoleWithHierarchy[][] result = new RoleWithHierarchy[input.size()][]; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleContainmentTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleContainmentTest.java index a69c137d5fffdf2c50eba094627422f007eb2d9d..11d7a2559ba671757524275773a8a54e893f5f68 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleContainmentTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleContainmentTest.java @@ -141,6 +141,12 @@ public class UpdateSampleContainmentTest extends BaseTest Space componentSpace; + Space unrelatedAdmin; + + Space unrelatedObserver; + + Space unrelatedNone; + @Test(dataProvider = "rolesAllowedToSetContainerToSample", groups = "authorization") public void settingContainerToSampleIsAllowedFor( RoleWithHierarchy containerSpaceRole, @@ -149,10 +155,13 @@ public class UpdateSampleContainmentTest extends BaseTest { Sample container = create(aSample().inSpace(containerSpace)); Sample componentCandidate = create(aSample().inSpace(componentSpace)); - String user = - create(aSession().withSpaceRole(containerSpaceRole, containerSpace).withSpaceRole( - componentSpaceRole, componentSpace).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(containerSpaceRole, containerSpace) + .withSpaceRole(componentSpaceRole, componentSpace) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(componentCandidate).toHaveContainer(container).as(user)); } @@ -166,10 +175,13 @@ public class UpdateSampleContainmentTest extends BaseTest { Sample container = create(aSample().inSpace(containerSpace)); Sample componentCandidate = create(aSample().inSpace(componentSpace)); - String user = - create(aSession().withSpaceRole(containerSpaceRole, containerSpace).withSpaceRole( - componentSpaceRole, componentSpace).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(containerSpaceRole, containerSpace) + .withSpaceRole(componentSpaceRole, componentSpace) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(componentCandidate).toHaveContainer(container).as(user)); } @@ -182,10 +194,13 @@ public class UpdateSampleContainmentTest extends BaseTest { Sample container = create(aSample().inSpace(containerSpace)); Sample component = create(aSample().inSpace(componentSpace).inContainer(container)); - String user = - create(aSession().withSpaceRole(containerSpaceRole, containerSpace).withSpaceRole( - componentSpaceRole, componentSpace).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(containerSpaceRole, containerSpace) + .withSpaceRole(componentSpaceRole, componentSpace) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(component).removingContainer().as(user)); } @@ -199,10 +214,13 @@ public class UpdateSampleContainmentTest extends BaseTest { Sample container = create(aSample().inSpace(containerSpace)); Sample component = create(aSample().inSpace(componentSpace).inContainer(container)); - String user = - create(aSession().withSpaceRole(containerSpaceRole, containerSpace).withSpaceRole( - componentSpaceRole, componentSpace).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(containerSpaceRole, containerSpace) + .withSpaceRole(componentSpaceRole, componentSpace) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(component).removingContainer().as(user)); } @@ -213,6 +231,9 @@ public class UpdateSampleContainmentTest extends BaseTest space = create(aSpace()); containerSpace = create(aSpace()); componentSpace = create(aSpace()); + unrelatedAdmin = create(aSpace()); + unrelatedObserver = create(aSpace()); + unrelatedNone = create(aSpace()); } GuardedDomain containerDomain; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleParentsTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleParentsTest.java index 4c008ea3023d10c92a2caacbb2d15a07aedde2f5..88f5b81d058ff9ec3365a31dcea6768925376c3d 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleParentsTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleParentsTest.java @@ -140,6 +140,12 @@ public class UpdateSampleParentsTest extends BaseTest perform(anUpdateOf(child).toHaveParent(parent)); } + Space unrelatedAdmin; + + Space unrelatedObserver; + + Space unrelatedNone; + @Test(dataProvider = "rolesAllowedToAddParentToSample", groups = "authorization") public void addingParentToSampleIsAllowedFor( RoleWithHierarchy spaceRole, @@ -148,7 +154,11 @@ public class UpdateSampleParentsTest extends BaseTest Sample parentToBe = create(aSample().inSpace(space)); Sample childToBe = create(aSample().inSpace(space)); String user = - create(aSession().withSpaceRole(spaceRole, space).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(spaceRole, space) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(childToBe).toHaveParent(parentToBe).as(user)); } @@ -162,7 +172,11 @@ public class UpdateSampleParentsTest extends BaseTest Sample parentToBe = create(aSample().inSpace(space)); Sample childToBe = create(aSample().inSpace(space)); String user = - create(aSession().withSpaceRole(spaceRole, space).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(spaceRole, space) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(childToBe).toHaveParent(parentToBe).as(user)); } @@ -175,9 +189,12 @@ public class UpdateSampleParentsTest extends BaseTest Sample parent1 = create(aSample().inSpace(space)); Sample parent2 = create(aSample().inSpace(space)); Sample child = create(aSample().inSpace(space).withParents(parent1, parent2)); - String user = - create(aSession().withSpaceRole(spaceRole, space).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(spaceRole, space) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(child).toHaveParent(parent1).as(user)); } @@ -191,9 +208,12 @@ public class UpdateSampleParentsTest extends BaseTest Sample parent1 = create(aSample().inSpace(space)); Sample parent2 = create(aSample().inSpace(space)); Sample child = create(aSample().inSpace(space).withParents(parent1, parent2)); - String user = - create(aSession().withSpaceRole(spaceRole, space).withInstanceRole(instanceRole)); + create(aSession() + .withSpaceRole(spaceRole, space) + .withInstanceRole(instanceRole) + .withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, unrelatedAdmin) + .withSpaceRole(RoleWithHierarchy.SPACE_OBSERVER, unrelatedObserver)); perform(anUpdateOf(child).toHaveParent(parent1).as(user)); } @@ -202,6 +222,9 @@ public class UpdateSampleParentsTest extends BaseTest void createFixture() throws Exception { space = create(aSpace()); + unrelatedAdmin = create(aSpace()); + unrelatedObserver = create(aSpace()); + unrelatedNone = create(aSpace()); } GuardedDomain spaceDomain; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/RelationshipServiceStub.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/RelationshipServiceStub.java index 2d184632e6c59ea8ce4faa945dab1ad6d091cb64..28bff546d9b52dd471fc94967749efb5ef2c4650 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/RelationshipServiceStub.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/RelationshipServiceStub.java @@ -17,13 +17,12 @@ package ch.systemsx.cisd.openbis.systemtest.base; import ch.systemsx.cisd.openbis.generic.shared.IRelationshipService; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.IAuthSession; import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; /** * @author anttil @@ -71,48 +70,34 @@ public class RelationshipServiceStub implements IRelationshipService } @Override - public void assignDataSetToExperiment(IAuthSession session, String dataSetCode, - ExperimentIdentifier experiment) + public void assignDataSetToExperiment(IAuthSession session, DataPE data, ExperimentPE experiment) { } @Override - public void assignDataSetToSample(IAuthSession session, String dataSetCode, - SampleIdentifier sample) + public void assignDataSetToSample(IAuthSession session, DataPE data, SamplePE sample) { } @Override - public void addParentToSample(IAuthSession session, SampleIdentifier sample, - SampleIdentifier parent) + public void addParentToSample(IAuthSession session, SamplePE sample, + SamplePE parent) { - // TODO Auto-generated method stub - } @Override - public void removeParentFromSample(IAuthSession session, SampleIdentifier sample, - SampleIdentifier parent) + public void removeParentFromSample(IAuthSession session, SamplePE sample, + SamplePE parent) { - // TODO Auto-generated method stub - } @Override - public void assignSampleToContainer(IAuthSession session, SampleIdentifier sampleId, - SamplePE sample, - SampleIdentifier containerId, SamplePE container) + public void assignSampleToContainer(IAuthSession session, SamplePE sample, SamplePE container) { - // TODO Auto-generated method stub - } @Override - public void removeSampleFromContainer(IAuthSession session, SampleIdentifier sampleId, - SamplePE sample) + public void removeSampleFromContainer(IAuthSession session, SamplePE sample) { - // TODO Auto-generated method stub - } - }