diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java index d91813d1973764ef12c52833e42ac6ec1dc53886..82928357bbffe2023e19d6b3d651907eb596bcbe 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ETLService.java @@ -86,6 +86,7 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.IRoleAssignmentTable; import ch.systemsx.cisd.openbis.generic.server.business.bo.ISampleBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.ISampleTable; import ch.systemsx.cisd.openbis.generic.server.business.bo.ISpaceBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IVocabularyBO; import ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.IDatasetLister; import ch.systemsx.cisd.openbis.generic.server.business.bo.fetchoptions.experimentlister.ExperimentLister; import ch.systemsx.cisd.openbis.generic.server.business.bo.materiallister.IMaterialLister; @@ -192,6 +193,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; 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.ProjectIdentifierFactory; @@ -1503,6 +1505,10 @@ public class ETLService extends AbstractCommonServer<IETLLIMSService> implements createProjects(sessionForEntityOperation, operationDetails, progressListener, authorize); + long vocabulariesUpdated = + updateVocabularies(sessionForEntityOperation, operationDetails, + progressListener, authorize); + long experimentsCreated = createExperiments(sessionForEntityOperation, operationDetails, progressListener, authorize); @@ -1550,7 +1556,7 @@ public class ETLService extends AbstractCommonServer<IETLLIMSService> implements return new AtomicEntityOperationResult(spacesCreated, projectsCreated, materialsCreated, materialsUpdates, experimentsCreated, experimentsUpdates, samplesCreated, samplesUpdated, dataSetsCreated, dataSetsUpdated, - metaprojectsCreated, metaprojectsUpdates); + metaprojectsCreated, metaprojectsUpdates, vocabulariesUpdated); } finally { EntityOperationsInProgress.getInstance().removeRegistrationPending(registrationId); @@ -1616,6 +1622,26 @@ public class ETLService extends AbstractCommonServer<IETLLIMSService> implements } } + private long updateVocabularies(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + + List<VocabularyUpdatesDTO> updates = operationDetails.getVocabularyUpdates(); + + for (VocabularyUpdatesDTO update : updates) + { + updateVocabulary(session, update); + } + + return updates.size(); + } + + private void updateVocabulary(Session session, VocabularyUpdatesDTO updates) + { + final IVocabularyBO vocabularyBO = businessObjectFactory.createVocabularyBO(session); + vocabularyBO.update(updates); + } + private long createMaterials(Session session, AtomicEntityOperationDetails operationDetails, IServiceConversationProgressListener progress, boolean authorize) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IVocabularyBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IVocabularyBO.java index 84c990a983c1bb3538eee598ffa788672b6b407c..dc57b84d7d168308ebdab3d375b7227b83844aba 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IVocabularyBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IVocabularyBO.java @@ -28,6 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTermReplaceme import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermWithStats; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; /** * Business object of a vocabulary. Holds an instance of {@link VocabularyPE}. @@ -97,6 +98,11 @@ public interface IVocabularyBO extends IEntityBusinessObject */ public void update(IVocabularyUpdates updates); + /** + * Updates the vocabulary. + */ + public void update(VocabularyUpdatesDTO updates); + /** * Deletes vocabulary for specified reason. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBO.java index dab7c4157cce12b10a04a9d9d75999e3983e802a..f8c4ace72841d10b4f8d65c6319a2d20b9c2528c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyBO.java @@ -50,11 +50,13 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.EntityPropertyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.EventPE; import ch.systemsx.cisd.openbis.generic.shared.dto.EventPE.EntityType; import ch.systemsx.cisd.openbis.generic.shared.dto.EventType; +import ch.systemsx.cisd.openbis.generic.shared.dto.NewVocabularyTerm; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; import ch.systemsx.cisd.openbis.generic.shared.dto.Session; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermWithStats; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; @@ -313,6 +315,26 @@ public class VocabularyBO extends AbstractBusinessObject implements IVocabularyB validateAndSave(); } + @Override + public void update(VocabularyUpdatesDTO updates) + { + loadDataByTechId(TechId.create(updates)); + + vocabularyPE.setCode(updates.getCode()); + vocabularyPE.setDescription(updates.getDescription()); + vocabularyPE.setURLTemplate(updates.getUrlTemplate()); + vocabularyPE.setChosenFromList(updates.isChosenFromList()); + vocabularyPE.setInternalNamespace(updates.isInternalNamespace()); + vocabularyPE.setManagedInternally(updates.isManagedInternally()); + + for (NewVocabularyTerm t : updates.getNewTerms()) + { + addTerm(t.getCode(), t.getDescription(), t.getLabel(), t.getOrdinal(), true); + } + + validateAndSave(); + } + private void validateAndSave() { getVocabularyDAO().validateAndSaveUpdatedEntity(vocabularyPE); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AtomicEntityOperationDetails.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AtomicEntityOperationDetails.java index 6d2f2118ddb08aa706352dd1ae64c65e42564c56..f70923ac8cb111343adf520482cf6f0e09453b24 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AtomicEntityOperationDetails.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AtomicEntityOperationDetails.java @@ -74,6 +74,8 @@ public class AtomicEntityOperationDetails implements Serializable private final List<DataSetBatchUpdatesDTO> dataSetUpdates; + private final List<VocabularyUpdatesDTO> vocabularyUpdates; + private Integer batchSizeOrNull; public AtomicEntityOperationDetails(TechId registrationId, String userIdOrNull, @@ -86,7 +88,8 @@ public class AtomicEntityOperationDetails implements Serializable List<? extends NewExternalData> dataSetRegistrations, List<DataSetBatchUpdatesDTO> dataSetUpdates, List<NewMetaproject> metaprojectRegistrations, - List<MetaprojectUpdatesDTO> metaprojectUpdates) + List<MetaprojectUpdatesDTO> metaprojectUpdates, + List<VocabularyUpdatesDTO> vocabularyUpdates) { this.registrationIdOrNull = registrationId; this.userIdOrNull = userIdOrNull; @@ -102,6 +105,7 @@ public class AtomicEntityOperationDetails implements Serializable this.dataSetUpdates = new ArrayList<DataSetBatchUpdatesDTO>(dataSetUpdates); this.metaprojectRegistrations = new ArrayList<NewMetaproject>(metaprojectRegistrations); this.metaprojectUpdates = new ArrayList<MetaprojectUpdatesDTO>(metaprojectUpdates); + this.vocabularyUpdates = new ArrayList<VocabularyUpdatesDTO>(vocabularyUpdates); } public AtomicEntityOperationDetails(TechId registrationId, String userIdOrNull, @@ -114,12 +118,13 @@ public class AtomicEntityOperationDetails implements Serializable List<? extends NewExternalData> dataSetRegistrations, List<DataSetBatchUpdatesDTO> dataSetUpdates, List<NewMetaproject> metaprojectRegistrations, - List<MetaprojectUpdatesDTO> metaprojectUpdates, Integer batchSizeOrNull) + List<MetaprojectUpdatesDTO> metaprojectUpdates, + List<VocabularyUpdatesDTO> vocabularyUpdates, Integer batchSizeOrNull) { this(registrationId, userIdOrNull, spaceRegistrations, projectRegistrations, experimentRegistrations, experimentUpdates, sampleUpdates, sampleRegistrations, materialRegistrations, materialUpdates, dataSetRegistrations, dataSetUpdates, - metaprojectRegistrations, metaprojectUpdates); + metaprojectRegistrations, metaprojectUpdates, vocabularyUpdates); this.batchSizeOrNull = batchSizeOrNull; } @@ -193,6 +198,11 @@ public class AtomicEntityOperationDetails implements Serializable return metaprojectUpdates; } + public List<VocabularyUpdatesDTO> getVocabularyUpdates() + { + return vocabularyUpdates; + } + public Integer getBatchSizeOrNull() { return batchSizeOrNull; @@ -215,6 +225,7 @@ public class AtomicEntityOperationDetails implements Serializable sb.append("dataSetUpdates", dataSetUpdates); sb.append("metaprojectRegistrations", metaprojectRegistrations); sb.append("metaprojectUpdates", metaprojectUpdates); + sb.append("vocabularyUpdates", vocabularyUpdates); return sb.toString(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AtomicEntityOperationResult.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AtomicEntityOperationResult.java index 39aa8a109a5b82a03212c80751d9e0fb01f47cb4..d5dbcefc5f7e56a8fe69fc4a2c2a38fc3f67715d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AtomicEntityOperationResult.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AtomicEntityOperationResult.java @@ -49,16 +49,18 @@ public class AtomicEntityOperationResult implements Serializable private final long metaprojectsUpdatedCount; + private final long vocabulariesUpdatedCount; + public AtomicEntityOperationResult() { - this(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + this(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); } public AtomicEntityOperationResult(long spacesCreated, long projectsCreated, long materialsCreated, long materialsUpdated, long experimentsCreated, long experimentsUpdated, long samplesCreated, long samplesUpdated, long dataSetsCreated, long dataSetsUpdated, long metaprojectsCreatedCount, - long metaprojectsUpdatedCount) + long metaprojectsUpdatedCount, long vocabulariesUpdatedCount) { this.spacesCreatedCount = spacesCreated; this.projectsCreatedCount = projectsCreated; @@ -72,6 +74,7 @@ public class AtomicEntityOperationResult implements Serializable this.dataSetsUpdatedCount = dataSetsUpdated; this.metaprojectsCreatedCount = metaprojectsCreatedCount; this.metaprojectsUpdatedCount = metaprojectsUpdatedCount; + this.vocabulariesUpdatedCount = vocabulariesUpdatedCount; } public long getExperimentsUpdatedCount() @@ -134,4 +137,9 @@ public class AtomicEntityOperationResult implements Serializable return metaprojectsUpdatedCount; } + public long getVocabulariesUpdatedCount() + { + return vocabulariesUpdatedCount; + } + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewVocabularyTerm.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewVocabularyTerm.java new file mode 100644 index 0000000000000000000000000000000000000000..3151fd14a1bf30f007eced3efcde872a98e8e2b3 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewVocabularyTerm.java @@ -0,0 +1,73 @@ +/* + * Copyright 2012 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.systemsx.cisd.openbis.generic.shared.dto; + +import java.io.Serializable; + +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; + +/** + * @author Jakub Straszewski + */ +public class NewVocabularyTerm implements Serializable +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private final String code; + + private final String description; + + private final String label; + + private final Long ordinal; + + public NewVocabularyTerm(String code, String description, String label, Long ordinal) + { + this.code = code; + this.description = description; + this.label = label; + this.ordinal = ordinal; + } + + public String getCode() + { + return code; + } + + public String getDescription() + { + return description; + } + + public String getLabel() + { + return label; + } + + public Long getOrdinal() + { + return ordinal; + } + + @Override + public String toString() + { + return "NewVocabularyTerm [code=" + code + ", description=" + description + ", label=" + + label + ", ordinal=" + ordinal + "]"; + } + +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyUpdatesDTO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyUpdatesDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..c045d0a0a3857487ac23cdd5b425206d4909ba89 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyUpdatesDTO.java @@ -0,0 +1,112 @@ +/* + * Copyright 2012 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.systemsx.cisd.openbis.generic.shared.dto; + +import java.io.Serializable; +import java.util.List; + +import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; + +/** + * @author Jakub Straszewski + */ +public class VocabularyUpdatesDTO implements IIdHolder, Serializable +{ + private static final long serialVersionUID = ServiceVersionHolder.VERSION; + + private final Long id; + + private final String code; + + private final String description; + + private final boolean isManagedInternally; + + private final boolean isInternalNamespace; + + private final boolean isChosenFromList; + + private final String urlTemplate; + + private final List<NewVocabularyTerm> newTerms; + + public VocabularyUpdatesDTO(Long id, String code, String description, + boolean isManagedInternally, boolean isInternalNamespace, boolean isChosenFromList, + String urlTemplate, List<NewVocabularyTerm> newTerms) + { + this.id = id; + this.code = code; + this.description = description; + this.isManagedInternally = isManagedInternally; + this.isInternalNamespace = isInternalNamespace; + this.isChosenFromList = isChosenFromList; + this.urlTemplate = urlTemplate; + this.newTerms = newTerms; + } + + @Override + public Long getId() + { + return id; + } + + public String getCode() + { + return code; + } + + public String getDescription() + { + return description; + } + + public boolean isManagedInternally() + { + return isManagedInternally; + } + + public boolean isInternalNamespace() + { + return isInternalNamespace; + } + + public boolean isChosenFromList() + { + return isChosenFromList; + } + + public String getUrlTemplate() + { + return urlTemplate; + } + + public List<NewVocabularyTerm> getNewTerms() + { + return newTerms; + } + + @Override + public String toString() + { + return "VocabularyUpdatesDTO [id=" + id + ", code=" + code + ", description=" + description + + ", isManagedInternally=" + isManagedInternally + ", isInternalNamespace=" + + isInternalNamespace + ", isChosenFromList=" + isChosenFromList + ", urlTemplate=" + + urlTemplate + ", newTerms=" + newTerms + "]"; + } + +} diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceDatabaseTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceDatabaseTest.java index e9d32df7d7712b33cafe51acc72ba398f1ec55d3..9a18a117c2cfc67d57b8dab650470a8d6096a2e4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceDatabaseTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceDatabaseTest.java @@ -64,6 +64,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialUpdateDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifierFactory; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier; @@ -321,13 +322,14 @@ public class ETLServiceDatabaseTest extends AbstractDAOTest List<? extends NewExternalData> dataSetRegistrations = Collections.emptyList(); List<NewMetaproject> metaprojectRegistrations = Collections.emptyList(); List<MetaprojectUpdatesDTO> metaprojectUpdates = Collections.emptyList(); + List<VocabularyUpdatesDTO> vocabularyUpdates = Collections.emptyList(); AtomicEntityOperationDetails details = new AtomicEntityOperationDetails(registrationid, null, spaceRegistrations, projectRegistrations, experimentRegistrations, experimentUpdates, sampleUpdates, sampleRegistrations, materialRegistrations, materialUpdates, dataSetRegistrations, dataSetUpdates, metaprojectRegistrations, - metaprojectUpdates, batchSizeOrNull); + metaprojectUpdates, vocabularyUpdates, batchSizeOrNull); service.performEntityOperations(sessionToken, details); } @@ -347,13 +349,14 @@ public class ETLServiceDatabaseTest extends AbstractDAOTest List<DataSetBatchUpdatesDTO> dataSetUpdates = Collections.emptyList(); List<NewMetaproject> metaprojectRegistrations = Collections.emptyList(); List<MetaprojectUpdatesDTO> metaprojectUpdates = Collections.emptyList(); + List<VocabularyUpdatesDTO> vocabularyUpdates = Collections.emptyList(); AtomicEntityOperationDetails details = new AtomicEntityOperationDetails(registrationid, null, spaceRegistrations, projectRegistrations, experimentRegistrations, experimentUpdates, sampleUpdates, sampleRegistrations, materialRegistrations, materialUpdates, dataSetRegistrations, dataSetUpdates, metaprojectRegistrations, - metaprojectUpdates, batchSizeOrNull); + metaprojectUpdates, vocabularyUpdates, batchSizeOrNull); service.performEntityOperations(sessionToken, details); } @@ -425,13 +428,14 @@ public class ETLServiceDatabaseTest extends AbstractDAOTest List<DataSetBatchUpdatesDTO> dataSetUpdates = Collections.emptyList(); List<NewMetaproject> metaprojectRegistrations = Collections.emptyList(); List<MetaprojectUpdatesDTO> metaprojectUpdates = Collections.emptyList(); + List<VocabularyUpdatesDTO> vocabularyUpdates = Collections.emptyList(); AtomicEntityOperationDetails details = new AtomicEntityOperationDetails(registrationid, null, spaceRegistrations, projectRegistrations, experimentRegistrations, experimentUpdates, sampleUpdates, sampleRegistrations, materialRegistrations, materialUpdates, dataSetRegistrations, dataSetUpdates, metaprojectRegistrations, - metaprojectUpdates); + metaprojectUpdates, vocabularyUpdates); service.performEntityOperations(sessionToken, details); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceTest.java index 265fe31b6c77ffa8f4a3d9bac92f8d14f4c16931..cf76ea04f67c0d549fc02811cc5e3f20075eff8e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceTest.java @@ -114,6 +114,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePropertyTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.Session; import ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.builders.DatabaseInstancePEBuilder; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.DatabaseInstanceIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; @@ -1083,6 +1084,8 @@ public class ETLServiceTest extends AbstractServerTestCase mtu.setRemovedEntities(Collections.singletonList(new ExperimentTechIdId(4l))); + List<VocabularyUpdatesDTO> vocabularyUpdates = Collections.emptyList(); + prepareEntityOperationsExpectations(samplePE, sampleUpdate, material, materialType, materialRegistrations, newSamplePE, newSampleIdentifier, newSample, externalData, updatedDataSetCode, dataSetUpdate, newMetaproject, metaprojectPE, mtu); @@ -1095,7 +1098,8 @@ public class ETLServiceTest extends AbstractServerTestCase Collections.singletonList(newSample), materialRegistrations, materialUpdates, Collections.singletonList(externalData), Collections.singletonList(dataSetUpdate), - Collections.singletonList(newMetaproject), Collections.singletonList(mtu)); + Collections.singletonList(newMetaproject), Collections.singletonList(mtu), + vocabularyUpdates); AtomicEntityOperationResult result = createService().performEntityOperations(SESSION_TOKEN, details); @@ -1316,6 +1320,8 @@ public class ETLServiceTest extends AbstractServerTestCase mtu.setRemovedEntities(Collections.singletonList(new ExperimentTechIdId(4l))); + List<VocabularyUpdatesDTO> vocabularyUpdates = Collections.emptyList(); + prepareEntityOperationsExpectations(samplePE, sampleUpdate, material, materialType, materialRegistrations, newSamplePE, newSampleIdentifier, newSample, externalData, updatedDataSetCode, dataSetUpdate, newMetaproject, metaprojectPE, mtu); @@ -1335,7 +1341,8 @@ public class ETLServiceTest extends AbstractServerTestCase Collections.singletonList(newSample), materialRegistrations, materialUpdates, Collections.singletonList(externalData), Collections.singletonList(dataSetUpdate), - Collections.singletonList(newMetaproject), Collections.singletonList(mtu)); + Collections.singletonList(newMetaproject), Collections.singletonList(mtu), + vocabularyUpdates); AtomicEntityOperationResult result = createService().performEntityOperations(SESSION_TOKEN, details); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AtomicEntityOperationDetailsTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AtomicEntityOperationDetailsTest.java index 9e6949e304c70c4e92a0a17620fa1605d62c0cf3..182b07bf6aa8e1100cade83446dada207bef3fe3 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AtomicEntityOperationDetailsTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AtomicEntityOperationDetailsTest.java @@ -33,6 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialUpdateDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFactory; /** @@ -98,12 +99,14 @@ public class AtomicEntityOperationDetailsTest extends AssertJUnit List<MetaprojectUpdatesDTO> metaprojectUpdates = new ArrayList<MetaprojectUpdatesDTO>(); + List<VocabularyUpdatesDTO> vocabularyUpdates = Collections.emptyList(); + AtomicEntityOperationDetails details = new AtomicEntityOperationDetails(null, null, spaceRegistrations, projectRegistrations, experimentRegistrations, experimentUpdates, sampleUpdates, sampleRegistrations, materialRegistrations, materialUpdates, dataSetRegistrations, dataSetUpdates, metaprojectRegistrations, - metaprojectUpdates); + metaprojectUpdates, vocabularyUpdates); assertEquals( "AtomicEntityOperationDetails[registrationIdOrNull=<null>" @@ -118,7 +121,7 @@ public class AtomicEntityOperationDetailsTest extends AssertJUnit + ",dataSetRegistrations=[NewExternalData[code=DATA-SET-CODE,type=<null>,fileFormat=<null>,properties=[]]]" + ",dataSetUpdates=[1]" + ",metaprojectRegistrations=[NewMetaproject[name=TEST-AEOD-TAG,description=short description,ownerId=test]]" - + ",metaprojectUpdates=[]]", details.toString()); + + ",metaprojectUpdates=[]" + ",vocabularyUpdates=[]]", details.toString()); } } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/AtomicEntityOperationDetailsBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/AtomicEntityOperationDetailsBuilder.java index ace164c4d15d1ff3bc37d868ca01c14231fbd544..70206af4b8a8c71c20356e73f0dcc732d980b204 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/AtomicEntityOperationDetailsBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/AtomicEntityOperationDetailsBuilder.java @@ -35,6 +35,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialUpdateDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; /** * @author Franz-Josef Elmer @@ -69,6 +70,9 @@ public class AtomicEntityOperationDetailsBuilder private final List<MetaprojectUpdatesDTO> metaprojectUpdates = new ArrayList<MetaprojectUpdatesDTO>(); + private final List<VocabularyUpdatesDTO> vocabularyUpdates = + new ArrayList<VocabularyUpdatesDTO>(); + private TechId registrationIdOrNull; private String userIdOrNull; @@ -130,6 +134,6 @@ public class AtomicEntityOperationDetailsBuilder spaceRegistrations, projectRegistrations, experimentRegistrations, experimentUpdates, sampleUpdates, sampleRegistrations, materialRegistrations, materialUpdates, dataSetRegistrations, dataSetUpdates, metaprojectRegistrations, - metaprojectUpdates, batchSizeOrNull); + metaprojectUpdates, vocabularyUpdates, batchSizeOrNull); } } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java index df72cae1f7634b25434e8491ef3b843c7029968d..a790de8d8d9476df11c7bac4bfdae159df64d1df 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java @@ -63,6 +63,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData; import ch.systemsx.cisd.openbis.generic.shared.dto.NewProperty; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.StorageFormat; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifierFactory; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFactory; @@ -125,6 +126,9 @@ public class EntityOperationTest extends SystemTestCase private final List<MetaprojectUpdatesDTO> metaprojectUpdates = new ArrayList<MetaprojectUpdatesDTO>(); + private final List<VocabularyUpdatesDTO> vocabularyUpdates = + new ArrayList<VocabularyUpdatesDTO>(); + private TechId registrationID = new TechId(counter++); private String userID; @@ -286,7 +290,7 @@ public class EntityOperationTest extends SystemTestCase return new AtomicEntityOperationDetails(registrationID, userID, spaces, projects, experiments, experimentUpdates, sampleUpdates, samples, materials, materialUpdates, dataSets, dataSetUpdates, metaprojectRegistrations, - metaprojectUpdates); + metaprojectUpdates, vocabularyUpdates); } } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/ETLServiceAuthorizationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/ETLServiceAuthorizationTest.java index 771d5170c685a2958c1a60f3fd4e64d053497359..0b047bdbb24f2ea3489d700985c1fcf10f1edbf9 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/ETLServiceAuthorizationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/ETLServiceAuthorizationTest.java @@ -49,6 +49,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialUpdateDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; import ch.systemsx.cisd.openbis.systemtest.base.BaseTest; import ch.systemsx.cisd.openbis.systemtest.base.builder.SessionBuilder; @@ -150,6 +151,7 @@ public class ETLServiceAuthorizationTest extends BaseTest List<DataSetBatchUpdatesDTO> dataSetUpdates = Collections.emptyList(); List<NewMetaproject> metaprojectRegistrations = Collections.emptyList(); List<MetaprojectUpdatesDTO> metaprojectUpdates = Collections.emptyList(); + List<VocabularyUpdatesDTO> vocabularyUpdates = Collections.emptyList(); TechId registrationid = new TechId(etlService.drawANewUniqueID(sessionToken)); @@ -157,7 +159,7 @@ public class ETLServiceAuthorizationTest extends BaseTest registrationid, userID, spaceRegistrations, projectRegistrations, experimentRegistrations, experimentUpdates, sampleUpdates, sampleRegistrations, materialRegistrations, materialUpdates, dataSetRegistrations, dataSetUpdates, - metaprojectRegistrations, metaprojectUpdates)); + metaprojectRegistrations, metaprojectUpdates, vocabularyUpdates)); } private void assertContainsProject(String expectedProjectIdentifer, List<Project> projects) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/EntityValidationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/EntityValidationTest.java index 5a708310256fd7a3b3ce378e3a6f0c5693646ac0..46c0095b139f34e78e1e8302111445a1edaf5ab8 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/EntityValidationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/EntityValidationTest.java @@ -54,6 +54,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialUpdateDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFactory; @@ -209,13 +210,14 @@ public class EntityValidationTest extends GenericSystemTestCase List<DataSetBatchUpdatesDTO> dataSetUpdates = Collections.emptyList(); List<NewMetaproject> metaprojectsRegistrations = Collections.emptyList(); List<MetaprojectUpdatesDTO> metaprojectUpdates = Collections.emptyList(); + List<VocabularyUpdatesDTO> vocabularyUpdates = Collections.emptyList(); AtomicEntityOperationDetails details = new AtomicEntityOperationDetails(null, null, spaceRegistrations, projectRegistrations, experimentRegistrations, experimentUpdates, sampleUpdates, sampleRegistrations, materialRegistrations, materialUpdates, dataSetRegistrations, dataSetUpdates, metaprojectsRegistrations, - metaprojectUpdates); + metaprojectUpdates, vocabularyUpdates); return details; }