
/*
 * Business Process Definition: Simple Publishing Workflow (publishing_wf)
 *
 * Auto-generated by ACS Workflow Export, version 4.3
 *
 * Context: default
 */


/*
 * Cases table
 */
create table publishing_wf_cases (
  case_id               integer primary key
                        references wf_cases on delete cascade
);

/* 
 * Declare the object type
 */


create function inline_0 () returns integer as '
begin
    PERFORM workflow__create_workflow (
        ''publishing_wf'', 
        ''Simple Publishing Workflow'', 
        ''Simple Publishing Workflows'', 
        ''A simple linear workflow for authoring, 
        editing and scheduling content items.'', 
        ''publishing_wf_cases'',
        ''case_id''
    );

    return null;

end;' language 'plpgsql';

select inline_0 ();
drop function inline_0 ();

        


/*****
 * Places
 *****/


    select workflow__add_place(
        'publishing_wf',
        'start', 
        'Created', 
        1
    );

        

    select workflow__add_place(
        'publishing_wf',
        'authored', 
        'Authored', 
        2
    );

        

    select workflow__add_place(
        'publishing_wf',
        'edited', 
        'Edited', 
        3
    );

        

    select workflow__add_place(
        'publishing_wf',
        'end', 
        'Approved', 
        4
    );

        
/*****
 * Roles
 *****/



	select workflow__add_role (
         'publishing_wf',
         'approval',
         'Approval',
         3
    );

        

	select workflow__add_role (
         'publishing_wf',
         'authoring',
         'Authoring',
         1
    );

        

	select workflow__add_role (
         'publishing_wf',
         'editing',
         'Editing',
         2
    );

        

/*****
 * Transitions
 *****/



	select workflow__add_transition (
         'publishing_wf',
         'authoring',
         'Authoring',
         'authoring',
         1,
         'user'
	);
	
        

	select workflow__add_transition (
         'publishing_wf',
         'editing',
         'Editing',
         'editing',
         2,
         'user'
	);
	
        

	select workflow__add_transition (
         'publishing_wf',
         'approval',
         'Approval',
         'approval',
         3,
         'user'
	);
	
        

/*****
 * Arcs
 *****/



	select workflow__add_arc (
         'publishing_wf',
         'approval',
         'authored',
         'out',
         'publishing_wf__is_next',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'approval',
         'edited',
         'out',
         '#',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'approval',
         'edited',
         'in',
         '',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'approval',
         'end',
         'out',
         'publishing_wf__is_next',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'approval',
         'start',
         'out',
         'publishing_wf__is_next',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'authoring',
         'authored',
         'out',
         'publishing_wf__is_next',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'authoring',
         'start',
         'out',
         '#',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'authoring',
         'start',
         'in',
         '',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'editing',
         'authored',
         'out',
         '#',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'editing',
         'authored',
         'in',
         '',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'editing',
         'edited',
         'out',
         'publishing_wf__is_next',
         '',
         ''
	);

        

	select workflow__add_arc (
         'publishing_wf',
         'editing',
         'start',
         'out',
         'publishing_wf__is_next',
         '',
         ''
	);

        

/*****
 * Attributes
 *****/



    select workflow__create_attribute(
        'publishing_wf',
        'next_place',
        'string',
        'Next Place',
	null,
	null,
	null,
        'start',
	1,
	1,
	null,
	'generic'
    );

        

	select workflow__add_trans_attribute_map(
        	'publishing_wf', 
        	'approval',
        	'next_place',
        	1
    );

        

	select workflow__add_trans_attribute_map(
        	'publishing_wf', 
        	'authoring',
        	'next_place',
        	1
    );

        

	select workflow__add_trans_attribute_map(
        	'publishing_wf', 
        	'editing',
        	'next_place',
        	1
    );

        
/*****
 * Transition-role-assignment-map
 *****/



/*
 * Context/Transition info
 * (for context = default)
 */



/*
 * Context/Role info
 * (for context = default)
 */



/*
 * Context Task Panels
 * (for context = default)
 */


commit;
