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

TODO

153       •   refactor init_random_generators, returns two similar objects?
154
155       •   refactor init_uuid_generators, returns two similar objects?
156
157       •   refactor init_uuid_generators, takes no parameters, even though we
158           shift parameters in?
159

SEE ALSO

161       •   Workflow::Factory
162
163       •   Workflow::History
164
166       Copyright (c) 2003-2023 Chris Winters. All rights reserved.
167
168       This library is free software; you can redistribute it and/or modify it
169       under the same terms as Perl itself.
170
171       Please see the LICENSE
172

AUTHORS

174       Please see Workflow
175
176
177
178perl v5.38.0                      2023-07-21            Workflow::Persister(3)
Impressum