Mercurial > gemma
changeset 5622:deb8dc106a4b
Merged erdms2 branch.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Thu, 22 Dec 2022 18:31:34 +0100 |
parents | 5049f7ad9faa (current diff) cf1e8ffe1ed5 (diff) |
children | ff0af91a7f62 |
files | |
diffstat | 10 files changed, 2582 insertions(+), 2708 deletions(-) [+] |
line wrap: on
line diff
--- a/example_conf.toml Wed Aug 10 12:01:22 2022 +0200 +++ b/example_conf.toml Thu Dec 22 18:31:34 2022 +0100 @@ -14,6 +14,7 @@ # File to persist session data: sessions = "/tmp/gemma_session.data" +# tmp-dir = "/tmp/" # Duration until sessions expire if not renewed #session-timeout = "3h" @@ -94,3 +95,15 @@ # log-file = "" # Level of logging. Possible values: trace, debug, info, warn, error, fatal. # log-level = "info" + +# ----------------------- +# Report Templates: +#report-path = "/path/to/gemma/report-templates/" + +# ----------------------- +# Tweeking +#soap-timeout = "5m" + +# ---------------------------------------------------------------------- +# URI of access token service used for ERDMS2 imports +#token-url="https://api.tech.ec.europa.eu/token"
--- a/pkg/config/config.go Wed Aug 10 12:01:22 2022 +0200 +++ b/pkg/config/config.go Thu Dec 22 18:31:34 2022 +0100 @@ -132,6 +132,9 @@ // LogLevel is the log level of the application. func LogLevel() log.Level { return log.ParseLogLevel(viper.GetString("log-level")) } +// TokenURL is the ERDMS token service URL. +func TokenURL() string { return viper.GetString("token-url") } + var ( proxyKeyOnce sync.Once proxyKey []byte @@ -307,6 +310,7 @@ str("log-file", "", "path to a file to log to.") str("log-level", log.InfoLogLevel.String(), "path to a file to log to.") + str("token-url", "", "URL to the ERDMS token server.") } var (
--- a/pkg/imports/dmv.go Wed Aug 10 12:01:22 2022 +0200 +++ b/pkg/imports/dmv.go Thu Dec 22 18:31:34 2022 +0100 @@ -148,6 +148,12 @@ continue } + if len(*dr.Relenc) > 12 { + feedback.Warn("relenc too long: %s", *dr.Relenc) + ignored++ + continue + } + if dr.Wwname.Loc == nil { feedback.Warn("missing wwname: %s", code) ignored++
--- a/pkg/imports/erdms.go Wed Aug 10 12:01:22 2022 +0200 +++ b/pkg/imports/erdms.go Thu Dec 22 18:31:34 2022 +0100 @@ -20,9 +20,10 @@ "fmt" "strings" + "gemma.intevation.de/gemma/pkg/config" "gemma.intevation.de/gemma/pkg/log" "gemma.intevation.de/gemma/pkg/soap" - "gemma.intevation.de/gemma/pkg/soap/erdms" + erdms "gemma.intevation.de/gemma/pkg/soap/erdms2" ) const ( @@ -72,25 +73,32 @@ return nil, nil, err } - var auth *soap.BasicAuth - if username != "" { - auth = &soap.BasicAuth{ - Login: username, - Password: password, + var auth soap.Auth + + if tokenURL := config.TokenURL(); tokenURL != "" && username != "" { + token, err := soap.FetchToken(tokenURL, username, password) + if err != nil { + return nil, nil, fmt.Errorf( + "error requesting token for ERDMS service: %w", err) } + auth = token } client := erdms.NewRefService(URL, insecure, auth) var responseData []*erdms.GetRisDataXMLResponse + + fcode := erdms.NoNS{Text: funcode} for _, country := range countries { feedback.Info("Request RIS index for country %s", country) + subcode := erdms.NoNS{Text: country + "%"} + request := &erdms.GetRisDataXML{ GetRisDataXMLType: &erdms.GetRisDataXMLType{ - Subcode: erdms.NoNS{Text: country + "%"}, - Funcode: erdms.NoNS{Text: funcode}, + Subcode: &subcode, + Funcode: &fcode, }, }
--- a/pkg/imports/wg.go Wed Aug 10 12:01:22 2022 +0200 +++ b/pkg/imports/wg.go Thu Dec 22 18:31:34 2022 +0100 @@ -17,13 +17,15 @@ import ( "context" "database/sql" + "errors" + "strings" "time" "github.com/jackc/pgx/pgtype" "gemma.intevation.de/gemma/pkg/models" "gemma.intevation.de/gemma/pkg/pgxutils" - "gemma.intevation.de/gemma/pkg/soap/erdms" + erdms "gemma.intevation.de/gemma/pkg/soap/erdms2" ) // WaterwayGauge is a Job to load gauge data from @@ -177,6 +179,8 @@ ` ) +var continueErr = errors.New("continue") + // Do implements the actual import. func (wg *WaterwayGauge) Do( ctx context.Context, @@ -226,22 +230,41 @@ var gauges []string var unchanged int + var invalidISRS, startEndOrder, missingObjname, missingZeropoint []string + + databaseErrors := map[string][]string{} + for _, data := range responseData { for _, dr := range data.RisdataReturn { isrs := string(*dr.RisidxCode) code, err := models.IsrsFromString(isrs) if err != nil { - feedback.Warn("Invalid ISRS code '%s': %v", isrs, err) + invalidISRS = append(invalidISRS, isrs) continue } gauges = append(gauges, isrs) - feedback.Info("Processing %s", code) // We need a valid, non-empty time range to identify gauge versions - if dr.Enddate != nil && dr.Startdate != nil && - !time.Time(*dr.Enddate).After(time.Time(*dr.Startdate)) { - feedback.Error("End date not after start date") + if dr.Enddate != nil && dr.Startdate != nil { + ed := dr.Enddate.ToGoTime() + sd := dr.Startdate.ToGoTime() + // log.Debugf("start date: %v end date: %v\n", sd, ed) + if !ed.After(sd) { + startEndOrder = append(startEndOrder, isrs) + unchanged++ + continue + } + } + + if dr.Zeropoint == nil { + missingZeropoint = append(missingZeropoint, isrs) + unchanged++ + continue + } + + if dr.Objname.Loc == nil { + missingObjname = append(missingObjname, isrs) unchanged++ continue } @@ -265,7 +288,7 @@ if dr.Startdate != nil { tfrom = pgtype.Timestamptz{ - Time: time.Time(*dr.Startdate), + Time: dr.Startdate.ToGoTime(), Status: pgtype.Present, } } else { @@ -276,7 +299,7 @@ if dr.Enddate != nil { tto = pgtype.Timestamptz{ - Time: time.Time(*dr.Enddate), + Time: dr.Enddate.ToGoTime(), Status: pgtype.Present, } } else { @@ -295,7 +318,7 @@ if dr.Infodate != nil { dateInfo = pgtype.Timestamptz{ - Time: time.Time(*dr.Infodate), + Time: dr.Infodate.ToGoTime(), Status: pgtype.Present, } } else { @@ -320,189 +343,213 @@ } } - tx, err := conn.BeginTx(ctx, nil) - if err != nil { - return nil, err - } - defer tx.Rollback() - - // Mark old entry of gauge as erased, if applicable - var isNew bool - err = tx.StmtContext(ctx, eraseGaugeStmt).QueryRowContext(ctx, - code.String(), - validity, - ).Scan(&isNew) - switch { - case err != nil: - feedback.Error(pgxutils.ReadableError{Err: err}.Error()) - if err2 := tx.Rollback(); err2 != nil { - return nil, err2 + err = func() error { + tx, err := conn.BeginTx(ctx, nil) + if err != nil { + return err } - unchanged++ - continue - case isNew: - // insert gauge version entry - if _, err = tx.StmtContext(ctx, insertStmt).ExecContext(ctx, - code.CountryCode, - code.LoCode, - code.FairwaySection, - code.Orc, - code.Hectometre, - dr.Objname.Loc, - dr.Lon, dr.Lat, - from, - to, - &validity, - dr.Zeropoint, - geodref, - &dateInfo, - source, - time.Time(*dr.Lastupdate), - ); err != nil { + defer tx.Rollback() + + // Mark old entry of gauge as erased, if applicable + var isNew bool + err = tx.StmtContext(ctx, eraseGaugeStmt).QueryRowContext(ctx, + code.String(), + validity, + ).Scan(&isNew) + switch { + case err != nil: feedback.Error(pgxutils.ReadableError{Err: err}.Error()) - if err2 := tx.Rollback(); err2 != nil { - return nil, err2 + unchanged++ + return continueErr + case isNew: + var lu *time.Time + if dr.Lastupdate != nil { + t := dr.Lastupdate.ToGoTime() + lu = &t + } + // insert gauge version entry + if _, err = tx.StmtContext(ctx, insertStmt).ExecContext(ctx, + code.CountryCode, + code.LoCode, + code.FairwaySection, + code.Orc, + code.Hectometre, + dr.Objname.Loc, + dr.Lon, dr.Lat, + from, + to, + &validity, + dr.Zeropoint, + geodref, + &dateInfo, + source, + lu, + ); err != nil { + key := pgxutils.ReadableError{Err: err}.Error() + databaseErrors[key] = append(databaseErrors[key], isrs) + return continueErr + } + //feedback.Info("insert new version") + case !isNew: + var lu *time.Time + if dr.Lastupdate != nil { + t := dr.Lastupdate.ToGoTime() + lu = &t } - unchanged++ - continue - } - feedback.Info("insert new version") - case !isNew: - // try to update - var dummy int - err2 := tx.StmtContext(ctx, updateStmt).QueryRowContext(ctx, - code.CountryCode, - code.LoCode, - code.FairwaySection, - code.Orc, - code.Hectometre, - dr.Objname.Loc, - dr.Lon, dr.Lat, - from, - to, - dr.Zeropoint, - geodref, - &dateInfo, - source, - time.Time(*dr.Lastupdate), - &validity, - ).Scan(&dummy) - switch { - case err2 == sql.ErrNoRows: - feedback.Info("unchanged") - if err3 := tx.Rollback(); err3 != nil { - return nil, err3 + // try to update + var dummy int + err2 := tx.StmtContext(ctx, updateStmt).QueryRowContext(ctx, + code.CountryCode, + code.LoCode, + code.FairwaySection, + code.Orc, + code.Hectometre, + dr.Objname.Loc, + dr.Lon, dr.Lat, + from, + to, + dr.Zeropoint, + geodref, + &dateInfo, + source, + lu, + &validity, + ).Scan(&dummy) + switch { + case err2 == sql.ErrNoRows: + //feedback.Info("unchanged") + unchanged++ + return continueErr + case err2 != nil: + key := pgxutils.ReadableError{Err: err}.Error() + databaseErrors[key] = append(databaseErrors[key], isrs) + unchanged++ + return continueErr + default: + //feedback.Info("update") } - unchanged++ - continue - case err2 != nil: - feedback.Error(pgxutils.ReadableError{Err: err2}.Error()) - if err3 := tx.Rollback(); err3 != nil { - return nil, err3 + + // Remove obsolete reference water levels + var currLevels pgtype.VarcharArray + currLevels.Set([]string{ + string(*dr.Reflevel1code), + string(*dr.Reflevel2code), + string(*dr.Reflevel3code), + }) + rwls, err := tx.StmtContext(ctx, + deleteReferenceWaterLevelsStmt).QueryContext(ctx, + code.String(), + &validity, + &currLevels, + ) + if err != nil { + return err } - unchanged++ - continue - default: - feedback.Info("update") + defer rwls.Close() + for rwls.Next() { + var delRef string + if err := rwls.Scan(&delRef); err != nil { + return err + } + feedback.Warn("Removed reference water level %s from %s", + delRef, code) + } + if err := rwls.Err(); err != nil { + return err + } } - // Remove obsolete reference water levels - var currLevels pgtype.VarcharArray - currLevels.Set([]string{ - string(*dr.Reflevel1code), - string(*dr.Reflevel2code), - string(*dr.Reflevel3code), - }) - rwls, err := tx.StmtContext(ctx, - deleteReferenceWaterLevelsStmt).QueryContext(ctx, + // Set end of validity of old version to start of new version + // in case of overlap + if _, err = tx.StmtContext(ctx, fixValidityStmt).ExecContext( + ctx, code.String(), &validity, - &currLevels, - ) - if err != nil { - return nil, err - } - defer rwls.Close() - for rwls.Next() { - var delRef string - if err := rwls.Scan(&delRef); err != nil { - return nil, err - } - feedback.Warn("Removed reference water level %s from %s", - delRef, code) - } - if err := rwls.Err(); err != nil { - return nil, err - } - } - - // Set end of validity of old version to start of new version - // in case of overlap - if _, err = tx.StmtContext(ctx, fixValidityStmt).ExecContext( - ctx, - code.String(), - &validity, - ); err != nil { - feedback.Error(pgxutils.ReadableError{Err: err}.Error()) - if err2 := tx.Rollback(); err2 != nil { - return nil, err2 - } - unchanged++ - continue - } - - // "Upsert" reference water levels - for _, wl := range []struct { - level **erdms.RisreflevelcodeType - value **erdms.RisreflevelvalueType - }{ - {&dr.Reflevel1code, &dr.Reflevel1value}, - {&dr.Reflevel2code, &dr.Reflevel2value}, - {&dr.Reflevel3code, &dr.Reflevel3value}, - } { - if *wl.level == nil || *wl.value == nil { - continue + ); err != nil { + key := pgxutils.ReadableError{Err: err}.Error() + databaseErrors[key] = append(databaseErrors[key], isrs) + unchanged++ + return continueErr } - var isNtSDepthRef bool - if err := tx.StmtContext( - ctx, isNtSDepthRefStmt).QueryRowContext(ctx, - string(**wl.level), - ).Scan( - &isNtSDepthRef, - ); err != nil { - return nil, err - } - if !isNtSDepthRef { - feedback.Warn( - "Reference level code '%s' is not in line "+ - "with the NtS reference_code table", - string(**wl.level)) + // "Upsert" reference water levels + for _, wl := range []struct { + level **erdms.RisreflevelcodeType + value **erdms.RisreflevelvalueType + }{ + {&dr.Reflevel1code, &dr.Reflevel1value}, + {&dr.Reflevel2code, &dr.Reflevel2value}, + {&dr.Reflevel3code, &dr.Reflevel3value}, + } { + if *wl.level == nil || *wl.value == nil { + continue + } + + var isNtSDepthRef bool + if err := tx.StmtContext( + ctx, isNtSDepthRefStmt).QueryRowContext(ctx, + string(**wl.level), + ).Scan( + &isNtSDepthRef, + ); err != nil { + return err + } + if !isNtSDepthRef { + feedback.Warn( + "Reference level code '%s' is not in line "+ + "with the NtS reference_code table", + string(**wl.level)) + } + + if _, err := tx.StmtContext( + ctx, insertWaterLevelStmt).ExecContext(ctx, + code.CountryCode, + code.LoCode, + code.FairwaySection, + code.Orc, + code.Hectometre, + &validity, + string(**wl.level), + int64(**wl.value), + ); err != nil { + key := pgxutils.ReadableError{Err: err}.Error() + databaseErrors[key] = append(databaseErrors[key], isrs) + continue + } } - if _, err := tx.StmtContext( - ctx, insertWaterLevelStmt).ExecContext(ctx, - code.CountryCode, - code.LoCode, - code.FairwaySection, - code.Orc, - code.Hectometre, - &validity, - string(**wl.level), - int64(**wl.value), - ); err != nil { - feedback.Error(pgxutils.ReadableError{Err: err}.Error()) - tx.Rollback() - continue - } - } + return tx.Commit() + }() - if err = tx.Commit(); err != nil { - return nil, err + if err != nil && err != continueErr { + return err, nil } } } + if len(invalidISRS) > 0 { + feedback.Error("Invalid ISRS code: '%s'", strings.Join(invalidISRS, "', '")) + } + + if len(startEndOrder) > 0 { + feedback.Error("start date not before end date: %s", + strings.Join(startEndOrder, ", ")) + } + + if len(databaseErrors) > 0 { + for err, iris := range databaseErrors { + feedback.Error("%s: %s", err, strings.Join(iris, ", ")) + } + } + + if len(missingZeropoint) > 0 { + feedback.Error("Missing zeropoint: %s", strings.Join(missingZeropoint, ", ")) + } + + if len(missingObjname) > 0 { + feedback.Error("Missing objname: %s", strings.Join(missingObjname, ", ")) + } + if len(gauges) == 0 { return nil, UnchangedError("No gauges returned from ERDMS") }
--- a/pkg/soap/erdms/service.go Wed Aug 10 12:01:22 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2521 +0,0 @@ -// This is Free Software under GNU Affero General Public License v >= 3.0 -// without warranty, see README.md and license for details. -// -// SPDX-License-Identifier: AGPL-3.0-or-later -// License-Filename: LICENSES/AGPL-3.0.txt -// -// Copyright (C) 2018 by via donau -// – Österreichische Wasserstraßen-Gesellschaft mbH -// Software engineering by Intevation GmbH -// -// Author(s): -// * Sascha L. Teichmann <sascha.teichmann@intevation.de> - -package erdms - -import ( - "encoding/xml" - "time" - - "gemma.intevation.de/gemma/pkg/soap" -) - -// adn (dgs goods) internal adn code (unnr + seqnr: to make each adn good unique) -type AdnCodeType string - -// adn class and classifications codes -type AdnClassType string - -// adn (dgs) labels applicable for a dgs good -type AdnLabelType string - -// Older CBS (number) code (3 digits) use by statistics organisations (backw comp) but replaced by newer iso 3166 (2 letters). -type CbscountryCodeType string - -// iso 6346 container type (code) -type ContIdType string - -// containertype textual description -type ContNameType string - -// indication (flag) wheater shiptype code is a single ship or a transport combination -type CombinationFlagType bool - -// Country iso 3166 code (2 alpha) -type CountryCodeType string - -// Country iso 3166 code (3 alpha) -type CountryCode3Type string - -// Countryname type (name of the country) -type CountryNameType string - -// Country iso 3166 numcode (3 digits) -type CountryIsoNumType string - -// techn directive craft type code (eu hull db) -type CraftTypeType string - -// inland cones 0,1,2,3,V (as used for DGS goods and cones calculations) -type ConesType string - -const ( - ConesType0 ConesType = "0" - - ConesType1 ConesType = "1" - - ConesType2 ConesType = "2" - - ConesType3 ConesType = "3" - - ConesTypeV ConesType = "V" -) - -// dimension type (length, width, draught etc) in [cm] (no decimals) -type DimType int64 - -// older 2 digit dvk shiptype code (replaced by unrec -type DvkTypeType string - -// record erased (not actual anymore) flag type -type ErasedType bool - -// eri location code type as used for eri_locations -type ErilocCodeType string - -// eri location name type as used in eri_locations -type ErilocNameType string - -// flags 0,B,V (dang goods indication seagoing vessels) -type FlagsType string - -const ( - FlagsType0 FlagsType = "0" - - FlagsTypeB FlagsType = "B" - - FlagsTypeV FlagsType = "V" -) - -// fairway code (text) -type FwCodeType string - -// ADN dangerous goodnames, description -type GoodDgsNameType string - -// non-dangerous goodnames, description -type GoodNameType string - -// ADN dangerous good synonym name,description -type GoodSynType string - -// HS code as used by customs -type HsCodeType string - -// hectometre code (hectomere in [hm] (no decimals) on the fairway) -type KmCodeType string - -// lastupdate, last modification date time of this record -type LastupdateType time.Time - -const LastupdateTypeFormat = "2006-01-02T15:04:05.999Z07:00" - -func (lut *LastupdateType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { - var value string - if err := d.DecodeElement(&value, &start); err != nil { - return err - } - t, err := time.Parse(LastupdateTypeFormat, value) - if err != nil { - return err - } - *lut = LastupdateType(t) - return nil -} - -// one of the supported languages (basic and additional set), based on ISO 639-1 -type LangType string - -const ( - LangTypeXX LangType = "%%" - - LangTypeLc LangType = "lc" - - LangTypeNl LangType = "nl" - - LangTypeDe LangType = "de" - - LangTypeFr LangType = "fr" - - LangTypeEn LangType = "en" - - LangTypeBg LangType = "bg" - - LangTypeCs LangType = "cs" - - LangTypeDa LangType = "da" - - LangTypeEl LangType = "el" - - LangTypeEs LangType = "es" - - LangTypeEt LangType = "et" - - LangTypeFi LangType = "fi" - - LangTypeHu LangType = "hu" - - LangTypeIt LangType = "it" - - LangTypeLt LangType = "lt" - - LangTypeLv LangType = "lv" - - LangTypePl LangType = "pl" - - LangTypePt LangType = "pt" - - LangTypeRo LangType = "ro" - - LangTypeSk LangType = "sk" - - LangTypeSl LangType = "sl" - - LangTypeSv LangType = "sv" - - LangTypeHr LangType = "hr" - - LangTypeRu LangType = "ru" - - LangTypeSr LangType = "sr" -) - -// lat long (WGS decimal [.] coordinates) coordinate type -type LatlonType float64 - -// un locode (2 country + 3 location code) -type LoCodeType string - -// Number of possible (departure) exist (routes) for a location -type LocExitsType int32 - -// VTS/IVS (code)name active in certain area and acting as a reporting point (when departing from that location) -type LocVtsCodeType string - -// location type, terminal type (a number indicating type of location,terminal) -type LocTypeType int32 - -// lloyds flag code for a certain country (seagoing) -type LloydsflagType string - -// NST code (corresponing nst2007 EU statistics codes for goods). -type NstCodeType string - -// NtS (Notices to Skippers) code/Value datatype -type NtsCodeType string - -// NtS name/description (belonging to a ntsCode) datatype -type NtsNameType string - -// NtS subtype (sub data type, there are several nts tables) -type NtstypeType string - -// ADN dangerous good packing group I, II, III -type PackGrpType string - -// UN rec 21 inner package code -type PackIdType string - -// Un rec 21 inner package name/description -type PackNameType string - -// Password type (belonging to a user, used to identify a user and its role and home country). -type PasswordType string - -// quay type (terminals), indicating quay nrs/id's -type QuayType string - -// record counter (nr of records available or in a set) -type RecCountType int64 - -// reftype Type (reftool data reftype, such as: risidx, eri_location, eri_hscode, nts_data) -type ReftypeType string - -const ( - ReftypeTypeRis_idx ReftypeType = "ris_idx" - - ReftypeTypeEri_location ReftypeType = "eri_location" - - ReftypeTypeEri_hscode ReftypeType = "eri_hscode" - - ReftypeTypeEri_adncode ReftypeType = "eri_adncode" - - ReftypeTypeEri_conttype ReftypeType = "eri_conttype" - - ReftypeTypeEri_packtype ReftypeType = "eri_packtype" - - ReftypeTypeEri_shiptype ReftypeType = "eri_shiptype" - - ReftypeTypeEri_country ReftypeType = "eri_country" - - ReftypeTypeNts_barrage ReftypeType = "nts_barrage" - - ReftypeTypeNts_communication ReftypeType = "nts_communication" - - ReftypeTypeNts_country ReftypeType = "nts_country" - - ReftypeTypeNts_direction ReftypeType = "nts_direction" - - ReftypeTypeNts_direction_max ReftypeType = "nts_direction_max" - - ReftypeTypeNts_direction_min ReftypeType = "nts_direction_min" - - ReftypeTypeNts_gui_labels ReftypeType = "nts_gui_labels" - - ReftypeTypeNts_ice_accessibility ReftypeType = "nts_ice_accessibility" - - ReftypeTypeNts_ice_condition ReftypeType = "nts_ice_condition" - - ReftypeTypeNts_ice_classification ReftypeType = "nts_ice_classification" - - ReftypeTypeNts_ice_situation ReftypeType = "nts_ice_situation" - - ReftypeTypeNts_indication ReftypeType = "nts_indication" - - ReftypeTypeNts_interval ReftypeType = "nts_interval" - - ReftypeTypeNts_language ReftypeType = "nts_language" - - ReftypeTypeNts_limitation ReftypeType = "nts_limitation" - - ReftypeTypeNts_measure ReftypeType = "nts_measure" - - ReftypeTypeNts_position ReftypeType = "nts_position" - - ReftypeTypeNts_reason ReftypeType = "nts_reason" - - ReftypeTypeNts_reference ReftypeType = "nts_reference" - - ReftypeTypeNts_regime ReftypeType = "nts_regime" - - ReftypeTypeNts_reporting ReftypeType = "nts_reporting" - - ReftypeTypeNts_subject ReftypeType = "nts_subject" - - ReftypeTypeNts_tag ReftypeType = "nts_tag" - - ReftypeTypeNts_target_group ReftypeType = "nts_target_group" - - ReftypeTypeNts_type ReftypeType = "nts_type" - - ReftypeTypeNts_weather_category ReftypeType = "nts_weather_category" - - ReftypeTypeNts_weather_class ReftypeType = "nts_weather_class" - - ReftypeTypeNts_weather_direction ReftypeType = "nts_weather_direction" - - ReftypeTypeNts_weather_item ReftypeType = "nts_weather_item" -) - -// RefData record version numbering (automaically, starts with 1 and increments on updates, requesting version 0=dont care) -type RefrecVersionType int64 - -// remarks string (remarks about the maintance of a record or any other remarks) -type RemarksType string - -// ris index (ISRS) code type (full ris index code) -type RisCodeType string - -// locationames as used in the ris index -type RislocNameType string - -// ris idx related ENC's type as used in ris idx (list of ENC id's) -type RisrelencType string - -// ris idx object code type (single code for a junction, termcode etc padded), subpart of the ris idx. -type RisobjCodeType string - -// ris idx communication information TXTDSC -type RiscomminfoType string - -// ris idx object function code type (junction, berths etc) -type RisobjfuncType string - -// ris idx section node id -type RissectnodeType string - -// ris idx national Gauge Code type (can be utilised to store any national coding/id/link for gauges) -type RisgaugeidType string - -// ris idx applicability from / to km (in hectometres (no decimals)) -type RisapplikmType int64 - -// ris idx reference level code (indicating the ref level) -type RisreflevelcodeType string - -// ris idx reference level value [cm] -type RisreflevelvalueType int64 - -// ris idx geod reference -type RisgeodrefType string - -// ris idx zero point [cm] -type RiszeropointType int64 - -// ris idx category of time schedule (cattab) -type RiscatoftimeschedType string - -// ris idx for ship type -type RisforshiptypeType string - -// ris idx use of ship useshp -type RisuseofshipType string - -// ris idx link to external XML file -type RislinkextxmlType string - -// UNrec 28 shiptype (4 digits) -type ShipTypeType string - -// shiptype name (textual) description -type ShiptypeNameType string - -// source string, to specify the source of this record/data or the update. -type SourceType string - -// ADN signal code (to group dgs for cones/flags calculations) -type SignalCodeType string - -// terminal code type (remark: termcode is the only part of eri locs with variable length, historical reasons). -type TermCodeType string - -// unlocode countrycode part (first 2 of unlocode) as used in ris idx -type UnlocCCType string - -// unlocode location code part (last 3 of unlocode) as used in ris idx -type UnlocLCType string - -// UN nr (4 digits) adn nr for identifying ADN dangerous goods (according CCNR) -type UnnrType string - -// reftool username(reftool accountname) type, to idetify a user and its role. -type UserNameType string - -// cargo weight type, integer nr (units [tons], [kg]) depending on element) -type WeightType int64 - -// adn warning (dgs) card id -type WarnIdType string - -// adn warning card -type WarnCardType string - -type MatchByCode struct { - XMLName xml.Name `xml:"http://rwsreftool/ matchByCode"` - - *MatchByCodeType -} - -type MatchByCodeResponse struct { - XMLName xml.Name `xml:"http://rwsreftool/ matchByCodeResponse"` - - *MatchByCodeResponseType -} - -type MatchByName struct { - XMLName xml.Name `xml:"http://rwsreftool/ matchByName"` - - *MatchByNameType -} - -type MatchByNameResponse struct { - XMLName xml.Name `xml:"http://rwsreftool/ matchByNameResponse"` - - *MatchByNameResponseType -} - -type GetDataXML struct { - XMLName xml.Name `xml:"http://rwsreftool/ getDataXML"` - - *GetDataXMLType -} - -type GetDataXMLResponse struct { - XMLName xml.Name `xml:"http://rwsreftool/ getDataXMLResponse"` - - *GetDataXMLResponseType -} - -type GetMutations struct { - XMLName xml.Name `xml:"http://rwsreftool/ getMutations"` - - *GetMutationsType -} - -type GetMutationsResponse struct { - XMLName xml.Name `xml:"http://rwsreftool/ getMutationsResponse"` - - *GetMutationsResponseType -} - -type GetRisDataXML struct { - XMLName xml.Name `xml:"http://rwsreftool/ getRisDataXML"` - - *GetRisDataXMLType -} - -type GetRisDataXMLResponse struct { - XMLName xml.Name `xml:"http://rwsreftool/ getRisDataXMLResponse"` - - *GetRisDataXMLResponseType -} - -type MutateDataXML struct { - XMLName xml.Name `xml:"http://rwsreftool/ mutateDataXML"` - - *MutateDataXMLType -} - -type MutateDataXMLResponse struct { - XMLName xml.Name `xml:"http://rwsreftool/ mutateDataXMLResponse"` - - *MutateDataXMLResponseType -} - -type RequestMutationXML struct { - XMLName xml.Name `xml:"http://rwsreftool/ requestMutationXML"` - - *RequestMutationXMLType -} - -type RequestMutationXMLResponse struct { - XMLName xml.Name `xml:"http://rwsreftool/ requestMutationXMLResponse"` - - *RequestMutationXMLResponseType -} - -type MatchByCodeType struct { - XMLName xml.Name `xml:"http://rwsreftool/ matchByCodeType"` - - Reftype *ReftypeType `xml:"reftype,omitempty"` - - Code string `xml:"code,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` -} - -type MatchByCodeResponseType struct { - XMLName xml.Name `xml:"http://rwsreftool/ matchByCodeResponseType"` - - // Indicates how many records are available/were found - // (due limitations less records can be returned/available in the resulting xml structure). - RecCount *RecCountType `xml:"recCount,omitempty"` - - RefdataReturn []*RefdataReturnType `xml:"refdataReturn,omitempty"` -} - -type MatchByNameType struct { - XMLName xml.Name `xml:"http://rwsreftool/ matchByNameType"` - - Reftype *ReftypeType `xml:"reftype,omitempty"` - - Lang *LangType `xml:"lang,omitempty"` - - Name string `xml:"name,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` -} - -type MatchByNameResponseType struct { - XMLName xml.Name `xml:"http://rwsreftool/ matchByNameResponseType"` - - // Indicates how many records are available/were found - // (due limitations less records can be returned/available in the resulting xml structure). - RecCount *RecCountType `xml:"recCount,omitempty"` - - RefdataReturn []*RefdataReturnType `xml:"refdataReturn,omitempty"` -} - -type GetMutationsType struct { - XMLName xml.Name `xml:"http://rwsreftool/ getMutationsType"` - - Reftype *ReftypeType `xml:"reftype,omitempty"` - - // from, to in datetime format in UTC time - FromDate time.Time `xml:"fromDate,omitempty"` - - ToDate time.Time `xml:"toDate,omitempty"` -} - -type GetMutationsResponseType struct { - XMLName xml.Name `xml:"http://rwsreftool/ getMutationsResponseType"` - - // Indicate how many records are available/were found. - RecCount *RecCountType `xml:"recCount,omitempty"` - - RefdataReturn []*RefdataReturnType `xml:"refdataReturn,omitempty"` -} - -type GetDataXMLType struct { - XMLName xml.Name `xml:"http://rwsreftool/ getDataXMLType"` - - Reftype *ReftypeType `xml:"reftype,omitempty"` - - Subcode string `xml:"subcode,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` -} - -type GetDataXMLResponseType struct { - XMLName xml.Name `xml:"http://rwsreftool/ getDataXMLResponseType"` - - // Indicates how many records are available/were found. - RecCount *RecCountType `xml:"recCount,omitempty"` - - RefdataReturn []*RefdataReturnType `xml:"refdataReturn,omitempty"` -} - -// NoNS is a helper type to allow string tags without a namespace. -type NoNS struct { - NS string `xml:"xmlns,attr"` - Text string `xml:",chardata"` -} - -type GetRisDataXMLType struct { - // XMLName xml.Name `xml:"http://rwsreftool/ getRisDataXMLType"` - - //Subcode string `xml:"subcode,omitempty"` - Subcode NoNS `xml:"subcode,omitempty"` - - Funcode NoNS `xml:"funcode,omitempty"` - - Version *RefrecVersionType `xml:"http://rwsreftool/ version,omitempty"` -} - -type GetRisDataXMLResponseType struct { - XMLName xml.Name `xml:"http://rwsreftool/ getRisDataXMLResponseType"` - - // Indicates how many records are available/were found. - RecCount *RecCountType `xml:"recCount,omitempty"` - - RisdataReturn []*Ris_idxType `xml:"risdataReturn,omitempty"` -} - -type MutateDataXMLType struct { - XMLName xml.Name `xml:"http://rwsreftool/ mutateDataXMLType"` - - Username *UserNameType `xml:"username,omitempty"` - - Password *PasswordType `xml:"password,omitempty"` - - Reftype *ReftypeType `xml:"reftype,omitempty"` - - RefData *RefdataReturnType `xml:"refData,omitempty"` -} - -type MutateDataXMLResponseType struct { - XMLName xml.Name `xml:"http://rwsreftool/ mutateDataXMLResponseType"` - - *StatReturnType -} - -type RequestMutationXMLType struct { - XMLName xml.Name `xml:"http://rwsreftool/ requestMutationXMLType"` - - Username *UserNameType `xml:"username,omitempty"` - - Password *PasswordType `xml:"password,omitempty"` - - Reftype *ReftypeType `xml:"reftype,omitempty"` - - InUserList bool `xml:"inUserList,omitempty"` - - RefDataReqMut *RefdataReqMutType `xml:"refDataReqMut,omitempty"` -} - -type RequestMutationXMLResponseType struct { - XMLName xml.Name `xml:"http://rwsreftool/ requestMutationXMLResponseType"` - - *StatReturnType -} - -type ExceptionType struct { - XMLName xml.Name `xml:"http://rwsreftool/ exception"` - - // exception code - Exception int32 `xml:"exception,omitempty"` - - // exception message in English - Message string `xml:"message,omitempty"` -} - -type RefdataReturnType struct { - XMLName xml.Name `xml:"http://rwsreftool/ refdataReturnType"` - - Reftype struct { - Value *ReftypeType - } `xml:"reftype,omitempty"` - - Ris_idx *Ris_idxType `xml:"ris_idx,omitempty"` - - Eri_location *Eri_locationType `xml:"eri_location,omitempty"` - - Eri_hscode *Eri_hscodeType `xml:"eri_hscode,omitempty"` - - Eri_adncode struct { - *Eri_adncodeType - } `xml:"eri_adncode,omitempty"` - - Eri_conttype *Eri_conttypeType `xml:"eri_conttype,omitempty"` - - Eri_packtype *Eri_packtypeType `xml:"eri_packtype,omitempty"` - - Eri_shiptype *Eri_shiptypeType `xml:"eri_shiptype,omitempty"` - - Eri_country *Eri_countryType `xml:"eri_country,omitempty"` - - // NtS element is only available in the return refdata structure. - // It is not available in the Req Mutation datastructure because we can not mutate nts data (not allowed)! - Nts_data *Nts_dataType `xml:"nts_data,omitempty"` -} - -type RefdataReqMutType struct { - XMLName xml.Name `xml:"http://rwsreftool/ refdataReqMutType"` - - // BE SURE to edit the basic (simple)types, DONT edit any of the subelements from here! - Reftype *ReftypeType `xml:"reftype,omitempty"` - - Ris_idx *Ris_idxReqMutType `xml:"ris_idx,omitempty"` - - Eri_location *Eri_locationReqMutType `xml:"eri_location,omitempty"` - - Eri_hscode *Eri_hscodeReqMutType `xml:"eri_hscode,omitempty"` - - Eri_adncode *Eri_adncodeReqMutType `xml:"eri_adncode,omitempty"` - - Eri_conttype *Eri_conttypeReqMutType `xml:"eri_conttype,omitempty"` - - Eri_packtype *Eri_packtypeReqMutType `xml:"eri_packtype,omitempty"` - - Eri_shiptype *Eri_shiptypeReqMutType `xml:"eri_shiptype,omitempty"` - - Eri_country *Eri_countryReqMutType `xml:"eri_country,omitempty"` -} - -type StatReturnType struct { - XMLName xml.Name `xml:"http://rwsreftool/ statReturnType"` - - // 0=ok, 1=warning, 2=error - Err int32 `xml:"err,omitempty"` - - Message struct { - } `xml:"message,omitempty"` -} - -type Ris_idxType struct { - //XMLName xml.Name `xml:"http://rwsreftool/ ris_idxType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - RisidxCode *RisCodeType `xml:"risidxCode,omitempty"` - - CodeOld *RisCodeType `xml:"codeOld,omitempty"` - - UnlocCC *UnlocCCType `xml:"unlocCC,omitempty"` - - UnlocLC *UnlocLCType `xml:"unlocLC,omitempty"` - - WwsectCode *FwCodeType `xml:"wwsectCode,omitempty"` - - Objcode *RisobjCodeType `xml:"objcode,omitempty"` - - Hectomt *KmCodeType `xml:"hectomt,omitempty"` - - Objfunc *RisobjfuncType `xml:"objfunc,omitempty"` - - Objname struct { - Loc *RislocNameType `xml:"Loc,omitempty"` - } `xml:"objname,omitempty"` - - Locname struct { - Loc *RislocNameType `xml:"Loc,omitempty"` - } `xml:"locname,omitempty"` - - Wwname struct { - Loc *RislocNameType `xml:"Loc,omitempty"` - } `xml:"wwname,omitempty"` - - Routename struct { - Loc *RislocNameType `xml:"Loc,omitempty"` - } `xml:"routename,omitempty"` - - Relrisindex *RisCodeType `xml:"relrisindex,omitempty"` - - Sectionnode *RissectnodeType `xml:"sectionnode,omitempty"` - - Lat *LatlonType `xml:"lat,omitempty"` - - Lon *LatlonType `xml:"lon,omitempty"` - - Relenc *RisrelencType `xml:"relenc,omitempty"` - - Comminfo *RiscomminfoType `xml:"comminfo,omitempty"` - - Gaugeid *RisgaugeidType `xml:"gaugeid,omitempty"` - - Vesselconvlength *DimType `xml:"vesselconvlength,omitempty"` - - Vesselconvbreadth *DimType `xml:"vesselconvbreadth,omitempty"` - - Vesselconvdraught *DimType `xml:"vesselconvdraught,omitempty"` - - Vesselconvairdraught *DimType `xml:"vesselconvairdraught,omitempty"` - - Availablelength *DimType `xml:"availablelength,omitempty"` - - Clearancewidth *DimType `xml:"clearancewidth,omitempty"` - - Availabledepth *DimType `xml:"availabledepth,omitempty"` - - Clearanceheight *DimType `xml:"clearanceheight,omitempty"` - - Applicabilityfromkm *RisapplikmType `xml:"applicabilityfromkm,omitempty"` - - Applicabilitytokm *RisapplikmType `xml:"applicabilitytokm,omitempty"` - - Reflevel1code *RisreflevelcodeType `xml:"reflevel1code,omitempty"` - - Reflevel1value *RisreflevelvalueType `xml:"reflevel1value,omitempty"` - - Reflevel2code *RisreflevelcodeType `xml:"reflevel2code,omitempty"` - - Reflevel2value *RisreflevelvalueType `xml:"reflevel2value,omitempty"` - - Reflevel3code *RisreflevelcodeType `xml:"reflevel3code,omitempty"` - - Reflevel3value *RisreflevelvalueType `xml:"reflevel3value,omitempty"` - - Zeropoint *RiszeropointType `xml:"zeropoint,omitempty"` - - Geodref *RisgeodrefType `xml:"geodref,omitempty"` - - Catoftimesched *RiscatoftimeschedType `xml:"catoftimesched,omitempty"` - - Forshiptype *RisforshiptypeType `xml:"forshiptype,omitempty"` - - Foruseofship *RisuseofshipType `xml:"foruseofship,omitempty"` - - LnktoextXMfiletimesched *RislinkextxmlType `xml:"lnktoextXMfiletimesched,omitempty"` - - LnktoextXMfilepastime *RislinkextxmlType `xml:"lnktoextXMfilepastime,omitempty"` - - Vesselconvlength2 *DimType `xml:"vesselconvlength2,omitempty"` - - Vesselconvbreadth2 *DimType `xml:"vesselconvbreadth2,omitempty"` - - Vesselconvdraught2 *DimType `xml:"vesselconvdraught2,omitempty"` - - Vesselconvairdraught2 *DimType `xml:"vesselconvairdraught2,omitempty"` - - Availablelength2 *DimType `xml:"availablelength2,omitempty"` - - Clearancewidth2 *DimType `xml:"clearancewidth2,omitempty"` - - Availabledepth2 *DimType `xml:"availabledepth2,omitempty"` - - Clearanceheight2 *DimType `xml:"clearanceheight2,omitempty"` - - Vesselconvlength3 *DimType `xml:"vesselconvlength3,omitempty"` - - Vesselconvbreadth3 *DimType `xml:"vesselconvbreadth3,omitempty"` - - Vesselconvdraught3 *DimType `xml:"vesselconvdraught3,omitempty"` - - Vesselconvairdraught3 *DimType `xml:"vesselconvairdraught3,omitempty"` - - Availablelength3 *DimType `xml:"availablelength3,omitempty"` - - Clearancewidth3 *DimType `xml:"clearancewidth3,omitempty"` - - Availabledepth3 *DimType `xml:"availabledepth3,omitempty"` - - Clearanceheight3 *DimType `xml:"clearanceheight3,omitempty"` - - Catoftimesched2 *RiscatoftimeschedType `xml:"catoftimesched2,omitempty"` - - Forshiptype2 *RisforshiptypeType `xml:"forshiptype2,omitempty"` - - Foruseofship2 *RisuseofshipType `xml:"foruseofship2,omitempty"` - - LnktoextXMfiletimesched2 *RislinkextxmlType `xml:"lnktoextXMfiletimesched2,omitempty"` - - LnktoextXMfilepastime2 *RislinkextxmlType `xml:"lnktoextXMfilepastime2,omitempty"` - - Catoftimesched3 *RiscatoftimeschedType `xml:"catoftimesched3,omitempty"` - - Forshiptype3 *RisforshiptypeType `xml:"forshiptype3,omitempty"` - - Foruseofship3 *RisuseofshipType `xml:"foruseofship3,omitempty"` - - LnktoextXMfiletimesched3 *RislinkextxmlType `xml:"lnktoextXMfiletimesched3,omitempty"` - - LnktoextXMfilepastime3 *RislinkextxmlType `xml:"lnktoextXMfilepastime3,omitempty"` - - Startdate *LastupdateType `xml:"startdate,omitempty"` - - Enddate *LastupdateType `xml:"enddate,omitempty"` - - Infodate *LastupdateType `xml:"infodate,omitempty"` - - // specific Ris idx remarks, reasons for change (descriptions as received with the ris idx) - RisidxRemarks *RemarksType `xml:"risidxRemarks,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - // remarks regarding the maintance of the ris idx - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_locationType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_locationType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - ErilocCode *ErilocCodeType `xml:"erilocCode,omitempty"` - - CodeOld *ErilocCodeType `xml:"codeOld,omitempty"` - - RisCode *RisCodeType `xml:"risCode,omitempty"` - - LoCode *LoCodeType `xml:"loCode,omitempty"` - - FwCode *FwCodeType `xml:"fwCode,omitempty"` - - TermCode *TermCodeType `xml:"termCode,omitempty"` - - KmCode *KmCodeType `xml:"kmCode,omitempty"` - - Name struct { - Loc *ErilocNameType `xml:"Loc,omitempty"` - - NL *ErilocNameType `xml:"NL,omitempty"` - - DE *ErilocNameType `xml:"DE,omitempty"` - - FR *ErilocNameType `xml:"FR,omitempty"` - - EN *ErilocNameType `xml:"EN,omitempty"` - } `xml:"name,omitempty"` - - LocType *LocTypeType `xml:"locType,omitempty"` - - Termname struct { - Loc *ErilocNameType `xml:"Loc,omitempty"` - - NL *ErilocNameType `xml:"NL,omitempty"` - - DE *ErilocNameType `xml:"DE,omitempty"` - - FR *ErilocNameType `xml:"FR,omitempty"` - - EN *ErilocNameType `xml:"EN,omitempty"` - } `xml:"termname,omitempty"` - - QuayFrom *QuayType `xml:"quayFrom,omitempty"` - - QuayTo *QuayType `xml:"quayTo,omitempty"` - - TermType *LocTypeType `xml:"termType,omitempty"` - - Lat *LatlonType `xml:"lat,omitempty"` - - Lon *LatlonType `xml:"lon,omitempty"` - - // VTS/IVS (code) acting as the default reporting (receiving) point (when departing from this llocation) - IvsVTSCode *LocVtsCodeType `xml:"ivsVTSCode,omitempty"` - - // Nr of possible exits (routes) when departing from this location >1 means a reporting or routepoint has to be specified. - Exits *LocExitsType `xml:"exits,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_hscodeType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_hscodeType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - HsCode *HsCodeType `xml:"hsCode,omitempty"` - - CodeOld *HsCodeType `xml:"codeOld,omitempty"` - - Name struct { - Loc *GoodNameType `xml:"Loc,omitempty"` - - NL *GoodNameType `xml:"NL,omitempty"` - - DE *GoodNameType `xml:"DE,omitempty"` - - FR *GoodNameType `xml:"FR,omitempty"` - - EN *GoodNameType `xml:"EN,omitempty"` - - BG *GoodNameType `xml:"BG,omitempty"` - - CS *GoodNameType `xml:"CS,omitempty"` - - DA *GoodNameType `xml:"DA,omitempty"` - - EL *GoodNameType `xml:"EL,omitempty"` - - ES *GoodNameType `xml:"ES,omitempty"` - - ET *GoodNameType `xml:"ET,omitempty"` - - FI *GoodNameType `xml:"FI,omitempty"` - - HU *GoodNameType `xml:"HU,omitempty"` - - IT *GoodNameType `xml:"IT,omitempty"` - - LT *GoodNameType `xml:"LT,omitempty"` - - LV *GoodNameType `xml:"LV,omitempty"` - - PL *GoodNameType `xml:"PL,omitempty"` - - PT *GoodNameType `xml:"PT,omitempty"` - - RO *GoodNameType `xml:"RO,omitempty"` - - SK *GoodNameType `xml:"SK,omitempty"` - - SL *GoodNameType `xml:"SL,omitempty"` - - SV *GoodNameType `xml:"SV,omitempty"` - - HR *GoodNameType `xml:"HR,omitempty"` - - RU *GoodNameType `xml:"RU,omitempty"` - - SR *GoodNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - NstCode *NstCodeType `xml:"nstCode,omitempty"` - - // English (NST2007) description. - NstName *GoodNameType `xml:"nstName,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_adncodeType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_adncodeType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - AdnCode *AdnCodeType `xml:"adnCode,omitempty"` - - CodeOld *AdnCodeType `xml:"codeOld,omitempty"` - - Unnr *UnnrType `xml:"unnr,omitempty"` - - AdnClass *AdnClassType `xml:"adnClass,omitempty"` - - AdnClassif *AdnClassType `xml:"adnClassif,omitempty"` - - ImoClass *AdnClassType `xml:"imoClass,omitempty"` - - PackGrp *PackGrpType `xml:"packGrp,omitempty"` - - Name struct { - Loc *GoodDgsNameType `xml:"Loc,omitempty"` - - NL *GoodDgsNameType `xml:"NL,omitempty"` - - DE *GoodDgsNameType `xml:"DE,omitempty"` - - FR *GoodDgsNameType `xml:"FR,omitempty"` - - EN *GoodDgsNameType `xml:"EN,omitempty"` - - BG *GoodDgsNameType `xml:"BG,omitempty"` - - CS *GoodDgsNameType `xml:"CS,omitempty"` - - DA *GoodDgsNameType `xml:"DA,omitempty"` - - EL *GoodDgsNameType `xml:"EL,omitempty"` - - ES *GoodDgsNameType `xml:"ES,omitempty"` - - ET *GoodDgsNameType `xml:"ET,omitempty"` - - FI *GoodDgsNameType `xml:"FI,omitempty"` - - HU *GoodDgsNameType `xml:"HU,omitempty"` - - IT *GoodDgsNameType `xml:"IT,omitempty"` - - LT *GoodDgsNameType `xml:"LT,omitempty"` - - LV *GoodDgsNameType `xml:"LV,omitempty"` - - PL *GoodDgsNameType `xml:"PL,omitempty"` - - PT *GoodDgsNameType `xml:"PT,omitempty"` - - RO *GoodDgsNameType `xml:"RO,omitempty"` - - SK *GoodDgsNameType `xml:"SK,omitempty"` - - SL *GoodDgsNameType `xml:"SL,omitempty"` - - SV *GoodDgsNameType `xml:"SV,omitempty"` - - HR *GoodDgsNameType `xml:"HR,omitempty"` - - RU *GoodDgsNameType `xml:"RU,omitempty"` - - SR *GoodDgsNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Syn struct { - Loc *GoodSynType `xml:"Loc,omitempty"` - - NL *GoodSynType `xml:"NL,omitempty"` - - DE *GoodSynType `xml:"DE,omitempty"` - - FR *GoodSynType `xml:"FR,omitempty"` - - EN *GoodSynType `xml:"EN,omitempty"` - - BG *GoodSynType `xml:"BG,omitempty"` - - CS *GoodSynType `xml:"CS,omitempty"` - - DA *GoodSynType `xml:"DA,omitempty"` - - EL *GoodSynType `xml:"EL,omitempty"` - - ES *GoodSynType `xml:"ES,omitempty"` - - ET *GoodSynType `xml:"ET,omitempty"` - - FI *GoodSynType `xml:"FI,omitempty"` - - HU *GoodSynType `xml:"HU,omitempty"` - - IT *GoodSynType `xml:"IT,omitempty"` - - LT *GoodSynType `xml:"LT,omitempty"` - - LV *GoodSynType `xml:"LV,omitempty"` - - PL *GoodSynType `xml:"PL,omitempty"` - - PT *GoodSynType `xml:"PT,omitempty"` - - RO *GoodSynType `xml:"RO,omitempty"` - - SK *GoodSynType `xml:"SK,omitempty"` - - SL *GoodSynType `xml:"SL,omitempty"` - - SV *GoodSynType `xml:"SV,omitempty"` - - HR *GoodSynType `xml:"HR,omitempty"` - - RU *GoodSynType `xml:"RU,omitempty"` - - SR *GoodSynType `xml:"SR,omitempty"` - } `xml:"syn,omitempty"` - - HsCode *HsCodeType `xml:"hsCode,omitempty"` - - NstCode *NstCodeType `xml:"nstCode,omitempty"` - - // 0, 1, 2, 3, V - ConesBulk *ConesType `xml:"conesBulk,omitempty"` - - ConesTank *ConesType `xml:"conesTank,omitempty"` - - ConesCont *ConesType `xml:"conesCont,omitempty"` - - // 0, B, V - FlagsBulk *FlagsType `xml:"flagsBulk,omitempty"` - - FlagsTank *FlagsType `xml:"flagsTank,omitempty"` - - WarnCard *WarnCardType `xml:"warnCard,omitempty"` - - WarnId *WarnIdType `xml:"warnId,omitempty"` - - Label1 *AdnLabelType `xml:"label1,omitempty"` - - Label2 *AdnLabelType `xml:"label2,omitempty"` - - Label3 *AdnLabelType `xml:"label3,omitempty"` - - MaxWeightCodeInlandBulkCont *SignalCodeType `xml:"maxWeightCodeInlandBulkCont,omitempty"` - - // max weight in kg - MaxWeightInlandBulkCont *WeightType `xml:"maxWeightInlandBulkCont,omitempty"` - - SignalCodeInlandCont *SignalCodeType `xml:"signalCodeInlandCont,omitempty"` - - // min weight in kg - MinWeightInlandCont *WeightType `xml:"minWeightInlandCont,omitempty"` - - SignalCodeInlandExcemp *SignalCodeType `xml:"signalCodeInlandExcemp,omitempty"` - - // min weight in kg - MinWeightInlandExcemp *WeightType `xml:"minWeightInlandExcemp,omitempty"` - - SignalCodeSeaBulk *SignalCodeType `xml:"signalCodeSeaBulk,omitempty"` - - // min weight in kg - MinWeightSeaBulk *WeightType `xml:"minWeightSeaBulk,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_conttypeType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_conttypeType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - ContId *ContIdType `xml:"contId,omitempty"` - - CodeOld *ContIdType `xml:"codeOld,omitempty"` - - // dimensions in cm - Length *DimType `xml:"length,omitempty"` - - Width *DimType `xml:"width,omitempty"` - - Height *DimType `xml:"height,omitempty"` - - // empty weight in kg - Weight *WeightType `xml:"weight,omitempty"` - - Name struct { - Loc *ContNameType `xml:"Loc,omitempty"` - - NL *ContNameType `xml:"NL,omitempty"` - - DE *ContNameType `xml:"DE,omitempty"` - - FR *ContNameType `xml:"FR,omitempty"` - - EN *ContNameType `xml:"EN,omitempty"` - - BG *ContNameType `xml:"BG,omitempty"` - - CS *ContNameType `xml:"CS,omitempty"` - - DA *ContNameType `xml:"DA,omitempty"` - - EL *ContNameType `xml:"EL,omitempty"` - - ES *ContNameType `xml:"ES,omitempty"` - - ET *ContNameType `xml:"ET,omitempty"` - - FI *ContNameType `xml:"FI,omitempty"` - - HU *ContNameType `xml:"HU,omitempty"` - - IT *ContNameType `xml:"IT,omitempty"` - - LT *ContNameType `xml:"LT,omitempty"` - - LV *ContNameType `xml:"LV,omitempty"` - - PL *ContNameType `xml:"PL,omitempty"` - - PT *ContNameType `xml:"PT,omitempty"` - - RO *ContNameType `xml:"RO,omitempty"` - - SK *ContNameType `xml:"SK,omitempty"` - - SL *ContNameType `xml:"SL,omitempty"` - - SV *ContNameType `xml:"SV,omitempty"` - - HR *ContNameType `xml:"HR,omitempty"` - - RU *ContNameType `xml:"RU,omitempty"` - - SR *ContNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_packtypeType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_packtypeType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - PackId *PackIdType `xml:"packId,omitempty"` - - CodeOld *PackIdType `xml:"codeOld,omitempty"` - - Name struct { - Loc *PackNameType `xml:"Loc,omitempty"` - - NL *PackNameType `xml:"NL,omitempty"` - - DE *PackNameType `xml:"DE,omitempty"` - - FR *PackNameType `xml:"FR,omitempty"` - - EN *PackNameType `xml:"EN,omitempty"` - - BG *PackNameType `xml:"BG,omitempty"` - - CS *PackNameType `xml:"CS,omitempty"` - - DA *PackNameType `xml:"DA,omitempty"` - - EL *PackNameType `xml:"EL,omitempty"` - - ES *PackNameType `xml:"ES,omitempty"` - - ET *PackNameType `xml:"ET,omitempty"` - - FI *PackNameType `xml:"FI,omitempty"` - - HU *PackNameType `xml:"HU,omitempty"` - - IT *PackNameType `xml:"IT,omitempty"` - - LT *PackNameType `xml:"LT,omitempty"` - - LV *PackNameType `xml:"LV,omitempty"` - - PL *PackNameType `xml:"PL,omitempty"` - - PT *PackNameType `xml:"PT,omitempty"` - - RO *PackNameType `xml:"RO,omitempty"` - - SK *PackNameType `xml:"SK,omitempty"` - - SL *PackNameType `xml:"SL,omitempty"` - - SV *PackNameType `xml:"SV,omitempty"` - - HR *PackNameType `xml:"HR,omitempty"` - - RU *PackNameType `xml:"RU,omitempty"` - - SR *PackNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_shiptypeType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_shiptypeType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - ShipType *ShipTypeType `xml:"shipType,omitempty"` - - CodeOld *ShipTypeType `xml:"codeOld,omitempty"` - - DvkType *DvkTypeType `xml:"dvkType,omitempty"` - - CraftType *CraftTypeType `xml:"craftType,omitempty"` - - // True = transport cominination type, false=single ship - Combination *CombinationFlagType `xml:"combination,omitempty"` - - Name struct { - Loc *ShiptypeNameType `xml:"Loc,omitempty"` - - NL *ShiptypeNameType `xml:"NL,omitempty"` - - DE *ShiptypeNameType `xml:"DE,omitempty"` - - FR *ShiptypeNameType `xml:"FR,omitempty"` - - EN *ShiptypeNameType `xml:"EN,omitempty"` - - BG *ShiptypeNameType `xml:"BG,omitempty"` - - CS *ShiptypeNameType `xml:"CS,omitempty"` - - DA *ShiptypeNameType `xml:"DA,omitempty"` - - EL *ShiptypeNameType `xml:"EL,omitempty"` - - ES *ShiptypeNameType `xml:"ES,omitempty"` - - ET *ShiptypeNameType `xml:"ET,omitempty"` - - FI *ShiptypeNameType `xml:"FI,omitempty"` - - HU *ShiptypeNameType `xml:"HU,omitempty"` - - IT *ShiptypeNameType `xml:"IT,omitempty"` - - LT *ShiptypeNameType `xml:"LT,omitempty"` - - LV *ShiptypeNameType `xml:"LV,omitempty"` - - PL *ShiptypeNameType `xml:"PL,omitempty"` - - PT *ShiptypeNameType `xml:"PT,omitempty"` - - RO *ShiptypeNameType `xml:"RO,omitempty"` - - SK *ShiptypeNameType `xml:"SK,omitempty"` - - SL *ShiptypeNameType `xml:"SL,omitempty"` - - SV *ShiptypeNameType `xml:"SV,omitempty"` - - HR *ShiptypeNameType `xml:"HR,omitempty"` - - RU *ShiptypeNameType `xml:"RU,omitempty"` - - SR *ShiptypeNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_countryType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_countryType"` - - // UN country ISO code 2 chars. Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - CountryCode *CountryCodeType `xml:"countryCode,omitempty"` - - CodeOld *CountryCodeType `xml:"codeOld,omitempty"` - - CbsCode *CbscountryCodeType `xml:"cbsCode,omitempty"` - - CountryIsoCode3 *CountryCode3Type `xml:"countryIsoCode3,omitempty"` - - CountryIsoNum *CountryIsoNumType `xml:"countryIsoNum,omitempty"` - - LloydsFlag *LloydsflagType `xml:"lloydsFlag,omitempty"` - - Name struct { - Loc *CountryNameType `xml:"Loc,omitempty"` - - NL *CountryNameType `xml:"NL,omitempty"` - - DE *CountryNameType `xml:"DE,omitempty"` - - FR *CountryNameType `xml:"FR,omitempty"` - - EN *CountryNameType `xml:"EN,omitempty"` - - BG *CountryNameType `xml:"BG,omitempty"` - - CS *CountryNameType `xml:"CS,omitempty"` - - DA *CountryNameType `xml:"DA,omitempty"` - - EL *CountryNameType `xml:"EL,omitempty"` - - ES *CountryNameType `xml:"ES,omitempty"` - - ET *CountryNameType `xml:"ET,omitempty"` - - FI *CountryNameType `xml:"FI,omitempty"` - - HU *CountryNameType `xml:"HU,omitempty"` - - IT *CountryNameType `xml:"IT,omitempty"` - - LT *CountryNameType `xml:"LT,omitempty"` - - LV *CountryNameType `xml:"LV,omitempty"` - - PL *CountryNameType `xml:"PL,omitempty"` - - PT *CountryNameType `xml:"PT,omitempty"` - - RO *CountryNameType `xml:"RO,omitempty"` - - SK *CountryNameType `xml:"SK,omitempty"` - - SL *CountryNameType `xml:"SL,omitempty"` - - SV *CountryNameType `xml:"SV,omitempty"` - - HR *CountryNameType `xml:"HR,omitempty"` - - RU *CountryNameType `xml:"RU,omitempty"` - - SR *CountryNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Nts_dataType struct { - XMLName xml.Name `xml:"http://rwsreftool/ nts_dataType"` - - // Just a string (no enum) to return nts data type of the nts_data returned! - // reftype already contains datatype. - Ntstype *NtstypeType `xml:"ntstype,omitempty"` - - Ntscode *NtsCodeType `xml:"ntscode,omitempty"` - - CodeOld *NtsCodeType `xml:"codeOld,omitempty"` - - Name struct { - Loc *NtsNameType `xml:"Loc,omitempty"` - - NL *NtsNameType `xml:"NL,omitempty"` - - DE *NtsNameType `xml:"DE,omitempty"` - - EN *NtsNameType `xml:"EN,omitempty"` - - FR *NtsNameType `xml:"FR,omitempty"` - - BG *NtsNameType `xml:"BG,omitempty"` - - CS *NtsNameType `xml:"CS,omitempty"` - - DA *NtsNameType `xml:"DA,omitempty"` - - EL *NtsNameType `xml:"EL,omitempty"` - - ES *NtsNameType `xml:"ES,omitempty"` - - ET *NtsNameType `xml:"ET,omitempty"` - - FI *NtsNameType `xml:"FI,omitempty"` - - HU *NtsNameType `xml:"HU,omitempty"` - - IT *NtsNameType `xml:"IT,omitempty"` - - LT *NtsNameType `xml:"LT,omitempty"` - - LV *NtsNameType `xml:"LV,omitempty"` - - PL *NtsNameType `xml:"PL,omitempty"` - - PT *NtsNameType `xml:"PT,omitempty"` - - RO *NtsNameType `xml:"RO,omitempty"` - - SK *NtsNameType `xml:"SK,omitempty"` - - SL *NtsNameType `xml:"SL,omitempty"` - - SV *NtsNameType `xml:"SV,omitempty"` - - HR *NtsNameType `xml:"HR,omitempty"` - - RU *NtsNameType `xml:"RU,omitempty"` - - SR *NtsNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Ris_idxReqMutType struct { - XMLName xml.Name `xml:"http://rwsreftool/ ris_idxReqMutType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - RisidxCode *RisCodeType `xml:"risidxCode,omitempty"` - - CodeOld *RisCodeType `xml:"codeOld,omitempty"` - - UnlocCC *UnlocCCType `xml:"unlocCC,omitempty"` - - UnlocLC *UnlocLCType `xml:"unlocLC,omitempty"` - - WwsectCode *FwCodeType `xml:"wwsectCode,omitempty"` - - Objcode *RisobjCodeType `xml:"objcode,omitempty"` - - Hectomt *KmCodeType `xml:"hectomt,omitempty"` - - Objfunc *RisobjfuncType `xml:"objfunc,omitempty"` - - Objname struct { - Loc *RislocNameType `xml:"Loc,omitempty"` - } `xml:"objname,omitempty"` - - Locname struct { - Loc *RislocNameType `xml:"Loc,omitempty"` - } `xml:"locname,omitempty"` - - Wwname struct { - Loc *RislocNameType `xml:"Loc,omitempty"` - } `xml:"wwname,omitempty"` - - Routename struct { - Loc *RislocNameType `xml:"Loc,omitempty"` - } `xml:"routename,omitempty"` - - Relrisindex *RisCodeType `xml:"relrisindex,omitempty"` - - Sectionnode *RissectnodeType `xml:"sectionnode,omitempty"` - - Lat *LatlonType `xml:"lat,omitempty"` - - Lon *LatlonType `xml:"lon,omitempty"` - - Relenc *RisrelencType `xml:"relenc,omitempty"` - - Comminfo *RiscomminfoType `xml:"comminfo,omitempty"` - - Gaugeid *RisgaugeidType `xml:"gaugeid,omitempty"` - - Vesselconvlength *DimType `xml:"vesselconvlength,omitempty"` - - Vesselconvbreadth *DimType `xml:"vesselconvbreadth,omitempty"` - - Vesselconvdraught *DimType `xml:"vesselconvdraught,omitempty"` - - Vesselconvairdraught *DimType `xml:"vesselconvairdraught,omitempty"` - - Availablelength *DimType `xml:"availablelength,omitempty"` - - Clearancewidth *DimType `xml:"clearancewidth,omitempty"` - - Availabledepth *DimType `xml:"availabledepth,omitempty"` - - Clearanceheight *DimType `xml:"clearanceheight,omitempty"` - - Applicabilityfromkm *RisapplikmType `xml:"applicabilityfromkm,omitempty"` - - Applicabilitytokm *RisapplikmType `xml:"applicabilitytokm,omitempty"` - - Reflevel1code *RisreflevelcodeType `xml:"reflevel1code,omitempty"` - - Reflevel1value *RisreflevelvalueType `xml:"reflevel1value,omitempty"` - - Reflevel2code *RisreflevelcodeType `xml:"reflevel2code,omitempty"` - - Reflevel2value *RisreflevelvalueType `xml:"reflevel2value,omitempty"` - - Reflevel3code *RisreflevelcodeType `xml:"reflevel3code,omitempty"` - - Reflevel3value *RisreflevelvalueType `xml:"reflevel3value,omitempty"` - - Zeropoint *RiszeropointType `xml:"zeropoint,omitempty"` - - Geodref *RisgeodrefType `xml:"geodref,omitempty"` - - Catoftimesched *RiscatoftimeschedType `xml:"catoftimesched,omitempty"` - - Forshiptype *RisforshiptypeType `xml:"forshiptype,omitempty"` - - Foruseofship *RisuseofshipType `xml:"foruseofship,omitempty"` - - LnktoextXMfiletimesched *RislinkextxmlType `xml:"lnktoextXMfiletimesched,omitempty"` - - LnktoextXMfilepastime *RislinkextxmlType `xml:"lnktoextXMfilepastime,omitempty"` - - Vesselconvlength2 *DimType `xml:"vesselconvlength2,omitempty"` - - Vesselconvbreadth2 *DimType `xml:"vesselconvbreadth2,omitempty"` - - Vesselconvdraught2 *DimType `xml:"vesselconvdraught2,omitempty"` - - Vesselconvairdraught2 *DimType `xml:"vesselconvairdraught2,omitempty"` - - Availablelength2 *DimType `xml:"availablelength2,omitempty"` - - Clearancewidth2 *DimType `xml:"clearancewidth2,omitempty"` - - Availabledepth2 *DimType `xml:"availabledepth2,omitempty"` - - Clearanceheight2 *DimType `xml:"clearanceheight2,omitempty"` - - Vesselconvlength3 *DimType `xml:"vesselconvlength3,omitempty"` - - Vesselconvbreadth3 *DimType `xml:"vesselconvbreadth3,omitempty"` - - Vesselconvdraught3 *DimType `xml:"vesselconvdraught3,omitempty"` - - Vesselconvairdraught3 *DimType `xml:"vesselconvairdraught3,omitempty"` - - Availablelength3 *DimType `xml:"availablelength3,omitempty"` - - Clearancewidth3 *DimType `xml:"clearancewidth3,omitempty"` - - Availabledepth3 *DimType `xml:"availabledepth3,omitempty"` - - Clearanceheight3 *DimType `xml:"clearanceheight3,omitempty"` - - Catoftimesched2 *RiscatoftimeschedType `xml:"catoftimesched2,omitempty"` - - Forshiptype2 *RisforshiptypeType `xml:"forshiptype2,omitempty"` - - Foruseofship2 *RisuseofshipType `xml:"foruseofship2,omitempty"` - - LnktoextXMfiletimesched2 *RislinkextxmlType `xml:"lnktoextXMfiletimesched2,omitempty"` - - LnktoextXMfilepastime2 *RislinkextxmlType `xml:"lnktoextXMfilepastime2,omitempty"` - - Catoftimesched3 *RiscatoftimeschedType `xml:"catoftimesched3,omitempty"` - - Forshiptype3 *RisforshiptypeType `xml:"forshiptype3,omitempty"` - - Foruseofship3 *RisuseofshipType `xml:"foruseofship3,omitempty"` - - LnktoextXMfiletimesched3 *RislinkextxmlType `xml:"lnktoextXMfiletimesched3,omitempty"` - - LnktoextXMfilepastime3 *RislinkextxmlType `xml:"lnktoextXMfilepastime3,omitempty"` - - Startdate *LastupdateType `xml:"startdate,omitempty"` - - Enddate *LastupdateType `xml:"enddate,omitempty"` - - Infodate *LastupdateType `xml:"infodate,omitempty"` - - // specific Ris idx remarks/reasons for change, as received with the ris idx - RisidxRemarks *RemarksType `xml:"risidxRemarks,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - // remarks regarding the maintance of the ris idx - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_locationReqMutType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_locationReqMutType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - ErilocCode *ErilocCodeType `xml:"erilocCode,omitempty"` - - CodeOld *ErilocCodeType `xml:"codeOld,omitempty"` - - RisCode *RisCodeType `xml:"risCode,omitempty"` - - LoCode *LoCodeType `xml:"loCode,omitempty"` - - FwCode *FwCodeType `xml:"fwCode,omitempty"` - - TermCode *TermCodeType `xml:"termCode,omitempty"` - - KmCode *KmCodeType `xml:"kmCode,omitempty"` - - Name struct { - Loc *ErilocNameType `xml:"Loc,omitempty"` - - NL *ErilocNameType `xml:"NL,omitempty"` - - DE *ErilocNameType `xml:"DE,omitempty"` - - FR *ErilocNameType `xml:"FR,omitempty"` - - EN *ErilocNameType `xml:"EN,omitempty"` - } `xml:"name,omitempty"` - - LocType *LocTypeType `xml:"locType,omitempty"` - - Termname struct { - Loc *ErilocNameType `xml:"Loc,omitempty"` - - NL *ErilocNameType `xml:"NL,omitempty"` - - DE *ErilocNameType `xml:"DE,omitempty"` - - FR *ErilocNameType `xml:"FR,omitempty"` - - EN *ErilocNameType `xml:"EN,omitempty"` - } `xml:"termname,omitempty"` - - QuayFrom *QuayType `xml:"quayFrom,omitempty"` - - QuayTo *QuayType `xml:"quayTo,omitempty"` - - TermType *LocTypeType `xml:"termType,omitempty"` - - Lat *LatlonType `xml:"lat,omitempty"` - - Lon *LatlonType `xml:"lon,omitempty"` - - IvsVTSCode *LocVtsCodeType `xml:"ivsVTSCode,omitempty"` - - Exits *LocExitsType `xml:"exits,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_hscodeReqMutType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_hscodeReqMutType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - HsCode *HsCodeType `xml:"hsCode,omitempty"` - - CodeOld *HsCodeType `xml:"codeOld,omitempty"` - - Name struct { - Loc *GoodNameType `xml:"Loc,omitempty"` - - NL *GoodNameType `xml:"NL,omitempty"` - - DE *GoodNameType `xml:"DE,omitempty"` - - FR *GoodNameType `xml:"FR,omitempty"` - - EN *GoodNameType `xml:"EN,omitempty"` - - BG *GoodNameType `xml:"BG,omitempty"` - - CS *GoodNameType `xml:"CS,omitempty"` - - DA *GoodNameType `xml:"DA,omitempty"` - - EL *GoodNameType `xml:"EL,omitempty"` - - ES *GoodNameType `xml:"ES,omitempty"` - - ET *GoodNameType `xml:"ET,omitempty"` - - FI *GoodNameType `xml:"FI,omitempty"` - - HU *GoodNameType `xml:"HU,omitempty"` - - IT *GoodNameType `xml:"IT,omitempty"` - - LT *GoodNameType `xml:"LT,omitempty"` - - LV *GoodNameType `xml:"LV,omitempty"` - - PL *GoodNameType `xml:"PL,omitempty"` - - PT *GoodNameType `xml:"PT,omitempty"` - - RO *GoodNameType `xml:"RO,omitempty"` - - SK *GoodNameType `xml:"SK,omitempty"` - - SL *GoodNameType `xml:"SL,omitempty"` - - SV *GoodNameType `xml:"SV,omitempty"` - - HR *GoodNameType `xml:"HR,omitempty"` - - RU *GoodNameType `xml:"RU,omitempty"` - - SR *GoodNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - NstCode *NstCodeType `xml:"nstCode,omitempty"` - - NstName *GoodNameType `xml:"nstName,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_adncodeReqMutType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_adncodeReqMutType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - AdnCode *AdnCodeType `xml:"adnCode,omitempty"` - - CodeOld *AdnCodeType `xml:"codeOld,omitempty"` - - Unnr *UnnrType `xml:"unnr,omitempty"` - - AdnClass *AdnClassType `xml:"adnClass,omitempty"` - - AdnClassif *AdnClassType `xml:"adnClassif,omitempty"` - - ImoClass *AdnClassType `xml:"imoClass,omitempty"` - - PackGrp *PackGrpType `xml:"packGrp,omitempty"` - - Name struct { - Loc *GoodDgsNameType `xml:"Loc,omitempty"` - - NL *GoodDgsNameType `xml:"NL,omitempty"` - - DE *GoodDgsNameType `xml:"DE,omitempty"` - - FR *GoodDgsNameType `xml:"FR,omitempty"` - - EN *GoodDgsNameType `xml:"EN,omitempty"` - - BG *GoodDgsNameType `xml:"BG,omitempty"` - - CS *GoodDgsNameType `xml:"CS,omitempty"` - - DA *GoodDgsNameType `xml:"DA,omitempty"` - - EL *GoodDgsNameType `xml:"EL,omitempty"` - - ES *GoodDgsNameType `xml:"ES,omitempty"` - - ET *GoodDgsNameType `xml:"ET,omitempty"` - - FI *GoodDgsNameType `xml:"FI,omitempty"` - - HU *GoodDgsNameType `xml:"HU,omitempty"` - - IT *GoodDgsNameType `xml:"IT,omitempty"` - - LT *GoodDgsNameType `xml:"LT,omitempty"` - - LV *GoodDgsNameType `xml:"LV,omitempty"` - - PL *GoodDgsNameType `xml:"PL,omitempty"` - - PT *GoodDgsNameType `xml:"PT,omitempty"` - - RO *GoodDgsNameType `xml:"RO,omitempty"` - - SK *GoodDgsNameType `xml:"SK,omitempty"` - - SL *GoodDgsNameType `xml:"SL,omitempty"` - - SV *GoodDgsNameType `xml:"SV,omitempty"` - - HR *GoodDgsNameType `xml:"HR,omitempty"` - - RU *GoodDgsNameType `xml:"RU,omitempty"` - - SR *GoodDgsNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Syn struct { - Loc *GoodSynType `xml:"Loc,omitempty"` - - NL *GoodSynType `xml:"NL,omitempty"` - - DE *GoodSynType `xml:"DE,omitempty"` - - FR *GoodSynType `xml:"FR,omitempty"` - - EN *GoodSynType `xml:"EN,omitempty"` - - BG *GoodSynType `xml:"BG,omitempty"` - - CS *GoodSynType `xml:"CS,omitempty"` - - DA *GoodSynType `xml:"DA,omitempty"` - - EL *GoodSynType `xml:"EL,omitempty"` - - ES *GoodSynType `xml:"ES,omitempty"` - - ET *GoodSynType `xml:"ET,omitempty"` - - FI *GoodSynType `xml:"FI,omitempty"` - - HU *GoodSynType `xml:"HU,omitempty"` - - IT *GoodSynType `xml:"IT,omitempty"` - - LT *GoodSynType `xml:"LT,omitempty"` - - LV *GoodSynType `xml:"LV,omitempty"` - - PL *GoodSynType `xml:"PL,omitempty"` - - PT *GoodSynType `xml:"PT,omitempty"` - - RO *GoodSynType `xml:"RO,omitempty"` - - SK *GoodSynType `xml:"SK,omitempty"` - - SL *GoodSynType `xml:"SL,omitempty"` - - SV *GoodSynType `xml:"SV,omitempty"` - - HR *GoodSynType `xml:"HR,omitempty"` - - RU *GoodSynType `xml:"RU,omitempty"` - - SR *GoodSynType `xml:"SR,omitempty"` - } `xml:"syn,omitempty"` - - HsCode *HsCodeType `xml:"hsCode,omitempty"` - - NstCode *NstCodeType `xml:"nstCode,omitempty"` - - // 0, 1, 2, 3, V (Inland) - ConesBulk *ConesType `xml:"conesBulk,omitempty"` - - ConesTank *ConesType `xml:"conesTank,omitempty"` - - ConesCont *ConesType `xml:"conesCont,omitempty"` - - // 0, B, V (Seagoing) - FlagsBulk *FlagsType `xml:"flagsBulk,omitempty"` - - FlagsTank *FlagsType `xml:"flagsTank,omitempty"` - - WarnCard *WarnCardType `xml:"warnCard,omitempty"` - - WarnId *WarnIdType `xml:"warnId,omitempty"` - - Label1 *AdnLabelType `xml:"label1,omitempty"` - - Label2 *AdnLabelType `xml:"label2,omitempty"` - - Label3 *AdnLabelType `xml:"label3,omitempty"` - - MaxWeightCodeInlandBulkCont *SignalCodeType `xml:"maxWeightCodeInlandBulkCont,omitempty"` - - // max weight in kg - MaxWeightInlandBulkCont *WeightType `xml:"maxWeightInlandBulkCont,omitempty"` - - SignalCodeInlandCont *SignalCodeType `xml:"signalCodeInlandCont,omitempty"` - - // min weight in kg - MinWeightInlandCont *WeightType `xml:"minWeightInlandCont,omitempty"` - - SignalCodeInlandExcemp *SignalCodeType `xml:"signalCodeInlandExcemp,omitempty"` - - // min weight in kg - MinWeightInlandExcemp *WeightType `xml:"minWeightInlandExcemp,omitempty"` - - SignalCodeSeaBulk *SignalCodeType `xml:"signalCodeSeaBulk,omitempty"` - - // min weight in kg - MinWeightSeaBulk *WeightType `xml:"minWeightSeaBulk,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_conttypeReqMutType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_conttypeReqMutType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - ContId *ContIdType `xml:"contId,omitempty"` - - CodeOld *ContIdType `xml:"codeOld,omitempty"` - - // dimensions in cm - Length *DimType `xml:"length,omitempty"` - - Width *DimType `xml:"width,omitempty"` - - Height *DimType `xml:"height,omitempty"` - - // empty weight in kg - Weight *DimType `xml:"weight,omitempty"` - - Name struct { - Loc *ContNameType `xml:"Loc,omitempty"` - - NL *ContNameType `xml:"NL,omitempty"` - - DE *ContNameType `xml:"DE,omitempty"` - - FR *ContNameType `xml:"FR,omitempty"` - - EN *ContNameType `xml:"EN,omitempty"` - - BG *ContNameType `xml:"BG,omitempty"` - - CS *ContNameType `xml:"CS,omitempty"` - - DA *ContNameType `xml:"DA,omitempty"` - - EL *ContNameType `xml:"EL,omitempty"` - - ES *ContNameType `xml:"ES,omitempty"` - - ET *ContNameType `xml:"ET,omitempty"` - - FI *ContNameType `xml:"FI,omitempty"` - - HU *ContNameType `xml:"HU,omitempty"` - - IT *ContNameType `xml:"IT,omitempty"` - - LT *ContNameType `xml:"LT,omitempty"` - - LV *ContNameType `xml:"LV,omitempty"` - - PL *ContNameType `xml:"PL,omitempty"` - - PT *ContNameType `xml:"PT,omitempty"` - - RO *ContNameType `xml:"RO,omitempty"` - - SK *ContNameType `xml:"SK,omitempty"` - - SL *ContNameType `xml:"SL,omitempty"` - - SV *ContNameType `xml:"SV,omitempty"` - - HR *ContNameType `xml:"HR,omitempty"` - - RU *ContNameType `xml:"RU,omitempty"` - - SR *ContNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_packtypeReqMutType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_packtypeReqMutType"` - - // Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - PackId *PackIdType `xml:"packId,omitempty"` - - CodeOld *PackIdType `xml:"codeOld,omitempty"` - - Name struct { - Loc *PackNameType `xml:"Loc,omitempty"` - - NL *PackNameType `xml:"NL,omitempty"` - - DE *PackNameType `xml:"DE,omitempty"` - - FR *PackNameType `xml:"FR,omitempty"` - - EN *PackNameType `xml:"EN,omitempty"` - - BG *PackNameType `xml:"BG,omitempty"` - - CS *PackNameType `xml:"CS,omitempty"` - - DA *PackNameType `xml:"DA,omitempty"` - - EL *PackNameType `xml:"EL,omitempty"` - - ES *PackNameType `xml:"ES,omitempty"` - - ET *PackNameType `xml:"ET,omitempty"` - - FI *PackNameType `xml:"FI,omitempty"` - - HU *PackNameType `xml:"HU,omitempty"` - - IT *PackNameType `xml:"IT,omitempty"` - - LT *PackNameType `xml:"LT,omitempty"` - - LV *PackNameType `xml:"LV,omitempty"` - - PL *PackNameType `xml:"PL,omitempty"` - - PT *PackNameType `xml:"PT,omitempty"` - - RO *PackNameType `xml:"RO,omitempty"` - - SK *PackNameType `xml:"SK,omitempty"` - - SL *PackNameType `xml:"SL,omitempty"` - - SV *PackNameType `xml:"SV,omitempty"` - - HR *PackNameType `xml:"HR,omitempty"` - - RU *PackNameType `xml:"RU,omitempty"` - - SR *PackNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_shiptypeReqMutType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_shiptypeReqMutType"` - - // UN rec 28. Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - ShipType *ShipTypeType `xml:"shipType,omitempty"` - - CodeOld *ShipTypeType `xml:"codeOld,omitempty"` - - DvkType *DvkTypeType `xml:"dvkType,omitempty"` - - CraftType *CraftTypeType `xml:"craftType,omitempty"` - - // True = transport cominination type, false=single ship - Combination *CombinationFlagType `xml:"combination,omitempty"` - - Name struct { - Loc *ShiptypeNameType `xml:"Loc,omitempty"` - - NL *ShiptypeNameType `xml:"NL,omitempty"` - - DE *ShiptypeNameType `xml:"DE,omitempty"` - - FR *ShiptypeNameType `xml:"FR,omitempty"` - - EN *ShiptypeNameType `xml:"EN,omitempty"` - - BG *ShiptypeNameType `xml:"BG,omitempty"` - - CS *ShiptypeNameType `xml:"CS,omitempty"` - - DA *ShiptypeNameType `xml:"DA,omitempty"` - - EL *ShiptypeNameType `xml:"EL,omitempty"` - - ES *ShiptypeNameType `xml:"ES,omitempty"` - - ET *ShiptypeNameType `xml:"ET,omitempty"` - - FI *ShiptypeNameType `xml:"FI,omitempty"` - - HU *ShiptypeNameType `xml:"HU,omitempty"` - - IT *ShiptypeNameType `xml:"IT,omitempty"` - - LT *ShiptypeNameType `xml:"LT,omitempty"` - - LV *ShiptypeNameType `xml:"LV,omitempty"` - - PL *ShiptypeNameType `xml:"PL,omitempty"` - - PT *ShiptypeNameType `xml:"PT,omitempty"` - - RO *ShiptypeNameType `xml:"RO,omitempty"` - - SK *ShiptypeNameType `xml:"SK,omitempty"` - - SL *ShiptypeNameType `xml:"SL,omitempty"` - - SV *ShiptypeNameType `xml:"SV,omitempty"` - - HR *ShiptypeNameType `xml:"HR,omitempty"` - - RU *ShiptypeNameType `xml:"RU,omitempty"` - - SR *ShiptypeNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type Eri_countryReqMutType struct { - XMLName xml.Name `xml:"http://rwsreftool/ eri_countryReqMutType"` - - // UN country ISO code 2 chars. Be sure to edit, change the basic Simpletypes, dont edit any of the (sub)elements from here!!! - CountryCode *CountryCodeType `xml:"countryCode,omitempty"` - - CodeOld *CountryCodeType `xml:"codeOld,omitempty"` - - CbsCode *CbscountryCodeType `xml:"cbsCode,omitempty"` - - CountryIsoCode3 *CountryCode3Type `xml:"countryIsoCode3,omitempty"` - - CountryIsoNum *CountryIsoNumType `xml:"countryIsoNum,omitempty"` - - LloydsFlag *LloydsflagType `xml:"lloydsFlag,omitempty"` - - Name struct { - Loc *CountryNameType `xml:"Loc,omitempty"` - - NL *CountryNameType `xml:"NL,omitempty"` - - DE *CountryNameType `xml:"DE,omitempty"` - - FR *CountryNameType `xml:"FR,omitempty"` - - EN *CountryNameType `xml:"EN,omitempty"` - - BG *CountryNameType `xml:"BG,omitempty"` - - CS *CountryNameType `xml:"CS,omitempty"` - - DA *CountryNameType `xml:"DA,omitempty"` - - EL *CountryNameType `xml:"EL,omitempty"` - - ES *CountryNameType `xml:"ES,omitempty"` - - ET *CountryNameType `xml:"ET,omitempty"` - - FI *CountryNameType `xml:"FI,omitempty"` - - HU *CountryNameType `xml:"HU,omitempty"` - - IT *CountryNameType `xml:"IT,omitempty"` - - LT *CountryNameType `xml:"LT,omitempty"` - - LV *CountryNameType `xml:"LV,omitempty"` - - PL *CountryNameType `xml:"PL,omitempty"` - - PT *CountryNameType `xml:"PT,omitempty"` - - RO *CountryNameType `xml:"RO,omitempty"` - - SK *CountryNameType `xml:"SK,omitempty"` - - SL *CountryNameType `xml:"SL,omitempty"` - - SV *CountryNameType `xml:"SV,omitempty"` - - HR *CountryNameType `xml:"HR,omitempty"` - - RU *CountryNameType `xml:"RU,omitempty"` - - SR *CountryNameType `xml:"SR,omitempty"` - } `xml:"name,omitempty"` - - Source *SourceType `xml:"source,omitempty"` - - Remarks *RemarksType `xml:"remarks,omitempty"` - - Version *RefrecVersionType `xml:"version,omitempty"` - - Erased *ErasedType `xml:"erased,omitempty"` - - Lastupdate *LastupdateType `xml:"lastupdate,omitempty"` -} - -type RefWeb interface { - - // Error can be either of the following types: - // - // - exception - - MatchByCode(request *MatchByCode) (*MatchByCodeResponse, error) - - // Error can be either of the following types: - // - // - exception - - MatchByName(request *MatchByName) (*MatchByNameResponse, error) - - // Error can be either of the following types: - // - // - exception - - GetMutations(request *GetMutations) (*GetMutationsResponse, error) - - // Error can be either of the following types: - // - // - exception - - GetDataXML(request *GetDataXML) (*GetDataXMLResponse, error) - - // Error can be either of the following types: - // - // - exception - - GetRisDataXML(request *GetRisDataXML) (*GetRisDataXMLResponse, error) - - // Error can be either of the following types: - // - // - exception - - MutateDataXML(request *MutateDataXML) (*MutateDataXMLResponse, error) - - // Error can be either of the following types: - // - // - exception - - RequestMutationXML(request *RequestMutationXML) (*RequestMutationXMLResponse, error) -} - -type refWeb struct { - client *soap.SOAPClient -} - -func NewRefService(url string, tls bool, auth *soap.BasicAuth) RefWeb { - return NewRefWeb(soap.NewSOAPClient(url, tls, auth)) -} - -func NewRefWeb(client *soap.SOAPClient) RefWeb { - return &refWeb{ - client: client, - } -} - -func (service *refWeb) MatchByCode(request *MatchByCode) (*MatchByCodeResponse, error) { - response := new(MatchByCodeResponse) - err := service.client.Call("", request, response) - if err != nil { - return nil, err - } - - return response, nil -} - -func (service *refWeb) MatchByName(request *MatchByName) (*MatchByNameResponse, error) { - response := new(MatchByNameResponse) - err := service.client.Call("", request, response) - if err != nil { - return nil, err - } - - return response, nil -} - -func (service *refWeb) GetMutations(request *GetMutations) (*GetMutationsResponse, error) { - response := new(GetMutationsResponse) - err := service.client.Call("", request, response) - if err != nil { - return nil, err - } - - return response, nil -} - -func (service *refWeb) GetDataXML(request *GetDataXML) (*GetDataXMLResponse, error) { - response := new(GetDataXMLResponse) - err := service.client.Call("", request, response) - if err != nil { - return nil, err - } - - return response, nil -} - -func (service *refWeb) GetRisDataXML(request *GetRisDataXML) (*GetRisDataXMLResponse, error) { - response := new(GetRisDataXMLResponse) - err := service.client.Call("", request, response) - if err != nil { - return nil, err - } - - return response, nil -} - -func (service *refWeb) MutateDataXML(request *MutateDataXML) (*MutateDataXMLResponse, error) { - response := new(MutateDataXMLResponse) - err := service.client.Call("", request, response) - if err != nil { - return nil, err - } - - return response, nil -} - -func (service *refWeb) RequestMutationXML(request *RequestMutationXML) (*RequestMutationXMLResponse, error) { - response := new(RequestMutationXMLResponse) - err := service.client.Call("", request, response) - if err != nil { - return nil, err - } - - return response, nil -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/soap/erdms2/service.go Thu Dec 22 18:31:34 2022 +0100 @@ -0,0 +1,1869 @@ +// This is Free Software under GNU Affero General Public License v >= 3.0 +// without warranty, see README.md and license for details. +// +// SPDX-License-Identifier: AGPL-3.0-or-later +// License-Filename: LICENSES/AGPL-3.0.txt +// +// Copyright (C) 2018 by via donau +// – Österreichische Wasserstraßen-Gesellschaft mbH +// Software engineering by Intevation GmbH +// +// Author(s): +// * Sascha L. Teichmann <sascha.teichmann@intevation.de> + +package erdms2 + +import ( + "context" + "encoding/xml" + + "gemma.intevation.de/gemma/pkg/soap" +) + +type AnyType struct { + InnerXML string `xml:",innerxml"` +} + +type AnyURI string + +type NCName string + +// adn (dgs goods) internal adn code (unnr + seqnr: to +// make each adn good unique) +// + +type AdnCodeType string + +// adn class and classifications codes +// + +type AdnClassType string + +type AdnClassIfType string + +type AdnImoClassType string + +// adn (dgs) labels applicable for a dgs good +// + +type AdnLabelType string + +// adn aquatic toxicity, tanker transports (indication +// for dgs, usuallly liquids) +// + +type AquaticToxicityType string + +// Older CBS (number) code (3 digits) use by +// statistics organisations (backw comp) but replaced by newer iso 3166 +// (2 letters). +// + +type CbscountryCodeType string + +// adn chemical stability (indication), tanker +// transports +// + +type ChemicalStabilityType string + +// adn CMR properties (tanker transports) +// + +type CmrPropertyType string + +// iso 6346 container type (code) + +type ContIdType string + +// containertype textual description +// + +type ContNameType string + +// indication (flag) wheater shiptype code is a single +// ship or a transport combination +// + +type CombinationFlagType bool + +// Country iso 3166 code (2 alpha) + +type CountryCodeType string + +// Country iso 3166 code (3 alpha) + +type CountryCode3Type string + +// Countryname type (name of the country) +// + +type CountryNameType string + +// Country iso 3166 numcode (3 digits) +// + +type CountryIsoNumType string + +// techn directive craft type code (eu hull db) +// + +type CraftTypeType string + +// inland cones 0,1,2,3,V (as used for DGS goods and +// cones calculations) +// + +type ConesType string + +const ( + ConesType0 ConesType = "0" + + ConesType1 ConesType = "1" + + ConesType2 ConesType = "2" + + ConesType3 ConesType = "3" + + ConesTypeV ConesType = "V" +) + +// dimension type (length, width, draught etc) in [cm] +// (no decimals) +// + +type DimType int64 + +// older 2 digit dvk shiptype code (replaced by unrec) +// + +type DvkTypeType string + +// record erased (not actual anymore) flag type +// + +type ErasedType bool + +// eri location code type as used for eri_locations +// + +type ErilocCodeType string + +// eri location name type as used in eri_locations +// + +type ErilocNameType string + +// flags 0,B,V (dang goods indication seagoing +// vessels) +// + +type FlagsType string + +const ( + FlagsType0 FlagsType = "0" + + FlagsTypeB FlagsType = "B" + + FlagsTypeV FlagsType = "V" +) + +// adn floater or sinker (indication), tanker +// transports +// + +type FloatersinkerType string + +// fairway code (text) + +type FwCodeType string + +// ADN dangerous goodnames, description +// + +type AdnCodeNameType string + +// non-dangerous goodnames, description +// + +type HsCodeNameType string + +// ADN dangerous good synonym name,description +// + +type GoodSynType string + +// HS code as used by customs + +type HsCodeType string + +// hectometre code (hectomere in [hm] (no decimals) on +// the fairway) +// + +type KmCodeType string + +// lastupdate, last modification date time of this +// record +// + +type LastupdateType = soap.XSDDateTime + +// one of the supported languages (basic and +// additional set), based on ISO 639-1 +// + +type LangType string + +const ( + LangTypeEmptyString LangType = "%%" + + LangTypeLc LangType = "lc" + + LangTypeNl LangType = "nl" + + LangTypeDe LangType = "de" + + LangTypeFr LangType = "fr" + + LangTypeEn LangType = "en" + + LangTypeBg LangType = "bg" + + LangTypeCs LangType = "cs" + + LangTypeDa LangType = "da" + + LangTypeEl LangType = "el" + + LangTypeEs LangType = "es" + + LangTypeEt LangType = "et" + + LangTypeFi LangType = "fi" + + LangTypeHu LangType = "hu" + + LangTypeIt LangType = "it" + + LangTypeLt LangType = "lt" + + LangTypeLv LangType = "lv" + + LangTypePl LangType = "pl" + + LangTypePt LangType = "pt" + + LangTypeRo LangType = "ro" + + LangTypeSk LangType = "sk" + + LangTypeSl LangType = "sl" + + LangTypeSv LangType = "sv" + + LangTypeHr LangType = "hr" + + LangTypeRu LangType = "ru" + + LangTypeSr LangType = "sr" +) + +// lat long (WGS decimal [.] coordinates) coordinate +// type +// + +type LatlonType float64 + +// un locode (2 country + 3 location code) +// + +type LoCodeType string + +// Number of possible (departure) exist (routes) for a +// location +// + +type LocExitsType int32 + +type LocExitsCodeType string + +type LocSbbLoCodeType string + +type LocSbbCodeType string + +// location type, terminal type (a number indicating +// type of location,terminal) +// + +type LocTypeType int32 + +// lloyds flag code for a certain country (seagoing) +// + +type LloydsflagType string + +// NST code (corresponing nst2007 EU statistics codes +// for goods). +// + +type NstCodeType string + +// NtS (Notices to Skippers) code/Value datatype +// + +type NtsCodeType string + +// NtS name/description (belonging to a ntsCode) +// datatype +// + +type NtsNameType string + +// NtS subtype (sub data type, there are several nts +// tables) +// + +type NtstypeType string + +// ADN dangerous good packing group I, II, III +// + +type PackGrpType string + +// UN rec 21 inner package code + +type PackIdType string + +// Un rec 21 inner package name/description +// + +type PackNameType string + +type IvsType string + +// VTS/IVS code = Provider ID active in certain area +// and acting as a reporting point = receiving system (when departing +// from that location) +// + +type ProviderIdType string + +type IvsNameType string + +type IvsTermType string + +type IvsReportType bool + +// quay type (terminals), indicating quay nrs/id's +// + +type QuayType string + +// record counter (nr of records available or in a +// set) +// + +type RecCountType int64 + +// reftype Type (reftool data reftype, such as: +// risidx, eri_location, eri_hscode, nts_data) +// + +type ReftypeType string + +const ( + ReftypeTypeRis_idx ReftypeType = "ris_idx" + + ReftypeTypeEri_location ReftypeType = "eri_location" + + ReftypeTypeEri_hscode ReftypeType = "eri_hscode" + + ReftypeTypeEri_adncode ReftypeType = "eri_adncode" + + ReftypeTypeEri_conttype ReftypeType = "eri_conttype" + + ReftypeTypeEri_packtype ReftypeType = "eri_packtype" + + ReftypeTypeEri_shiptype ReftypeType = "eri_shiptype" + + ReftypeTypeEri_country ReftypeType = "eri_country" + + ReftypeTypeEri_error_code_erirsp ReftypeType = "eri_error_code_erirsp" + + ReftypeTypeNts_barrage ReftypeType = "nts_barrage" + + ReftypeTypeNts_communication ReftypeType = "nts_communication" + + ReftypeTypeNts_country ReftypeType = "nts_country" + + ReftypeTypeNts_dimension_code ReftypeType = "nts_dimension_code" + + ReftypeTypeNts_direction ReftypeType = "nts_direction" + + ReftypeTypeNts_direction_max ReftypeType = "nts_direction_max" + + ReftypeTypeNts_direction_min ReftypeType = "nts_direction_min" + + ReftypeTypeNts_gui_labels ReftypeType = "nts_gui_labels" + + ReftypeTypeNts_ice_accessibility ReftypeType = "nts_ice_accessibility" + + ReftypeTypeNts_ice_condition ReftypeType = "nts_ice_condition" + + ReftypeTypeNts_ice_classification ReftypeType = "nts_ice_classification" + + ReftypeTypeNts_ice_situation ReftypeType = "nts_ice_situation" + + ReftypeTypeNts_indication ReftypeType = "nts_indication" + + ReftypeTypeNts_interval ReftypeType = "nts_interval" + + ReftypeTypeNts_language ReftypeType = "nts_language" + + ReftypeTypeNts_limitation ReftypeType = "nts_limitation" + + ReftypeTypeNts_measure ReftypeType = "nts_measure" + + ReftypeTypeNts_position ReftypeType = "nts_position" + + ReftypeTypeNts_reason ReftypeType = "nts_reason" + + ReftypeTypeNts_reference ReftypeType = "nts_reference" + + ReftypeTypeNts_regime ReftypeType = "nts_regime" + + ReftypeTypeNts_reporting ReftypeType = "nts_reporting" + + ReftypeTypeNts_subject ReftypeType = "nts_subject" + + ReftypeTypeNts_tag ReftypeType = "nts_tag" + + ReftypeTypeNts_target_group ReftypeType = "nts_target_group" + + ReftypeTypeNts_type ReftypeType = "nts_type" + + ReftypeTypeNts_weather_category ReftypeType = "nts_weather_category" + + ReftypeTypeNts_weather_class ReftypeType = "nts_weather_class" + + ReftypeTypeNts_weather_direction ReftypeType = "nts_weather_direction" + + ReftypeTypeNts_weather_item ReftypeType = "nts_weather_item" +) + +// RefData record version numbering (automaically, +// starts with 1 and increments on updates, requesting version 0=dont +// care) +// + +type RefrecVersionType int64 + +// remarks string (remarks about the maintance of a +// record or any other remarks) +// + +type RemarksType string + +// return status info string + +type ReturnStatusType string + +// ris idx applicability from / to km (in hectometres +// (no decimals)) +// + +type RisapplikmType int64 + +// ris index (ISRS) code type (full ris index code) +// + +type RisCodeType string + +// ris idx communication information TXTDSC +// + +type RiscomminfoType string + +// ris idx category of time schedule (cattab) +// + +type RiscatoftimeschedType string + +// ris idx for ship type + +type RisforshiptypeType string + +// ris idx national Gauge Code type (can be utilised +// to store any national coding/id/link for gauges) +// + +type RisgaugeidType string + +// ris idx geod reference + +type RisgeodrefType string + +// ris idx link to external XML file +// + +type RislinkextxmlType string + +// locationames as used in the ris index +// + +type RislocNameType string + +// ris idx object code type (single code for a +// junction, termcode etc padded), subpart of the ris idx. +// + +type RisobjCodeType string + +// ris idx object function code type (junction, berths +// etc) +// + +type RisobjfuncType string + +// ris idx position on the fairway code +// + +type RispostionCodeType string + +// ris idx related ENC's type as used in ris idx (list +// of ENC id's) +// + +type RisrelencType string + +// route names, descriptions as used in the ris index +// + +type RisrouteNameType string + +// ris idx section node id + +type RissectnodeType string + +// ris idx reference level code (indicating the ref +// level) +// + +type RisreflevelcodeType string + +// ris idx reference level value [cm] +// + +type RisreflevelvalueType int64 + +// ris idx use of ship useshp + +type RisuseofshipType string + +// ris idx zero point [cm] + +type RiszeropointType int64 + +// UNrec 28 shiptype (4 digits) + +type ShipTypeType string + +// shiptype name (textual) description +// + +type ShiptypeNameType string + +// source string, to specify the source of this +// record/data or the update. +// + +type SourceType string + +// ADN signal code (to group dgs for cones/flags +// calculations) +// + +type SignalCodeType string + +// terminal code type (remark: termcode is the only +// part of eri locs with variable length, historical reasons). +// + +type TermCodeType string + +// unlocode countrycode part (first 2 of unlocode) as +// used in ris idx +// + +type UnlocCCType string + +// unlocode location code part (last 3 of unlocode) as +// used in ris idx +// + +type UnlocLCType string + +// UN nr (4 digits) adn nr for identifying ADN +// dangerous goods (according CCNR) +// + +type UnnrType string + +// Username which makes the call +// + +type UserNameType string + +// cargo weight type, integer nr (units [tons], [kg]) +// depending on element) +// + +type WeightType int64 + +// adn warning (dgs) card id + +type WarnIdType string + +// adn warning card + +type WarnCardType string + +// +// Page code, last record id in given page +// + +type PageCodeType string + +type PageSizeType uint32 + +type EcErrorCodeType string + +type EcErrorGroupType uint32 + +type EcNameType string + +type NtsIceConditionCodeThicknessType string + +type AggrStatusType string + +type TechNameType uint32 + +type MatchByCode struct { + XMLName xml.Name `xml:"http://rwsreftool/ matchByCode"` + + *MatchByCodeType +} + +type MatchByCodeResponse struct { + XMLName xml.Name `xml:"http://rwsreftool/ matchByCodeResponse"` + + *MatchByCodeResponseType +} + +type MatchByName struct { + XMLName xml.Name `xml:"http://rwsreftool/ matchByName"` + + *MatchByNameType +} + +type MatchByNameResponse struct { + XMLName xml.Name `xml:"http://rwsreftool/ matchByNameResponse"` + + *MatchByNameResponseType +} + +type GetDataXML struct { + XMLName xml.Name `xml:"http://rwsreftool/ getDataXML"` + + *GetDataXMLType +} + +type GetDataXMLResponse struct { + XMLName xml.Name `xml:"http://rwsreftool/ getDataXMLResponse"` + + *GetDataXMLResponseType +} + +type GetMutatedTables struct { + XMLName xml.Name `xml:"http://rwsreftool/ getMutatedTables"` + + *GetMutatedTablesType +} + +type GetMutatedTablesResponse struct { + XMLName xml.Name `xml:"http://rwsreftool/ getMutatedTablesResponse"` + + *GetMutatedTablesResponseType +} + +type GetMutations struct { + XMLName xml.Name `xml:"http://rwsreftool/ getMutations"` + + *GetMutationsType +} + +type GetMutationsResponse struct { + XMLName xml.Name `xml:"http://rwsreftool/ getMutationsResponse"` + + *GetMutationsResponseType +} + +type GetRisDataXML struct { + XMLName xml.Name `xml:"http://rwsreftool/ getRisDataXML"` + + *GetRisDataXMLType +} + +type GetRisDataXMLResponse struct { + XMLName xml.Name `xml:"http://rwsreftool/ getRisDataXMLResponse"` + + *GetRisDataXMLResponseType +} + +type MutateDataXML struct { + XMLName xml.Name `xml:"http://rwsreftool/ mutateDataXML"` + + *MutateDataXMLType +} + +type MutateDataXMLResponse struct { + XMLName xml.Name `xml:"http://rwsreftool/ mutateDataXMLResponse"` + + *MutateDataXMLResponseType +} + +type Exception ExceptionType + +type MatchByCodeType struct { + Reftype *ReftypeType `xml:"reftype,omitempty" json:"reftype,omitempty"` + + Code string `xml:"code,omitempty" json:"code,omitempty"` + + Page *PageRequestType `xml:"page,omitempty" json:"page,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` +} + +type MatchByCodeResponseType struct { + PageDetails *PageDetailsType `xml:"pageDetails,omitempty" json:"pageDetails,omitempty"` + + RefdataReturn []*RefdataReturnType `xml:"refdataReturn,omitempty" json:"refdataReturn,omitempty"` +} + +type MatchByNameType struct { + Reftype *ReftypeType `xml:"reftype,omitempty" json:"reftype,omitempty"` + + Lang *LangType `xml:"lang,omitempty" json:"lang,omitempty"` + + Name string `xml:"name,omitempty" json:"name,omitempty"` + + Page *PageRequestType `xml:"page,omitempty" json:"page,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` +} + +type MatchByNameResponseType struct { + PageDetails *PageDetailsType `xml:"pageDetails,omitempty" json:"pageDetails,omitempty"` + + RefdataReturn []*RefdataReturnType `xml:"refdataReturn,omitempty" json:"refdataReturn,omitempty"` +} + +type GetMutatedTablesType struct { + + // fromDate and toDate in datetime format in UTC time + // + FromDate soap.XSDDateTime `xml:"fromDate,omitempty" json:"fromDate,omitempty"` + + ToDate soap.XSDDateTime `xml:"toDate,omitempty" json:"toDate,omitempty"` +} + +type GetMutatedTablesResponseType struct { + + // Indicate how many mutated tables are + // available/were found. + // + RecCount *RecCountType `xml:"recCount,omitempty" json:"recCount,omitempty"` + + // Generic status info field, to return (any) status + // info + // + ReturnStatus *ReturnStatusType `xml:"returnStatus,omitempty" json:"returnStatus,omitempty"` + + MutatedTables []*MutatedTableReturnType `xml:"mutatedTables,omitempty" json:"mutatedTables,omitempty"` +} + +type GetMutationsType struct { + Reftype *ReftypeType `xml:"reftype,omitempty" json:"reftype,omitempty"` + + // from, to in datetime format in UTC time + // + FromDate soap.XSDDateTime `xml:"fromDate,omitempty" json:"fromDate,omitempty"` + + ToDate soap.XSDDateTime `xml:"toDate,omitempty" json:"toDate,omitempty"` + + Page *PageRequestType `xml:"page,omitempty" json:"page,omitempty"` +} + +type GetMutationsResponseType struct { + PageDetails *PageDetailsType `xml:"pageDetails,omitempty" json:"pageDetails,omitempty"` + + RefdataReturn []*RefdataReturnType `xml:"refdataReturn,omitempty" json:"refdataReturn,omitempty"` +} + +type GetDataXMLType struct { + Reftype *ReftypeType `xml:"reftype,omitempty" json:"reftype,omitempty"` + + Page *PageRequestType `xml:"page,omitempty" json:"page,omitempty"` + + Subcode *RisCodeType `xml:"subcode,omitempty" json:"subcode,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` +} + +type GetDataXMLResponseType struct { + PageDetails *PageDetailsType `xml:"pageDetails,omitempty" json:"pageDetails,omitempty"` + + RefdataReturn []*RefdataReturnType `xml:"refdataReturn,omitempty" json:"refdataReturn,omitempty"` +} + +// NoNS is a helper type to allow string tags without a namespace. +type NoNS struct { + NS string `xml:"xmlns,attr"` + Text string `xml:",chardata"` +} + +type GetRisDataXMLType struct { + Funcode *NoNS `xml:"funcode,omitempty" json:"funcode,omitempty"` + + CountryCode *NoNS `xml:"countryCode,omitempty" json:"countryCode,omitempty"` + + Page *PageRequestType `xml:"page,omitempty" json:"page,omitempty"` + + Subcode *NoNS `xml:"subcode,omitempty" json:"subcode,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` +} + +type GetRisDataXMLResponseType struct { + PageDetails *PageDetailsType `xml:"pageDetails,omitempty" json:"pageDetails,omitempty"` + + RisdataReturn []*Ris_idxType `xml:"risdataReturn,omitempty" json:"risdataReturn,omitempty"` +} + +type MutateDataXMLType struct { + Username *UserNameType `xml:"username,omitempty" json:"username,omitempty"` + + RefData *RefdataReturnType `xml:"refData,omitempty" json:"refData,omitempty"` +} + +type MutateDataXMLResponseType struct { + *StatReturnType +} + +type ExceptionType struct { + XMLName xml.Name `xml:"http://rwsreftool/ exception"` + + // exception code + Exception int32 `xml:"exception,omitempty" json:"exception,omitempty"` + + // exception message in English + Message string `xml:"message,omitempty" json:"message,omitempty"` +} + +type RefdataReturnType struct { + Reftype struct { + Value *ReftypeType `xml:",chardata" json:"-,"` + } `xml:"reftype,omitempty" json:"reftype,omitempty"` + + Ris_idx *Ris_idxType `xml:"ris_idx,omitempty" json:"ris_idx,omitempty"` + + Eri_location *Eri_locationType `xml:"eri_location,omitempty" json:"eri_location,omitempty"` + + Eri_hscode *Eri_hscodeType `xml:"eri_hscode,omitempty" json:"eri_hscode,omitempty"` + + Eri_adncode *Eri_adncodeType `xml:"eri_adncode,omitempty" json:"eri_adncode,omitempty"` + + Eri_conttype *Eri_conttypeType `xml:"eri_conttype,omitempty" json:"eri_conttype,omitempty"` + + Eri_packtype *Eri_packtypeType `xml:"eri_packtype,omitempty" json:"eri_packtype,omitempty"` + + Eri_shiptype *Eri_shiptypeType `xml:"eri_shiptype,omitempty" json:"eri_shiptype,omitempty"` + + Eri_country *Eri_countryType `xml:"eri_country,omitempty" json:"eri_country,omitempty"` + + Eri_errorCodeRsp *Eri_errorCodeRspType `xml:"eri_errorCodeRsp,omitempty" json:"eri_errorCodeRsp,omitempty"` + + // NtS element is only available in the return + // refdata structure. + // It is not available in the Req Mutation datastructure because we + // can not mutate nts data (not allowed)! + // + Nts_data *Nts_dataType `xml:"nts_data,omitempty" json:"nts_data,omitempty"` +} + +type MutatedTableReturnType struct { + XMLName xml.Name `xml:"http://rwsreftool/ mutatedTables"` + + // This table (refType) has mutations (>0) + // + RefType *ReftypeType `xml:"refType,omitempty" json:"refType,omitempty"` + + // Indicates how many (>0) mutations (records) are + // available for THIS table. + // + RecCount *RecCountType `xml:"recCount,omitempty" json:"recCount,omitempty"` +} + +type StatReturnType struct { + + // 0=ok, 1=warning, 2=error + + Err int32 `xml:"err,omitempty" json:"err,omitempty"` + + Message struct { + } `xml:"message,omitempty" json:"message,omitempty"` +} + +type Ris_idxType struct { + RisidxCode *RisCodeType `xml:"risidxCode,omitempty" json:"risidxCode,omitempty"` + + CodeOld *RisCodeType `xml:"codeOld,omitempty" json:"codeOld,omitempty"` + + UnlocCC *UnlocCCType `xml:"unlocCC,omitempty" json:"unlocCC,omitempty"` + + UnlocLC *UnlocLCType `xml:"unlocLC,omitempty" json:"unlocLC,omitempty"` + + WwsectCode *FwCodeType `xml:"wwsectCode,omitempty" json:"wwsectCode,omitempty"` + + Objcode *RisobjCodeType `xml:"objcode,omitempty" json:"objcode,omitempty"` + + Hectomt *KmCodeType `xml:"hectomt,omitempty" json:"hectomt,omitempty"` + + Objfunc *RisobjfuncType `xml:"objfunc,omitempty" json:"objfunc,omitempty"` + + Objname struct { + + // Without diacritics (to be used in EDIfact + // msgs) + // + Loc *RislocNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + // in UTF8 + LocNational *RislocNameType `xml:"locNational,omitempty" json:"locNational,omitempty"` + } `xml:"objname,omitempty" json:"objname,omitempty"` + + Locname struct { + Loc *RislocNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + LocNational *RislocNameType `xml:"locNational,omitempty" json:"locNational,omitempty"` + } `xml:"locname,omitempty" json:"locname,omitempty"` + + Wwname struct { + Loc *RislocNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + LocNational *RislocNameType `xml:"locNational,omitempty" json:"locNational,omitempty"` + } `xml:"wwname,omitempty" json:"wwname,omitempty"` + + Routename struct { + Loc *RisrouteNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + LocNational *RisrouteNameType `xml:"locNational,omitempty" json:"locNational,omitempty"` + } `xml:"routename,omitempty" json:"routename,omitempty"` + + PositionCode *RispostionCodeType `xml:"positionCode,omitempty" json:"positionCode,omitempty"` + + Relrisindex *RisCodeType `xml:"relrisindex,omitempty" json:"relrisindex,omitempty"` + + Sectionnode *RissectnodeType `xml:"sectionnode,omitempty" json:"sectionnode,omitempty"` + + Lat *LatlonType `xml:"lat,omitempty" json:"lat,omitempty"` + + Lon *LatlonType `xml:"lon,omitempty" json:"lon,omitempty"` + + Relenc *RisrelencType `xml:"relenc,omitempty" json:"relenc,omitempty"` + + Comminfo *RiscomminfoType `xml:"comminfo,omitempty" json:"comminfo,omitempty"` + + Gaugeid *RisgaugeidType `xml:"gaugeid,omitempty" json:"gaugeid,omitempty"` + + Vesselconvlength *DimType `xml:"vesselconvlength,omitempty" json:"vesselconvlength,omitempty"` + + Vesselconvbreadth *DimType `xml:"vesselconvbreadth,omitempty" json:"vesselconvbreadth,omitempty"` + + Vesselconvdraught *DimType `xml:"vesselconvdraught,omitempty" json:"vesselconvdraught,omitempty"` + + Vesselconvairdraught *DimType `xml:"vesselconvairdraught,omitempty" json:"vesselconvairdraught,omitempty"` + + Availablelength *DimType `xml:"availablelength,omitempty" json:"availablelength,omitempty"` + + Clearancewidth *DimType `xml:"clearancewidth,omitempty" json:"clearancewidth,omitempty"` + + Availabledepthcode *RisreflevelcodeType `xml:"availabledepthcode,omitempty" json:"availabledepthcode,omitempty"` + + Availabledepth *DimType `xml:"availabledepth,omitempty" json:"availabledepth,omitempty"` + + Clearanceheightcode *RisreflevelcodeType `xml:"clearanceheightcode,omitempty" json:"clearanceheightcode,omitempty"` + + Clearanceheight *DimType `xml:"clearanceheight,omitempty" json:"clearanceheight,omitempty"` + + ReferencegaugeISRS *RisCodeType `xml:"referencegaugeISRS,omitempty" json:"referencegaugeISRS,omitempty"` + + Applicabilityfromkm *RisapplikmType `xml:"applicabilityfromkm,omitempty" json:"applicabilityfromkm,omitempty"` + + Applicabilitytokm *RisapplikmType `xml:"applicabilitytokm,omitempty" json:"applicabilitytokm,omitempty"` + + Reflevel1code *RisreflevelcodeType `xml:"reflevel1code,omitempty" json:"reflevel1code,omitempty"` + + Reflevel1value *RisreflevelvalueType `xml:"reflevel1value,omitempty" json:"reflevel1value,omitempty"` + + Reflevel2code *RisreflevelcodeType `xml:"reflevel2code,omitempty" json:"reflevel2code,omitempty"` + + Reflevel2value *RisreflevelvalueType `xml:"reflevel2value,omitempty" json:"reflevel2value,omitempty"` + + Reflevel3code *RisreflevelcodeType `xml:"reflevel3code,omitempty" json:"reflevel3code,omitempty"` + + Reflevel3value *RisreflevelvalueType `xml:"reflevel3value,omitempty" json:"reflevel3value,omitempty"` + + Zeropoint *RiszeropointType `xml:"zeropoint,omitempty" json:"zeropoint,omitempty"` + + Geodref *RisgeodrefType `xml:"geodref,omitempty" json:"geodref,omitempty"` + + Catoftimesched *RiscatoftimeschedType `xml:"catoftimesched,omitempty" json:"catoftimesched,omitempty"` + + Forshiptype *RisforshiptypeType `xml:"forshiptype,omitempty" json:"forshiptype,omitempty"` + + Foruseofship *RisuseofshipType `xml:"foruseofship,omitempty" json:"foruseofship,omitempty"` + + LnktoextXMfiletimesched *RislinkextxmlType `xml:"lnktoextXMfiletimesched,omitempty" json:"lnktoextXMfiletimesched,omitempty"` + + LnktoextXMfilepastime *RislinkextxmlType `xml:"lnktoextXMfilepastime,omitempty" json:"lnktoextXMfilepastime,omitempty"` + + Vesselconvlength2 *DimType `xml:"vesselconvlength2,omitempty" json:"vesselconvlength2,omitempty"` + + Vesselconvbreadth2 *DimType `xml:"vesselconvbreadth2,omitempty" json:"vesselconvbreadth2,omitempty"` + + Vesselconvdraught2 *DimType `xml:"vesselconvdraught2,omitempty" json:"vesselconvdraught2,omitempty"` + + Vesselconvairdraught2 *DimType `xml:"vesselconvairdraught2,omitempty" json:"vesselconvairdraught2,omitempty"` + + Availablelength2 *DimType `xml:"availablelength2,omitempty" json:"availablelength2,omitempty"` + + Clearancewidth2 *DimType `xml:"clearancewidth2,omitempty" json:"clearancewidth2,omitempty"` + + Availabledepth2code *RisreflevelcodeType `xml:"availabledepth2code,omitempty" json:"availabledepth2code,omitempty"` + + Availabledepth2 *DimType `xml:"availabledepth2,omitempty" json:"availabledepth2,omitempty"` + + Clearanceheight2code *RisreflevelcodeType `xml:"clearanceheight2code,omitempty" json:"clearanceheight2code,omitempty"` + + Clearanceheight2 *DimType `xml:"clearanceheight2,omitempty" json:"clearanceheight2,omitempty"` + + Referencegauge2ISRS *RisCodeType `xml:"referencegauge2ISRS,omitempty" json:"referencegauge2ISRS,omitempty"` + + Vesselconvlength3 *DimType `xml:"vesselconvlength3,omitempty" json:"vesselconvlength3,omitempty"` + + Vesselconvbreadth3 *DimType `xml:"vesselconvbreadth3,omitempty" json:"vesselconvbreadth3,omitempty"` + + Vesselconvdraught3 *DimType `xml:"vesselconvdraught3,omitempty" json:"vesselconvdraught3,omitempty"` + + Vesselconvairdraught3 *DimType `xml:"vesselconvairdraught3,omitempty" json:"vesselconvairdraught3,omitempty"` + + Availablelength3 *DimType `xml:"availablelength3,omitempty" json:"availablelength3,omitempty"` + + Clearancewidth3 *DimType `xml:"clearancewidth3,omitempty" json:"clearancewidth3,omitempty"` + + Availabledepth3code *RisreflevelcodeType `xml:"availabledepth3code,omitempty" json:"availabledepth3code,omitempty"` + + Availabledepth3 *DimType `xml:"availabledepth3,omitempty" json:"availabledepth3,omitempty"` + + Clearanceheight3code *RisreflevelcodeType `xml:"clearanceheight3code,omitempty" json:"clearanceheight3code,omitempty"` + + Clearanceheight3 *DimType `xml:"clearanceheight3,omitempty" json:"clearanceheight3,omitempty"` + + Referencegauge3ISRS *RisCodeType `xml:"referencegauge3ISRS,omitempty" json:"referencegauge3ISRS,omitempty"` + + Catoftimesched2 *RiscatoftimeschedType `xml:"catoftimesched2,omitempty" json:"catoftimesched2,omitempty"` + + Forshiptype2 *RisforshiptypeType `xml:"forshiptype2,omitempty" json:"forshiptype2,omitempty"` + + Foruseofship2 *RisuseofshipType `xml:"foruseofship2,omitempty" json:"foruseofship2,omitempty"` + + LnktoextXMfiletimesched2 *RislinkextxmlType `xml:"lnktoextXMfiletimesched2,omitempty" json:"lnktoextXMfiletimesched2,omitempty"` + + LnktoextXMfilepastime2 *RislinkextxmlType `xml:"lnktoextXMfilepastime2,omitempty" json:"lnktoextXMfilepastime2,omitempty"` + + Catoftimesched3 *RiscatoftimeschedType `xml:"catoftimesched3,omitempty" json:"catoftimesched3,omitempty"` + + Forshiptype3 *RisforshiptypeType `xml:"forshiptype3,omitempty" json:"forshiptype3,omitempty"` + + Foruseofship3 *RisuseofshipType `xml:"foruseofship3,omitempty" json:"foruseofship3,omitempty"` + + LnktoextXMfiletimesched3 *RislinkextxmlType `xml:"lnktoextXMfiletimesched3,omitempty" json:"lnktoextXMfiletimesched3,omitempty"` + + LnktoextXMfilepastime3 *RislinkextxmlType `xml:"lnktoextXMfilepastime3,omitempty" json:"lnktoextXMfilepastime3,omitempty"` + + Startdate *LastupdateType `xml:"startdate,omitempty" json:"startdate,omitempty"` + + Enddate *LastupdateType `xml:"enddate,omitempty" json:"enddate,omitempty"` + + Infodate *LastupdateType `xml:"infodate,omitempty" json:"infodate,omitempty"` + + // specific (RIS) source of this information + // + RisidxSource *RemarksType `xml:"risidxSource,omitempty" json:"risidxSource,omitempty"` + + // specific Ris idx remarks, reasons for change + // (descriptions as received with the ris idx) + // + RisidxRemarks *RemarksType `xml:"risidxRemarks,omitempty" json:"risidxRemarks,omitempty"` + + // source of mutation + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + // remarks regarding the maintance of the ris idx + // + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type Eri_locationType struct { + XMLName xml.Name `xml:"http://rwsreftool/ eri_location"` + + ErilocCode *ErilocCodeType `xml:"erilocCode,omitempty" json:"erilocCode,omitempty"` + + CodeOld *ErilocCodeType `xml:"codeOld,omitempty" json:"codeOld,omitempty"` + + RisCode *RisCodeType `xml:"risCode,omitempty" json:"risCode,omitempty"` + + LoCode *LoCodeType `xml:"loCode,omitempty" json:"loCode,omitempty"` + + FwCode *FwCodeType `xml:"fwCode,omitempty" json:"fwCode,omitempty"` + + KmCode *KmCodeType `xml:"kmCode,omitempty" json:"kmCode,omitempty"` + + Name struct { + Loc *ErilocNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + NL *ErilocNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *ErilocNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *ErilocNameType `xml:"FR,omitempty" json:"FR,omitempty"` + + EN *ErilocNameType `xml:"EN,omitempty" json:"EN,omitempty"` + } `xml:"name,omitempty" json:"name,omitempty"` + + LocType *LocTypeType `xml:"locType,omitempty" json:"locType,omitempty"` + + Lat *LatlonType `xml:"lat,omitempty" json:"lat,omitempty"` + + Lon *LatlonType `xml:"lon,omitempty" json:"lon,omitempty"` + + TermCode *TermCodeType `xml:"termCode,omitempty" json:"termCode,omitempty"` + + Termname struct { + Loc *ErilocNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + NL *ErilocNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *ErilocNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *ErilocNameType `xml:"FR,omitempty" json:"FR,omitempty"` + + EN *ErilocNameType `xml:"EN,omitempty" json:"EN,omitempty"` + } `xml:"termname,omitempty" json:"termname,omitempty"` + + TermType *LocTypeType `xml:"termType,omitempty" json:"termType,omitempty"` + + QuayFrom *QuayType `xml:"quayFrom,omitempty" json:"quayFrom,omitempty"` + + QuayTo *QuayType `xml:"quayTo,omitempty" json:"quayTo,omitempty"` + + Ivs *IvsType `xml:"ivs,omitempty" json:"ivs,omitempty"` + + // VTS/IVS (code) acting as the default reporting + // (receiving) point (when departing from this location) + // + IvsVTSCode *ProviderIdType `xml:"ivsVTSCode,omitempty" json:"ivsVTSCode,omitempty"` + + IvsName *IvsNameType `xml:"ivsName,omitempty" json:"ivsName,omitempty"` + + IvsTerm *IvsTermType `xml:"ivsTerm,omitempty" json:"ivsTerm,omitempty"` + + IvsReport *IvsReportType `xml:"ivsReport,omitempty" json:"ivsReport,omitempty"` + + // Nr of possible exits (routes) when departing from + // this location >1 means a reporting or routepoint has to be + // specified. + // + Exits *LocExitsType `xml:"exits,omitempty" json:"exits,omitempty"` + + Exit0 *LocExitsCodeType `xml:"exit0,omitempty" json:"exit0,omitempty"` + + Exit1 *LocExitsCodeType `xml:"exit1,omitempty" json:"exit1,omitempty"` + + Exit2 *LocExitsCodeType `xml:"exit2,omitempty" json:"exit2,omitempty"` + + Exit3 *LocExitsCodeType `xml:"exit3,omitempty" json:"exit3,omitempty"` + + Exit4 *LocExitsCodeType `xml:"exit4,omitempty" json:"exit4,omitempty"` + + Exit5 *LocExitsCodeType `xml:"exit5,omitempty" json:"exit5,omitempty"` + + Exit6 *LocExitsCodeType `xml:"exit6,omitempty" json:"exit6,omitempty"` + + Exit7 *LocExitsCodeType `xml:"exit7,omitempty" json:"exit7,omitempty"` + + Exit8 *LocExitsCodeType `xml:"exit8,omitempty" json:"exit8,omitempty"` + + Exit9 *LocExitsCodeType `xml:"exit9,omitempty" json:"exit9,omitempty"` + + SbbLoCode *LocSbbLoCodeType `xml:"sbbLoCode,omitempty" json:"sbbLoCode,omitempty"` + + SbbCode *LocSbbCodeType `xml:"sbbCode,omitempty" json:"sbbCode,omitempty"` + + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type Eri_hscodeType struct { + XMLName xml.Name `xml:"http://rwsreftool/ eri_hscode"` + + // Harmonised System type + HsCode *HsCodeType `xml:"hsCode,omitempty" json:"hsCode,omitempty"` + + CodeOld *HsCodeType `xml:"codeOld,omitempty" json:"codeOld,omitempty"` + + Name struct { + Loc *HsCodeNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + EN *HsCodeNameType `xml:"EN,omitempty" json:"EN,omitempty"` + + NL *HsCodeNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *HsCodeNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *HsCodeNameType `xml:"FR,omitempty" json:"FR,omitempty"` + } `xml:"name,omitempty" json:"name,omitempty"` + + NstCode *NstCodeType `xml:"nstCode,omitempty" json:"nstCode,omitempty"` + + // English (NST2007) description. + NstName *HsCodeNameType `xml:"nstName,omitempty" json:"nstName,omitempty"` + + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type Eri_adncodeType struct { + XMLName xml.Name `xml:"http://rwsreftool/ eri_adncode"` + + // Be sure to edit, change the basic Simpletypes, + // dont edit any of the (sub)elements from here!!! + // + AdnCode *AdnCodeType `xml:"adnCode,omitempty" json:"adnCode,omitempty"` + + CodeOld *AdnCodeType `xml:"codeOld,omitempty" json:"codeOld,omitempty"` + + Unnr *UnnrType `xml:"unnr,omitempty" json:"unnr,omitempty"` + + AdnClass *AdnClassType `xml:"adnClass,omitempty" json:"adnClass,omitempty"` + + AdnClassif *AdnClassIfType `xml:"adnClassif,omitempty" json:"adnClassif,omitempty"` + + ImoClass *AdnImoClassType `xml:"imoClass,omitempty" json:"imoClass,omitempty"` + + PackGrp *PackGrpType `xml:"packGrp,omitempty" json:"packGrp,omitempty"` + + Name struct { + Loc *AdnCodeNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + EN *AdnCodeNameType `xml:"EN,omitempty" json:"EN,omitempty"` + + NL *AdnCodeNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *AdnCodeNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *AdnCodeNameType `xml:"FR,omitempty" json:"FR,omitempty"` + } `xml:"name,omitempty" json:"name,omitempty"` + + Syn struct { + Loc *GoodSynType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + NL *GoodSynType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *GoodSynType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *GoodSynType `xml:"FR,omitempty" json:"FR,omitempty"` + + EN *GoodSynType `xml:"EN,omitempty" json:"EN,omitempty"` + } `xml:"syn,omitempty" json:"syn,omitempty"` + + HsCode *HsCodeType `xml:"hsCode,omitempty" json:"hsCode,omitempty"` + + NstCode *NstCodeType `xml:"nstCode,omitempty" json:"nstCode,omitempty"` + + // 0, 1, 2, 3, V + ConesBulk *ConesType `xml:"conesBulk,omitempty" json:"conesBulk,omitempty"` + + ConesTank *ConesType `xml:"conesTank,omitempty" json:"conesTank,omitempty"` + + ConesCont *ConesType `xml:"conesCont,omitempty" json:"conesCont,omitempty"` + + // 0, B, V + FlagsBulk *FlagsType `xml:"flagsBulk,omitempty" json:"flagsBulk,omitempty"` + + FlagsTank *FlagsType `xml:"flagsTank,omitempty" json:"flagsTank,omitempty"` + + WarnCard *WarnCardType `xml:"warnCard,omitempty" json:"warnCard,omitempty"` + + WarnId *WarnIdType `xml:"warnId,omitempty" json:"warnId,omitempty"` + + Label1 *AdnLabelType `xml:"label1,omitempty" json:"label1,omitempty"` + + Label2 *AdnLabelType `xml:"label2,omitempty" json:"label2,omitempty"` + + Label3 *AdnLabelType `xml:"label3,omitempty" json:"label3,omitempty"` + + Label4 *AdnLabelType `xml:"label4,omitempty" json:"label4,omitempty"` + + AquaticToxicity *AquaticToxicityType `xml:"aquaticToxicity,omitempty" json:"aquaticToxicity,omitempty"` + + ChemicalStability *ChemicalStabilityType `xml:"chemicalStability,omitempty" json:"chemicalStability,omitempty"` + + CmrProperties *CmrPropertyType `xml:"cmrProperties,omitempty" json:"cmrProperties,omitempty"` + + Floater *FloatersinkerType `xml:"floater,omitempty" json:"floater,omitempty"` + + MaxWeightCodeInlandBulkCont *SignalCodeType `xml:"maxWeightCodeInlandBulkCont,omitempty" json:"maxWeightCodeInlandBulkCont,omitempty"` + + // max weight in kg + MaxWeightInlandBulkCont *WeightType `xml:"maxWeightInlandBulkCont,omitempty" json:"maxWeightInlandBulkCont,omitempty"` + + SignalCodeInlandCont *SignalCodeType `xml:"signalCodeInlandCont,omitempty" json:"signalCodeInlandCont,omitempty"` + + // min weight in kg + MinWeightInlandCont *WeightType `xml:"minWeightInlandCont,omitempty" json:"minWeightInlandCont,omitempty"` + + SignalCodeInlandExcemp *SignalCodeType `xml:"signalCodeInlandExcemp,omitempty" json:"signalCodeInlandExcemp,omitempty"` + + // min weight in kg + MinWeightInlandExcemp *WeightType `xml:"minWeightInlandExcemp,omitempty" json:"minWeightInlandExcemp,omitempty"` + + SignalCodeSeaBulk *SignalCodeType `xml:"signalCodeSeaBulk,omitempty" json:"signalCodeSeaBulk,omitempty"` + + // min weight in kg + MinWeightSeaBulk *WeightType `xml:"minWeightSeaBulk,omitempty" json:"minWeightSeaBulk,omitempty"` + + AggrStatus *AggrStatusType `xml:"aggrStatus,omitempty" json:"aggrStatus,omitempty"` + + TechName *TechNameType `xml:"techName,omitempty" json:"techName,omitempty"` + + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type Eri_conttypeType struct { + XMLName xml.Name `xml:"http://rwsreftool/ eri_conttype"` + + ContId *ContIdType `xml:"contId,omitempty" json:"contId,omitempty"` + + CodeOld *ContIdType `xml:"codeOld,omitempty" json:"codeOld,omitempty"` + + // dimensions in cm + Length *DimType `xml:"length,omitempty" json:"length,omitempty"` + + Width *DimType `xml:"width,omitempty" json:"width,omitempty"` + + Height *DimType `xml:"height,omitempty" json:"height,omitempty"` + + // empty weight in kg + Weight *WeightType `xml:"weight,omitempty" json:"weight,omitempty"` + + Name struct { + Loc *ContNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + NL *ContNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *ContNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *ContNameType `xml:"FR,omitempty" json:"FR,omitempty"` + + EN *ContNameType `xml:"EN,omitempty" json:"EN,omitempty"` + } `xml:"name,omitempty" json:"name,omitempty"` + + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type Eri_packtypeType struct { + XMLName xml.Name `xml:"http://rwsreftool/ eri_packtype"` + + PackId *PackIdType `xml:"packId,omitempty" json:"packId,omitempty"` + + CodeOld *PackIdType `xml:"codeOld,omitempty" json:"codeOld,omitempty"` + + Name struct { + Loc *PackNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + EN *PackNameType `xml:"EN,omitempty" json:"EN,omitempty"` + + NL *PackNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *PackNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *PackNameType `xml:"FR,omitempty" json:"FR,omitempty"` + } `xml:"name,omitempty" json:"name,omitempty"` + + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type Eri_shiptypeType struct { + XMLName xml.Name `xml:"http://rwsreftool/ eri_shiptype"` + + ShipType *ShipTypeType `xml:"shipType,omitempty" json:"shipType,omitempty"` + + CodeOld *ShipTypeType `xml:"codeOld,omitempty" json:"codeOld,omitempty"` + + DvkType *DvkTypeType `xml:"dvkType,omitempty" json:"dvkType,omitempty"` + + CraftType *CraftTypeType `xml:"craftType,omitempty" json:"craftType,omitempty"` + + // True = transport cominination type, false=single + // ship + // + Combination *CombinationFlagType `xml:"combination,omitempty" json:"combination,omitempty"` + + Name struct { + Loc *ShiptypeNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + EN *ShiptypeNameType `xml:"EN,omitempty" json:"EN,omitempty"` + + NL *ShiptypeNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *ShiptypeNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *ShiptypeNameType `xml:"FR,omitempty" json:"FR,omitempty"` + } `xml:"name,omitempty" json:"name,omitempty"` + + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type Eri_countryType struct { + XMLName xml.Name `xml:"http://rwsreftool/ eri_country"` + + // UN country ISO code 2 chars. + // + CountryCode *CountryCodeType `xml:"countryCode,omitempty" json:"countryCode,omitempty"` + + CodeOld *CountryCodeType `xml:"codeOld,omitempty" json:"codeOld,omitempty"` + + CbsCode *CbscountryCodeType `xml:"cbsCode,omitempty" json:"cbsCode,omitempty"` + + CountryIsoCode3 *CountryCode3Type `xml:"countryIsoCode3,omitempty" json:"countryIsoCode3,omitempty"` + + CountryIsoNum *CountryIsoNumType `xml:"countryIsoNum,omitempty" json:"countryIsoNum,omitempty"` + + LloydsFlag *LloydsflagType `xml:"lloydsFlag,omitempty" json:"lloydsFlag,omitempty"` + + Name struct { + Loc *CountryNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + EN *CountryNameType `xml:"EN,omitempty" json:"EN,omitempty"` + + NL *CountryNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *CountryNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *CountryNameType `xml:"FR,omitempty" json:"FR,omitempty"` + } `xml:"name,omitempty" json:"name,omitempty"` + + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type Eri_errorCodeRspType struct { + XMLName xml.Name `xml:"http://rwsreftool/ eri_errorCodeRsp"` + + ErrorCode *EcErrorCodeType `xml:"errorCode,omitempty" json:"errorCode,omitempty"` + + ErrorCodeOld *EcErrorCodeType `xml:"errorCodeOld,omitempty" json:"errorCodeOld,omitempty"` + + ErrorGroup *EcErrorGroupType `xml:"errorGroup,omitempty" json:"errorGroup,omitempty"` + + Name struct { + Loc *EcNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + EN *EcNameType `xml:"EN,omitempty" json:"EN,omitempty"` + + NL *EcNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *EcNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + FR *EcNameType `xml:"FR,omitempty" json:"FR,omitempty"` + } `xml:"name,omitempty" json:"name,omitempty"` + + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type NtsIceConditionCodeType struct { + *Nts_dataType + + Thickness *NtsIceConditionCodeThicknessType `xml:"thickness,omitempty" json:"thickness,omitempty"` +} + +type Nts_dataType struct { + XMLName xml.Name `xml:"http://rwsreftool/ nts_data"` + + // Just a string (no enum) to return nts data type + // of the nts_data returned! + // reftype already contains datatype. + // + Ntstype *NtstypeType `xml:"ntstype,omitempty" json:"ntstype,omitempty"` + + Ntscode *NtsCodeType `xml:"ntscode,omitempty" json:"ntscode,omitempty"` + + CodeOld *NtsCodeType `xml:"codeOld,omitempty" json:"codeOld,omitempty"` + + Name struct { + Loc *NtsNameType `xml:"Loc,omitempty" json:"Loc,omitempty"` + + NL *NtsNameType `xml:"NL,omitempty" json:"NL,omitempty"` + + DE *NtsNameType `xml:"DE,omitempty" json:"DE,omitempty"` + + EN *NtsNameType `xml:"EN,omitempty" json:"EN,omitempty"` + + FR *NtsNameType `xml:"FR,omitempty" json:"FR,omitempty"` + + BG *NtsNameType `xml:"BG,omitempty" json:"BG,omitempty"` + + CS *NtsNameType `xml:"CS,omitempty" json:"CS,omitempty"` + + DA *NtsNameType `xml:"DA,omitempty" json:"DA,omitempty"` + + EL *NtsNameType `xml:"EL,omitempty" json:"EL,omitempty"` + + ES *NtsNameType `xml:"ES,omitempty" json:"ES,omitempty"` + + ET *NtsNameType `xml:"ET,omitempty" json:"ET,omitempty"` + + FI *NtsNameType `xml:"FI,omitempty" json:"FI,omitempty"` + + HU *NtsNameType `xml:"HU,omitempty" json:"HU,omitempty"` + + IT *NtsNameType `xml:"IT,omitempty" json:"IT,omitempty"` + + LT *NtsNameType `xml:"LT,omitempty" json:"LT,omitempty"` + + LV *NtsNameType `xml:"LV,omitempty" json:"LV,omitempty"` + + MT *NtsNameType `xml:"MT,omitempty" json:"MT,omitempty"` + + PL *NtsNameType `xml:"PL,omitempty" json:"PL,omitempty"` + + PT *NtsNameType `xml:"PT,omitempty" json:"PT,omitempty"` + + RO *NtsNameType `xml:"RO,omitempty" json:"RO,omitempty"` + + SK *NtsNameType `xml:"SK,omitempty" json:"SK,omitempty"` + + SL *NtsNameType `xml:"SL,omitempty" json:"SL,omitempty"` + + SV *NtsNameType `xml:"SV,omitempty" json:"SV,omitempty"` + + HR *NtsNameType `xml:"HR,omitempty" json:"HR,omitempty"` + + RU *NtsNameType `xml:"RU,omitempty" json:"RU,omitempty"` + + SR *NtsNameType `xml:"SR,omitempty" json:"SR,omitempty"` + } `xml:"name,omitempty" json:"name,omitempty"` + + Source *SourceType `xml:"source,omitempty" json:"source,omitempty"` + + Remarks *RemarksType `xml:"remarks,omitempty" json:"remarks,omitempty"` + + Version *RefrecVersionType `xml:"version,omitempty" json:"version,omitempty"` + + Erased *ErasedType `xml:"erased,omitempty" json:"erased,omitempty"` + + Lastupdate *LastupdateType `xml:"lastupdate,omitempty" json:"lastupdate,omitempty"` +} + +type PageRequestType struct { + XMLName xml.Name `xml:"http://rwsreftool/ page"` + + PageCode *PageCodeType `xml:"pageCode,omitempty" json:"pageCode,omitempty"` + + PageSize *PageSizeType `xml:"pageSize,omitempty" json:"pageSize,omitempty"` +} + +type PageDetailsType struct { + //XMLName xml.Name `xml:"http://rwsreftool/ pageDetails"` + XMLName xml.Name `xml:"pageDetails"` + + PageCode *PageCodeType `xml:"pageCode,omitempty" json:"pageCode,omitempty"` + + PageSize *PageSizeType `xml:"pageSize,omitempty" json:"pageSize,omitempty"` + + TotalElements *PageSizeType `xml:"totalElements,omitempty" json:"totalElements,omitempty"` + + TotalPages *PageSizeType `xml:"totalPages,omitempty" json:"totalPages,omitempty"` +} + +type RefWeb interface { + + // Error can be either of the following types: + // + // - Exception + + MutateDataXML(request *MutateDataXML) (*MutateDataXMLResponse, error) + + MutateDataXMLContext(ctx context.Context, request *MutateDataXML) (*MutateDataXMLResponse, error) + + // Error can be either of the following types: + // + // - Exception + + MatchByCode(request *MatchByCode) (*MatchByCodeResponse, error) + + MatchByCodeContext(ctx context.Context, request *MatchByCode) (*MatchByCodeResponse, error) + + // Error can be either of the following types: + // + // - Exception + + GetMutations(request *GetMutations) (*GetMutationsResponse, error) + + GetMutationsContext(ctx context.Context, request *GetMutations) (*GetMutationsResponse, error) + + // Error can be either of the following types: + // + // - Exception + + GetRisDataXML(request *GetRisDataXML) (*GetRisDataXMLResponse, error) + + GetRisDataXMLContext(ctx context.Context, request *GetRisDataXML) (*GetRisDataXMLResponse, error) + + // Error can be either of the following types: + // + // - Exception + + MatchByName(request *MatchByName) (*MatchByNameResponse, error) + + MatchByNameContext(ctx context.Context, request *MatchByName) (*MatchByNameResponse, error) + + // Error can be either of the following types: + // + // - Exception + + GetMutatedTables(request *GetMutatedTables) (*GetMutatedTablesResponse, error) + + GetMutatedTablesContext(ctx context.Context, request *GetMutatedTables) (*GetMutatedTablesResponse, error) + + // Error can be either of the following types: + // + // - Exception + + GetDataXML(request *GetDataXML) (*GetDataXMLResponse, error) + + GetDataXMLContext(ctx context.Context, request *GetDataXML) (*GetDataXMLResponse, error) +} + +type refWeb struct { + client *soap.SOAPClient +} + +func NewRefService(url string, tls bool, auth soap.Auth) RefWeb { + return NewRefWeb(soap.NewSOAPClient(url, tls, auth)) +} + +func NewRefWeb(client *soap.SOAPClient) RefWeb { + return &refWeb{ + client: client, + } +} + +func (service *refWeb) MutateDataXMLContext(ctx context.Context, request *MutateDataXML) (*MutateDataXMLResponse, error) { + response := new(MutateDataXMLResponse) + err := service.client.CallContext(ctx, "''", request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (service *refWeb) MutateDataXML(request *MutateDataXML) (*MutateDataXMLResponse, error) { + return service.MutateDataXMLContext( + context.Background(), + request, + ) +} + +func (service *refWeb) MatchByCodeContext(ctx context.Context, request *MatchByCode) (*MatchByCodeResponse, error) { + response := new(MatchByCodeResponse) + err := service.client.CallContext(ctx, "''", request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (service *refWeb) MatchByCode(request *MatchByCode) (*MatchByCodeResponse, error) { + return service.MatchByCodeContext( + context.Background(), + request, + ) +} + +func (service *refWeb) GetMutationsContext(ctx context.Context, request *GetMutations) (*GetMutationsResponse, error) { + response := new(GetMutationsResponse) + err := service.client.CallContext(ctx, "''", request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (service *refWeb) GetMutations(request *GetMutations) (*GetMutationsResponse, error) { + return service.GetMutationsContext( + context.Background(), + request, + ) +} + +func (service *refWeb) GetRisDataXMLContext(ctx context.Context, request *GetRisDataXML) (*GetRisDataXMLResponse, error) { + response := new(GetRisDataXMLResponse) + err := service.client.CallContext(ctx, "''", request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (service *refWeb) GetRisDataXML(request *GetRisDataXML) (*GetRisDataXMLResponse, error) { + return service.GetRisDataXMLContext( + context.Background(), + request, + ) +} + +func (service *refWeb) MatchByNameContext(ctx context.Context, request *MatchByName) (*MatchByNameResponse, error) { + response := new(MatchByNameResponse) + err := service.client.CallContext(ctx, "''", request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (service *refWeb) MatchByName(request *MatchByName) (*MatchByNameResponse, error) { + return service.MatchByNameContext( + context.Background(), + request, + ) +} + +func (service *refWeb) GetMutatedTablesContext(ctx context.Context, request *GetMutatedTables) (*GetMutatedTablesResponse, error) { + response := new(GetMutatedTablesResponse) + err := service.client.CallContext(ctx, "''", request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (service *refWeb) GetMutatedTables(request *GetMutatedTables) (*GetMutatedTablesResponse, error) { + return service.GetMutatedTablesContext( + context.Background(), + request, + ) +} + +func (service *refWeb) GetDataXMLContext(ctx context.Context, request *GetDataXML) (*GetDataXMLResponse, error) { + response := new(GetDataXMLResponse) + err := service.client.CallContext(ctx, "''", request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (service *refWeb) GetDataXML(request *GetDataXML) (*GetDataXMLResponse, error) { + return service.GetDataXMLContext( + context.Background(), + request, + ) +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/soap/oauth.go Thu Dec 22 18:31:34 2022 +0100 @@ -0,0 +1,71 @@ +// This is Free Software under GNU Affero General Public License v >= 3.0 +// without warranty, see README.md and license for details. +// +// SPDX-License-Identifier: AGPL-3.0-or-later +// License-Filename: LICENSES/AGPL-3.0.txt +// +// Copyright (C) 2022 by via donau +// – Österreichische Wasserstraßen-Gesellschaft mbH +// Software engineering by Intevation GmbH +// +// Author(s): +// * Sascha L. Teichmann <sascha.teichmann@intevation.de> + +package soap + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "net/http" + "strings" +) + +type Token struct { + AccessToken string `json:"access_token"` + Scope string `json:"scope"` + TokenType string `json:"token_type"` + ExpiresIn int `json:"expires_in"` +} + +func (token *Token) AddAuth(request *http.Request) { + request.Header.Add("Authorization", "Bearer "+token.AccessToken) +} + +func FetchToken(tokenURL, key, secret string) (*Token, error) { + + keyPair := key + ":" + secret + + encodedKeyPair := base64.URLEncoding.EncodeToString([]byte(keyPair)) + + req, err := http.NewRequest( + http.MethodPost, + tokenURL, + strings.NewReader("grant_type=client_credentials")) + + if err != nil { + return nil, err + } + + req.Header.Set("Authorization", "Basic "+encodedKeyPair) + + resp, err := http.DefaultClient.Do(req) + if err != nil { + return nil, err + } + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf( + "POST failed: %s (%d)", + http.StatusText(resp.StatusCode), + resp.StatusCode) + } + + var token Token + defer resp.Body.Close() + + if err = json.NewDecoder(resp.Body).Decode(&token); err != nil { + return nil, err + } + return &token, err +}
--- a/pkg/soap/soap.go Wed Aug 10 12:01:22 2022 +0200 +++ b/pkg/soap/soap.go Thu Dec 22 18:31:34 2022 +0100 @@ -100,15 +100,25 @@ Data string `xml:",chardata"` } +type Auth interface { + AddAuth(request *http.Request) +} + type BasicAuth struct { Login string Password string } +func (ba *BasicAuth) AddAuth(request *http.Request) { + if ba != nil { + request.SetBasicAuth(ba.Login, ba.Password) + } +} + type SOAPClient struct { url string tlsCfg *tls.Config - auth *BasicAuth + auth Auth headers []interface{} } @@ -205,14 +215,14 @@ return f.String } -func NewSOAPClient(url string, insecureSkipVerify bool, auth *BasicAuth) *SOAPClient { +func NewSOAPClient(url string, insecureSkipVerify bool, auth Auth) *SOAPClient { tlsCfg := &tls.Config{ InsecureSkipVerify: insecureSkipVerify, } return NewSOAPClientWithTLSConfig(url, tlsCfg, auth) } -func NewSOAPClientWithTLSConfig(url string, tlsCfg *tls.Config, auth *BasicAuth) *SOAPClient { +func NewSOAPClientWithTLSConfig(url string, tlsCfg *tls.Config, auth Auth) *SOAPClient { return &SOAPClient{ url: url, tlsCfg: tlsCfg, @@ -224,6 +234,10 @@ s.headers = append(s.headers, header) } +func (s *SOAPClient) CallContext(ctx context.Context, soapAction string, request, response interface{}) error { + return s.Call(soapAction, request, response) +} + func (s *SOAPClient) Call(soapAction string, request, response interface{}) error { envelope := SOAPEnvelope{} @@ -237,7 +251,7 @@ buffer := new(bytes.Buffer) encoder := xml.NewEncoder(buffer) - //encoder.Indent("", " ") + encoder.Indent("", " ") if err := encoder.Encode(envelope); err != nil { return err @@ -247,12 +261,16 @@ return err } + if log.DebugLogLevel >= log.GetLogLevel() { + log.Debugf("SOAP message:\n%s\n", buffer.String()) + } + req, err := http.NewRequest("POST", s.url, buffer) if err != nil { return err } if s.auth != nil { - req.SetBasicAuth(s.auth.Login, s.auth.Password) + s.auth.AddAuth(req) } req.Header.Add("Content-Type", "text/xml; charset=\"utf-8\"") @@ -316,6 +334,8 @@ return nil } + log.Debugf("length response: %d\n", len(rawbody)) + //log.Debugln(string(rawbody)) respEnvelope := new(SOAPEnvelope) respEnvelope.Body = SOAPBody{Content: response}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/soap/xsdDateTime.go Thu Dec 22 18:31:34 2022 +0100 @@ -0,0 +1,357 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package soap + +import ( + "encoding/xml" + "strings" + "time" +) + +const ( + dateLayout = "2006-01-02Z07:00" + timeLayout = "15:04:05.999999999Z07:00" +) + +// +// DateTime struct +// + +// XSDDateTime is a type for representing xsd:datetime in Golang +type XSDDateTime struct { + innerTime time.Time + hasTz bool +} + +// StripTz removes TZ information from the datetime +func (xdt *XSDDateTime) StripTz() { + xdt.hasTz = false +} + +// ToGoTime converts the time to time.Time by checking if a TZ is specified. +// If there is a TZ, that TZ is used, otherwise local TZ is used +func (xdt *XSDDateTime) ToGoTime() time.Time { + if xdt.hasTz { + return xdt.innerTime + } + return time.Date(xdt.innerTime.Year(), xdt.innerTime.Month(), xdt.innerTime.Day(), + xdt.innerTime.Hour(), xdt.innerTime.Minute(), xdt.innerTime.Second(), + xdt.innerTime.Nanosecond(), time.Local) +} + +// MarshalXML implements xml.MarshalerAttr on XSDDateTime +func (xdt XSDDateTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + xdtString := xdt.string() + if xdtString != "" { + return e.EncodeElement(xdtString, start) + } + return nil +} + +// MarshalXMLAttr implements xml.MarshalerAttr on XSDDateTime +func (xdt XSDDateTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { + xdtString := xdt.string() + attr := xml.Attr{} + if xdtString != "" { + attr.Name = name + attr.Value = xdtString + } + return attr, nil +} + +// returns string representation and skips "zero" time values. It also checks if nanoseconds and TZ exist. +func (xdt XSDDateTime) string() string { + if !xdt.innerTime.IsZero() { + dateTimeLayout := time.RFC3339Nano + if xdt.innerTime.Nanosecond() == 0 { + dateTimeLayout = time.RFC3339 + } + dtString := xdt.innerTime.Format(dateTimeLayout) + if !xdt.hasTz { + // split off time portion + dateAndTime := strings.SplitN(dtString, "T", 2) + toks := strings.SplitN(dateAndTime[1], "Z", 2) + toks = strings.SplitN(toks[0], "+", 2) + toks = strings.SplitN(toks[0], "-", 2) + dtString = dateAndTime[0] + "T" + toks[0] + } + return dtString + } + return "" +} + +// UnmarshalXML implements xml.Unmarshaler on XSDDateTime to use time.RFC3339Nano +func (xdt *XSDDateTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + var content string + err := d.DecodeElement(&content, &start) + if err != nil { + return err + } + xdt.innerTime, xdt.hasTz, err = fromString(content, time.RFC3339Nano) + return err +} + +// UnmarshalXMLAttr implements xml.UnmarshalerAttr on XSDDateTime to use time.RFC3339Nano +func (xdt *XSDDateTime) UnmarshalXMLAttr(attr xml.Attr) error { + var err error + xdt.innerTime, xdt.hasTz, err = fromString(attr.Value, time.RFC3339Nano) + return err +} + +func fromString(content string, format string) (time.Time, bool, error) { + var t time.Time + if content == "" { + return t, true, nil + } + hasTz := false + if strings.Contains(content, "T") { // check if we have a time portion + // split into date and time portion + dateAndTime := strings.SplitN(content, "T", 2) + if len(dateAndTime) > 1 { + if strings.Contains(dateAndTime[1], "Z") || + strings.Contains(dateAndTime[1], "+") || + strings.Contains(dateAndTime[1], "-") { + hasTz = true + } + } + if !hasTz { + content += "Z" + } + if content == "0001-01-01T00:00:00Z" { + return t, true, nil + } + } else { + // we don't see to have a time portion, check timezone + if strings.Contains(content, "Z") || + strings.Contains(content, ":") { + hasTz = true + } + if !hasTz { + content += "Z" + } + } + t, err := time.Parse(format, content) + return t, hasTz, err +} + +// CreateXsdDateTime creates an object represent xsd:datetime object in Golang +func CreateXsdDateTime(dt time.Time, hasTz bool) XSDDateTime { + return XSDDateTime{ + innerTime: dt, + hasTz: hasTz, + } +} + +// XSDDate is a type for representing xsd:date in Golang +type XSDDate struct { + innerDate time.Time + hasTz bool +} + +// StripTz removes the TZ information from the date +func (xd *XSDDate) StripTz() { + xd.hasTz = false +} + +// ToGoTime converts the date to Golang time.Time by checking if a TZ is specified. +// If there is a TZ, that TZ is used, otherwise local TZ is used +func (xd *XSDDate) ToGoTime() time.Time { + if xd.hasTz { + return xd.innerDate + } + return time.Date(xd.innerDate.Year(), xd.innerDate.Month(), xd.innerDate.Day(), + 0, 0, 0, 0, time.Local) +} + +// MarshalXML implementation on XSDDate +func (xd XSDDate) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + xdtString := xd.string() + if xdtString != "" { + return e.EncodeElement(xdtString, start) + } + return nil +} + +// MarshalXMLAttr implementation on XSDDate +func (xd XSDDate) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { + xdString := xd.string() + attr := xml.Attr{} + if xdString != "" { + attr.Name = name + attr.Value = xdString + } + return attr, nil +} + +// returns string representation and skips "zero" time values +func (xd XSDDate) string() string { + if !xd.innerDate.IsZero() { + dateString := xd.innerDate.Format(dateLayout) // serialize with TZ + if !xd.hasTz { + if strings.Contains(dateString, "Z") { + // UTC Tz + toks := strings.SplitN(dateString, "Z", 2) + dateString = toks[0] + } else { + // [+-]00:00 Tz, remove last 6 chars + if len(dateString) > 5 { // this should always be true + start := len(dateString) - 6 // locate at "-" + dateString = dateString[0:start] + } + } + } + return dateString + } + return "" +} + +// UnmarshalXML implements xml.Unmarshaler on XSDDate to use dateLayout +func (xd *XSDDate) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + var content string + err := d.DecodeElement(&content, &start) + if err != nil { + return err + } + xd.innerDate, xd.hasTz, err = fromString(content, dateLayout) + return err +} + +// UnmarshalXMLAttr implements xml.UnmarshalerAttr on XSDDate to use dateLayout +func (xd *XSDDate) UnmarshalXMLAttr(attr xml.Attr) error { + var err error + xd.innerDate, xd.hasTz, err = fromString(attr.Value, dateLayout) + return err +} + +// CreateXsdDate creates an object represent xsd:datetime object in Golang +func CreateXsdDate(date time.Time, hasTz bool) XSDDate { + return XSDDate{ + innerDate: date, + hasTz: hasTz, + } +} + +// XSDTime is a type for representing xsd:time +type XSDTime struct { + innerTime time.Time + hasTz bool +} + +// MarshalXML implements xml.Marshaler on XSDTime +func (xt XSDTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + xdtString := xt.string() + if xdtString != "" { + return e.EncodeElement(xdtString, start) + } + return nil +} + +// MarshalXMLAttr implements xml.MarshalerAttr on XSDTime +func (xt XSDTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { + xdString := xt.string() + attr := xml.Attr{} + if xdString != "" { + attr.Name = name + attr.Value = xdString + } + return attr, nil +} + +// returns string representation and skips "zero" time values +func (xt XSDTime) string() string { + if !xt.innerTime.IsZero() { + dateTimeLayout := time.RFC3339Nano + if xt.innerTime.Nanosecond() == 0 { + dateTimeLayout = time.RFC3339 + } + // split off date portion + dateAndTime := strings.SplitN(xt.innerTime.Format(dateTimeLayout), "T", 2) + timeString := dateAndTime[1] + if !xt.hasTz { + toks := strings.SplitN(timeString, "Z", 2) + toks = strings.SplitN(toks[0], "+", 2) + toks = strings.SplitN(toks[0], "-", 2) + timeString = toks[0] + } + return timeString + } + return "" +} + +// UnmarshalXML implements xml.Unmarshaler on XSDTime to use dateTimeLayout +func (xt *XSDTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + var err error + var content string + err = d.DecodeElement(&content, &start) + if err != nil { + return err + } + return xt.fromString(content) +} + +// UnmarshalXMLAttr implements xml.UnmarshalerAttr on XSDTime to use dateTimeLayout +func (xt *XSDTime) UnmarshalXMLAttr(attr xml.Attr) error { + return xt.fromString(attr.Value) +} + +func (xt *XSDTime) fromString(content string) error { + var t time.Time + var err error + if content == "" { + xt.innerTime = t + return nil + } + xt.hasTz = false + if strings.Contains(content, "Z") || + strings.Contains(content, "+") || + strings.Contains(content, "-") { + xt.hasTz = true + } + if !xt.hasTz { + content += "Z" + } + xt.innerTime, err = time.Parse(timeLayout, content) + return err +} + +// Hour returns hour of the xsd:time +func (xt XSDTime) Hour() int { + return xt.innerTime.Hour() +} + +// Minute returns minutes of the xsd:time +func (xt XSDTime) Minute() int { + return xt.innerTime.Minute() +} + +// Second returns seconds of the xsd:time +func (xt XSDTime) Second() int { + return xt.innerTime.Second() +} + +// Nanosecond returns nanosecond of the xsd:time +func (xt XSDTime) Nanosecond() int { + return xt.innerTime.Nanosecond() +} + +// Location returns the TZ information of the xsd:time +func (xt XSDTime) Location() *time.Location { + if xt.hasTz { + return xt.innerTime.Location() + } + return nil +} + +// CreateXsdTime creates an object representing xsd:time in Golang +func CreateXsdTime(hour int, min int, sec int, nsec int, loc *time.Location) XSDTime { + realLoc := loc + if loc == nil { + realLoc = time.Local + } + return XSDTime{ + innerTime: time.Date(1951, 10, 22, hour, min, sec, nsec, realLoc), + hasTz: loc != nil, + } +}