diff --git a/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/IApplicationServerApi.java b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/IApplicationServerApi.java index adbc705142be288cfb62befb62675f3a8608e844..aeb40a54d8e48c92224be586c0415d1011c98ef1 100644 --- a/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/IApplicationServerApi.java +++ b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/IApplicationServerApi.java @@ -83,6 +83,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.externaldms.update.ExternalDmsUp import ch.ethz.sis.openbis.generic.asapi.v3.dto.global.GlobalSearchObject; import ch.ethz.sis.openbis.generic.asapi.v3.dto.global.fetchoptions.GlobalSearchObjectFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.global.search.GlobalSearchCriteria; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.importer.ImportOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.Material; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.MaterialType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.material.create.MaterialCreation; @@ -245,6 +246,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.vocabulary.update.VocabularyUpda import ch.systemsx.cisd.common.api.IRpcService; import ch.systemsx.cisd.common.exceptions.UserFailureException; +import java.nio.file.Path; import java.util.List; import java.util.Map; @@ -2243,4 +2245,6 @@ public interface IApplicationServerApi extends IRpcService */ public List<String> createCodes(String sessionToken, String prefix, EntityKind entityKind, int count); + public void doImport(String sessionToken, Path path, ImportOptions importOptions); + } diff --git a/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportModes.java b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportModes.java new file mode 100644 index 0000000000000000000000000000000000000000..9fcc477528b7b98a82e88426a4d854a21966f5d3 --- /dev/null +++ b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportModes.java @@ -0,0 +1,27 @@ +/* + * Copyright ETH 2022 - 2023 Zürich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ch.ethz.sis.openbis.generic.asapi.v3.dto.importer; + +public enum ImportModes +{ + + UPDATE_IF_EXISTS, // default mode + + IGNORE_EXISTING, + + FAIL_IF_EXISTS + +} diff --git a/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportOperation.java b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportOperation.java new file mode 100644 index 0000000000000000000000000000000000000000..a772260e5bac33f3ccdc3eaa730ea9ea67f7daa8 --- /dev/null +++ b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportOperation.java @@ -0,0 +1,45 @@ +/* + * Copyright ETH 2023 Zürich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package ch.ethz.sis.openbis.generic.asapi.v3.dto.importer; + +import java.nio.file.Path; + +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.operation.IOperation; +import ch.systemsx.cisd.base.annotation.JsonObject; + +@JsonObject("as.dto.importer.ImportOperation") +public class ImportOperation implements IOperation +{ + + private final Path path; + + private final ImportOptions importOptions; + + public ImportOperation(final Path path, final ImportOptions importOptions) + { + this.path = path; + this.importOptions = importOptions; + } + + @Override + public String getMessage() + { + return toString(); + } + +} diff --git a/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportOperationResult.java b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportOperationResult.java new file mode 100644 index 0000000000000000000000000000000000000000..e1483c3ef6ff6d3141f8a11a299cd612c9063c08 --- /dev/null +++ b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportOperationResult.java @@ -0,0 +1,39 @@ +/* + * Copyright ETH 2023 Zürich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package ch.ethz.sis.openbis.generic.asapi.v3.dto.importer; + +import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.operation.IOperationResult; + +public class ImportOperationResult implements IOperationResult +{ + + private static final long serialVersionUID = 1L; + + @Override + public String getMessage() + { + return toString(); + } + + @Override + public String toString() + { + return this.getClass().getSimpleName(); + } + +} diff --git a/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportOptions.java b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportOptions.java new file mode 100644 index 0000000000000000000000000000000000000000..16e4f2f46b568584933b83058979c3ca81f70b3a --- /dev/null +++ b/api-openbis-java/source/java/ch/ethz/sis/openbis/generic/asapi/v3/dto/importer/ImportOptions.java @@ -0,0 +1,107 @@ +/* + * Copyright ETH 2023 Zürich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package ch.ethz.sis.openbis.generic.asapi.v3.dto.importer; + +import java.util.Map; + +public class ImportOptions +{ + + private ImportModes importMode; + + private Map<String, String> experimentsByType; + + private Map<String, String> spacesByType; + + private boolean definitionsOnly = false; + + private boolean disallowEntityCreations = false; + + private boolean ignoreVersioning = false; + + private boolean renderResult = true; + + private boolean allowProjectSamples = true; + + public ImportModes getImportMode() + { + return importMode; + } + + public void setImportMode(final ImportModes importMode) + { + this.importMode = importMode; + } + + public Map<String, String> getExperimentsByType() { + return experimentsByType; + } + + public void setExperimentsByType(Map<String, String> experimentsByType) { + this.experimentsByType = experimentsByType; + } + + public Map<String, String> getSpacesByType() { + return spacesByType; + } + + public void setSpacesByType(Map<String, String> spacesByType) { + this.spacesByType = spacesByType; + } + + public boolean getDefinitionsOnly() { + return definitionsOnly; + } + + public void setDefinitionsOnly(boolean definitionsOnly) { + this.definitionsOnly = definitionsOnly; + } + + public boolean getDisallowEntityCreations() { + return disallowEntityCreations; + } + + public void setDisallowEntityCreations(boolean disallowEntityCreations) { + this.disallowEntityCreations = disallowEntityCreations; + } + + public boolean getIgnoreVersioning() { + return ignoreVersioning; + } + + public void setIgnoreVersioning(boolean ignoreVersioning) { + this.ignoreVersioning = ignoreVersioning; + } + + public boolean getRenderResult() { + return renderResult; + } + + public void setRenderResult(boolean renderResult) { + this.renderResult = renderResult; + } + + public boolean getAllowProjectSamples() { + return allowProjectSamples; + } + + public void setAllowProjectSamples(boolean allowProjectSamples) { + this.allowProjectSamples = allowProjectSamples; + } + +}