class Bizflow::Lib::BlueprintBuilder

Public Instance Methods

build(semantic_repo) click to toggle source
# File lib/bizflow/lib/blueprint_builder.rb, line 10
def build(semantic_repo)

  semantic_repo.processes.each do |p|

    # processes

          process = Bizflow::DataModel::ProcessBlueprint.create(
                  name: p.name,
                  description: p.description,
                                          start: p.start
          )

    p.actions.each do |a|

      # actions

      action = process.add_action_blueprint(
        name: a.name,
        type: a.type,
        description: a.description,
        question: a.question
      )

      # tasks

      a.tasks.each do |t|
        action.add_task_blueprint(
          name: t.name,
          roles: t.roles.join(" "),
          description: t.description
        )
      end

    end

    data_actions = process.action_blueprints

    # next_actions

    p.actions.each do |a|

      a.next_actions.each do |k, v|

        ending = nil
        ending = k.to_s if k != :only_one

        current_action = data_actions.select { |acc| acc.name == a.name }.first
        next_action = data_actions.select { |acc| acc.name == v }.first

        Bizflow::DataModel::NextActionBlueprint.create(
          action_blueprint: current_action,
          next_blueprint: next_action,
          ending: ending
        )

      end

    end

  end

end

Private Instance Methods

handle_next_blueprints(action) click to toggle source
# File lib/bizflow/lib/blueprint_builder.rb, line 75
def handle_next_blueprints(action)
  res = []
  if action.type == "task"
    res = Bizflow::DataModel::NextActionBlueprint.new()
  elsif action.type == "input"

  else

  end


end