|
1 | | -# Copyright (C) 2021 Fraunhofer Institut IOSB, Fraunhoferstr. 1, D 76131 |
2 | | -# Karlsruhe, Germany. |
3 | | -# |
4 | | -# This program is free software: you can redistribute it and/or modify |
5 | | -# it under the terms of the GNU Lesser General Public License as published by |
6 | | -# the Free Software Foundation, either version 3 of the License, or |
7 | | -# (at your option) any later version. |
8 | | -# |
9 | | -# This program is distributed in the hope that it will be useful, |
10 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | | -# GNU Lesser General Public License for more details. |
13 | | -# |
14 | | -# You should have received a copy of the GNU Lesser General Public License |
15 | | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | | - |
17 | | -EntityTypes = { |
18 | | - 'Datastream': { |
19 | | - 'singular': 'Datastream', |
20 | | - 'plural': 'Datastreams', |
21 | | - 'class': 'frost_sta_client.model.datastream.Datastream', |
22 | | - 'relations_list': ['Sensor', 'Thing', 'ObservedProperty', 'Observations'] |
23 | | - }, |
24 | | - 'MultiDatastream': { |
25 | | - 'singular': 'MultiDatastream', |
26 | | - 'plural': 'MultiDatastreams', |
27 | | - 'class': 'frost_sta_client.model.multi_datastream.MultiDatastream', |
28 | | - 'relations_list': ['Sensor', 'Thing', 'ObservedProperties', 'Observations'] |
29 | | - }, |
30 | | - 'FeatureOfInterest': { |
31 | | - 'singular': 'FeatureOfInterest', |
32 | | - 'plural': 'FeaturesOfInterest', |
33 | | - 'class': 'frost_sta_client.model.feature_of_interest.FeatureOfInterest', |
34 | | - 'relations_list': ['Observations'] |
35 | | - }, |
36 | | - 'HistoricalLocation': { |
37 | | - 'singular': 'HistoricalLocation', |
38 | | - 'plural': 'HistoricalLocations', |
39 | | - 'class': 'frost_sta_client.model.historical_location.HistoricalLocation', |
40 | | - 'relations_list': ['Thing', 'Locations'] |
41 | | - }, |
42 | | - 'Actuator': { |
43 | | - 'singular': 'Actuator', |
44 | | - 'plural': 'Actuators', |
45 | | - 'class': 'frost_sta_client.model.actuator.Actuator', |
46 | | - 'relations_list': ['TaskingCapabilities'] |
47 | | - }, |
48 | | - 'Location': { |
49 | | - 'singular': 'Location', |
50 | | - 'plural': 'Locations', |
51 | | - 'class': 'frost_sta_client.model.location.Location', |
52 | | - 'relations_list': ['Things', 'HistoricalLocations'] |
53 | | - }, |
54 | | - 'Observation': { |
55 | | - 'singular': 'Observation', |
56 | | - 'plural': 'Observations', |
57 | | - 'class': 'frost_sta_client.model.observation.Observation', |
58 | | - 'relations_list': ['FeatureOfInterest', 'Datastream', 'MultiDatastream'] |
59 | | - }, |
60 | | - 'Thing': { |
61 | | - 'singular': 'Thing', |
62 | | - 'plural': 'Things', |
63 | | - 'class': 'frost_sta_client.model.thing.Thing', |
64 | | - 'relations_list': ['Datastreams', 'MultiDatastreams', 'Locations', 'HistoricalLocations', 'TaskingCapabilities'] |
65 | | - }, |
66 | | - 'ObservedProperty': { |
67 | | - 'singular': 'ObservedProperty', |
68 | | - 'plural': 'ObservedProperties', |
69 | | - 'class': 'frost_sta_client.model.observedproperty.ObservedProperty', |
70 | | - 'relations_list': ['Datastreams', 'MultiDatastreams'] |
71 | | - }, |
72 | | - 'Sensor': { |
73 | | - 'singular': 'Sensor', |
74 | | - 'plural': 'Sensors', |
75 | | - 'class': 'frost_sta_client.model.sensor.Sensor', |
76 | | - 'relations_list': ['Datastreams', 'MultiDatastreams'] |
77 | | - }, |
78 | | - 'Task': { |
79 | | - 'singular': 'Task', |
80 | | - 'plural': 'Tasks', |
81 | | - 'class': 'frost_sta_client.model.task.Task', |
82 | | - 'relations_list': ['TaskingCapability'] |
83 | | - }, |
84 | | - 'TaskingCapability': { |
85 | | - 'singular': 'TaskingCapability', |
86 | | - 'plural': 'TaskingCapabilities', |
87 | | - 'class': 'frost_sta_client.model.tasking_capability.TaskingCapability', |
88 | | - 'relations_list': ['Tasks', 'Actuator', 'Thing'] |
89 | | - }, |
90 | | - 'UnitOfMeasurement': { |
91 | | - 'singular': 'UnitOfMeasurement', |
92 | | - 'plural': 'UnitOfMeasurements', |
93 | | - 'class': 'frost_sta_client.model.ext.unitofmeasurement.UnitOfMeasurement' |
94 | | - }, |
95 | | - 'EntityList': { |
96 | | - 'singular': 'EntityList', |
97 | | - 'plural': 'EntityLists', |
98 | | - 'class': 'frost_sta_client.model.ext.entity_list.EntityList' |
99 | | - } |
100 | | -} |
101 | | - |
102 | | -list_for_class = {} |
103 | | -for key, entity_type in EntityTypes.items(): |
104 | | - list_for_class[entity_type["class"]] = entity_type["plural"] |
105 | | - |
106 | | -def get_list_for_class(clazz): |
107 | | - clazz_name = clazz.__module__ + "." + clazz.__name__ |
108 | | - return list_for_class[clazz_name] |
| 1 | +# Copyright (C) 2021 Fraunhofer Institut IOSB, Fraunhoferstr. 1, D 76131 |
| 2 | +# Karlsruhe, Germany. |
| 3 | +# |
| 4 | +# This program is free software: you can redistribute it and/or modify |
| 5 | +# it under the terms of the GNU Lesser General Public License as published by |
| 6 | +# the Free Software Foundation, either version 3 of the License, or |
| 7 | +# (at your option) any later version. |
| 8 | +# |
| 9 | +# This program is distributed in the hope that it will be useful, |
| 10 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +# GNU Lesser General Public License for more details. |
| 13 | +# |
| 14 | +# You should have received a copy of the GNU Lesser General Public License |
| 15 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + |
| 17 | +EntityTypes = { |
| 18 | + 'Datastream': { |
| 19 | + 'singular': 'Datastream', |
| 20 | + 'plural': 'Datastreams', |
| 21 | + 'class': 'frost_sta_client.model.datastream.Datastream', |
| 22 | + 'relations_list': ['Sensor', 'Thing', 'ObservedProperty', 'Observations'] |
| 23 | + }, |
| 24 | + 'MultiDatastream': { |
| 25 | + 'singular': 'MultiDatastream', |
| 26 | + 'plural': 'MultiDatastreams', |
| 27 | + 'class': 'frost_sta_client.model.multi_datastream.MultiDatastream', |
| 28 | + 'relations_list': ['Sensor', 'Thing', 'ObservedProperties', 'Observations'] |
| 29 | + }, |
| 30 | + 'FeatureOfInterest': { |
| 31 | + 'singular': 'FeatureOfInterest', |
| 32 | + 'plural': 'FeaturesOfInterest', |
| 33 | + 'class': 'frost_sta_client.model.feature_of_interest.FeatureOfInterest', |
| 34 | + 'relations_list': ['Observations'] |
| 35 | + }, |
| 36 | + 'HistoricalLocation': { |
| 37 | + 'singular': 'HistoricalLocation', |
| 38 | + 'plural': 'HistoricalLocations', |
| 39 | + 'class': 'frost_sta_client.model.historical_location.HistoricalLocation', |
| 40 | + 'relations_list': ['Thing', 'Locations'] |
| 41 | + }, |
| 42 | + 'Actuator': { |
| 43 | + 'singular': 'Actuator', |
| 44 | + 'plural': 'Actuators', |
| 45 | + 'class': 'frost_sta_client.model.actuator.Actuator', |
| 46 | + 'relations_list': ['TaskingCapabilities'] |
| 47 | + }, |
| 48 | + 'Location': { |
| 49 | + 'singular': 'Location', |
| 50 | + 'plural': 'Locations', |
| 51 | + 'class': 'frost_sta_client.model.location.Location', |
| 52 | + 'relations_list': ['Things', 'HistoricalLocations'] |
| 53 | + }, |
| 54 | + 'Observation': { |
| 55 | + 'singular': 'Observation', |
| 56 | + 'plural': 'Observations', |
| 57 | + 'class': 'frost_sta_client.model.observation.Observation', |
| 58 | + 'relations_list': ['FeatureOfInterest', 'Datastream', 'MultiDatastream'] |
| 59 | + }, |
| 60 | + 'Thing': { |
| 61 | + 'singular': 'Thing', |
| 62 | + 'plural': 'Things', |
| 63 | + 'class': 'frost_sta_client.model.thing.Thing', |
| 64 | + 'relations_list': ['Datastreams', 'MultiDatastreams', 'Locations', 'HistoricalLocations', 'TaskingCapabilities'] |
| 65 | + }, |
| 66 | + 'ObservedProperty': { |
| 67 | + 'singular': 'ObservedProperty', |
| 68 | + 'plural': 'ObservedProperties', |
| 69 | + 'class': 'frost_sta_client.model.observedproperty.ObservedProperty', |
| 70 | + 'relations_list': ['Datastreams', 'MultiDatastreams'] |
| 71 | + }, |
| 72 | + 'Sensor': { |
| 73 | + 'singular': 'Sensor', |
| 74 | + 'plural': 'Sensors', |
| 75 | + 'class': 'frost_sta_client.model.sensor.Sensor', |
| 76 | + 'relations_list': ['Datastreams', 'MultiDatastreams'] |
| 77 | + }, |
| 78 | + 'Task': { |
| 79 | + 'singular': 'Task', |
| 80 | + 'plural': 'Tasks', |
| 81 | + 'class': 'frost_sta_client.model.task.Task', |
| 82 | + 'relations_list': ['TaskingCapability'] |
| 83 | + }, |
| 84 | + 'TaskingCapability': { |
| 85 | + 'singular': 'TaskingCapability', |
| 86 | + 'plural': 'TaskingCapabilities', |
| 87 | + 'class': 'frost_sta_client.model.tasking_capability.TaskingCapability', |
| 88 | + 'relations_list': ['Tasks', 'Actuator', 'Thing'] |
| 89 | + }, |
| 90 | + 'UnitOfMeasurement': { |
| 91 | + 'singular': 'UnitOfMeasurement', |
| 92 | + 'plural': 'UnitOfMeasurements', |
| 93 | + 'class': 'frost_sta_client.generated.odata.datamodel.UnitOfMeasurement' |
| 94 | + }, |
| 95 | + 'EntityList': { |
| 96 | + 'singular': 'EntityList', |
| 97 | + 'plural': 'EntityLists', |
| 98 | + 'class': 'frost_sta_client.model.ext.entity_list.EntityList' |
| 99 | + } |
| 100 | +} |
| 101 | + |
| 102 | +list_for_class = {} |
| 103 | +for key, entity_type in EntityTypes.items(): |
| 104 | + list_for_class[entity_type["class"]] = entity_type["plural"] |
| 105 | + |
| 106 | +def get_list_for_class(clazz): |
| 107 | + clazz_name = clazz.__module__ + "." + clazz.__name__ |
| 108 | + return list_for_class[clazz_name] |
0 commit comments