-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathexperimentergroup.py
More file actions
58 lines (47 loc) · 1.97 KB
/
Copy pathexperimentergroup.py
File metadata and controls
58 lines (47 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle.
# If the file is missing please request a copy by contacting
# jason@glencoesoftware.com.
#
from ... import SCHEMA_VERSION
from .. import Encoder
from omero.model import ExperimenterGroupI
class ExperimenterGroup201501Encoder(Encoder):
TYPE = \
'http://www.openmicroscopy.org/Schemas/OME/2015-01#ExperimenterGroup'
def encode(self, obj):
v = super(ExperimenterGroup201501Encoder, self).encode(obj)
if not obj.isLoaded():
return v
self.set_if_not_none(v, 'Description', obj.description)
self.set_if_not_none(v, 'Name', obj.name)
if obj.isGroupExperimenterMapLoaded() \
and obj.sizeOfGroupExperimenterMap() > 0:
experimenters = list()
for group_experimenter_map in obj.copyGroupExperimenterMap():
experimenter = group_experimenter_map.child
experimenter_encoder = self.ctx.get_encoder(
experimenter.__class__
)
experimenter_data = experimenter_encoder.encode(experimenter)
self.set_if_not_none(
experimenter_data,
'omero:owner',
group_experimenter_map.owner
)
experimenters.append(experimenter_data)
v['Experimenters'] = experimenters
return v
class ExperimenterGroup201606Encoder(ExperimenterGroup201501Encoder):
TYPE = \
'http://www.openmicroscopy.org/Schemas/OME/2016-06#ExperimenterGroup'
if SCHEMA_VERSION == '2015-01':
encoder = (ExperimenterGroupI, ExperimenterGroup201501Encoder)
elif SCHEMA_VERSION == '2016-06':
encoder = (ExperimenterGroupI, ExperimenterGroup201606Encoder)
ExperimenterGroupEncoder = encoder[1]