Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
workflow_core
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
workflow_core
Commits
8e5a7dc1
Commit
8e5a7dc1
authored
Oct 04, 2018
by
jasl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
d654e1e3
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
79 additions
and
19 deletions
+79
-19
place.rb
app/models/workflow_core/place.rb
+2
-0
token.rb
app/models/workflow_core/token.rb
+2
-0
transition.rb
app/models/workflow_core/transition.rb
+2
-18
workflow.rb
app/models/workflow_core/workflow.rb
+2
-0
workflow_instance.rb
app/models/workflow_core/workflow_instance.rb
+2
-0
workflow_core.rb
lib/workflow_core.rb
+6
-1
place.rb
lib/workflow_core/concerns/models/place.rb
+9
-0
token.rb
lib/workflow_core/concerns/models/token.rb
+9
-0
transition.rb
lib/workflow_core/concerns/models/transition.rb
+27
-0
workflow.rb
lib/workflow_core/concerns/models/workflow.rb
+9
-0
workflow_instance.rb
lib/workflow_core/concerns/models/workflow_instance.rb
+9
-0
No files found.
app/models/workflow_core/place.rb
View file @
8e5a7dc1
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
WorkflowCore
module
WorkflowCore
class
Place
<
ApplicationRecord
class
Place
<
ApplicationRecord
include
WorkflowCore
::
Concerns
::
Models
::
Place
self
.
table_name
=
"workflow_places"
self
.
table_name
=
"workflow_places"
belongs_to
:workflow
belongs_to
:workflow
...
...
app/models/workflow_core/token.rb
View file @
8e5a7dc1
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
WorkflowCore
module
WorkflowCore
class
Token
<
ApplicationRecord
class
Token
<
ApplicationRecord
include
WorkflowCore
::
Concerns
::
Models
::
Token
self
.
table_name
=
"workflow_tokens"
self
.
table_name
=
"workflow_tokens"
belongs_to
:instance
,
belongs_to
:instance
,
...
...
app/models/workflow_core/transition.rb
View file @
8e5a7dc1
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
WorkflowCore
module
WorkflowCore
class
Transition
<
ApplicationRecord
class
Transition
<
ApplicationRecord
include
WorkflowCore
::
Concerns
::
Models
::
Transition
self
.
table_name
=
"workflow_transitions"
self
.
table_name
=
"workflow_transitions"
belongs_to
:workflow
belongs_to
:workflow
...
@@ -10,23 +12,5 @@ module WorkflowCore
...
@@ -10,23 +12,5 @@ module WorkflowCore
foreign_key:
"output_transition_id"
,
class_name:
"WorkflowCore::Place"
foreign_key:
"output_transition_id"
,
class_name:
"WorkflowCore::Place"
has_many
:output_places
,
dependent: :destroy
,
has_many
:output_places
,
dependent: :destroy
,
foreign_key:
"input_transition_id"
,
class_name:
"WorkflowCore::Place"
foreign_key:
"input_transition_id"
,
class_name:
"WorkflowCore::Place"
def
fire
(
token
,
transaction_options:
{
requires_new:
true
},
**
options
)
transaction
(
**
transaction_options
)
do
on_fire
(
token
,
transaction_options
,
options
)
end
rescue
=>
ex
rescue_fire_error
ex
end
protected
def
on_fire
(
_token
,
_transaction_options
,
**
_options
)
raise
NotImplementedError
end
def
rescue_fire_error
(
ex
)
raise
ex
end
end
end
end
end
app/models/workflow_core/workflow.rb
View file @
8e5a7dc1
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
WorkflowCore
module
WorkflowCore
class
Workflow
<
ApplicationRecord
class
Workflow
<
ApplicationRecord
include
WorkflowCore
::
Concerns
::
Models
::
Workflow
self
.
table_name
=
"workflows"
self
.
table_name
=
"workflows"
has_one
:start_place
,
class_name:
"WorkflowCore::Place"
,
dependent: :destroy
has_one
:start_place
,
class_name:
"WorkflowCore::Place"
,
dependent: :destroy
...
...
app/models/workflow_core/workflow_instance.rb
View file @
8e5a7dc1
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
module
WorkflowCore
module
WorkflowCore
class
WorkflowInstance
<
ApplicationRecord
class
WorkflowInstance
<
ApplicationRecord
include
WorkflowCore
::
Concerns
::
Models
::
WorkflowInstance
self
.
table_name
=
"workflow_instances"
self
.
table_name
=
"workflow_instances"
belongs_to
:workflow
belongs_to
:workflow
...
...
lib/workflow_core.rb
View file @
8e5a7dc1
...
@@ -2,6 +2,11 @@
...
@@ -2,6 +2,11 @@
require
"workflow_core/engine"
require
"workflow_core/engine"
require
"workflow_core/concerns/models/workflow"
require
"workflow_core/concerns/models/transition"
require
"workflow_core/concerns/models/place"
require
"workflow_core/concerns/models/workflow_instance"
require
"workflow_core/concerns/models/token"
module
WorkflowCore
module
WorkflowCore
# Your code goes here...
end
end
lib/workflow_core/concerns/models/place.rb
0 → 100644
View file @
8e5a7dc1
# frozen_string_literal: true
module
WorkflowCore::Concerns
module
Models
module
Place
extend
ActiveSupport
::
Concern
end
end
end
lib/workflow_core/concerns/models/token.rb
0 → 100644
View file @
8e5a7dc1
# frozen_string_literal: true
module
WorkflowCore::Concerns
module
Models
module
Token
extend
ActiveSupport
::
Concern
end
end
end
lib/workflow_core/concerns/models/transition.rb
0 → 100644
View file @
8e5a7dc1
# frozen_string_literal: true
module
WorkflowCore::Concerns
module
Models
module
Transition
extend
ActiveSupport
::
Concern
def
fire
(
token
,
transaction_options:
{
requires_new:
true
},
**
options
)
transaction
(
**
transaction_options
)
do
on_fire
(
token
,
transaction_options
,
options
)
end
rescue
=>
ex
rescue_fire_error
ex
end
protected
def
on_fire
(
_token
,
_transaction_options
,
**
_options
)
raise
NotImplementedError
end
def
rescue_fire_error
(
ex
)
raise
ex
end
end
end
end
lib/workflow_core/concerns/models/workflow.rb
0 → 100644
View file @
8e5a7dc1
# frozen_string_literal: true
module
WorkflowCore::Concerns
module
Models
module
Workflow
extend
ActiveSupport
::
Concern
end
end
end
lib/workflow_core/concerns/models/workflow_instance.rb
0 → 100644
View file @
8e5a7dc1
# frozen_string_literal: true
module
WorkflowCore::Concerns
module
Models
module
WorkflowInstance
extend
ActiveSupport
::
Concern
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment