1Workflow::Persister(3)User Contributed Perl DocumentationWorkflow::Persister(3)
2
3
4

NAME

6       Workflow::Persister - Base class for workflow persistence
7

VERSION

9       This documentation describes version 1.09 of this package
10

SYNOPSIS

12        # Associate a workflow with a persister
13        <workflow type="Ticket"
14                  persister="MainDatabase">
15        ...
16
17        # Declare a persister
18        <persister name="MainDatabase"
19                   class="Workflow::Persister::DBI"
20                   driver="MySQL"
21                   dsn="DBI:mysql:database=workflows"
22                   user="wf"
23                   password="mypass"/>
24
25        # Declare a separate persister
26        <persister name="FileSystem"
27                   class="Workflow::Persister::File"
28                   path="/path/to/my/workflow"/>
29

DESCRIPTION

31       This is the base class for persisting workflows. It does not implement
32       anything itself but actual implementations should subclass it to ensure
33       they fulfill the contract.
34
35       The job of a persister is to create, update and fetch the workflow
36       object plus any data associated with the workflow. It also creates and
37       fetches workflow history records.
38

SUBCLASSING

40   Methods
41       create_workflow( $workflow )
42
43       Stub that warns that the method should be overwritten in the derived
44       Persister. Since this is a SUPER class.
45
46       Generate an ID for the workflow, serialize the workflow data (ID and
47       state) and set the ID in the workflow.
48
49       update_workflow( $workflow )
50
51       Stub that warns that the method should be overwritten in the derived
52       Persister. Since this is a SUPER class.
53
54       Update the workflow state.
55
56       fetch_workflow( $workflow_id )
57
58       Stub that warns that the method should be overwritten in the derived
59       Persister. Since this is a SUPER class.
60
61       Retrieve the workflow data corresponding to $workflow_id. It not found
62       return undef, if found return a hashref with the data.
63
64       create_history( $workflow, @history )
65
66       Stub that warns that the method should be overwritten in the derived
67       Persister. Since this is a SUPER class.
68
69       Serialize all objects in @history for later retrieval.
70
71       fetch_history( $workflow )
72
73       Stub that warns that the method should be overwritten in the derived
74       Persister. Since this is a SUPER class.
75
76       The derived class method should return a list of Workflow::History
77       objects.
78
79       get_create_user( $workflow )
80
81       When creating an initial Workflow::History record to insert into the
82       database, the return value of this method is used for the value of the
83       "user" field.
84
85       Override this method to change the value from the default, "n/a".
86
87       get_create_description( $workflow )
88
89       When creating an initial Workflow::History record to insert into the
90       database, the return value of this method is used for the value of the
91       "description" field.
92
93       Override this method to change the value from the default, "Create new
94       workflow".
95
96       get_create_action( $workflow )
97
98       When creating an initial Workflow::History record to insert into the
99       database, the return value of this method is used for the value of the
100       "action" field.
101
102       Override this method to change the value from the default, "Create
103       workflow".
104
105       assign_generators( \%params )
106
107       Assigns proper generators based on intialization, see "init"
108
109       fetch_extra_workflow_data ( $workflow )
110
111       A stub that warns that the method should be overwritten in the derived
112       Persister. Since this is a SUPER class.
113
114       commit_transaction
115
116       Commit the current transaction if the persister supports transactions.
117       This stub does not have to be overridden. It is not executed if
118       autocommit is on.
119
120       rollback_transaction
121
122       Roll back the current transaction if the persister supports
123       transactions.  This stub does not have to be overridden. It is not
124       executed if autocommit is on.
125
126       init
127
128       Method to initialize persister based on configuration.
129
130       init_random_generators( \%params )
131
132       Initializes random id generators, takes the following named parameters:
133
134       ·   length, of random id to be generated
135
136       Returns two identical random id generator objects in list context.
137
138       init_uuid_generators( \%params )
139
140       Initializes UUID generators, takes no parameters
141
142       Returns two identical UUID generator objects in list context.
143

TODO

145       ·   refactor init_random_generators, returns two similar objects?
146
147       ·   refactor init_uuid_generators, returns two similar objects?
148
149       ·   refactor init_uuid_generators, takes no parameters, even though we
150           shift parameters in?
151

SEE ALSO

153       Workflow::Factory
154
155       Workflow::History
156
158       Copyright (c) 2003-2007 Chris Winters. All rights reserved.
159
160       This library is free software; you can redistribute it and/or modify it
161       under the same terms as Perl itself.
162

AUTHORS

164       Jonas B. Nielsen (jonasbn) <jonasbn@cpan.org> is the current
165       maintainer.
166
167       Chris Winters <chris@cwinters.com>, original author.
168
169
170
171perl v5.28.0                      2018-07-15            Workflow::Persister(3)
Impressum