1Workflow::Persister::DBUIs:e:rExCtornatDraitbau(t3e)d PeWrolrkDfolcouwm:e:nPteartsiiosnter::DBI::ExtraData(3)
2
3
4

NAME

6       Workflow::Persister::DBI::ExtraData - Fetch extra data with each
7       workflow and put it into the context
8

VERSION

10       This documentation describes version 1.51 of this package
11

SYNOPSIS

13        <persister name="MyPersister"
14                   class="Workflow::Persister::DBI::ExtraData"
15                   dsn="DBI:mysql:database=workflows"
16                   user="wf"
17                   password="mypass"
18                   extra_table="workflow_ticket"
19                   extra_data_field="ticket_id"
20                   extra_context_key="ticket_id"/>
21

DESCRIPTION

23   Overview
24       Simple subclass of Workflow::Persister::DBI to allow you to declare an
25       extra table and data field(s) from which to fetch data whenever you
26       fetch a workflow. There is a simple restriction: the table must have a
27       field 'workflow_id' of the same datatype as the 'workflow_id' field in
28       the 'workflow' table.
29
30   Examples
31        # Specify a single field 'ticket_id' from the table 'workflow_ticket'
32        # and store it in the context using the same key:
33
34        <persister
35            ...
36            extra_table="workflow_ticket"
37            extra_data_field="ticket_id"
38            ...
39
40        # How you would use this:
41        my $wf = FACTORY->fetch_workflow( 'Ticket', 55 );
42        print "Workflow is associated with ticket: ",
43              $wf->context->param( 'ticket_id' );
44
45        # Specify a single field 'ticket_id' from the table 'workflow_ticket'
46        # and store it in the context using a different key
47
48        <persister
49            ...
50            extra_table="workflow_ticket"
51            extra_data_field="ticket_id"
52            extra_context_key="THE_TICKET_ID"
53            ...
54
55        # How you would use this:
56        my $wf = FACTORY->fetch_workflow( 'Ticket', 55 );
57        print "Workflow is associated with ticket: ",
58              $wf->context->param( 'THE_TICKET_ID' );
59
60        # Specify multiple fields ('ticket_id', 'last_viewer',
61        # 'last_view_date') to pull from the 'workflow_ticket' table:
62
63        <persister
64            ...
65            extra_table="workflow_ticket"
66            extra_data_field="ticket_id,last_viewer,last_view_date"
67            ...
68
69        # How you would use this:
70        my $wf = FACTORY->fetch_workflow( 'Ticket', 55 );
71        print "Workflow is associated with ticket: ",
72              $wf->context->param( 'ticket_id' ), " ",
73              "which was last viewed by ",
74              $wf->context->param( 'last_viewer' ), " on ",
75              $wf->context->param( 'last_view_date' );
76
77   Configuration
78       extra_table (required)
79
80       Table where the extra data are kept.
81
82       extra_data_field (required)
83
84       Can be a single field or a comma-separated list of fields, all in the
85       same table. If a single field specified you have the option of
86       declaring a different "extra_context_key" under which the value should
87       be stored in the workflow context. Otherwise the values are stored by
88       the field names in the workflow context.
89
90       extra_context_key (optional)
91
92       Key under which to save the data from "extra_data_field" in the
93       workflow context.
94
95       Note: this is ignored when you specify multiple fields in
96       "extra_data_field"; we just use the fieldnames for the context keys in
97       that case. And if you specify a single data field and do not specify a
98       context key we also use the data field name.
99
100   METHODS
101       init ( \%params )
102
103       Initializes persister for extra workflow data.
104
105       Throws Workflow::Exception if initialization is not successful.
106
107       fetch_extra_workflow_data ( $wf )
108
109       Fetches extra data from database and feeds this to context of given
110       workflow.
111
112       Takes a single parameter, a workflow object to which extra data are
113       feed if retrieved successfully.
114
115       Throws Workflow::Exception if retrieval is not successful.
116
118       Copyright (c) 2003-2021 Chris Winters. All rights reserved.
119
120       This library is free software; you can redistribute it and/or modify it
121       under the same terms as Perl itself.
122
123       Please see the LICENSE
124

AUTHORS

126       Please see Workflow
127
128
129
130perl v5.32.1                      2021-01W-o3r1kflow::Persister::DBI::ExtraData(3)
Impressum