/* This table will hold one row for each case using this workflow. */ create table wf_ticket_cases ( case_id integer primary key constraint wf_ticket_cases_case_fk references wf_cases ); declare v_workflow_key varchar(40); begin v_workflow_key := workflow.create_workflow( workflow_key => 'ticket_wf', pretty_name => 'Ticket Tracker Process', pretty_plural => 'Ticket Tracker Process', description => 'Workflow for processing a ticket in the ticket-tracker', table_name => 'wf_ticket_cases' ); end; / show errors insert into wf_places(place_key, workflow_key, place_name, sort_order) values ('start', 'ticket_wf', 'Needs to be fixed', 1); insert into wf_places(place_key, workflow_key, place_name, sort_order) values ('to_be_acknowledged', 'ticket_wf', 'Needs to be acknowledged', 2); insert into wf_places(place_key, workflow_key, place_name, sort_order) values ('to_be_clarified', 'ticket_wf', 'Needs to be clarified', 3); insert into wf_places(place_key, workflow_key, place_name, sort_order) values ('end', 'ticket_wf', 'End state', 4); insert into wf_transitions(transition_key, transition_name, workflow_key, sort_order, trigger_type) values ('fix', 'Fix problem', 'ticket_wf', 1, 'user'); insert into wf_transitions(transition_key, transition_name, workflow_key, sort_order, trigger_type) values ('acknowledge', 'Acknowledge fix', 'ticket_wf', 2, 'user'); insert into wf_transitions(transition_key, transition_name, workflow_key, sort_order, trigger_type) values ('clarify', 'Clarify problem', 'ticket_wf', 3, 'user'); -- fix -- -- in insert into wf_arcs(workflow_key, transition_key, place_key, direction) values ('ticket_wf', 'fix', 'start', 'in'); -- out insert into wf_arcs(workflow_key, transition_key, place_key, direction, guard_callback, guard_custom_arg, guard_description) values ('ticket_wf', 'fix', 'to_be_acknowledged', 'out', 'wf_callback.guard_attribute_true', 'clear', 'Problem clear and fixed'); insert into wf_arcs(workflow_key, transition_key, place_key, direction, guard_callback, guard_custom_arg, guard_description) values ('ticket_wf', 'fix', 'to_be_clarified', 'out', '#', '', 'Problem not clear'); -- acknowledge -- in insert into wf_arcs(workflow_key, transition_key, place_key, direction) values ('ticket_wf', 'acknowledge', 'to_be_acknowledged', 'in'); -- out insert into wf_arcs(workflow_key, transition_key, place_key, direction, guard_callback, guard_custom_arg, guard_description) values ('ticket_wf', 'acknowledge', 'end', 'out', 'wf_callback.guard_attribute_true', 'acknowledged', 'Fix okay'); insert into wf_arcs(workflow_key, transition_key, place_key, direction, guard_callback, guard_custom_arg, guard_description) values ('ticket_wf', 'acknowledge', 'start', 'out', '#', '', 'Fix not okay'); -- clarify -- in insert into wf_arcs(workflow_key, transition_key, place_key, direction) values ('ticket_wf', 'clarify', 'to_be_clarified', 'in'); -- out insert into wf_arcs(workflow_key, transition_key, place_key, direction) values ('ticket_wf', 'clarify', 'start', 'out'); declare v_attribute_id acs_attributes.attribute_id%TYPE; begin v_attribute_id := workflow.create_attribute( workflow_key => 'ticket_wf', attribute_name => 'clear', datatype => 'boolean', pretty_name => 'Problem is clear', default_value => 't' ); insert into wf_transition_attribute_map (workflow_key, transition_key, attribute_id, sort_order) values ('ticket_wf', 'fix', v_attribute_id, 1); v_attribute_id := workflow.create_attribute( workflow_key => 'ticket_wf', attribute_name => 'acknowledged', datatype => 'boolean', pretty_name => 'Fix is okay', default_value => 't' ); insert into wf_transition_attribute_map (workflow_key, transition_key, attribute_id, sort_order) values ('ticket_wf', 'acknowledge', v_attribute_id, 1); end; / show errors; insert into wf_context_transition_info (context_key, workflow_key, transition_key, panels_callback_tcl) values ('default', 'ticket_wf', 'fix', 'wf_ticket_panel_fix'); insert into wf_context_transition_info (context_key, workflow_key, transition_key, panels_callback_tcl) values ('default', 'ticket_wf', 'clarify', 'wf_ticket_panel_clarify'); insert into wf_context_transition_info (context_key, workflow_key, transition_key, panels_callback_tcl) values ('default', 'ticket_wf', 'acknowledge', 'wf_ticket_panel_acknowledge'); commit;