/*==============================================================*/
/*               XPDL Scope Definition                          */
/*    =================================================         */
/*                                                              */
/* XPDL_PACKAGE                                                 */
/* XPDL_DATAFIELD                                               */
/* XPDL_APPLICATION                                             */
/*                                                              */
/* XPDL_PROCESS                                                 */
/* XPDL_ACTIVITY                                                */
/* XPDL_TRANSITION                                              */
/* XPDL_IMPL_TOOL                                               */
/* XPDL_IMPL_SUBFLOW                                            */
/*                                                              */
/*==============================================================*/

/*==============================================================*/
/* @table: xpdl_p_actualparameter (xpdl_p_001)                  */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_actualparameter
(
vc_scope         varchar2(50)    not null, --parameter scope
vc_packageid     varchar2(50)    ,         --package uuid.refers to xpdl_p_package#vc_uuid
vc_processid     varchar2(50)    ,         --process uuid.refers to xpdl_p_process#vc_uuid,maybe mainprocess or subprocess
vc_activityid    varchar2(50)    ,         --activityuuid.refers to xpdl_p_activity#vc_uuid
vc_transitionid  varchar2(50)    ,         --transition uuid.refers to xpdl_p_transition#vc_uuid
vc_toolid        varchar2(50)    ,         --tool uuid.refers to xpdl_p_tool#vc_uuid
vc_subflowid     varchar2(50)    ,         --subflow uuid.refers to xpdl_p_subflow#vc_uuid
vc_name          varchar2(50)    not null, --parameter name.refer to xpdl_p_datafield#vc_uuid
primary key(vc_scope,vc_name)
);

/*==============================================================*/
/* @table: xpdl_p_formalparameter (xpdl_p_002)                  */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_formalparameter
(
vc_scope          varchar2(50)    not null, --parameter scope
vc_packageid      varchar2(50)    ,         --package uuid.refers to xpdl_p_package#vc_uuid
vc_processid      varchar2(50)    ,         --process uuid.refers to xpdl_p_process#vc_uuid,maybe mainprocess or subprocess
vc_activityid     varchar2(50)    ,         --activityuuid.refers to xpdl_p_activity#vc_uuid
vc_transitionid   varchar2(50)    ,         --transition uuid.refers to xpdl_p_transition#vc_uuid
vc_toolid         varchar2(50)    ,         --tool uuid.refers to xpdl_p_tool#vc_uuid
vc_subflowid      varchar2(50)    ,         --subflow uuid.refers to xpdl_p_subflow#vc_uuid
vc_uuid           varchar2(50)    not null, --parameter uuid
int_index         number(2)       not null, --parameter index
vc_mode           varchar2(10)    not null, --parameter mode
vc_type           varchar2(50)    not null, --parameter type (basictype or javaclass name)
vc_description    varchar2(255)   ,         --parameter description
primary key(vc_scope,vc_uuid,int_index)
);

/*==============================================================*/
/* @table: xpdl_p_extendedattribute (xpdl_p_003)                */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_extendedattribute
(
vc_scope         varchar2(50)    not null, --attribute scope
vc_packageid     varchar2(50)    ,         --package uuid.refers to xpdl_p_package#vc_uuid
vc_processid     varchar2(50)    ,         --process uuid.refers to xpdl_p_process#vc_uuid,maybe mainprocess or subprocess
vc_activityid    varchar2(50)    ,         --activityuuid.refers to xpdl_p_activity#vc_uuid
vc_transitionid  varchar2(50)    ,         --transition uuid.refers to xpdl_p_transition#vc_uuid
vc_toolid        varchar2(50)    ,         --tool uuid.refers to xpdl_p_tool#vc_uuid
vc_subflowid     varchar2(50)    ,         --subflow uuid.refers to xpdl_p_subflow#vc_uuid
vc_name          varchar2(50)    not null, --attribute name
vc_value         varchar2(100)   not null, --attribute value
primary key(vc_scope,vc_name)
);

/*==============================================================*/
/* @table: xpdl_p_package (xpdl_p_004)                          */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_package
(
vc_uuid         varchar2(50)    not null, --package uuid
vc_name         varchar2(50)    not null, --package name
primary key(vc_uuid)
);

/*==============================================================*/
/* @table: xpdl_p_packageheader (xpdl_p_005)                    */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_packageheader
(
vc_packageid      varchar2(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_xpdlversion    varchar2(50)    not null, --xpdl version
vc_vendor         varchar2(50)    not null, --package definition vendor
dat_created       date            not null, --package creation time
dat_description   varchar2(255)   ,         --package description
primary key(vc_packageid)
);

/*==============================================================*/
/* @table:  xpdl_p_application (xpdl_p_006)                     */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_application
(
vc_packageid     varchar2(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_uuid          varchar2(50)    not null, --application uuid
vc_name          varchar2(50)    not null, --application name
vc_description   varchar2(255)   ,         --application description
primary key(vc_packageid,vc_uuid)
);

/*==============================================================*/
/* @table:  xpdl_p_datafield (xpdl_p_007)                       */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_datafield
(
vc_packageid     varchar2(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_uuid          varchar2(50)    not null, --datafield uuid
vc_name          varchar2(50)    not null, --datafield name
vc_type          varchar2(50)    not null, --datafield type (basictype or javaclass name)
vc_value         varchar2(50)    ,         --datafield value
vc_description   varchar2(255)   ,         --datafield description
primary key(vc_packageid,vc_uuid)
);

/*==============================================================*/
/* @table: xpdl_p_script (xpdl_p_008)                           */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_script
(
vc_packageid     varchar2(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_type          varchar2(50)    not null, --script type
vc_version       varchar2(50)    ,         --script version
vc_grammar       varchar2(50) ,            --script grammar
primary key(vc_packageid)
);

/*==============================================================*/
/* @table: xpdl_p_process (xpdl_p_009)                          */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_process
(
vc_packageid     varchar2(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_uuid          varchar2(50)    not null, --process uuid
vc_name          varchar2(50)    not null, --process name
primary key(vc_packageid)
);

/*==============================================================*/
/* @table: xpdl_p_processheader (xpdl_p_010)                    */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_processheader
(
vc_packageid     varchar2(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_processid     varchar2(50)    not null, --process uuid.refers to xpdl_p_process#vc_uuid
dat_created      date            ,         --process creation time
dat_validfrom    date            not null, --process validation start date
dat_validto      date            ,         --process validation stop date
int_limit        number(10)      ,         --process wait timeout setting
vc_durationunit  varchar2(3)    not null,  --process limit unit
vc_description   varchar2(255)  ,          --process description
primary key(vc_packageid,vc_processid)
);

/*==============================================================*/
/* @table: xpdl_p_activity (xpdl_p_011)                         */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_activity
(
vc_packageid          varchar2(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_processid          varchar2(50)    not null, --process uuid.refers to xpdl_p_process#vc_uuid,maybe mainprocess or subprocess
vc_uuid               varchar2(50)    not null, --activity uuid
vc_name               varchar2(50)    not null, --activity name
int_limit             number(10)      ,         --activity wait timeout setting
vc_impltype           varchar(20)     ,         --activity impl type. 'No','Tool','SubFlow'
vc_implid             varchar(20)     ,         --activity impl id .olny used by engine (undefined in wfmc xpdl)
vc_performer          varchar(255)    ,         --activity performer list (255 is too short???)
int_performertype     number(2)       ,         --activity performer type
vc_jointype           varchar(10)     ,         --activity join type. 'AND','OR','WEIGHT'
vc_splittype          varchar(10)     ,         --activity split type (reserved)
vc_description        varchar2(255)   ,         --activity description
primary key(vc_packageid,vc_processid,vc_uuid)
);

/*==============================================================*/
/* @table: xpdl_p_tool (xpdl_p_012)                             */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_tool
(
vc_uuid          varchar2(50)    not null, --tool uuid . olny used by workflow engine
vc_description   varchar2(255)   ,         --tool description
vc_packageid     varchar2(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_appid         varchar2(50)    not null, --tool applicationid .refers to xpdl_p_application#vc_uuid
primary key(vc_uuid)
);

/*==============================================================*/
/* @table: xpdl_p_subflow (xpdl_p_013)                          */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_subflow
(
vc_uuid          varchar2(50)    not null, --subflow uuid . olny used by workflow engine
vc_description   varchar2(255)   ,         --subflow description
vc_packageid     varchar2(50)    not null, --subflow package uuid.refers to xpdl_p_package#vc_uuid
vc_processid     varchar2(50)    not null, --subflow process uuid .refers to xpdl_p_process#vc_uuid
primary key(vc_uuid)
);

/*==============================================================*/
/* @table: xpdl_p_transition (xpdl_p_014)                      */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_transition
(
vc_packageid     varchar2(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_processid     varchar2(50)    not null, --process uuid.refers to xpdl_p_process#vc_uuid,maybe mainprocess or subprocess
vc_uuid          varchar2(50)    not null, --transition uuid
vc_name          varchar2(50)    not null, --transition name
vc_from          varchar2(50)    not null, --transition from activity .refers to xpdl_p_activity#vc_uuid
vc_to            varchar2(50)    not null, --transition to activity .refers to xpdl_p_activity#vc_uuid
vc_condition     varchar2(1024)  ,         --transition condition script.(1024 is enough???)
int_weight       number(2)       ,         --transition weight (reserved)
vc_description   varchar2(255)   ,         --transition description
primary key(vc_packageid,vc_processid,vc_uuid)
);
