definition

package
v0.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2019 License: BSD-3-Clause Imports: 12 Imported by: 100

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDataResolver

func GetDataResolver() data.Resolver

func SetLinkExprManagerFactory

func SetLinkExprManagerFactory(factory LinkExprManagerFactory)

func SetMapperFactory

func SetMapperFactory(factory MapperFactory)

Types

type ActivityConfig added in v0.5.2

type ActivityConfig struct {
	Activity activity.Activity
	// contains filtered or unexported fields
}

func (*ActivityConfig) GetInputAttr added in v0.5.2

func (ac *ActivityConfig) GetInputAttr(attrName string) (attr *data.Attribute, exists bool)

GetAttr gets the specified input attribute

func (*ActivityConfig) GetOutputAttr added in v0.5.2

func (ac *ActivityConfig) GetOutputAttr(attrName string) (attr *data.Attribute, exists bool)

GetOutputAttr gets the specified output attribute

func (*ActivityConfig) GetSetting added in v0.5.2

func (ac *ActivityConfig) GetSetting(setting string) (attr *data.Attribute, exists bool)

GetSetting gets the specified setting

func (*ActivityConfig) InputMapper added in v0.5.2

func (ac *ActivityConfig) InputMapper() data.Mapper

InputMapper returns the InputMapper of the task

func (*ActivityConfig) OutputMapper added in v0.5.2

func (ac *ActivityConfig) OutputMapper() data.Mapper

OutputMapper returns the OutputMapper of the task

func (*ActivityConfig) Ref added in v0.5.2

func (ac *ActivityConfig) Ref() string

type ActivityConfigRep added in v0.5.2

type ActivityConfigRep struct {
	Ref         string                 `json:"ref"`
	Mappings    *Mappings              `json:"mappings,omitempty"`
	Settings    map[string]interface{} `json:"settings"`
	InputAttrs  map[string]interface{} `json:"input,omitempty"`
	OutputAttrs map[string]interface{} `json:"output,omitempty"`
}

ActivityConfigRep is a serializable representation of an activity configuration

type BasicMapperFactory

type BasicMapperFactory struct {
	// contains filtered or unexported fields
}

func (*BasicMapperFactory) GetDefaultActivityOutputMapper added in v0.5.2

func (mf *BasicMapperFactory) GetDefaultActivityOutputMapper(task *Task) data.Mapper

func (*BasicMapperFactory) GetDefaultTaskOutputMapper

func (mf *BasicMapperFactory) GetDefaultTaskOutputMapper(task *Task) data.Mapper

Deprecated

func (*BasicMapperFactory) NewActivityInputMapper added in v0.5.2

func (mf *BasicMapperFactory) NewActivityInputMapper(task *Task, mapperDef *data.MapperDef) data.Mapper

func (*BasicMapperFactory) NewActivityOutputMapper added in v0.5.2

func (mf *BasicMapperFactory) NewActivityOutputMapper(task *Task, mapperDef *data.MapperDef) data.Mapper

func (*BasicMapperFactory) NewMapper

func (mf *BasicMapperFactory) NewMapper(mapperDef *MapperDef) data.Mapper

func (*BasicMapperFactory) NewTaskInputMapper

func (mf *BasicMapperFactory) NewTaskInputMapper(task *Task, mapperDef *MapperDef) data.Mapper

Deprecated

func (*BasicMapperFactory) NewTaskOutputMapper

func (mf *BasicMapperFactory) NewTaskOutputMapper(task *Task, mapperDef *MapperDef) data.Mapper

Deprecated

type DefaultActivityOutputMapper added in v0.5.2

type DefaultActivityOutputMapper struct {
	// contains filtered or unexported fields
}

BasicMapper is a simple object holding and executing mappings

func (*DefaultActivityOutputMapper) Apply added in v0.5.2

func (m *DefaultActivityOutputMapper) Apply(inputScope data.Scope, outputScope data.Scope) error

type DefaultTaskOutputMapper added in v0.5.2

type DefaultTaskOutputMapper struct {
	// contains filtered or unexported fields
}

BasicMapper is a simple object holding and executing mappings Deprecated

func (*DefaultTaskOutputMapper) Apply added in v0.5.2

func (m *DefaultTaskOutputMapper) Apply(inputScope data.Scope, outputScope data.Scope) error

Deprecated

type Definition

type Definition struct {
	// contains filtered or unexported fields
}

Definition is the object that describes the definition of a flow. It contains its data (attributes) and structure (tasks & links).

func NewDefinition

func NewDefinition(rep *DefinitionRep) (def *Definition, err error)

NewDefinition creates a flow Definition from a serializable definition representation

func (*Definition) ExplicitReply

func (d *Definition) ExplicitReply() bool

func (*Definition) GetAttr

func (d *Definition) GetAttr(attrName string) (attr *data.Attribute, exists bool)

GetAttr gets the specified attribute

func (*Definition) GetErrorHandler added in v0.5.2

func (d *Definition) GetErrorHandler() *ErrorHandler
func (d *Definition) GetLink(linkID int) *Link

GetLink returns the link with the specified ID

func (*Definition) GetLinkExprManager

func (d *Definition) GetLinkExprManager() LinkExprManager

GetLinkExprManager gets the LinkOld Expression Manager for the definition

func (*Definition) GetTask

func (d *Definition) GetTask(taskID string) *Task

GetTask returns the task with the specified ID

func (d *Definition) Links() []*Link

func (*Definition) Metadata added in v0.5.2

func (d *Definition) Metadata() *data.IOMetadata

Metadata returns IO metadata for the flow

func (*Definition) ModelID

func (d *Definition) ModelID() string

ModelID returns the ID of the model the definition uses

func (*Definition) Name

func (d *Definition) Name() string

Name returns the name of the definition

func (*Definition) SetLinkExprManager

func (d *Definition) SetLinkExprManager(mgr LinkExprManager)

SetLinkExprManager sets the LinkOld Expression Manager for the definition

func (*Definition) Tasks added in v0.5.2

func (d *Definition) Tasks() []*Task

GetTask returns the task with the specified ID

type DefinitionRep

type DefinitionRep struct {
	ExplicitReply bool   `json:"explicitReply"`
	Name          string `json:"name"`
	ModelID       string `json:"model"`

	Metadata   *data.IOMetadata  `json:"metadata"`
	Attributes []*data.Attribute `json:"attributes,omitempty"`

	Tasks []*TaskRep `json:"tasks"`
	Links []*LinkRep `json:"links"`

	ErrorHandler *ErrorHandlerRep `json:"errorHandler"`

	//deprecated
	RootTask         *TaskRepOld `json:"rootTask"`
	ErrorHandlerTask *TaskRepOld `json:"errorHandlerTask"`
}

DefinitionRep is a serializable representation of a flow Definition

type DummyTaskCtx added in v0.5.2

type DummyTaskCtx struct {
	// contains filtered or unexported fields
}

func (*DummyTaskCtx) ActivityHost added in v0.5.2

func (*DummyTaskCtx) ActivityHost() activity.Host

func (*DummyTaskCtx) FlowDetails added in v0.5.2

func (*DummyTaskCtx) FlowDetails() activity.FlowDetails

func (*DummyTaskCtx) GetInitValue added in v0.5.2

func (*DummyTaskCtx) GetInitValue(key string) (value interface{}, exists bool)

func (*DummyTaskCtx) GetInput added in v0.5.2

func (*DummyTaskCtx) GetInput(name string) interface{}

func (*DummyTaskCtx) GetOutput added in v0.5.2

func (*DummyTaskCtx) GetOutput(name string) interface{}

func (*DummyTaskCtx) GetSetting added in v0.5.2

func (ctx *DummyTaskCtx) GetSetting(setting string) (value interface{}, exists bool)

func (*DummyTaskCtx) GetSharedTempData added in v0.5.6

func (*DummyTaskCtx) GetSharedTempData() map[string]interface{}

func (*DummyTaskCtx) Name added in v0.5.2

func (ctx *DummyTaskCtx) Name() string

func (*DummyTaskCtx) SetOutput added in v0.5.2

func (*DummyTaskCtx) SetOutput(name string, value interface{})

func (*DummyTaskCtx) TaskName added in v0.5.2

func (ctx *DummyTaskCtx) TaskName() string

type ErrorHandler added in v0.5.2

type ErrorHandler struct {
	// contains filtered or unexported fields
}

func (*ErrorHandler) Tasks added in v0.5.2

func (eh *ErrorHandler) Tasks() []*Task

type ErrorHandlerRep added in v0.5.2

type ErrorHandlerRep struct {
	Tasks []*TaskRep `json:"tasks"`
	Links []*LinkRep `json:"links"`
}

ErrorHandlerRep is a serializable representation of the error flow

type FlowResolver

type FlowResolver struct {
}

func (*FlowResolver) Resolve

func (r *FlowResolver) Resolve(toResolve string, scope data.Scope) (value interface{}, err error)
type Link struct {
	// contains filtered or unexported fields
}

LinkOld is the object that describes the definition of a link.

func GetExpressionLinks(def *Definition) []*Link

GetExpressionLinks gets the links of the definition that are of type LtExpression

func (*Link) FromTask

func (link *Link) FromTask() *Task

FromTask returns the task the link is coming from

func (*Link) ID

func (link *Link) ID() int

ID gets the id of the link

func (*Link) String

func (link *Link) String() string

func (*Link) ToTask

func (link *Link) ToTask() *Task

ToTask returns the task the link is going to

func (*Link) Type

func (link *Link) Type() LinkType

Type gets the link type

func (*Link) Value

func (link *Link) Value() string

Value gets the "value" of the link

type LinkExprError

type LinkExprError struct {
	// contains filtered or unexported fields
}

LinkExprError thrown if error is encountered evaluating an link expression

func NewLinkExprError

func NewLinkExprError(msg string) *LinkExprError

func (*LinkExprError) Error

func (e *LinkExprError) Error() string

type LinkExprManager

type LinkExprManager interface {
	// EvalLinkExpr evaluate the link expression
	EvalLinkExpr(link *Link, scope data.Scope) (bool, error)
}

LinkExprManager interface that defines a Link Expression Manager

type LinkExprManagerFactory

type LinkExprManagerFactory interface {
	NewLinkExprManager() LinkExprManager
}

func GetLinkExprManagerFactory

func GetLinkExprManagerFactory() LinkExprManagerFactory

type LinkRep

type LinkRep struct {
	Type string `json:"type"`

	Name   string `json:"name"`
	ToID   string `json:"to"`
	FromID string `json:"from"`
	Value  string `json:"value"`
}

LinkRep is a serializable representation of a flow LinkOld

type LinkRepOld added in v0.5.2

type LinkRepOld struct {
	ID   int    `json:"id"`
	Type int    `json:"type"`
	Name string `json:"name"`
	// Using interface{} type to support backward compatibility changes since Id was
	// int before, change to string once BC is removed
	ToID interface{} `json:"to"`
	// Using interface{} type to support backward compatibility changes since Id was
	// int before, change to string once BC is removed
	FromID interface{} `json:"from"`
	Value  string      `json:"value"`
}

LinkRepOld is a serializable representation of a flow LinkOld Deprecated

type LinkType

type LinkType int

LinkType is an enum for possible Link Types

const (
	// LtDependency denotes an normal dependency link
	LtDependency LinkType = 0

	// LtExpression denotes a link with an expression
	LtExpression LinkType = 1 //expr language on the model or def?

	// LtLabel denotes 'label' link
	LtLabel LinkType = 2

	// LtError denotes an error link
	LtError LinkType = 3
)

type MapperDef

type MapperDef struct {
	Mappings []*data.MappingDef
}

MapperDef represents a Mapper, which is a collection of mappings

type MapperFactory

type MapperFactory interface {
	// NewMapper creates a new Mapper from the specified MapperDef
	NewMapper(mapperDef *MapperDef) data.Mapper

	// NewActivityInputMapper creates a new Activity Input Mapper from the specified MapperDef
	// for the specified Task, method to facilitate pre-compiled mappers
	NewActivityInputMapper(task *Task, mapperDef *data.MapperDef) data.Mapper

	// NewActivityOutputMapper creates a new Activity Output Mapper from the specified MapperDef
	// for the specified Task, method to facilitate pre-compiled mappers
	NewActivityOutputMapper(task *Task, mapperDef *data.MapperDef) data.Mapper

	// GetDefaultTaskOutputMapper get the default Activity Output Mapper for the
	// specified Task
	GetDefaultActivityOutputMapper(task *Task) data.Mapper

	// NewTaskInputMapper creates a new Input Mapper from the specified MapperDef
	// for the specified Task, method to facilitate pre-compiled mappers
	//Deprecated
	NewTaskInputMapper(task *Task, mapperDef *MapperDef) data.Mapper

	// NewTaskOutputMapper creates a new Output Mapper from the specified MapperDef
	// for the specified Task, method to facilitate pre-compiled mappers
	//Deprecated
	NewTaskOutputMapper(task *Task, mapperDef *MapperDef) data.Mapper

	// GetDefaultTaskOutputMapper get the default Output Mapper for the
	// specified Task
	//Deprecated
	GetDefaultTaskOutputMapper(task *Task) data.Mapper
}

func GetMapperFactory

func GetMapperFactory() MapperFactory

type Mappings

type Mappings struct {
	Input  []*data.MappingDef `json:"input,omitempty"`
	Output []*data.MappingDef `json:"output,omitempty"`
}

Mappings is a collection of input & output mappings

type Provider added in v0.5.2

type Provider interface {

	// GetFlow retrieves the flow definition for the specified uri
	GetFlow(flowURI string) (*DefinitionRep, error)
}

ExtensionProvider is the interface that describes an object that can provide flow definitions from a URI

type Task

type Task struct {
	// contains filtered or unexported fields
}

Task is the object that describes the definition of a task. It contains its data (attributes) and its nested structure (child tasks & child links).

func (*Task) ActivityConfig added in v0.5.2

func (task *Task) ActivityConfig() *ActivityConfig
func (task *Task) FromLinks() []*Link

FromLinks returns the successor links of the task

func (*Task) GetAttr

func (task *Task) GetAttr(attrName string) (attr *data.Attribute, exists bool)

GetAttr gets the specified attribute DEPRECATED

func (*Task) GetInputAttr

func (task *Task) GetInputAttr(attrName string) (attr *data.Attribute, exists bool)

GetAttr gets the specified input attribute

func (*Task) GetOutputAttr

func (task *Task) GetOutputAttr(attrName string) (attr *data.Attribute, exists bool)

GetOutputAttr gets the specified output attribute

func (*Task) GetSetting

func (task *Task) GetSetting(attrName string) (value interface{}, exists bool)

func (*Task) ID

func (task *Task) ID() string

ID gets the id of the task

func (*Task) IsScope

func (task *Task) IsScope() bool

IsScope returns flag indicating if the Task is a scope task (a container of attributes)

func (*Task) Name

func (task *Task) Name() string

Name gets the name of the task

func (*Task) String

func (task *Task) String() string
func (task *Task) ToLinks() []*Link

ToLinks returns the predecessor links of the task

func (*Task) TypeID

func (task *Task) TypeID() string

TypeID gets the id of the task type

type TaskRep

type TaskRep struct {
	ID       string                 `json:"id"`
	Type     string                 `json:"type"`
	Name     string                 `json:"name"`
	Settings map[string]interface{} `json:"settings"`

	ActivityCfgRep *ActivityConfigRep `json:"activity"`
}

TaskRep is a serializable representation of a flow task

type TaskRepOld added in v0.5.2

type TaskRepOld struct {
	// Using interface{} type to support backward compatibility changes since Id was
	// int before, change to string once BC is removed
	ID          interface{} `json:"id"`
	TypeID      int         `json:"type"`
	ActivityRef string      `json:"activityRef"`
	Name        string      `json:"name"`

	Tasks []*TaskRepOld `json:"tasks,omitempty"`
	Links []*LinkRepOld `json:"links,omitempty"`

	Mappings    *Mappings              `json:"mappings,omitempty"`
	InputAttrs  map[string]interface{} `json:"input,omitempty"`
	OutputAttrs map[string]interface{} `json:"output,omitempty"`

	Settings map[string]interface{} `json:"settings"`

	//keep temporarily for backwards compatibility
	InputAttrsOld  map[string]interface{} `json:"inputs,omitempty"`
	OutputAttrsOld map[string]interface{} `json:"outputs,omitempty"`
	InputMappings  []*data.MappingDef     `json:"inputMappings,omitempty"`
	OutputMappings []*data.MappingDef     `json:"outputMappings,omitempty"`
	Attributes     []*data.Attribute      `json:"attributes,omitempty"`
	ActivityType   string                 `json:"activityType"`
}

TaskRepOld is a serializable representation of a flow TaskOld Deprecated

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL