insert into workflow_cases (
case_id, workflow_id, object_id
) values (
:case_id, :workflow_id, :object_id
)
insert into workflow_case_fsm (
case_id, current_state
) values (
:case_id, null
)
select case_id
from workflow_cases c,
workflows w
where c.object_id = :object_id
and w.workflow_id = c.workflow_id
and w.short_name = :workflow_short_name
select object_id
from workflow_cases c
where c.case_id = :case_id
select distinct rpm.role_id
from workflow_case_role_party_map rpm,
party_approved_member_map pmm
where rpm.case_id = :case_id
and rpm.party_id = pmm.party_id
and pmm.member_id = :user_id
select a.action_id
from workflow_cases c,
workflow_actions a
where c.case_id = :case_id
and a.workflow_id = c.workflow_id
and not exists (select 1
from workflow_initial_action wia
where wia.workflow_id = c.workflow_id
and wia.action_id = a.action_id)
and (a.always_enabled_p = 't'
or exists (select 1
from workflow_case_fsm cfsm,
workflow_fsm_action_enabled_in_states waeis
where cfsm.case_id = c.case_id
and waeis.state_id = cfsm.current_state
and waeis.action_id = a.action_id))
select count(*)
from workflow_case_role_party_map
where case_id = :case_id
and role_id = :role_id
select impl.impl_name
from workflow_role_callbacks r,
acs_sc_impls impl,
acs_sc_bindings bind,
acs_sc_contracts ctr
where r.role_id = :role_id
and impl.impl_id = r.acs_sc_impl_id
and impl.impl_id = bind.impl_id
and bind.contract_id = ctr.contract_id
and ctr.contract_name = :contract_name
order by r.sort_order
insert into workflow_case_role_party_map
(case_id, role_id, party_id)
values
(:case_id, :role_id, :party_id)
select count(*)
from workflow_case_role_party_map
where case_id = :case_id
and role_id = :role_id
and party_id = :party_id
select current_state
from workflow_case_fsm c
where c.case_id = :case_id
select 1
from workflow_actions a
where a.action_id = :action_id
and (a.always_enabled_p = 't' or
exists (select 1
from workflow_fsm_action_enabled_in_states waeis,
workflow_case_fsm c_fsm
where waeis.action_id = a.action_id
and c_fsm.case_id = :case_id
and waeis.state_id = c_fsm.current_state)
)
update workflow_case_fsm
set current_state = :new_state
where case_id = :case_id
insert into workflow_case_log
(entry_id, case_id, action_id, user_id, comment, comment_format)
values
(:entry_id, :case_id, :action_id, :user_id, :comment, :comment_format)