From e231aa59175ad48f18c87b64f5a3be583a8af0f4 Mon Sep 17 00:00:00 2001 From: vkovtun <victor.kovtun@gmail.com> Date: Thu, 3 Nov 2022 18:03:09 +0100 Subject: [PATCH] SSDM-12286 Added parameter to specify whether the exported property text should be plain or rich. --- .../generic/server/xls/export/XLSExport.java | 32 ++++++++++++------- .../helper/AbstractXLSExportHelper.java | 11 +++++++ .../xls/export/helper/IXLSExportHelper.java | 3 +- .../export/helper/XLSDataSetExportHelper.java | 7 ++-- .../helper/XLSDataSetTypeExportHelper.java | 3 +- .../helper/XLSExperimentExportHelper.java | 7 ++-- .../helper/XLSExperimentTypeExportHelper.java | 3 +- .../export/helper/XLSProjectExportHelper.java | 3 +- .../export/helper/XLSSampleExportHelper.java | 7 ++-- .../helper/XLSSampleTypeExportHelper.java | 3 +- .../export/helper/XLSSpaceExportHelper.java | 3 +- .../helper/XLSVocabularyExportHelper.java | 3 +- .../1/as/services/xls-export/xls-export.py | 19 +++++------ 13 files changed, 70 insertions(+), 34 deletions(-) diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/XLSExport.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/XLSExport.java index 7360e30dc55..d3218b6d602 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/XLSExport.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/XLSExport.java @@ -81,11 +81,13 @@ public class XLSExport private static final String ZIP_EXTENSION = ".zip"; - public String export(final String filePrefix, final IApplicationServerApi api, final String sessionToken, - final Collection<ExportablePermId> exportablePermIds, final boolean exportReferred) throws IOException + public static String export(final String filePrefix, final IApplicationServerApi api, final String sessionToken, + final Collection<ExportablePermId> exportablePermIds, final boolean exportReferred, +// final Map<ExportableKind, Map<String, Collection<String>>> exportProperties, + final TextFormatting textFormatting) throws IOException { final PrepareWorkbookResult exportResult = prepareWorkbook(api, sessionToken, exportablePermIds, - exportReferred); + exportReferred, textFormatting); final Map<String, String> scripts = exportResult.getScripts(); final ISessionWorkspaceProvider sessionWorkspaceProvider = CommonServiceProvider.getSessionWorkspaceProvider(); final ByteArrayOutputStream baos = getByteArrayOutputStream(filePrefix, exportResult, scripts); @@ -150,8 +152,9 @@ public class XLSExport } } - PrepareWorkbookResult prepareWorkbook(final IApplicationServerApi api, final String sessionToken, - Collection<ExportablePermId> exportablePermIds, final boolean exportReferred) throws IOException + static PrepareWorkbookResult prepareWorkbook(final IApplicationServerApi api, final String sessionToken, + Collection<ExportablePermId> exportablePermIds, final boolean exportReferred, + final TextFormatting textFormatting) { if (!isValid(exportablePermIds)) { @@ -177,7 +180,7 @@ public class XLSExport final IXLSExportHelper helper = getHelper(exportablePermId.getExportableKind()); final List<String> permIds = exportablePermIdGroup.stream() .map(permId -> permId.getPermId().getPermId()).collect(Collectors.toList()); - rowNumber = helper.add(api, sessionToken, wb, permIds, rowNumber); + rowNumber = helper.add(api, sessionToken, wb, permIds, rowNumber, textFormatting); final IEntityType entityType = helper.getEntityType(api, sessionToken, exportablePermId.getPermId().getPermId()); @@ -202,7 +205,7 @@ public class XLSExport return new PrepareWorkbookResult(wb, scripts); } - private Collection<ExportablePermId> expandReference(final IApplicationServerApi api, + private static Collection<ExportablePermId> expandReference(final IApplicationServerApi api, final String sessionToken, final Collection<ExportablePermId> exportablePermIds) { return exportablePermIds.stream().flatMap(exportablePermId -> @@ -213,7 +216,7 @@ public class XLSExport }).collect(Collectors.toCollection(LinkedHashSet::new)); } - private Stream<ExportablePermId> getExpandedExportablePermIds(final IApplicationServerApi api, + private static Stream<ExportablePermId> getExpandedExportablePermIds(final IApplicationServerApi api, final String sessionToken, final ExportablePermId exportablePermId, final Set<ExportablePermId> processedIds) { @@ -268,7 +271,7 @@ public class XLSExport return Stream.empty(); } - private IXLSExportHelper getHelper(final ExportableKind exportableKind) + private static IXLSExportHelper getHelper(final ExportableKind exportableKind) { switch (exportableKind) { @@ -315,7 +318,7 @@ public class XLSExport } } - Collection<Collection<ExportablePermId>> group(final Collection<ExportablePermId> exportablePermIds) + static Collection<Collection<ExportablePermId>> group(final Collection<ExportablePermId> exportablePermIds) { final Map<ExportableKind, Collection<ExportablePermId>> groupMap = new EnumMap<>(ExportableKind.class); final Collection<Collection<ExportablePermId>> result = new ArrayList<>(exportablePermIds.size()); @@ -348,7 +351,7 @@ public class XLSExport return result; } - Collection<Collection<ExportablePermId>> putVocabulariesFirst( + static Collection<Collection<ExportablePermId>> putVocabulariesFirst( final Collection<Collection<ExportablePermId>> exportablePermIds) { final List<Collection<ExportablePermId>> result = new ArrayList<>(exportablePermIds.size()); @@ -374,7 +377,7 @@ public class XLSExport return result; } - private boolean isValid(final Collection<ExportablePermId> exportablePermIds) + private static boolean isValid(final Collection<ExportablePermId> exportablePermIds) { boolean isValid = true; for (final ExportablePermId exportablePermId : exportablePermIds) @@ -445,4 +448,9 @@ public class XLSExport } + public enum TextFormatting + { + PLAIN, RICH + } + } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/AbstractXLSExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/AbstractXLSExportHelper.java index 6e390b2abb4..c7fac581199 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/AbstractXLSExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/AbstractXLSExportHelper.java @@ -4,6 +4,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -23,6 +24,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.plugin.Plugin; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.vocabulary.Vocabulary; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; abstract class AbstractXLSExportHelper implements IXLSExportHelper { @@ -125,4 +127,13 @@ abstract class AbstractXLSExportHelper implements IXLSExportHelper return null; } + protected static Function<String, String> getPropertiesMappingFunction( + final XLSExport.TextFormatting textFormatting, final Map<String, String> properties) + { + return textFormatting == XLSExport.TextFormatting.PLAIN + ? propertyCode -> properties.get(propertyCode) != null + ? properties.get(propertyCode).replaceAll("<[^>]+>", "") : null + : properties::get; + } + } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/IXLSExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/IXLSExportHelper.java index b39ecc5cfa1..660799899ea 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/IXLSExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/IXLSExportHelper.java @@ -6,12 +6,13 @@ import org.apache.poi.ss.usermodel.Workbook; import ch.ethz.sis.openbis.generic.asapi.v3.IApplicationServerApi; import ch.ethz.sis.openbis.generic.asapi.v3.dto.common.interfaces.IEntityType; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public interface IXLSExportHelper { int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, final int rowNumber); + final Collection<String> permIds, final int rowNumber, final XLSExport.TextFormatting textFormatting); IEntityType getEntityType(final IApplicationServerApi api, final String sessionToken, final String permId); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSDataSetExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSDataSetExportHelper.java index a7f3feb81eb..1bda579ccc9 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSDataSetExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSDataSetExportHelper.java @@ -15,13 +15,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSet; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.DataSetType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions.DataSetFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.DataSetPermId; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public class XLSDataSetExportHelper extends AbstractXLSExportHelper { @Override public int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, int rowNumber) + final Collection<String> permIds, int rowNumber, final XLSExport.TextFormatting textFormatting) { final Collection<DataSet> dataSets = getDataSets(api, sessionToken, permIds); @@ -57,7 +58,9 @@ public class XLSDataSetExportHelper extends AbstractXLSExportHelper List.of(dataSet.getCode(), identifierHolder.getIdentifier().getIdentifier())); final Map<String, String> properties = dataSet.getProperties(); - dataSetValues.addAll(propertyCodes.stream().map(properties::get).collect(Collectors.toList())); + dataSetValues.addAll(propertyCodes.stream() + .map(getPropertiesMappingFunction(textFormatting, properties)) + .collect(Collectors.toList())); addRow(wb, rowNumber++, false, dataSetValues.toArray(String[]::new)); } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSDataSetTypeExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSDataSetTypeExportHelper.java index 2c8a42e2340..d2f30b28174 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSDataSetTypeExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSDataSetTypeExportHelper.java @@ -16,13 +16,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.IEntityTypeId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.plugin.Plugin; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public class XLSDataSetTypeExportHelper extends AbstractXLSExportHelper { @Override public int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, int rowNumber) + final Collection<String> permIds, int rowNumber, final XLSExport.TextFormatting textFormatting) { assert permIds.size() == 1; final DataSetType dataSetType = getDataSetType(api, sessionToken, permIds.iterator().next()); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSExperimentExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSExperimentExportHelper.java index 2eb2a90e9b5..60adfc86fef 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSExperimentExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSExperimentExportHelper.java @@ -14,13 +14,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.Experiment; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.ExperimentType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions.ExperimentFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.id.ExperimentPermId; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public class XLSExperimentExportHelper extends AbstractXLSExportHelper { @Override public int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, int rowNumber) + final Collection<String> permIds, int rowNumber, final XLSExport.TextFormatting textFormatting) { final Collection<Experiment> experiments = getExperiments(api, sessionToken, permIds); @@ -53,7 +54,9 @@ public class XLSExperimentExportHelper extends AbstractXLSExportHelper experiment.getProject().getIdentifier().getIdentifier())); final Map<String, String> properties = experiment.getProperties(); - experimentValues.addAll(propertyCodes.stream().map(properties::get).collect(Collectors.toList())); + experimentValues.addAll(propertyCodes.stream() + .map(getPropertiesMappingFunction(textFormatting, properties)) + .collect(Collectors.toList())); addRow(wb, rowNumber++, false, experimentValues.toArray(String[]::new)); } diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSExperimentTypeExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSExperimentTypeExportHelper.java index 87a279e587f..e7d40ccdfd8 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSExperimentTypeExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSExperimentTypeExportHelper.java @@ -16,13 +16,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.ExperimentType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions.ExperimentTypeFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.plugin.Plugin; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public class XLSExperimentTypeExportHelper extends AbstractXLSExportHelper { @Override public int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, int rowNumber) + final Collection<String> permIds, int rowNumber, final XLSExport.TextFormatting textFormatting) { assert permIds.size() == 1; final ExperimentType experimentType = getExperimentType(api, sessionToken, permIds.iterator().next()); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSProjectExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSProjectExportHelper.java index e97d7bcb206..40b6e9b4db4 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSProjectExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSProjectExportHelper.java @@ -10,13 +10,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.IApplicationServerApi; import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.Project; import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.fetchoptions.ProjectFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.id.ProjectPermId; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public class XLSProjectExportHelper extends AbstractXLSExportHelper { @Override public int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, int rowNumber) + final Collection<String> permIds, int rowNumber, final XLSExport.TextFormatting textFormatting) { final Collection<Project> projects = getProjects(api, sessionToken, permIds); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSampleExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSampleExportHelper.java index d562ba2e7d2..bf216a8faf9 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSampleExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSampleExportHelper.java @@ -14,13 +14,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.Sample; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.SampleType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SamplePermId; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public class XLSSampleExportHelper extends AbstractXLSExportHelper { @Override public int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, int rowNumber) + final Collection<String> permIds, int rowNumber, final XLSExport.TextFormatting textFormatting) { final Collection<Sample> samples = getSamples(api, sessionToken, permIds); @@ -62,7 +63,9 @@ public class XLSSampleExportHelper extends AbstractXLSExportHelper sample.getExperiment().getIdentifier().getIdentifier(), "FALSE", parents, children)); - sampleValues.addAll(propertyCodes.stream().map(sample.getProperties()::get) + final Map<String, String> properties = sample.getProperties(); + sampleValues.addAll(propertyCodes.stream() + .map(getPropertiesMappingFunction(textFormatting, properties)) .collect(Collectors.toList())); addRow(wb, rowNumber++, false, sampleValues.toArray(String[]::new)); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSampleTypeExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSampleTypeExportHelper.java index d80e6e6b2a6..d8c33c75d23 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSampleTypeExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSampleTypeExportHelper.java @@ -16,13 +16,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.plugin.Plugin; import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.fetchoptions.PropertyAssignmentFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.SampleType; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleTypeFetchOptions; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public class XLSSampleTypeExportHelper extends AbstractXLSExportHelper { @Override public int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, int rowNumber) + final Collection<String> permIds, int rowNumber, final XLSExport.TextFormatting textFormatting) { assert permIds.size() == 1; final SampleType sampleType = getSampleType(api, sessionToken, permIds.iterator().next()); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSpaceExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSpaceExportHelper.java index 0944d69b4eb..30d4a62ebcc 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSpaceExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSSpaceExportHelper.java @@ -10,13 +10,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.IApplicationServerApi; import ch.ethz.sis.openbis.generic.asapi.v3.dto.space.Space; import ch.ethz.sis.openbis.generic.asapi.v3.dto.space.fetchoptions.SpaceFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.space.id.SpacePermId; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public class XLSSpaceExportHelper extends AbstractXLSExportHelper { @Override public int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, int rowNumber) + final Collection<String> permIds, int rowNumber, final XLSExport.TextFormatting textFormatting) { final Collection<Space> spaces = getSpaces(api, sessionToken, permIds); diff --git a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSVocabularyExportHelper.java b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSVocabularyExportHelper.java index 4b6eb18d0ac..013368ec482 100644 --- a/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSVocabularyExportHelper.java +++ b/openbis/source/java/ch/ethz/sis/openbis/generic/server/xls/export/helper/XLSVocabularyExportHelper.java @@ -13,13 +13,14 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.vocabulary.VocabularyTerm; import ch.ethz.sis.openbis.generic.asapi.v3.dto.vocabulary.fetchoptions.VocabularyFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.vocabulary.id.IVocabularyId; import ch.ethz.sis.openbis.generic.asapi.v3.dto.vocabulary.id.VocabularyPermId; +import ch.ethz.sis.openbis.generic.server.xls.export.XLSExport; public class XLSVocabularyExportHelper extends AbstractXLSExportHelper { @Override public int add(final IApplicationServerApi api, final String sessionToken, final Workbook wb, - final Collection<String> permIds, int rowNumber) + final Collection<String> permIds, int rowNumber, final XLSExport.TextFormatting textFormatting) { assert permIds.size() == 1; final Vocabulary vocabulary = getVocabulary(api, sessionToken, permIds.iterator().next()); diff --git a/openbis_ng_ui/src/core-plugins/openbis-ng-ui/1/as/services/xls-export/xls-export.py b/openbis_ng_ui/src/core-plugins/openbis-ng-ui/1/as/services/xls-export/xls-export.py index fee1122fe82..f9f5b428a0b 100644 --- a/openbis_ng_ui/src/core-plugins/openbis-ng-ui/1/as/services/xls-export/xls-export.py +++ b/openbis_ng_ui/src/core-plugins/openbis-ng-ui/1/as/services/xls-export/xls-export.py @@ -23,9 +23,10 @@ def export(context, parameters): perm_id: permId of the exportable }] - export_referred: whether the referred entities should be exported as well + export_referred: whether the referred vocabularies and sample properties should be exported as well } - :return: Openbis's execute operations result string. It should contain report on what was created. + :return: Openbis's execute operations result string. Contains either the error message or the exported file name + in the session workspace. """ try: file_name = parameters.get("file_name") @@ -33,14 +34,14 @@ def export(context, parameters): id.get("perm_id")), parameters.get("ids", {})) + # export_properties = parameters.get("export_properties", None) session_token = context.getSessionToken() api = context.getApplicationService() - xls_export = XLSExport() - full_file_name = xls_export.export(file_name, api, session_token, vocabularies, - parameters.get("export_referred", False)) + text_formatting = XLSExport.TextFormatting.valueOf(parameters.get("text_formatting")) + full_file_name = XLSExport.export(file_name, api, session_token, vocabularies, + parameters.get("export_referred"), + # export_properties, + text_formatting) except Exception as e: return {"status": "error", "message": str(e)} - return { - "status": "OK", - "result": full_file_name - } + return {"status": "OK", "result": full_file_name} -- GitLab