Mercurial > gemma
annotate pkg/imports/modelconvert.go @ 4974:e1d8217954a0 fairway-marks-import
Ignore fields not used as arguments to prepared statements
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 28 Feb 2020 20:22:25 +0100 |
parents | 3f704ebad0c5 |
children | cf25b23e3eec |
rev | line source |
---|---|
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 // This is Free Software under GNU Affero General Public License v >= 3.0 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 // without warranty, see README.md and license for details. |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 // |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 // SPDX-License-Identifier: AGPL-3.0-or-later |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 // License-Filename: LICENSES/AGPL-3.0.txt |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
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:
4852
diff
changeset
|
7 // Copyright (C) 2018, 2020 by via donau |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 // – Österreichische Wasserstraßen-Gesellschaft mbH |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 // Software engineering by Intevation GmbH |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 // |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 // Author(s): |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de> |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 package imports |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import ( |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 "gemma.intevation.de/gemma/pkg/models" |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 ) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 |
2040
f1e32babb587
Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2038
diff
changeset
|
20 var kindToImportModel = map[JobKind]func() interface{}{ |
4962
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
21 BNJobKind: func() interface{} { return new(models.BottleneckImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
22 GMJobKind: func() interface{} { return new(models.GaugeMeasurementImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
23 FAJobKind: func() interface{} { return new(models.FairwayAvailabilityImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
24 WXJobKind: func() interface{} { return new(models.WaterwayAxisImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
25 WAJobKind: func() interface{} { return new(models.WaterwayAreaImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
26 WGJobKind: func() interface{} { return new(models.WaterwayGaugeImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
27 DMVJobKind: func() interface{} { return new(models.DistanceMarksVirtualImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
28 FDJobKind: func() interface{} { return new(models.FairwayDimensionImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
29 DMAJobKind: func() interface{} { return new(models.DistanceMarksAshoreImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
30 BCNLATHYDROJobKind: func() interface{} { return FindJobCreator(BCNLATHYDROJobKind).Create() }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
31 BCNLATIENCJobKind: func() interface{} { return FindJobCreator(BCNLATIENCJobKind).Create() }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
32 BOYCARJobKind: func() interface{} { return FindJobCreator(BOYCARJobKind).Create() }, |
4964
58dc06e91c39
Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents:
4962
diff
changeset
|
33 BOYLATHYDROJobKind: func() interface{} { return FindJobCreator(BOYLATHYDROJobKind).Create() }, |
58dc06e91c39
Follow-up of rev. 1b309a8e7673 for BOYLAT
Tom Gottfried <tom@intevation.de>
parents:
4962
diff
changeset
|
34 BOYLATIENCJobKind: func() interface{} { return FindJobCreator(BOYLATIENCJobKind).Create() }, |
4962
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
35 BOYSAWJobKind: func() interface{} { return FindJobCreator(BOYSAWJobKind).Create() }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
36 BOYSPPJobKind: func() interface{} { return FindJobCreator(BOYSPPJobKind).Create() }, |
4967
3f704ebad0c5
Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents:
4964
diff
changeset
|
37 DAYMARHYDROJobKind: func() interface{} { return FindJobCreator(DAYMARHYDROJobKind).Create() }, |
3f704ebad0c5
Follow-up of rev. 1b309a8e7673 for DAYMAR
Tom Gottfried <tom@intevation.de>
parents:
4964
diff
changeset
|
38 DAYMARIENCJobKind: func() interface{} { return FindJobCreator(DAYMARIENCJobKind).Create() }, |
4962
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
39 LIGHTSJobKind: func() interface{} { return FindJobCreator(LIGHTSJobKind).Create() }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
40 RTPBCNJobKind: func() interface{} { return FindJobCreator(RTPBCNJobKind).Create() }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
41 TOPMARJobKind: func() interface{} { return FindJobCreator(TOPMARJobKind).Create() }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
42 NOTMRKJobKind: func() interface{} { return FindJobCreator(NOTMRKJobKind).Create() }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
43 STJobKind: func() interface{} { return new(models.StretchImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
44 SECJobKind: func() interface{} { return new(models.SectionImport) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
45 DSECJobKind: func() interface{} { return new(models.SectionDelete) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
46 DSTJobKind: func() interface{} { return new(models.StretchDelete) }, |
1b309a8e7673
Distinguish more clearly between BCNLAT HYDRO and IENC features
Tom Gottfried <tom@intevation.de>
parents:
4946
diff
changeset
|
47 DSRJobKind: func() interface{} { return new(models.SoundingResultDelete) }, |
2040
f1e32babb587
Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2038
diff
changeset
|
48 } |
f1e32babb587
Imports: Moved constructor functions for import models to a table in the import package to be re-used by the configure/scheduled import.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2038
diff
changeset
|
49 |
4178
51e90370eced
A few more doc strings to make 'golint' a little bit more happy with the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
diff
changeset
|
50 // ImportModelForJobKind returns the constructor function to |
51e90370eced
A few more doc strings to make 'golint' a little bit more happy with the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
diff
changeset
|
51 // de-serialize an incoming JSON REST represention of an import. |
2042
d29ac997eb34
This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2040
diff
changeset
|
52 func ImportModelForJobKind(kind JobKind) func() interface{} { |
d29ac997eb34
This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2040
diff
changeset
|
53 return kindToImportModel[kind] |
d29ac997eb34
This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2040
diff
changeset
|
54 } |
d29ac997eb34
This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2040
diff
changeset
|
55 |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 var convertModel = map[JobKind]func(interface{}) interface{}{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 BNJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 bi := input.(*models.BottleneckImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 return &Bottleneck{ |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2058
diff
changeset
|
61 URL: bi.URL, |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2058
diff
changeset
|
62 Tolerance: bi.Tolerance, |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2058
diff
changeset
|
63 Insecure: bi.Insecure, |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 GMJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 gi := input.(*models.GaugeMeasurementImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 return &GaugeMeasurement{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 URL: gi.URL, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 Insecure: gi.Insecure, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 FAJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 fai := input.(*models.FairwayAvailabilityImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 return &FairwayAvailability{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 URL: fai.URL, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 Insecure: fai.Insecure, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 WXJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 wxi := input.(*models.WaterwayAxisImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 return &WaterwayAxis{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 URL: wxi.URL, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 FeatureType: wxi.FeatureType, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 SortBy: nilString(wxi.SortBy), |
2723
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
89 User: nilString(wxi.User), |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
90 Password: nilString(wxi.Password), |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 WAJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 wai := input.(*models.WaterwayAreaImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 return &WaterwayArea{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 URL: wai.URL, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 FeatureType: wai.FeatureType, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 SortBy: nilString(wai.SortBy), |
2723
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
100 User: nilString(wai.User), |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
101 Password: nilString(wai.Password), |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 WGJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 wgi := input.(*models.WaterwayGaugeImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 return &WaterwayGauge{ |
2056
0a401d81c6a6
Waterway gauge import: Fixed model converter (missed URL).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2042
diff
changeset
|
108 URL: wgi.URL, |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 Username: nilString(wgi.User), |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 Password: nilString(wgi.Password), |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 Insecure: wgi.Insecure, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 DMVJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 dmvi := input.(*models.DistanceMarksVirtualImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 return &DistanceMarksVirtual{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 URL: dmvi.URL, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 Username: nilString(dmvi.User), |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 Password: nilString(dmvi.Password), |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 Insecure: dmvi.Insecure, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 FDJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 fdi := input.(*models.FairwayDimensionImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 return &FairwayDimension{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 URL: fdi.URL, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 FeatureType: fdi.FeatureType, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 SortBy: nilString(fdi.SortBy), |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 LOS: fdi.LOS, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 MinWidth: fdi.MinWidth, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 MaxWidth: fdi.MaxWidth, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 Depth: fdi.Depth, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 SourceOrganization: fdi.SourceOrganization, |
2723
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
136 User: nilString(fdi.User), |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
137 Password: nilString(fdi.Password), |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 DMAJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 dmai := input.(*models.DistanceMarksAshoreImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
143 return &DistanceMarksAshore{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 URL: dmai.URL, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 FeatureType: dmai.FeatureType, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 SortBy: nilString(dmai.SortBy), |
2723
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
147 User: nilString(dmai.User), |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
148 Password: nilString(dmai.Password), |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 STJobKind: func(input interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 sti := input.(*models.StretchImport) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 return &Stretch{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 Name: sti.Name, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 From: sti.From, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 To: sti.To, |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2058
diff
changeset
|
158 Tolerance: sti.Tolerance, |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 ObjNam: sti.ObjNam, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 NObjNam: sti.NObjNam, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 Source: sti.Source, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 Date: sti.Date, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 Countries: sti.Countries, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 }, |
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:
2723
diff
changeset
|
166 |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2723
diff
changeset
|
167 SECJobKind: func(input interface{}) interface{} { |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2723
diff
changeset
|
168 seci := input.(*models.SectionImport) |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2723
diff
changeset
|
169 return &Section{ |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2723
diff
changeset
|
170 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:
2723
diff
changeset
|
171 From: seci.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:
2723
diff
changeset
|
172 To: seci.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:
2723
diff
changeset
|
173 Tolerance: seci.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:
2723
diff
changeset
|
174 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:
2723
diff
changeset
|
175 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:
2723
diff
changeset
|
176 Source: 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:
2723
diff
changeset
|
177 Date: seci.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:
2723
diff
changeset
|
178 } |
c8ded555c2a8
Sections import: Added a sections import. Derived from the stretches import w/o the countries.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2723
diff
changeset
|
179 }, |
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:
4178
diff
changeset
|
180 |
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:
4178
diff
changeset
|
181 DSECJobKind: func(input interface{}) interface{} { |
4392
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
182 dsec := input.(*models.SectionDelete) |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
183 return &DeleteSection{ID: dsec.ID} |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
184 }, |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
185 |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
186 DSTJobKind: func(input interface{}) interface{} { |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
187 dst := input.(*models.StretchDelete) |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
188 return &DeleteStretch{ID: dst.ID} |
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:
4178
diff
changeset
|
189 }, |
4400
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
190 |
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
191 DSRJobKind: func(input interface{}) interface{} { |
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
192 dsr := input.(*models.SoundingResultDelete) |
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
193 return &DeleteSoundingResult{ |
4852
046a07a33b19
Fixed the golint issues of the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4400
diff
changeset
|
194 BottleneckID: dsr.BottleneckId, |
4400
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
195 Date: dsr.Date, |
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
196 } |
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
197 }, |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
198 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
199 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
200 func nilString(s *string) string { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
201 if s != nil { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
202 return *s |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
203 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
204 return "" |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
206 |
4178
51e90370eced
A few more doc strings to make 'golint' a little bit more happy with the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
diff
changeset
|
207 // ConvertToInternal converts an external JSON REST represention |
51e90370eced
A few more doc strings to make 'golint' a little bit more happy with the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
diff
changeset
|
208 // of an import into the internal one store in the import queue. |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
209 func ConvertToInternal(kind JobKind, src interface{}) interface{} { |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 fn := convertModel[kind] |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
211 if fn == nil { |
4946
b0dbc0f2c748
Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4940
diff
changeset
|
212 return src |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
213 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
214 return fn(src) |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
215 } |