changeset 1856:5996b50d154a

Fairway dimension import: Added missing scheduled configuration.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 17 Jan 2019 11:58:46 +0100
parents bbd653a43a6a
children 9141abe7c75a
files pkg/imports/scheduled.go
diffstat 1 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/scheduled.go	Thu Jan 17 11:45:33 2019 +0100
+++ b/pkg/imports/scheduled.go	Thu Jan 17 11:58:46 2019 +0100
@@ -88,6 +88,49 @@
 		}, nil
 	},
 
+	FDJobKind: func(cfg *IDConfig) (interface{}, error) {
+		log.Println("info: schedule 'fd' import")
+		ft, found := cfg.Attributes.Get("feature-type")
+		if !found {
+			return nil, errors.New("cannot find 'feature-type' attribute")
+		}
+		sb, found := cfg.Attributes.Get("sort-by")
+		if !found {
+			return nil, errors.New("cannot find 'sort-by' attribute")
+		}
+		los, found := cfg.Attributes.Int("los")
+		if !found {
+			return nil, errors.New("cannot find 'los' attribute")
+		}
+		minWidth, found := cfg.Attributes.Int("min-width")
+		if !found {
+			return nil, errors.New("cannot find 'min-width' attribute")
+		}
+		maxWidth, found := cfg.Attributes.Int("max-width")
+		if !found {
+			return nil, errors.New("cannot find 'max-width' attribute")
+		}
+		depth, found := cfg.Attributes.Int("depth")
+		if !found {
+			return nil, errors.New("cannot find 'depth' attribute")
+		}
+		sourceOrganization, found := cfg.Attributes.Get("source-organization")
+		if !found {
+			return nil, errors.New("cannot find 'source-organization' attribute")
+		}
+
+		return &FairwayDimension{
+			URL:                *cfg.URL,
+			FeatureType:        ft,
+			SortBy:             sb,
+			LOS:                los,
+			MinWidth:           minWidth,
+			MaxWidth:           maxWidth,
+			Depth:              depth,
+			SourceOrganization: sourceOrganization,
+		}, nil
+	},
+
 	WGJobKind: func(cfg *IDConfig) (interface{}, error) {
 		log.Println("info: schedule 'wg' import")
 		username, _ := cfg.Attributes.Get("username")