diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/DSPropertyUtils.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/DSPropertyUtils.java index 0db251e86fb8144b7ad7217bef60525be5b35085..e2721b73d57c9ab3eacba839bbcabaa5939a0266 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/DSPropertyUtils.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/DSPropertyUtils.java @@ -46,7 +46,8 @@ public class DSPropertyUtils { ArrayList<IEntityProperty> list = new ArrayList<IEntityProperty>(); for (NewProperty prop : dataSetProperties) - { + { // if value is a material it will have been properly parsed in the ResourceListParser so we do not need to + // do anything special about it here. String propertyCode = prop.getPropertyCode(); String value = prop.getValue(); list.add(new PropertyBuilder(propertyCode).value(value).getProperty()); diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/EntitySynchronizer.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/EntitySynchronizer.java index 6d1001244136caf8b02e5c6deb4d6daf87e36477..73d49b442e1b79b8ad16c588bc73e3ae14aecc54 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/EntitySynchronizer.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/EntitySynchronizer.java @@ -195,15 +195,11 @@ public class EntitySynchronizer { throw new UserFailureException("Please specify a data source alias in the config file to be used in name translations."); } - else - { - nameTranslator = new PrefixBasedNameTranslator(dataSourceAlias); - } + nameTranslator = new PrefixBasedNameTranslator(dataSourceAlias); } - // even when do not translate other things, we always translate space name. // TODO re-think - ResourceListParser parser = ResourceListParser.create(nameTranslator, new PrefixBasedNameTranslator(dataSourceAlias), dataStoreCode); + ResourceListParser parser = ResourceListParser.create(nameTranslator, dataStoreCode); ResourceListParserData data = parser.parseResourceListDocument(doc); processDeletions(data); @@ -754,7 +750,7 @@ public class EntitySynchronizer expUpdate.setProperties(newPropList); expUpdate.setExperimentId(TechId.create(experiment)); - // TODO attachments + // attachments are synched later separately but we need to have a non-null value for attachment list. expUpdate.setAttachments(Collections.<NewAttachment> emptyList()); return expUpdate; } @@ -859,7 +855,7 @@ public class EntitySynchronizer prjUpdate.setVersion(project.getVersion()); prjUpdate.setTechId(TechId.create(project)); prjUpdate.setDescription(incomingProject.getDescription()); - // TODO attachments???? + // attachments are synched later separately but we need to have a non-null value for attachment list. prjUpdate.setAttachments(Collections.<NewAttachment> emptyList()); ProjectIdentifier projectIdentifier = ProjectIdentifierFactory.parse(incomingProject.getIdentifier()); prjUpdate.setSpaceCode(projectIdentifier.getSpaceCode()); @@ -968,6 +964,7 @@ public class EntitySynchronizer List<IEntityProperty> newPropList = prepareUpdatedPropertyList(incomingSmp.getProperties(), sample.getProperties()); + // attachments are synched later separately but we need to have a non-null value for attachment list. SampleUpdatesDTO updates = new SampleUpdatesDTO(sampleId, newPropList, experimentIdentifier, projectIdentifier, Collections.<NewAttachment> emptyList(), diff --git a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/ResourceListParser.java b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/ResourceListParser.java index a94032f0b210aae2fc70310cea0a7c6c0e2f0ccf..03041f18076d4949f84fe7e2bd93180d9fdfbecf 100644 --- a/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/ResourceListParser.java +++ b/datastore_server/source/java/ch/ethz/sis/openbis/generic/server/dss/plugins/sync/harvester/synchronizer/ResourceListParser.java @@ -54,13 +54,10 @@ import ch.ethz.sis.openbis.generic.server.dss.plugins.sync.harvester.synchronize import ch.ethz.sis.openbis.generic.server.dss.plugins.sync.harvester.synchronizer.ResourceListParserData.MaterialWithLastModificationDate; import ch.ethz.sis.openbis.generic.server.dss.plugins.sync.harvester.synchronizer.translator.DefaultNameTranslator; import ch.ethz.sis.openbis.generic.server.dss.plugins.sync.harvester.synchronizer.translator.INameTranslator; -import ch.ethz.sis.openbis.generic.server.dss.plugins.sync.harvester.synchronizer.translator.PrefixBasedNameTranslator; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; -import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewAttachment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterialWithType; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewProject; @@ -86,8 +83,6 @@ public class ResourceListParser private final INameTranslator nameTranslator; - private final INameTranslator spaceNameTranslator; - private final String dataStoreCode; public INameTranslator getNameTranslator() @@ -95,26 +90,25 @@ public class ResourceListParser return nameTranslator; } - private ResourceListParser(INameTranslator nameTranslator, PrefixBasedNameTranslator spaceNameTranslator, String dataStoreCode) + private ResourceListParser(INameTranslator nameTranslator, String dataStoreCode) { this.data = new ResourceListParserData(); this.nameTranslator = nameTranslator; this.dataStoreCode = dataStoreCode; - this.spaceNameTranslator = spaceNameTranslator; } - public static ResourceListParser create(INameTranslator nameTranslator, PrefixBasedNameTranslator spaceNameTranslator, String dataStoreCode) + public static ResourceListParser create(INameTranslator nameTranslator, String dataStoreCode) { if (nameTranslator == null) { - return create(spaceNameTranslator, dataStoreCode); + return create(dataStoreCode); } - return new ResourceListParser(nameTranslator, spaceNameTranslator, dataStoreCode); + return new ResourceListParser(nameTranslator, dataStoreCode); } - public static ResourceListParser create(PrefixBasedNameTranslator spaceNameTranslator, String dataStoreCode) + private static ResourceListParser create(String dataStoreCode) { - return create(new DefaultNameTranslator(), spaceNameTranslator, dataStoreCode); + return create(new DefaultNameTranslator(), dataStoreCode); } public ResourceListParserData parseResourceListDocument(Document doc) throws XPathExpressionException @@ -356,7 +350,7 @@ public class ResourceListParser SampleIdentifier sampleIdentifier = SampleIdentifierFactory.parse(sampleIdentifierStr); SpaceIdentifier spaceLevel = sampleIdentifier.getSpaceLevel(); String originalSpaceCode = spaceLevel.getSpaceCode(); - return new SampleIdentifier(new SpaceIdentifier(spaceNameTranslator.translate(originalSpaceCode)), sampleIdentifier.getSampleCode()); + return new SampleIdentifier(new SpaceIdentifier(nameTranslator.translate(originalSpaceCode)), sampleIdentifier.getSampleCode()); } private ExperimentIdentifier getExperimentIdentifier(String experimentIdentifierStr) @@ -369,7 +363,7 @@ public class ResourceListParser String originalSpaceCode = experimentIdentifier.getSpaceCode(); String projectCode = experimentIdentifier.getProjectCode(); String expCode = experimentIdentifier.getExperimentCode(); - return new ExperimentIdentifier(new ProjectIdentifier(new SpaceIdentifier(spaceNameTranslator.translate(originalSpaceCode)), projectCode), + return new ExperimentIdentifier(new ProjectIdentifier(new SpaceIdentifier(nameTranslator.translate(originalSpaceCode)), projectCode), expCode); } @@ -556,8 +550,8 @@ public class ResourceListParser SampleIdentifier identifier = createSampleIdentifier(code, space); NewSample newSample = new NewSample(identifier.toString(), sampleType, null, null, - experiment, null, null, new IEntityProperty[0], - new ArrayList<NewAttachment>()); + experiment, null, null, null, + null); newSample.setPermID(permId); if (space == null) { @@ -580,7 +574,7 @@ public class ResourceListParser String space = extractAttribute(xdNode, "space", nullAllowed); if (space != null) { - space = spaceNameTranslator.translate(space); + // space = nameTranslator.translate(space); data.getHarvesterSpaceList().add(space); } return space;