Index: openacs-4/packages/cms/tcl/workflow-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/Attic/workflow-procs-oracle.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/cms/tcl/workflow-procs-oracle.xql 3 Sep 2001 05:56:37 -0000 1.4 +++ openacs-4/packages/cms/tcl/workflow-procs-oracle.xql 19 Nov 2001 18:40:38 -0000 1.5 @@ -3,226 +3,839 @@ oracle8.1.6 - + + + select case_id, + acs_object.name(object_id) as object_name, + + state + from wf_cases + where case_id = :case_id + + + - begin - :1 := acs_mail_nt.post_request( - party_from => :user_id, - party_to => :party_id, - expand_group => 'f', - subject => :subject, - message => :message - ); - end; + + + + + select t.task_id, + t.case_id, + c.object_id, + acs_object.name(c.object_id) as object_name, + ot.pretty_name as object_type_pretty, + c.workflow_key, + tr.transition_name as task_name, + tr.instructions, + t.state, + t.enabled_date, + to_char(t.enabled_date, :date_format) as enabled_date_pretty, + t.started_date, + to_char(t.started_date, :date_format) as started_date_pretty, + t.canceled_date, + to_char(t.canceled_date, :date_format) as canceled_date_pretty, + t.finished_date, + to_char(t.finished_date, :date_format) as finished_date_pretty, + t.overridden_date, + to_char(t.overridden_date, :date_format) as overridden_date_pretty, + t.holding_user, + acs_object.name(t.holding_user) as holding_user_name, + p.email as holding_user_email, + t.hold_timeout, + to_char(t.hold_timeout, :date_format) as hold_timeout_pretty, + t.deadline, + to_char(t.deadline, :date_format) as deadline_pretty, + t.deadline - sysdate as days_till_deadline, + tr.estimated_minutes, + sysdate + from wf_tasks t, + wf_cases c, + wf_transition_info tr, + acs_objects o, + acs_object_types ot, + parties p + where t.task_id = :task_id + and c.case_id = t.case_id + and tr.transition_key = t.transition_key + and tr.workflow_key = t.workflow_key and tr.context_key = c.context_key + and o.object_id = c.object_id + and ot.object_type = o.object_type + and p.party_id (+) = t.holding_user + + + + + + + + select a.attribute_id, + a.attribute_name, + a.pretty_name, + a.datatype, + acs_object.get_attribute(t.case_id, a.attribute_name) as value, + '' as attribute_widget + from acs_attributes a, wf_transition_attribute_map m, wf_tasks t + where t.task_id = :task_id + and m.workflow_key = t.workflow_key and m.transition_key = t.transition_key + and a.attribute_id = m.attribute_id + order by m.sort_order + - + + + + select ut.user_id, + acs_object.name(ut.user_id) as name, + p.email as email + from wf_user_tasks ut, parties p + where ut.task_id = :task_id + and p.party_id = ut.user_id + + + - begin - :1 := acs_mail_nt.post_request( - party_from => null, - party_to => :admin_id, - expand_group => 'f', - subject => :subject, - message => :message - ); - end; + + + + + select j.journal_id, + j.action, + j.action_pretty, + o.creation_date, + to_char(o.creation_date, :date_format) as creation_date_pretty, + o.creation_user, + acs_object.name(o.creation_user) as creation_user_name, + p.email as creation_user_email, + o.creation_ip, + j.msg + from journal_entries j, acs_objects o, parties p + where j.object_id = :case_id + and o.object_id = j.journal_id + and p.party_id (+) = o.creation_user + order by o.creation_date $sql_order + + + + + + + + begin + :1 := workflow_case.begin_task_action( + task_id => :task_id, + action => :action, + action_ip => :modifying_ip, + user_id => :user_id, + msg => :msg); + end; + - + + + + begin + workflow_case.set_attribute_value( + journal_id => :journal_id, + attribute_name => :attribute_name, + value => :value + ); + end; + + + - begin - :1 := acs_mail_nt.post_request( - party_from => null, - party_to => :admin_id, - expand_group => 'f', - subject => :subject, - message => :message - ); - end; + + + + + begin + workflow_case.clear_manual_assignments( + case_id => :case_id, + role_key => :role_key + ); + end; + + + + + + + + begin + workflow_case.add_manual_assignment( + case_id => :case_id, + role_key => :role_key, + party_id => :party_id + ); + end; + - + + - select - transition_name, party_id, - content_item.get_title(i.item_id) title, - to_char(cd.deadline,'Month DD, YYYY') deadline_pretty, - nvl(party.name(party_id),person.name(party_id)) name - from - wf_transitions t, cr_items i, - wf_cases c, wf_case_assignments ca, wf_case_deadlines cd - where - c.workflow_key = 'publishing_wf' - and - c.workflow_key = t.workflow_key - and - ca.transition_key = t.transition_key - and - ca.transition_key = cd.transition_key - and - c.case_id = ca.case_id - and - c.case_id = cd.case_id - and - c.case_id = :case_id - and - c.state = 'active' - and - c.object_id = i.item_id + begin + workflow_case.end_task_action( + journal_id => :journal_id, + action => :action, + task_id => :task_id + ); + end; + + + + + + + + + begin + workflow_case.fire_message_transition( + task_id => :task_id + ); + end; - + - begin - :1 := acs_mail_nt.post_request( - party_from => :user_id, - party_to => :party_id, - expand_group => 'f', - subject => :subject, - message => :message - ); + begin + :1 := workflow_case.new(case_id => :case_id, + workflow_key => :workflow_key, + context_key => :context_key, + object_id => :object_id, + creation_user => :user_id, + creation_ip => :creation_ip + ); end; + + + + begin workflow_case.start_case(case_id => :case_id, + creation_user => :user_id, + creation_ip => :creation_ip + ); end; - + + + + + - select - o.creation_user as admin_id, transition_name, party_id, - content_item.get_title(i.item_id) title, - to_char(deadline,'Month DD, YYYY') deadline_pretty, - nvl(party.name(party_id),person.name(party_id)) name, - nvl(party.name(admin_id),person.name(admin_id)) admin_name - from - wf_cases c, wf_case_assignments ca, wf_case_deadlines cd, - wf_transitions t, cr_items i, acs_objects o - where - c.workflow_key = 'publishing_wf' - and - c.workflow_key = t.workflow_key - and - c.case_id = ca.case_id - and - c.case_id = cd.case_id - and - c.case_id = :case_id - and - ca.transition_key = t.transition_key - and - ca.transition_key = cd.transition_key - and - t.transition_key = :transition_key - and - c.state = 'active' - and - c.object_id = i.item_id - and - c.case_id = o.object_id + begin + workflow_case.suspend( + case_id => :case_id, + user_id => :user_id, + ip_address => :ip_address, + msg => :msg + ); + end; - + + + begin + workflow_case.resume( + case_id => :case_id, + user_id => :user_id, + ip_address => :ip_address, + msg => :msg + ); + end; + + + - begin - :1 := acs_mail_nt.post_request( - party_from => null, - party_to => :admin_id, - expand_group => 'f', - subject => :subject, - message => :message - ); - end; + + + + + begin + workflow_case.cancel( + case_id => :case_id, + user_id => :user_id, + ip_address => :ip_address, + msg => :msg + ); + end; + + + + + + + + begin + :1 := journal_entry.new( + object_id => :case_id, + action => 'comment', + creation_user => :user_id, + creation_ip => :ip_address, + msg => :msg + ); + end; + + + + + + begin + workflow_case.add_manual_assignment( + case_id => :case_id, + role_key => :role_key, + party_id => :party_id + ); + end; + + + - + + - select person.name( :user_id ) from dual + begin + workflow_case.remove_manual_assignment( + case_id => :case_id, + role_key => :role_key, + party_id => :party_id + ); + end; - + - select - transition_name, - content_item.get_title(i.item_id) as title, - o.creation_user as admin_id, - person.name( o.creation_user ) as admin_name, - to_char(sysdate,'Mon DD, YYYY') as today - from - wf_tasks t, wf_transitions tr, wf_cases c, - cr_items i, acs_objects o - where - tr.transition_key = t.transition_key - and - tr.workflow_key = t.workflow_key - and - t.case_id = c.case_id - and - c.object_id = i.item_id - and - i.item_id = o.object_id - and - t.task_id = :task_id + begin + workflow_case.clear_manual_assignments( + case_id => :case_id, + role_key => :role_key + ); + end; - + + + begin + workflow_case.add_task_assignment( + task_id => :task_id, + party_id => :party_id, + permanent_p => :permanent_value + ); + end; + + + - begin - :1 := acs_mail_nt.post_request( - party_from => null, - party_to => :admin_id, - expand_group => 'f', - subject => :subject, - message => :message - ); - end; + + + + + begin + workflow_case.remove_task_assignment( + task_id => :task_id, + party_id => :party_id, + permanent_p => :permanent_value + ); + end; + + + + + + + + begin + workflow_case.clear_task_assignments( + task_id => :task_id, + permanent_p => :permanent_value + ); + end; + + + + + + begin + workflow_case.set_case_deadline( + case_id => :case_id, + transition_key => :transition_key, + deadline => :deadline + ); + end; + + + - + + - select - content_workflow.can_touch( :item_id, :user_id ) - from - dual + begin + workflow_case.remove_case_deadline( + case_id => :case_id, + transition_key => :transition_key + ); + end; + + + + begin + workflow.add_place( + workflow_key => :workflow_key, + place_key => :place_key, + place_name => :place_name, + sort_order => :sort_order + ); + end; + + + + + + + + + begin + workflow.delete_place( + workflow_key => :workflow_key, + place_key => :place_key + ); + end; + + + + + + + + + begin + workflow.add_role( + workflow_key => :workflow_key, + role_key => :role_key, + role_name => :role_name, + sort_order => :sort_order + ); + end; + + + + + + + + + begin + workflow.move_role_up( + workflow_key => :workflow_key, + role_key => :role_key + ); + end; + + + + + + + + + begin + workflow.move_role_down( + workflow_key => :workflow_key, + role_key => :role_key + ); + end; + + + + + + + + + begin + workflow.delete_role( + workflow_key => :workflow_key, + role_key => :role_key + ); + end; + + + + + + + + + begin + workflow.add_transition( + workflow_key => :workflow_key, + transition_key => :transition_key, + transition_name => :transition_name, + role_key => :role_key, + sort_order => :sort_order, + trigger_type => :trigger_type + ); + end; + + + + + + + + + begin + workflow.delete_transition( + workflow_key => :workflow_key, + transition_key => :transition_key + ); + end; + + + + + + + + + begin + workflow.add_arc( + workflow_key => :workflow_key, + transition_key => :transition_key, + place_key => :place_key, + direction => :direction, + guard_callback => :guard_callback, + guard_custom_arg => :guard_custom_arg, + guard_description => :guard_description + ); + end; + + + + + + + + + begin + workflow.add_arc( + workflow_key => :workflow_key, + transition_key => :from_transition_key, + place_key => :to_place_key, + guard_callback => :guard_callback, + guard_custom_arg => :guard_custom_arg, + guard_description => :guard_description + ); + end; + + + + + + + + + begin + workflow.add_arc( + workflow_key => :workflow_key, + transition_key => :to_transition_key, + place_key => :from_place_key + ); + end; + + + + + + + + + begin + workflow.delete_arc( + workflow_key => :workflow_key, + transition_key => :transition_key, + place_key => :place_key, + direction => :direction + ); + end; + + + + + + + + + begin + workflow.add_trans_attribute_map( + workflow_key => :workflow_key, + transition_key => :transition_key, + attribute_id => :attribute_id, + sort_order => :sort_order + ); + end; + + + + + + + + + begin + workflow.add_trans_attribute_map( + workflow_key => :workflow_key, + transition_key => :transition_key, + attribute_name => :attribute_name, + sort_order => :sort_order + ); + end; + + + + + + + + + begin + workflow.delete_trans_attribute_map( + workflow_key => :workflow_key, + transition_key => :transition_key, + attribute_id => :attribute_id + ); + end; + + + + + + + + + begin + workflow.add_trans_role_assign_map( + workflow_key => :workflow_key, + transition_key => :transition_key, + assign_role_key => :assign_role_key + ); + end; + + + + + + + + + begin + workflow.delete_trans_role_assign_map( + workflow_key => :workflow_key, + transition_key => :transition_key, + assign_role_key => :assign_role_key + ); + end; + + + + + + + + begin :1 := workflow.simple_p(:workflow_key); end; + + + + + + +declare + v_workflow_key varchar2(40); +begin + v_workflow_key := workflow.create_workflow( + workflow_key => '[db_quote $new_workflow_key]', + pretty_name => '[db_quote $new_workflow_pretty_name]', + pretty_plural => '[db_quote $new_workflow_pretty_plural]', + description => '[db_quote $description]', + table_name => '[db_quote $new_table_name]' + ); +end; +/ +show errors + + + + + + + +begin + workflow.add_place( + workflow_key => '[db_quote $new_workflow_key]', + place_key => '[db_quote $place_key]', + place_name => '[db_quote $place_name]', + sort_order => [ad_decode $sort_order "" "null" $sort_order] + ); +end; +/ +show errors + + + + + + + +begin + workflow.add_role( + workflow_key => '[db_quote $new_workflow_key]', + role_key => '[db_quote $role_key]', + role_name => '[db_quote $role_name]', + sort_order => [ad_decode $sort_order "" "null" $sort_order] + ); +end; +/ +show errors + + + + + + +begin + workflow.add_transition( + workflow_key => '[db_quote $new_workflow_key]', + transition_key => '[db_quote $transition_key]', + transition_name => '[db_quote $transition_name]', + role_key => '[db_quote $role_key]', + sort_order => [ad_decode $sort_order "" "null" $sort_order], + trigger_type => '[db_quote $trigger_type]' + ); +end; +/ +show errors + + + + + + + +begin + workflow.add_arc( + workflow_key => '[db_quote $new_workflow_key]', + transition_key => '[db_quote $transition_key]', + place_key => '[db_quote $place_key]', + direction => '[db_quote $direction]', + guard_callback => '[db_quote $guard_callback]', + guard_custom_arg => '[db_quote $guard_custom_arg]', + guard_description => '[db_quote $guard_description]' + ); +end; +/ +show errors + + + + + + + + +declare + v_attribute_id integer; +begin + v_attribute_id := workflow.create_attribute( + workflow_key => '[db_quote $new_workflow_key]', + attribute_name => '[db_quote $attribute_name]', + datatype => '[db_quote $datatype]', + pretty_name => '[db_quote $pretty_name]', + default_value => '[db_quote $default_value]' + ); +end; +/ +show errors + + + + + + + + +begin + workflow.add_trans_attribute_map( + workflow_key => '[db_quote $new_workflow_key]', + transition_key => '[db_quote $transition_key]', + attribute_name => '[db_quote $attribute_name]', + sort_order => [ad_decode $sort_order "" "null" $sort_order] + ); +end; +/ +show errors + + + + + + + +begin + workflow.add_trans_role_assign_map( + workflow_key => '[db_quote $new_workflow_key]', + transition_key => '[db_quote $transition_key]', + assign_role_key => '[db_quote $assign_role_key]' + ); +end; +/ +show errors; + + +