modelRT/model/identity_token_model.go

120 lines
4.8 KiB
Go

// Package model define model struct of model runtime service
package model
import "modelRT/orm"
// IndentityTokenModelInterface define basic identity token model type interface
type IndentityTokenModelInterface interface {
GetComponentInfo() *orm.Component
GetMeasurementInfo() *orm.Measurement
GetGridTag() string // token1
GetZoneTag() string // token2
GetStationTag() string // token3
GetNamespacePath() string // token4(COMPONENT TABLE NSPATH)
GetComponentTag() string // token5(COMPONENT TABLE TAG)
GetAttributeGroup() string // token6(component attribute group information)
GetMeasurementTag() string // token7(measurement value or attribute field)
IsLocal() bool
}
// LongIdentityTokenModel define struct to long identity token info
type LongIdentityTokenModel struct {
ComponentInfo *orm.Component
MeasurementInfo *orm.Measurement
GridTag string
ZoneTag string
StationTag string
NamespacePath string
ComponentTag string
AttributeGroup string
MeasurementTag string
}
// GetComponentInfo define return the component information in the long identity token
func (l *LongIdentityTokenModel) GetComponentInfo() *orm.Component {
return l.ComponentInfo
}
// GetMeasurementInfo define return the measurement information in the long identity token
func (l *LongIdentityTokenModel) GetMeasurementInfo() *orm.Measurement {
return l.MeasurementInfo
}
// GetGridTag define function to return the grid tag information in the long identity token
func (l *LongIdentityTokenModel) GetGridTag() string { return l.GridTag }
// GetZoneTag define function to return the zone tag information in the long identity token
func (l *LongIdentityTokenModel) GetZoneTag() string { return l.ZoneTag }
// GetStationTag define function to return the station tag information in the long identity token
func (l *LongIdentityTokenModel) GetStationTag() string { return l.StationTag }
// GetNamespacePath define function to return the namespace path information in the long identity token
func (l *LongIdentityTokenModel) GetNamespacePath() string { return l.NamespacePath }
// GetComponentTag define function to return the component tag information in the long identity token
func (l *LongIdentityTokenModel) GetComponentTag() string { return l.ComponentTag }
// GetAttributeGroup define function to return the attribute group information in the long identity token
func (l *LongIdentityTokenModel) GetAttributeGroup() string { return l.AttributeGroup }
// GetMeasurementTag define function to return the measurement tag information in the long identity token
func (l *LongIdentityTokenModel) GetMeasurementTag() string {
return l.MeasurementTag
}
// IsLocal define return the is_local information in the long identity token
func (l *LongIdentityTokenModel) IsLocal() bool {
return false
}
// ShortIdentityTokenModel define struct to short identity token info
type ShortIdentityTokenModel struct {
ComponentInfo *orm.Component
MeasurementInfo *orm.Measurement
GridTag string // token1
ZoneTag string // token2
StationTag string // token3
NamespacePath string // token4
MeasurementTag string // token7
}
// GetComponentInfo define return the component information in the short identity token
func (s *ShortIdentityTokenModel) GetComponentInfo() *orm.Component {
return s.ComponentInfo
}
// GetMeasurementInfo define return the measurement information in the long identity token
func (s *ShortIdentityTokenModel) GetMeasurementInfo() *orm.Measurement {
return s.MeasurementInfo
}
// GetGridTag define function to return the grid tag information in the short identity token
func (s *ShortIdentityTokenModel) GetGridTag() string { return "" }
// GetZoneTag define function to return the zone tag information in the short identity token
func (s *ShortIdentityTokenModel) GetZoneTag() string { return "" }
// GetStationTag define function to return the station tag information in the short identity token
func (s *ShortIdentityTokenModel) GetStationTag() string { return "" }
// GetNamespacePath define function to return the namespace path information in the short identity token
func (s *ShortIdentityTokenModel) GetNamespacePath() string { return s.NamespacePath }
// GetComponentTag define function to return the component tag information in the short identity token
func (s *ShortIdentityTokenModel) GetComponentTag() string { return "" }
// GetAttributeGroup define function to return the attribute group information in the short identity token
func (s *ShortIdentityTokenModel) GetAttributeGroup() string { return "" }
// GetMeasurementTag define function to return the measurement tag information in the short identity token
func (s *ShortIdentityTokenModel) GetMeasurementTag() string {
return ""
}
// IsLocal define return the is_local information in the short identity token
func (s *ShortIdentityTokenModel) IsLocal() bool {
return true
}