Skip to content

Commit 5adf701

Browse files
author
Frank Martinez
authored
Merge pull request #22 from fm-tibco/master
fix activity ref
2 parents 01ce096 + e3ebeea commit 5adf701

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pipeline/stage.go

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package pipeline
22

33
import (
44
"fmt"
5+
"github.com/project-flogo/core/support"
56

67
"github.com/project-flogo/core/activity"
78
"github.com/project-flogo/core/data/mapper"
@@ -49,10 +50,24 @@ func (ctx *initContextImpl) Logger() log.Logger {
4950

5051
func NewStage(config *StageConfig, mf mapper.Factory, resolver resolve.CompositeResolver) (*Stage, error) {
5152

53+
if config.Ref == "" && config.Type != "" {
54+
log.RootLogger().Warnf("stage configuration 'type' deprecated, use 'ref' in the future")
55+
config.Ref = "#" + config.Type
56+
}
57+
5258
if config.Ref == "" {
5359
return nil, fmt.Errorf("activity not specified for stage")
5460
}
5561

62+
if config.Ref[0] == '#' {
63+
var ok bool
64+
activityRef := config.Ref
65+
config.Ref, ok = support.GetAliasRef("activity", activityRef)
66+
if !ok {
67+
return nil, fmt.Errorf("activity '%s' not imported", activityRef)
68+
}
69+
}
70+
5671
act := activity.Get(config.Ref)
5772
if act == nil {
5873
return nil, fmt.Errorf("unsupported Activity:" + config.Ref)

0 commit comments

Comments
 (0)