@@ -54,40 +54,45 @@ def __init__(self, session):
5454 # Annotations
5555 # ################################################################################
5656
57- def getAnnotations (self , type = None ):
57+ def getAnnotations (self , type = None , codes = None ):
5858
5959 # TODO What keywords do I use for type
6060 a = Annotations
61- if type == "action" :
62- a = ActionAnnotations
63- elif type == "categoricalresultvalue" :
64- a = CategoricalResultValueAnnotations
65- elif type == "equipmentannotation" :
66- a = EquipmentAnnotations
67- elif type == "measurementresultvalue" :
68- a = MeasurementResultValueAnnotations
69- elif type == "method" :
70- a = MethodAnnotations
71- elif type == "pointcoverageresultvalue" :
72- a = PointCoverageResultValueAnnotations
73- elif type == "profileresultvalue" :
74- a = ProfileResultValueAnnotations
75- elif type == "result" :
76- a = ResultAnnotations
77- elif type == "samplingfeature" :
78- a = SamplingFeatureAnnotations
79- elif type == "sectionresultvalue" :
80- a = SectionResultValueAnnotations
81- elif type == "spectraresultvalue" :
82- a = SpectraResultValueAnnotations
83- elif type == "timeseriesresultvalue" :
84- a = TimeSeriesResultValueAnnotations
85- elif type == "trajectoryresultvalue" :
86- a = TrajectoryResultValueAnnotations
87- elif type == "transectresultvalue" :
88- a = TransectResultValueAnnotations
61+ if type :
62+ if type == "action" :
63+ a = ActionAnnotations
64+ elif type == "categoricalresultvalue" :
65+ a = CategoricalResultValueAnnotations
66+ elif type == "equipmentannotation" :
67+ a = EquipmentAnnotations
68+ elif type == "measurementresultvalue" :
69+ a = MeasurementResultValueAnnotations
70+ elif type == "method" :
71+ a = MethodAnnotations
72+ elif type == "pointcoverageresultvalue" :
73+ a = PointCoverageResultValueAnnotations
74+ elif type == "profileresultvalue" :
75+ a = ProfileResultValueAnnotations
76+ elif type == "result" :
77+ a = ResultAnnotations
78+ elif type == "samplingfeature" :
79+ a = SamplingFeatureAnnotations
80+ elif type == "sectionresultvalue" :
81+ a = SectionResultValueAnnotations
82+ elif type == "spectraresultvalue" :
83+ a = SpectraResultValueAnnotations
84+ elif type == "timeseriesresultvalue" :
85+ a = TimeSeriesResultValueAnnotations
86+ elif type == "trajectoryresultvalue" :
87+ a = TrajectoryResultValueAnnotations
88+ elif type == "transectresultvalue" :
89+ a = TransectResultValueAnnotations
8990 try :
90- return self ._session .query (a ).all ()
91+ query = self ._session .query (a )
92+ if codes :
93+ query = query .filter (Annotations .AnnotationCode .in_ (codes ))
94+ return query .all ()
95+
9196 except :
9297 return None
9398
0 commit comments