func (s *Step) SetIf(condition string) {
	s.Condition = condition
}
SetIf sets the execution condition of the step
package api
import (
	"encoding/json"
	"fmt"
	"reflect"
	"sync"
	"github.com/project-flogo/core/activity"
	"github.com/project-flogo/core/api"
	"github.com/project-flogo/core/support"
)
var (
	resources      = make(map[string]*Microgateway)
	resourcesMutex = sync.RWMutex{}
)
func GetResource(name string) *Microgateway {
	resourcesMutex.RLock()
	defer resourcesMutex.RUnlock()
	return resources[name]
}
func ClearResources() {
	resources = make(map[string]*Microgateway)
}
func New(name string) *Microgateway {
	return &Microgateway{
		Name: name,
	}
}
func (m *Microgateway) NewService(name string, act interface{}) *Service {
	service := &Service{
		Name:     name,
		Settings: make(map[string]interface{}),
	}
	switch act := act.(type) {
	case string:
		service.Ref = act
	case activity.Activity:
		if hr, ok := act.(support.HasRef); ok {
			service.Ref = hr.Ref()
		} else {
			value := reflect.ValueOf(act)
			value = value.Elem()
			service.Ref = value.Type().PkgPath()
		}
	case func(ctx activity.Context) (done bool, err error):
		service.Handler = act
	case ServiceFunc:
		service.Handler = act
	default:
		panic("invalid type for act")
	}
	m.Services = append(m.Services, service)
	return service
}
func (m *Microgateway) NewStep(service *Service) *Step {
	step := &Step{
		Service: service.Name,
		Input:   make(map[string]interface{}),
	}
	m.Steps = append(m.Steps, step)
	return step
}
func (m *Microgateway) NewResponse(isError bool) *Response {
	response := &Response{
		Error: isError,
	}
	m.Responses = append(m.Responses, response)
	return response
}
func (s *Service) SetDescription(description string) {
	s.Description = description
}
func (s *Service) AddSetting(name string, value interface{}) {
	s.Settings[name] = value
}