Skip to content

Commit

Permalink
Merge pull request #22 from fm-tibco/master
Browse files Browse the repository at this point in the history
fix activity ref
  • Loading branch information
Frank Martinez authored May 9, 2019
2 parents 01ce096 + e3ebeea commit 5adf701
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pipeline/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pipeline

import (
"fmt"
"github.com/project-flogo/core/support"

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

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

if config.Ref == "" && config.Type != "" {
log.RootLogger().Warnf("stage configuration 'type' deprecated, use 'ref' in the future")
config.Ref = "#" + config.Type
}

if config.Ref == "" {
return nil, fmt.Errorf("activity not specified for stage")
}

if config.Ref[0] == '#' {
var ok bool
activityRef := config.Ref
config.Ref, ok = support.GetAliasRef("activity", activityRef)
if !ok {
return nil, fmt.Errorf("activity '%s' not imported", activityRef)
}
}

act := activity.Get(config.Ref)
if act == nil {
return nil, fmt.Errorf("unsupported Activity:" + config.Ref)
Expand Down

0 comments on commit 5adf701

Please sign in to comment.