Class: Camunda::Deployment
Overview
You must supply the paths of the BPMN files as a param titled file_names to deploy the BPMN file
Deployment is responsible for creating BPMN, DMN, and CMMN processes within Camunda. Before a process (or case, or decision) can be executed by the process engine, it has to be deployed. A deployment is a logical entity that groups multiple resources that are deployed together. Camunda offers an application called Modeler(camunda.com/download/modeler/) that allows you to create and edit BPMN diagrams and BPMN decision tables. and deploy BPMN, DMN, CMMN definitions in the Camunda engine.
Class Method Summary collapse
-
.create(file_names:, tenant_id: nil, deployment_source: 'Camunda Workflow Gem', deployment_name: nil) ⇒ Camunda::ProcessDefinition
Deploys a new process definition to Camunda and returns an instance of Camunda::ProcessDefinition.
-
.deployed_process_definitions(definitions_hash) ⇒ Array<Camunda::ProcessDefinition>
Returns a new instance of Camunda::ProcessDefinition according to definitions hash returned by Camunda.
-
.file_data(file_names) ⇒ Object
Convenience method for dealing with files and IO that are to be uploaded.
Methods inherited from Model
find_by!, log_details?, worker_id
Class Method Details
.create(file_names:, tenant_id: nil, deployment_source: 'Camunda Workflow Gem', deployment_name: nil) ⇒ Camunda::ProcessDefinition
Only supporting .create which uses a POST on deployment/create.
Deploys a new process definition to Camunda and returns an instance of Camunda::ProcessDefinition.
19 20 21 22 23 24 25 26 27 |
# File 'lib/camunda/deployment.rb', line 19 def self.create(file_names:, tenant_id: nil, deployment_source: 'Camunda Workflow Gem', deployment_name: nil) deployment_name ||= file_names.map { |file_name| File.basename(file_name) }.join(", ") tenant_id ||= Camunda::Workflow.configuration.tenant_id args = file_data(file_names).merge('deployment-name' => deployment_name, 'deployment-source' => deployment_source) args.merge!("tenant-id": tenant_id) if tenant_id response = post_raw('deployment/create', args) deployed_process_definitions(response[:parsed_data][:data][:deployed_process_definitions]) end |
.deployed_process_definitions(definitions_hash) ⇒ Array<Camunda::ProcessDefinition>
Returns a new instance of Camunda::ProcessDefinition according to definitions hash returned by Camunda
41 42 43 44 45 46 47 48 49 |
# File 'lib/camunda/deployment.rb', line 41 def self.deployed_process_definitions(definitions_hash) # Currently only returning the process definitions. But this Deployment.create can create a DMN, CMMN also # It returns :deployed_process_definitions, :deployed_case_definitions, :deployed_decision_definitions, # :deployed_decision_requirements_definitions raise Camunda::ProcessEngineException, "No Process Definition created" if definitions_hash.nil? definitions_hash.values.map { |process_definition| Camunda::ProcessDefinition.new process_definition } end |
.file_data(file_names) ⇒ Object
Convenience method for dealing with files and IO that are to be uploaded
31 32 33 34 35 |
# File 'lib/camunda/deployment.rb', line 31 def self.file_data(file_names) file_names.map do |file_name| [file_name, Faraday::FilePart.new(file_name, 'text/plain')] end.to_h end |