Mercurial > gemma
annotate pkg/imports/modelconvert.go @ 5736:55892008ec96 default tip
Fixed a bunch of corner cases in WG import.
author | Sascha Wilde <wilde@sha-bang.de> |
---|---|
date | Wed, 29 May 2024 19:02:42 +0200 |
parents | 6270951dda28 |
children |
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 // |
5387
8e30b926b94d
Added an import to run update stats scripts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5326
diff
changeset
|
7 // Copyright (C) 2018, 2020, 2021 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 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
20 var kindToImportModel = map[JobKind]func() any{ |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
21 BNJobKind: func() any { return new(models.BottleneckImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
22 GMJobKind: func() any { return new(models.GaugeMeasurementImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
23 FAJobKind: func() any { return new(models.FairwayAvailabilityImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
24 WXJobKind: func() any { return FindJobCreator(WXJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
25 WAJobKind: func() any { return new(models.WaterwayAreaImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
26 WGJobKind: func() any { return new(models.WaterwayGaugeImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
27 DMVJobKind: func() any { return new(models.DistanceMarksVirtualImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
28 FDJobKind: func() any { return new(models.FairwayDimensionImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
29 DMAJobKind: func() any { return new(models.DistanceMarksAshoreImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
30 BCNLATHYDROJobKind: func() any { return FindJobCreator(BCNLATHYDROJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
31 BCNLATIENCJobKind: func() any { return FindJobCreator(BCNLATIENCJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
32 BOYCARJobKind: func() any { return FindJobCreator(BOYCARJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
33 BOYLATHYDROJobKind: func() any { return FindJobCreator(BOYLATHYDROJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
34 BOYLATIENCJobKind: func() any { return FindJobCreator(BOYLATIENCJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
35 BOYSAWJobKind: func() any { return FindJobCreator(BOYSAWJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
36 BOYSPPJobKind: func() any { return FindJobCreator(BOYSPPJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
37 DAYMARHYDROJobKind: func() any { return FindJobCreator(DAYMARHYDROJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
38 DAYMARIENCJobKind: func() any { return FindJobCreator(DAYMARIENCJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
39 LIGHTSJobKind: func() any { return FindJobCreator(LIGHTSJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
40 RTPBCNJobKind: func() any { return FindJobCreator(RTPBCNJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
41 TOPMARJobKind: func() any { return FindJobCreator(TOPMARJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
42 NOTMRKJobKind: func() any { return FindJobCreator(NOTMRKJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
43 STJobKind: func() any { return new(models.StretchImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
44 SECJobKind: func() any { return new(models.SectionImport) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
45 DSECJobKind: func() any { return new(models.SectionDelete) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
46 DSTJobKind: func() any { return new(models.StretchDelete) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
47 DSRJobKind: func() any { return new(models.SoundingResultDelete) }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
48 ReportJobKind: func() any { return FindJobCreator(ReportJobKind).Create() }, |
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
49 StatsUpdateJobKind: func() any { return FindJobCreator(StatsUpdateJobKind).Create() }, |
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
|
50 } |
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
|
51 |
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
|
52 // 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
|
53 // de-serialize an incoming JSON REST represention of an import. |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
54 func ImportModelForJobKind(kind JobKind) func() any { |
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
|
55 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
|
56 } |
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
|
57 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
58 var convertModel = map[JobKind]func(any) any{ |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
60 BNJobKind: func(input any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 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
|
62 return &Bottleneck{ |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2058
diff
changeset
|
63 URL: bi.URL, |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2058
diff
changeset
|
64 Tolerance: bi.Tolerance, |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2058
diff
changeset
|
65 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
|
66 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
69 GMJobKind: func(input any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 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
|
71 return &GaugeMeasurement{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 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
|
73 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
|
74 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
77 FAJobKind: func(input any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 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
|
79 return &FairwayAvailability{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 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
|
81 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
|
82 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
85 WAJobKind: func(input any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 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
|
87 return &WaterwayArea{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 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
|
89 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
|
90 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
|
91 User: nilString(wai.User), |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
92 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
|
93 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
96 WGJobKind: func(input any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 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
|
98 return &WaterwayGauge{ |
2056
0a401d81c6a6
Waterway gauge import: Fixed model converter (missed URL).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2042
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 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
|
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 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
106 DMVJobKind: func(input any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 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
|
108 return &DistanceMarksVirtual{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 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
|
110 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
|
111 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
|
112 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
|
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 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
116 FDJobKind: func(input any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 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
|
118 return &FairwayDimension{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 SourceOrganization: fdi.SourceOrganization, |
2723
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
127 User: nilString(fdi.User), |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
128 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
|
129 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
132 DMAJobKind: func(input any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 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
|
134 return &DistanceMarksAshore{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 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
|
136 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
|
137 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
|
138 User: nilString(dmai.User), |
a10022399e24
WFS downloads: Fetch user and password from config.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2563
diff
changeset
|
139 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
|
140 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 }, |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
143 STJobKind: func(input any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 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
|
145 return &Stretch{ |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 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
|
147 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
|
148 To: sti.To, |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2058
diff
changeset
|
149 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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 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
|
155 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 }, |
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
|
157 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
158 SECJobKind: func(input any) any { |
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
|
159 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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 } |
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 }, |
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
|
171 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
172 DSECJobKind: func(input any) any { |
4392
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
173 dsec := input.(*models.SectionDelete) |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
174 return &DeleteSection{ID: dsec.ID} |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
175 }, |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
176 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
177 DSTJobKind: func(input any) any { |
4392
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
178 dst := input.(*models.StretchDelete) |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4189
diff
changeset
|
179 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
|
180 }, |
4400
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
181 |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
182 DSRJobKind: func(input any) any { |
4400
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
183 dsr := input.(*models.SoundingResultDelete) |
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
184 return &DeleteSoundingResult{ |
5601
1222b777f51f
Made golint finally happy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5387
diff
changeset
|
185 BottleneckID: dsr.BottleneckID, |
4400
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
186 Date: dsr.Date, |
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
187 } |
3b36c4d810b0
Added back end for deletion of sounding results.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
188 }, |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
189 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
190 |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
191 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
|
192 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
|
193 return *s |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
195 return "" |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
196 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
197 |
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
|
198 // 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
|
199 // of an import into the internal one store in the import queue. |
5712
6270951dda28
/interface{}/any/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
5601
diff
changeset
|
200 func ConvertToInternal(kind JobKind, src any) any { |
2038
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
201 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
|
202 if fn == nil { |
4946
b0dbc0f2c748
Simplified importing of fairway marks.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
4940
diff
changeset
|
203 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
|
204 } |
42a33f9e1f95
Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 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
|
206 } |