Skip to content

Commit

Permalink
Fix api/NewActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
skothari-tibco authored and Frank Martinez committed Mar 4, 2019
1 parent cb1eb24 commit 503b53d
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions api/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,29 +142,29 @@ func NewActivity(act activity.Activity, settings ...interface{}) (activity.Activ

ref := activity.GetRef(act)

if f := activity.GetFactory(ref); f == nil {

return activity.Get(ref), nil
}else {
if len(settings) != 0{
inSettings := settings[0]
var settingsMap map[string]interface{}
if im, ok := inSettings.(map[string]interface{}); ok {
settingsMap = im
} else {
settingsMap = metadata.StructToMap(inSettings)
}
f := activity.GetFactory(ref)
ctx := &initCtx{settings: settingsMap}
return f(ctx)
}
return nil, nil
}
return nil, nil
if f := activity.GetFactory(ref); f == nil {

return activity.Get(ref), nil
} else {

var settingsMap map[string]interface{}

if len(settings) == 0 {
settingsMap = make(map[string]interface{})
} else {
inSettings := settings[0]

if im, ok := inSettings.(map[string]interface{}); ok {
settingsMap = im
} else {
settingsMap = metadata.StructToMap(inSettings)
}
}

f := activity.GetFactory(ref)
ctx := &initCtx{settings: settingsMap}
return f(ctx)
}

}

Expand Down Expand Up @@ -199,6 +199,8 @@ func EvalActivity(act activity.Activity, input interface{}) (map[string]interfac

logger := activityLogger



if act.Metadata() == nil {

//try loading activity with metadata
Expand Down

0 comments on commit 503b53d

Please sign in to comment.