Mercurial > gemma
annotate pkg/models/imports.go @ 5710:37c8feeecb4d
Merged branch sr-v2 into default.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 20 Feb 2024 21:28:56 +0100 |
parents | 1222b777f51f |
children |
rev | line source |
---|---|
2016
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 // This is Free Software under GNU Affero General Public License v >= 3.0 |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 // without warranty, see README.md and license for details. |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 // |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 // SPDX-License-Identifier: AGPL-3.0-or-later |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 // License-Filename: LICENSES/AGPL-3.0.txt |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 // |
4894
8eb36d0d5bdf
Draft implementation of fairway marks import
Tom Gottfried <tom@intevation.de>
parents:
4400
diff
changeset
|
7 // Copyright (C) 2018, 2019, 2020 by via donau |
2016
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 // – Österreichische Wasserstraßen-Gesellschaft mbH |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 // Software engineering by Intevation GmbH |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 // |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 // Author(s): |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de> |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
13 // * Tom Gottfried <tom.gottfried@intevation.de> |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
14 |
2016
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 package models |
25967829cf00
Started to simplify the import models.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
17 import ( |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
18 "errors" |
2059
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
19 "strings" |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
20 |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
21 "gemma.intevation.de/gemma/pkg/common" |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
22 ) |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
23 |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
24 type ( |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
25 // ConfigurableURLImport is configuration with an URL. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
26 ConfigurableURLImport struct { |
2025
070ac9dd61a1
Bring manual imports to new import modeling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2024
diff
changeset
|
27 URLType |
070ac9dd61a1
Bring manual imports to new import modeling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2024
diff
changeset
|
28 QueueConfigurationType |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
29 } |
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
30 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
31 // BottleneckImport is a bottleneck import. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
32 BottleneckImport struct { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
33 ConfigurableURLImport |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
34 |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
35 // Tolerance used for axis snapping |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
36 Tolerance float64 `json:"tolerance"` |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
37 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
38 |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
39 // GaugeMeasurementImport contains data used to define the endpoint |
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
40 GaugeMeasurementImport struct { |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
41 ConfigurableURLImport |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
42 } |
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
43 |
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
44 // FairwayAvailabilityImport contains data used to define the endpoint |
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
45 FairwayAvailabilityImport struct { |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
46 ConfigurableURLImport |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
47 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
48 |
2633
eb1d119f253f
Fetch data from ERDMS for all allowed countries
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
49 // WaterwayGaugeImport specifies an import of waterway gauges. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
50 WaterwayGaugeImport struct { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
51 ConfigurableURLImport |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
52 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
53 |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
54 // DistanceMarksVirtualImport specifies an import of distance marks virtual. |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
55 DistanceMarksVirtualImport struct { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
56 ConfigurableURLImport |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
57 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
58 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
59 // WFSImport is the common base for WFS imports. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
60 WFSImport struct { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
61 ConfigurableURLImport |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
62 |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
63 // FeatureType is the layer to use. |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
64 FeatureType string `json:"feature-type"` |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
65 // SortBy sorts the feature by this key. |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
66 SortBy *string `json:"sort-by"` |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
67 } |
2018
8a62ce2a5c70
Moved gaugemeasurement to local package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2016
diff
changeset
|
68 |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
69 // WaterwayAxisImport specifies an import of the waterway axis. |
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
70 WaterwayAxisImport struct { |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
71 WFSImport |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
72 } |
2019
aeff01c6edec
Moved fairwayavailability to a local model.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2018
diff
changeset
|
73 |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
74 // WaterwayAreaImport specifies an import of the waterway area. |
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
75 WaterwayAreaImport struct { |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
76 WFSImport |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
77 } |
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
78 |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
79 // DistanceMarksAshoreImport specifies an import of the distance marks. |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
80 DistanceMarksAshoreImport struct { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
81 WFSImport |
2021
aa74466feaa8
Moved distancemarks virtual to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2020
diff
changeset
|
82 } |
2022
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
83 |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
84 // FairwayDimensionImport specifies an import of the waterway axis. |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
85 FairwayDimensionImport struct { |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
86 WFSImport |
2025
070ac9dd61a1
Bring manual imports to new import modeling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2024
diff
changeset
|
87 |
2022
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
88 // LOS is the level of service provided by the wfs |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
89 LOS int `json:"los"` |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
90 // MinWidth is the minimum width of the fairway for the specified LOS |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
91 MinWidth int `json:"min-width"` |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
92 // MaxWidth is the maximum width of the fairway for the specified LOS |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
93 MaxWidth int `json:"max-width"` |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
94 // Depth is the minimum depth of the fairway for the specified LOS |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
95 Depth int `json:"depth"` |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
96 // SourceOrganization specifies the source of the entry |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
97 SourceOrganization string `json:"source-organization"` |
213f79fde44a
Moved fairway dimension import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2021
diff
changeset
|
98 } |
2023
fc5c888428c8
Moved distance marks ashore import into imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2022
diff
changeset
|
99 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
100 // StretchImport imports a stretch. |
2024
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
101 StretchImport struct { |
2029
8d006afa7c1b
Imports: Stretch imports are not configurabel and scheduable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2025
diff
changeset
|
102 EmailType |
2025
070ac9dd61a1
Bring manual imports to new import modeling.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2024
diff
changeset
|
103 |
2024
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
104 Name string `json:"name"` |
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
105 From Isrs `json:"from"` |
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
106 To Isrs `json:"to"` |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
107 Tolerance float32 `json:"tolerance"` |
2024
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
108 ObjNam string `json:"objnam"` |
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
109 NObjNam *string `json:"nobjnam"` |
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
110 Source string `json:"source-organization"` |
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
111 Date Date `json:"date-info"` |
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
112 Countries UniqueCountries `json:"countries"` |
6d9fbc62c5a6
Moved stretch import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2023
diff
changeset
|
113 } |
3171
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
114 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
115 // SectionImport imports a section. |
3171
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
116 SectionImport struct { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
117 EmailType |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
118 |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
119 Name string `json:"name"` |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
120 From Isrs `json:"from"` |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
121 To Isrs `json:"to"` |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
122 Tolerance float32 `json:"tolerance"` |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
123 ObjNam string `json:"objnam"` |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
124 NObjNam *string `json:"nobjnam"` |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
125 Source string `json:"source-organization"` |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
126 Date Date `json:"date-info"` |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
127 } |
4189
2ac52d89619e
Exposed the import to delete sections under POST /api/imports/dsec with a JSON input as '{ "id": 42 }'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
diff
changeset
|
128 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
129 // SectionDelete deletes a section. |
4189
2ac52d89619e
Exposed the import to delete sections under POST /api/imports/dsec with a JSON input as '{ "id": 42 }'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
diff
changeset
|
130 SectionDelete struct { |
2ac52d89619e
Exposed the import to delete sections under POST /api/imports/dsec with a JSON input as '{ "id": 42 }'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
diff
changeset
|
131 ID int64 `json:"id"` |
2ac52d89619e
Exposed the import to delete sections under POST /api/imports/dsec with a JSON input as '{ "id": 42 }'.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
diff
changeset
|
132 } |
4392
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
133 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
134 // StretchDelete deletes a stretch. |
4392
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
135 StretchDelete struct { |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
136 ID int64 `json:"id"` |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
137 } |
4400
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
138 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
139 // SoundingResultDelete deletes a sounding result. |
4400
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
140 SoundingResultDelete struct { |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
141 BottleneckID string `json:"bottleneck-id"` |
4400
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
142 Date Date `json:"date-info"` |
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
143 } |
2020
491084efd15c
Moved waterway(area|axis|gauge) import to imports file.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2019
diff
changeset
|
144 ) |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
145 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
146 // MarshalAttributes stores a configuration. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
147 func (cui *ConfigurableURLImport) MarshalAttributes(attrs common.Attributes) error { |
2297
c8cc875d271c
Import config: Marshalling of so properties got lost somehow.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2100
diff
changeset
|
148 if err := cui.URLType.MarshalAttributes(attrs); err != nil { |
c8cc875d271c
Import config: Marshalling of so properties got lost somehow.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2100
diff
changeset
|
149 return err |
c8cc875d271c
Import config: Marshalling of so properties got lost somehow.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2100
diff
changeset
|
150 } |
c8cc875d271c
Import config: Marshalling of so properties got lost somehow.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2100
diff
changeset
|
151 return cui.QueueConfigurationType.MarshalAttributes(attrs) |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
152 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
153 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
154 // UnmarshalAttributes restores a configuration. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
155 func (cui *ConfigurableURLImport) UnmarshalAttributes(attrs common.Attributes) error { |
2297
c8cc875d271c
Import config: Marshalling of so properties got lost somehow.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2100
diff
changeset
|
156 if err := cui.URLType.UnmarshalAttributes(attrs); err != nil { |
c8cc875d271c
Import config: Marshalling of so properties got lost somehow.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2100
diff
changeset
|
157 return err |
c8cc875d271c
Import config: Marshalling of so properties got lost somehow.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2100
diff
changeset
|
158 } |
c8cc875d271c
Import config: Marshalling of so properties got lost somehow.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2100
diff
changeset
|
159 return cui.QueueConfigurationType.UnmarshalAttributes(attrs) |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
160 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
161 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
162 // MarshalAttributes stores a configuration. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
163 func (wi *WFSImport) MarshalAttributes(attrs common.Attributes) error { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
164 if err := wi.ConfigurableURLImport.MarshalAttributes(attrs); err != nil { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
165 return err |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
166 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
167 attrs.Set("feature-type", wi.FeatureType) |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
168 if wi.SortBy != nil { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
169 attrs.Set("sort-by", *wi.SortBy) |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
170 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
171 return nil |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
172 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
173 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
174 // UnmarshalAttributes restores a configuration. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
175 func (wi *WFSImport) UnmarshalAttributes(attrs common.Attributes) error { |
2305
9c4ef2345db4
Configured Imports: Fixed unmarshalling of WFS imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2297
diff
changeset
|
176 if err := wi.ConfigurableURLImport.UnmarshalAttributes(attrs); err != nil { |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
177 return err |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
178 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
179 ft, found := attrs.Get("feature-type") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
180 if !found { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
181 return errors.New("missing 'feature-type' attribute") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
182 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
183 wi.FeatureType = ft |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
184 if sb, found := attrs.Get("sort-by"); found { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
185 wi.SortBy = &sb |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
186 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
187 return nil |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
188 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
189 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
190 // MarshalAttributes stores a configuration. |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
191 func (bn *BottleneckImport) MarshalAttributes(attrs common.Attributes) error { |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
192 if err := bn.ConfigurableURLImport.MarshalAttributes(attrs); err != nil { |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
193 return err |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
194 } |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
195 attrs.SetFloat("tolerance", bn.Tolerance) |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
196 return nil |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
197 } |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
198 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
199 // UnmarshalAttributes restores a configuration. |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
200 func (bn *BottleneckImport) UnmarshalAttributes(attrs common.Attributes) error { |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
201 if err := bn.ConfigurableURLImport.UnmarshalAttributes(attrs); err != nil { |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
202 return err |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
203 } |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
204 tol, found := attrs.Float("tolerance") |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
205 if !found { |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
206 return errors.New("missing 'tolerance' attribute") |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
207 } |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
208 bn.Tolerance = tol |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
209 return nil |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
210 } |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2305
diff
changeset
|
211 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
212 // MarshalAttributes stores a configuration. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
213 func (fdi *FairwayDimensionImport) MarshalAttributes(attrs common.Attributes) error { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
214 if err := fdi.WFSImport.MarshalAttributes(attrs); err != nil { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
215 return err |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
216 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
217 attrs.SetInt("los", fdi.LOS) |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
218 attrs.SetInt("min-width", fdi.MinWidth) |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
219 attrs.SetInt("max-width", fdi.MaxWidth) |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
220 attrs.SetInt("depth", fdi.Depth) |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
221 attrs.Set("source-organization", fdi.SourceOrganization) |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
222 return nil |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
223 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
224 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
225 // UnmarshalAttributes restores a configuration. |
2036
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
226 func (fdi *FairwayDimensionImport) UnmarshalAttributes(attrs common.Attributes) error { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
227 if err := fdi.WFSImport.UnmarshalAttributes(attrs); err != nil { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
228 return err |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
229 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
230 los, found := attrs.Int("los") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
231 if !found { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
232 return errors.New("missing 'los' attribute") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
233 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
234 fdi.LOS = los |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
235 minWidth, found := attrs.Int("min-width") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
236 if !found { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
237 return errors.New("missing 'min-width' attribute") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
238 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
239 fdi.MinWidth = minWidth |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
240 maxWidth, found := attrs.Int("max-width") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
241 if !found { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
242 return errors.New("missing 'max-width' attribute") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
243 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
244 fdi.MaxWidth = maxWidth |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
245 depth, found := attrs.Int("depth") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
246 if !found { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
247 return errors.New("missing 'depth' attribute") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
248 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
249 fdi.Depth = depth |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
250 source, found := attrs.Get("source-organization") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
251 if !found { |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
252 return errors.New("missing 'source-organization' attribute") |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
253 } |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
254 fdi.SourceOrganization = source |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
255 return nil |
74e24ae3205a
Imports: Added a persistent model for the extra attributes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2029
diff
changeset
|
256 } |
2059
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
257 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
258 // MarshalAttributes stores an configuration. |
2059
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
259 func (sti *StretchImport) MarshalAttributes(attrs common.Attributes) error { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
260 if err := sti.EmailType.MarshalAttributes(attrs); err != nil { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
261 return err |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
262 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
263 attrs.Set("name", sti.Name) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
264 attrs.Set("from", sti.From.String()) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
265 attrs.Set("to", sti.To.String()) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
266 attrs.Set("objnam", sti.ObjNam) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
267 if sti.NObjNam != nil { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
268 attrs.Set("nobjnam", *sti.NObjNam) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
269 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
270 attrs.Set("source-organization", sti.Source) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
271 attrs.SetDate("date-info", sti.Date.Time) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
272 if len(sti.Countries) > 0 { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
273 countries := make([]string, len(sti.Countries)) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
274 for i, c := range sti.Countries { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
275 countries[i] = string(c) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
276 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
277 attrs.Set("countries", strings.Join(countries, ",")) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
278 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
279 |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
280 return nil |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
281 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
282 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
283 // UnmarshalAttributes restores a configuration. |
2059
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
284 func (sti *StretchImport) UnmarshalAttributes(attrs common.Attributes) error { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
285 if err := sti.EmailType.UnmarshalAttributes(attrs); err != nil { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
286 return err |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
287 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
288 name, found := attrs.Get("name") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
289 if !found { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
290 return errors.New("missing 'name' attribute") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
291 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
292 sti.Name = name |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
293 from, found := attrs.Get("from") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
294 if !found { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
295 return errors.New("missing 'from' attribute") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
296 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
297 f, err := IsrsFromString(from) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
298 if err != nil { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
299 return err |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
300 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
301 sti.From = *f |
2100
46343e3f7a3e
Imports: Fixed small issue with de-serializing stretches.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2059
diff
changeset
|
302 to, found := attrs.Get("to") |
2059
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
303 if !found { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
304 return errors.New("missing 'to' attribute") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
305 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
306 t, err := IsrsFromString(to) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
307 if err != nil { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
308 return err |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
309 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
310 sti.To = *t |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
311 objnam, found := attrs.Get("objnam") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
312 if !found { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
313 return errors.New("missing 'objnam' attribute") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
314 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
315 sti.ObjNam = objnam |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
316 nobjnam, found := attrs.Get("nobjnam") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
317 if found { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
318 sti.NObjNam = &nobjnam |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
319 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
320 source, found := attrs.Get("source-organization") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
321 if !found { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
322 return errors.New("missing 'source' attribute") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
323 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
324 sti.Source = source |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
325 date, found := attrs.Date("date-info") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
326 if !found { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
327 return errors.New("missing 'date-info' attribute") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
328 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
329 sti.Date = Date{date} |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
330 countries, found := attrs.Get("countries") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
331 if found { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
332 csp := strings.Split(countries, ",") |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
333 cs := make(UniqueCountries, len(csp)) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
334 for i, c := range csp { |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
335 cs[i] = Country(c) |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
336 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
337 sti.Countries = cs |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
338 } |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
339 return nil |
ae0021feaac8
Imports: Made stretch import marshable (even if it is not needed).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2036
diff
changeset
|
340 } |
3171
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
341 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
342 // MarshalAttributes stores a configuration. |
3171
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
343 func (seci *SectionImport) MarshalAttributes(attrs common.Attributes) error { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
344 if err := seci.EmailType.MarshalAttributes(attrs); err != nil { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
345 return err |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
346 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
347 attrs.Set("name", seci.Name) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
348 attrs.Set("from", seci.From.String()) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
349 attrs.Set("to", seci.To.String()) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
350 attrs.Set("objnam", seci.ObjNam) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
351 if seci.NObjNam != nil { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
352 attrs.Set("nobjnam", *seci.NObjNam) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
353 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
354 attrs.Set("source-organization", seci.Source) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
355 attrs.SetDate("date-info", seci.Date.Time) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
356 |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
357 return nil |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
358 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
359 |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4946
diff
changeset
|
360 // UnmarshalAttributes restores a configuration. |
3171
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
361 func (seci *SectionImport) UnmarshalAttributes(attrs common.Attributes) error { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
362 if err := seci.EmailType.UnmarshalAttributes(attrs); err != nil { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
363 return err |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
364 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
365 name, found := attrs.Get("name") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
366 if !found { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
367 return errors.New("missing 'name' attribute") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
368 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
369 seci.Name = name |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
370 from, found := attrs.Get("from") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
371 if !found { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
372 return errors.New("missing 'from' attribute") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
373 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
374 f, err := IsrsFromString(from) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
375 if err != nil { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
376 return err |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
377 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
378 seci.From = *f |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
379 to, found := attrs.Get("to") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
380 if !found { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
381 return errors.New("missing 'to' attribute") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
382 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
383 t, err := IsrsFromString(to) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
384 if err != nil { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
385 return err |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
386 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
387 seci.To = *t |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
388 objnam, found := attrs.Get("objnam") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
389 if !found { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
390 return errors.New("missing 'objnam' attribute") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
391 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
392 seci.ObjNam = objnam |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
393 nobjnam, found := attrs.Get("nobjnam") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
394 if found { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
395 seci.NObjNam = &nobjnam |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
396 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
397 source, found := attrs.Get("source-organization") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
398 if !found { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
399 return errors.New("missing 'source' attribute") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
400 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
401 seci.Source = source |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
402 date, found := attrs.Date("date-info") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
403 if !found { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
404 return errors.New("missing 'date-info' attribute") |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
405 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
406 seci.Date = Date{date} |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
407 return nil |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2633
diff
changeset
|
408 } |