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
002677ab
Commit
002677ab
authored
12 years ago
by
cramakri
Browse files
Options
Downloads
Patches
Plain Diff
Renamed json_encoded_list to json_encoded_value
SVN: 27266
parent
612f7f1d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py
+8
-8
8 additions, 8 deletions
...1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py
with
8 additions
and
8 deletions
openbis-ipad/ipad-example-data/ipad-ui/1/dss/reporting-plugins/ipad-read-service-v1/ipad_read.py
+
8
−
8
View file @
002677ab
...
...
@@ -6,7 +6,7 @@ from com.fasterxml.jackson.databind import ObjectMapper
# BEGIN Infrastructure
#
def
json_encoded_
list
(
coll
):
def
json_encoded_
value
(
coll
):
"""
Utility function for converting a list into a json-encoded list
"""
return
ObjectMapper
().
writeValueAsString
(
coll
)
...
...
@@ -87,7 +87,7 @@ class RequestHandler:
for
entry
in
entities
:
self
.
add_row
(
entry
)
def
json_encoded_
list
(
self
,
coll
):
def
json_encoded_
value
(
self
,
coll
):
return
ObjectMapper
().
writeValueAsString
(
coll
)
def
process_request
(
self
):
...
...
@@ -122,7 +122,7 @@ def material_to_dict(material):
refcon
=
{}
refcon
[
'
entityKind
'
]
=
'
MATERIAL
'
refcon
[
'
entityType
'
]
=
material
.
getMaterialType
()
material_dict
[
'
REFCON
'
]
=
json_encoded_
list
(
refcon
)
material_dict
[
'
REFCON
'
]
=
json_encoded_
value
(
refcon
)
material_dict
[
'
CATEGORY
'
]
=
material
.
getMaterialType
()
if
material
.
getMaterialType
()
==
'
5HT_COMPOUND
'
:
material_dict
[
'
SUMMARY
'
]
=
material
.
getPropertyValue
(
"
FORMULA
"
)
...
...
@@ -131,11 +131,11 @@ def material_to_dict(material):
material_dict
[
'
SUMMARY
'
]
=
material
.
getPropertyValue
(
"
DESC
"
)
material_dict
[
'
IMAGE_URL
'
]
=
""
material_dict
[
'
CHILDREN
'
]
=
json_encoded_
list
([])
material_dict
[
'
CHILDREN
'
]
=
json_encoded_
value
([])
prop_names
=
[
"
NAME
"
,
"
PROT_NAME
"
,
"
GENE_NAME
"
,
"
LENGTH
"
,
"
CHEMBL
"
,
"
DESC
"
,
"
FORMULA
"
,
"
WEIGHT
"
,
"
SMILES
"
]
properties
=
dict
((
name
,
material
.
getPropertyValue
(
name
))
for
name
in
prop_names
if
material
.
getPropertyValue
(
name
)
is
not
None
)
material_dict
[
'
PROPERTIES
'
]
=
json_encoded_
list
(
properties
)
material_dict
[
'
PROPERTIES
'
]
=
json_encoded_
value
(
properties
)
return
material_dict
def
sample_to_dict
(
five_ht_sample
,
material_by_perm_id
):
...
...
@@ -147,17 +147,17 @@ def sample_to_dict(five_ht_sample, material_by_perm_id):
refcon
=
{}
refcon
[
'
entityKind
'
]
=
'
SAMPLE
'
refcon
[
'
entityType
'
]
=
five_ht_sample
.
getSampleType
()
sample_dict
[
'
REFCON
'
]
=
json_encoded_
list
(
refcon
)
sample_dict
[
'
REFCON
'
]
=
json_encoded_
value
(
refcon
)
sample_dict
[
'
CATEGORY
'
]
=
five_ht_sample
.
getSampleType
()
compound
=
material_by_perm_id
[
five_ht_sample
.
getPropertyValue
(
"
COMPOUND
"
)]
sample_dict
[
'
IMAGE_URL
'
]
=
image_url_for_compound
(
compound
)
children
=
[
five_ht_sample
.
getPropertyValue
(
"
TARGET
"
),
five_ht_sample
.
getPropertyValue
(
"
COMPOUND
"
)]
sample_dict
[
'
CHILDREN
'
]
=
json_encoded_
list
(
children
)
sample_dict
[
'
CHILDREN
'
]
=
json_encoded_
value
(
children
)
prop_names
=
[
"
DESC
"
]
properties
=
dict
((
name
,
five_ht_sample
.
getPropertyValue
(
name
))
for
name
in
prop_names
if
five_ht_sample
.
getPropertyValue
(
name
)
is
not
None
)
sample_dict
[
'
PROPERTIES
'
]
=
json_encoded_
list
(
properties
)
sample_dict
[
'
PROPERTIES
'
]
=
json_encoded_
value
(
properties
)
# Need to handle the material links as entity links: "TARGET", "COMPOUND"
return
sample_dict
...
...
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