annotate pkg/imports/modelconvert.go @ 2042:d29ac997eb34 unify_imports

This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 25 Jan 2019 16:07:09 +0100
parents f1e32babb587
children 0a401d81c6a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 //
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 // Copyright (C) 2018 by via donau
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 (
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
17 "fmt"
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
18
2038
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 "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
20 )
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21
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
22 var kindToImportModel = map[JobKind]func() interface{}{
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
23 BNJobKind: func() interface{} { return new(models.BottleneckImport) },
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
24 GMJobKind: func() interface{} { return new(models.GaugeMeasurementImport) },
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
25 FAJobKind: func() interface{} { return new(models.FairwayAvailabilityImport) },
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
26 WXJobKind: func() interface{} { return new(models.WaterwayAxisImport) },
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
27 WAJobKind: func() interface{} { return new(models.WaterwayAreaImport) },
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
28 WGJobKind: func() interface{} { return new(models.WaterwayGaugeImport) },
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
29 DMVJobKind: func() interface{} { return new(models.DistanceMarksVirtualImport) },
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
30 FDJobKind: func() interface{} { return new(models.FairwayDimensionImport) },
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
31 DMAJobKind: func() interface{} { return new(models.DistanceMarksAshoreImport) },
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
32 STJobKind: func() interface{} { return new(models.StretchImport) },
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
33 }
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
34
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
35 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
36 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
37 }
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
38
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
39 func MustImportModel(kind JobKind) func() interface{} {
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
40 if ctor := kindToImportModel[kind]; ctor != nil {
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
41 return ctor
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
42 }
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
43 panic(fmt.Sprintf("Cannot find import model for kind '%s'.", kind))
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
44 }
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
45
2038
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 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
47
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 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
49 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
50 return &Bottleneck{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 URL: bi.URL,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 Insecure: bi.Insecure,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 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
57 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
58 return &GaugeMeasurement{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 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
60 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
61 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 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
65 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
66 return &FairwayAvailability{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 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
68 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
69 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 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
73 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
74 return &WaterwayAxis{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 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
76 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
77 SortBy: nilString(wxi.SortBy),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 },
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 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
82 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
83 return &WaterwayArea{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 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
85 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
86 SortBy: nilString(wai.SortBy),
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 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
91 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
92 return &WaterwayGauge{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 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
94 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
95 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
96 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 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
100 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
101 return &DistanceMarksVirtual{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 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
103 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
104 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
105 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
106 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 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
110 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
111 return &FairwayDimension{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112 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
113 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
114 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
115 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
116 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
117 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
118 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
119 SourceOrganization: fdi.SourceOrganization,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
121 },
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 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
124 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
125 return &DistanceMarksAshore{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126 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
127 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
128 SortBy: nilString(dmai.SortBy),
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
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 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
133 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
134 return &Stretch{
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135 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
136 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
137 To: sti.To,
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
138 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
139 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
140 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
141 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
142 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
143 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144 },
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
145 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
146
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
147 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
148 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
149 return *s
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 return ""
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
152 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
153
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
154 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
155 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
156 if fn == nil {
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
157 return nil
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
158 }
42a33f9e1f95 Imports: Moved model conversion into a table in the imports package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
159 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
160 }