definition

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: BSD-3-Clause Imports: 9 Imported by: 0

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 BasicMapperFactory

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

func (*BasicMapperFactory) GetDefaultTaskOutputMapper

func (mf *BasicMapperFactory) GetDefaultTaskOutputMapper(task *Task) 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

func (*BasicMapperFactory) NewTaskOutputMapper

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

type DefaultOutputMapper

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

BasicMapper is a simple object holding and executing mappings

func (*DefaultOutputMapper) Apply

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

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) ErrorHandlerTask

func (pd *Definition) ErrorHandlerTask() *Task

ErrorHandler returns the error handler task of the definition

func (*Definition) ExplicitReply

func (pd *Definition) ExplicitReply() bool

func (*Definition) GetAttr

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

GetAttr gets the specified attribute

func (pd *Definition) GetLink(linkID int) *Link

GetLink returns the link with the specified ID

func (*Definition) GetLinkExprManager

func (pd *Definition) GetLinkExprManager() LinkExprManager

GetLinkExprManager gets the Link Expression Manager for the definition

func (*Definition) GetTask

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

GetTask returns the task with the specified ID

func (*Definition) ModelID

func (pd *Definition) ModelID() string

ModelID returns the ID of the model the definition uses

func (*Definition) Name

func (pd *Definition) Name() string

Name returns the name of the definition

func (*Definition) RootTask

func (pd *Definition) RootTask() *Task

RootTask returns the root task of the definition

func (*Definition) SetLinkExprManager

func (pd *Definition) SetLinkExprManager(mgr LinkExprManager)

SetLinkExprManager sets the Link Expression Manager for the definition

type DefinitionRep

type DefinitionRep struct {
	ExplicitReply    bool              `json:"explicitReply"`
	Name             string            `json:"name"`
	ModelID          string            `json:"model"`
	Attributes       []*data.Attribute `json:"attributes,omitempty"`
	RootTask         *TaskRep          `json:"rootTask"`
	ErrorHandlerTask *TaskRep          `json:"errorHandlerTask"`
}

DefinitionRep is a serializable representation of a flow Definition

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
}

Link 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(def *Definition) LinkExprManager
}

func GetLinkExprManagerFactory

func GetLinkExprManagerFactory() LinkExprManagerFactory

type LinkRep

type LinkRep 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"`
}

LinkRep is a serializable representation of a flow Link

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 'labelled' 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

	// NewTaskInputMapper creates a new Input Mapper from the specified MapperDef
	// for the specified Task, method to facilitate pre-compiled mappers
	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
	NewTaskOutputMapper(task *Task, mapperDef *MapperDef) data.Mapper

	// GetDefaultTaskOutputMapper get the default Output Mapper for the
	// specified Task
	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"`
}

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) ActivityRef

func (task *Task) ActivityRef() string

ActivityRef gets the activity ref

func (*Task) ActivityType

func (task *Task) ActivityType() string

ActivityType gets the activity type

func (task *Task) ChildLinks() []*Link

ChildLinks gets the child tasks of the task

func (*Task) ChildTasks

func (task *Task) ChildTasks() []*Task

ChildTasks gets the child tasks of the task

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) InputMapper

func (task *Task) InputMapper() data.Mapper

InputMapper returns the InputMapper 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) OutputMapper

func (task *Task) OutputMapper() data.Mapper

OutputMapper returns the OutputMapper of the task

func (*Task) Parent

func (task *Task) Parent() *Task

Parent gets the parent task 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() int

TypeID gets the id of the task type

type TaskRep

type TaskRep 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 []*TaskRep `json:"tasks,omitempty"`
	Links []*LinkRep `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"`
}

TaskRep is a serializable representation of a flow Task

Jump to

Keyboard shortcuts

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