Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
73bcd32e
Commit
73bcd32e
authored
8 years ago
by
juanf
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-3733 : TXT implementation, properties labels
SVN: 36691
parent
ed7f1d32
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py
+39
-5
39 additions, 5 deletions
...n-lims/1/dss/reporting-plugins/exports-api/exports-api.py
with
39 additions
and
5 deletions
openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exports-api.py
+
39
−
5
View file @
73bcd32e
...
@@ -39,6 +39,8 @@ from ch.systemsx.cisd.common.mail import EMailAddress;
...
@@ -39,6 +39,8 @@ from ch.systemsx.cisd.common.mail import EMailAddress;
#To obtain the openBIS URL
#To obtain the openBIS URL
from
ch.systemsx.cisd.openbis.dss.generic.server
import
DataStoreServer
;
from
ch.systemsx.cisd.openbis.dss.generic.server
import
DataStoreServer
;
from
ch.systemsx.cisd.openbis.dss.generic.server
import
SessionTokenManager
from
ch.systemsx.cisd.openbis.generic.shared.api.v1.dto
import
SearchCriteria
OPENBISURL
=
DataStoreServer
.
getConfigParameters
().
getServerURL
()
+
"
/openbis/openbis
"
;
OPENBISURL
=
DataStoreServer
.
getConfigParameters
().
getServerURL
()
+
"
/openbis/openbis
"
;
V3_DSS_BEAN
=
"
data-store-server_INTERNAL
"
;
V3_DSS_BEAN
=
"
data-store-server_INTERNAL
"
;
...
@@ -50,11 +52,21 @@ from ch.ethz.sis.openbis.generic.asapi.v3.dto.project.search import ProjectSearc
...
@@ -50,11 +52,21 @@ from ch.ethz.sis.openbis.generic.asapi.v3.dto.project.search import ProjectSearc
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.search
import
ExperimentSearchCriteria
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.search
import
ExperimentSearchCriteria
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.search
import
SampleSearchCriteria
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.search
import
SampleSearchCriteria
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search
import
DataSetSearchCriteria
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search
import
DataSetSearchCriteria
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.project.fetchoptions
import
ProjectFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.project.fetchoptions
import
ProjectFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions
import
ExperimentFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions
import
ExperimentFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions
import
SampleFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions
import
SampleFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions
import
DataSetFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions
import
DataSetFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.search
import
ExperimentTypeSearchCriteria
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.fetchoptions
import
ExperimentTypeFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.search
import
SampleTypeSearchCriteria
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions
import
SampleTypeFetchOptions
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search
import
DataSetTypeSearchCriteria
;
from
ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions
import
DataSetTypeFetchOptions
;
#V3 API - Files
#V3 API - Files
from
ch.ethz.sis.openbis.generic.dssapi.v3
import
IDataStoreServerApi
;
from
ch.ethz.sis.openbis.generic.dssapi.v3
import
IDataStoreServerApi
;
from
ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search
import
DataSetFileSearchCriteria
;
from
ch.ethz.sis.openbis.generic.dssapi.v3.dto.datasetfile.search
import
DataSetFileSearchCriteria
;
...
@@ -323,7 +335,7 @@ def export(sessionToken, entities, includeRoot, userEmail, mailClient):
...
@@ -323,7 +335,7 @@ def export(sessionToken, entities, includeRoot, userEmail, mailClient):
entityJson
=
String
(
objectMapper
.
writeValueAsString
(
entityObj
));
entityJson
=
String
(
objectMapper
.
writeValueAsString
(
entityObj
));
addFile
(
tempDirPath
,
entityFilePath
,
"
json
"
,
entityJson
.
getBytes
(),
zos
);
addFile
(
tempDirPath
,
entityFilePath
,
"
json
"
,
entityJson
.
getBytes
(),
zos
);
#TEXT
#TEXT
entityTXT
=
String
(
getTXT
(
entityObj
));
entityTXT
=
String
(
getTXT
(
entityObj
,
v3
,
sessionToken
));
addFile
(
tempDirPath
,
entityFilePath
,
"
txt
"
,
entityTXT
.
getBytes
(),
zos
);
addFile
(
tempDirPath
,
entityFilePath
,
"
txt
"
,
entityTXT
.
getBytes
(),
zos
);
...
@@ -342,20 +354,38 @@ def export(sessionToken, entities, includeRoot, userEmail, mailClient):
...
@@ -342,20 +354,38 @@ def export(sessionToken, entities, includeRoot, userEmail, mailClient):
FileUtils
.
forceDelete
(
File
(
tempZipFilePath
));
FileUtils
.
forceDelete
(
File
(
tempZipFilePath
));
return
True
return
True
def
getTXT
(
entityObj
):
def
getTXT
(
entityObj
,
v3
,
sessionToken
):
txtBuilder
=
StringBuilder
();
txtBuilder
=
StringBuilder
();
txtBuilder
.
append
(
entityObj
.
getCode
()).
append
(
"
\n
"
);
txtBuilder
.
append
(
entityObj
.
getCode
()).
append
(
"
\n
"
);
txtBuilder
.
append
(
"
# Identification Info:
"
).
append
(
"
\n
"
);
txtBuilder
.
append
(
"
# Identification Info:
"
).
append
(
"
\n
"
);
typeObj
=
None
if
isinstance
(
entityObj
,
Project
):
if
isinstance
(
entityObj
,
Project
):
txtBuilder
.
append
(
"
Kind: Project
"
).
append
(
"
\n
"
);
txtBuilder
.
append
(
"
Kind: Project
"
).
append
(
"
\n
"
);
if
isinstance
(
entityObj
,
Experiment
):
if
isinstance
(
entityObj
,
Experiment
):
txtBuilder
.
append
(
"
Kind: Experiment
"
).
append
(
"
\n
"
);
txtBuilder
.
append
(
"
Kind: Experiment
"
).
append
(
"
\n
"
);
searchCriteria
=
ExperimentTypeSearchCriteria
();
searchCriteria
.
withCode
().
thatEquals
(
entityObj
.
getType
().
getCode
());
fetchOptions
=
ExperimentTypeFetchOptions
();
fetchOptions
.
withPropertyAssignments
();
results
=
v3
.
searchExperimentTypes
(
sessionToken
,
searchCriteria
,
fetchOptions
);
typeObj
=
results
.
getObjects
().
get
(
0
);
if
isinstance
(
entityObj
,
Sample
):
if
isinstance
(
entityObj
,
Sample
):
txtBuilder
.
append
(
"
Kind: Sample
"
).
append
(
"
\n
"
);
txtBuilder
.
append
(
"
Kind: Sample
"
).
append
(
"
\n
"
);
searchCriteria
=
SampleTypeSearchCriteria
();
searchCriteria
.
withCode
().
thatEquals
(
entityObj
.
getType
().
getCode
());
fetchOptions
=
SampleTypeFetchOptions
();
fetchOptions
.
withPropertyAssignments
();
results
=
v3
.
searchSampleTypes
(
sessionToken
,
searchCriteria
,
fetchOptions
);
typeObj
=
results
.
getObjects
().
get
(
0
);
if
isinstance
(
entityObj
,
DataSet
):
if
isinstance
(
entityObj
,
DataSet
):
txtBuilder
.
append
(
"
Kind: DataSet
"
).
append
(
"
\n
"
);
txtBuilder
.
append
(
"
Kind: DataSet
"
).
append
(
"
\n
"
);
searchCriteria
=
DataSetTypeSearchCriteria
();
searchCriteria
.
withCode
().
thatEquals
(
entityObj
.
getType
().
getCode
());
fetchOptions
=
DataSetTypeFetchOptions
();
fetchOptions
.
withPropertyAssignments
();
results
=
v3
.
searchDataSetTypes
(
sessionToken
,
searchCriteria
,
fetchOptions
);
typeObj
=
results
.
getObjects
().
get
(
0
);
if
not
isinstance
(
entityObj
,
Project
):
if
not
isinstance
(
entityObj
,
Project
):
txtBuilder
.
append
(
"
Type:
"
+
entityObj
.
getType
().
getCode
()).
append
(
"
\n
"
);
txtBuilder
.
append
(
"
Type:
"
+
entityObj
.
getType
().
getCode
()).
append
(
"
\n
"
);
...
@@ -383,10 +413,14 @@ def getTXT(entityObj):
...
@@ -383,10 +413,14 @@ def getTXT(entityObj):
if
not
isinstance
(
entityObj
,
Project
):
if
not
isinstance
(
entityObj
,
Project
):
txtBuilder
.
append
(
"
# Properties:
"
).
append
(
"
\n
"
);
txtBuilder
.
append
(
"
# Properties:
"
).
append
(
"
\n
"
);
propertyAssigments
=
typeObj
.
getPropertyAssignments
();
properties
=
entityObj
.
getProperties
();
properties
=
entityObj
.
getProperties
();
for
propertyCode
in
properties
:
for
propertyAssigment
in
propertyAssigments
:
txtBuilder
.
append
(
propertyCode
).
append
(
"
:
"
).
append
(
properties
[
propertyCode
]).
append
(
"
\n
"
);
propertyType
=
propertyAssigment
.
getPropertyType
();
if
propertyType
.
getCode
()
in
properties
:
txtBuilder
.
append
(
propertyType
.
getLabel
()).
append
(
"
:
"
).
append
(
properties
[
propertyType
.
getCode
()]).
append
(
"
\n
"
);
print
txtBuilder
.
toString
();
return
txtBuilder
.
toString
();
return
txtBuilder
.
toString
();
def
addFile
(
tempDirPath
,
entityFilePath
,
extension
,
fileContent
,
zos
):
def
addFile
(
tempDirPath
,
entityFilePath
,
extension
,
fileContent
,
zos
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment