/*==============================================================*/
/* @table: xpdl_p_actualparameter (xpdl_p_001)                  */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_actualparameter
(
vc_scope           varchar(50)    not null, --parameter scope
vc_packageid       varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_compid          varchar(50)    not null,
int_index          int(2)       not null, --parameter index
vc_name            varchar(50)    not null, --parameter name.refer to xpdl_p_datafield#vc_uuid
primary key(vc_scope,vc_packageid,vc_compid)
);

/*==============================================================*/
/* @table: xpdl_p_formalparameter (xpdl_p_002)                  */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_formalparameter
(
vc_scope          varchar(50)    not null, --parameter scope
vc_packageid      varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_compid         varchar(50)    ,         
vc_uuid           varchar(50)    not null, --parameter uuid
int_index         int(2)       not null, --parameter index
vc_mode           varchar(10)    not null, --parameter mode
vc_type           varchar(50)    not null, --parameter type (basictype or javaclass name)
vc_description    varchar(255)   ,         --parameter description
primary key(vc_scope,vc_packageid,vc_compid,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           varchar(50)    not null, --attribute scope
vc_packageid       varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_compid          varchar(50)    not null,         
vc_name            varchar(50)    not null, --attribute name
vc_value           varchar(100)   not null, --attribute value
primary key(vc_scope,vc_packageid,vc_compid,vc_name)
);

/*==============================================================*/
/* @table: xpdl_p_package (xpdl_p_004)                          */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_package
(
vc_uuid         varchar(50)    not null, --package uuid
vc_name         varchar(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      varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_xpdlversion    varchar(50)    not null, --xpdl version
vc_vendor         varchar(50)    not null, --package definition vendor
dat_created       datetime            not null, --package creation time
vc_description    varchar(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     varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_uuid          varchar(50)    not null, --application uuid
vc_name          varchar(50)    not null, --application name
vc_description   varchar(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     varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_uuid          varchar(50)    not null, --datafield uuid
vc_name          varchar(50)    not null, --datafield name
vc_type          varchar(50)    not null, --datafield type (basictype or javaclass name)
vc_value         varchar(50)    ,         --datafield value
vc_description   varchar(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     varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_type          varchar(50)    not null, --script type
vc_version       varchar(50)    ,         --script version
vc_grammar       varchar(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     varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_uuid          varchar(50)    not null, --process uuid
vc_name          varchar(50)    not null, --process name
primary key(vc_packageid,vc_uuid)
);

/*==============================================================*/
/* @table: xpdl_p_processheader (xpdl_p_010)                    */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 14:06                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table xpdl_p_processheader
(
vc_packageid     varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_processid     varchar(50)    not null, --process uuid.refers to xpdl_p_process#vc_uuid
dat_created      datetime            ,         --process creation time
dat_validfrom    datetime       not null, --process validation start datetime
dat_validto      datetime     ,           --process validation stop datetime
int_limit        int(10)      ,           --process wait timeout setting
vc_durationunit  varchar(3)   ,           --process limit unit
vc_description   varchar(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          varchar(50)    not null, --package uuid.refers to xpdl_p_package#vc_uuid
vc_processid          varchar(50)    not null, --process uuid.refers to xpdl_p_process#vc_uuid,maybe mainprocess or subprocess
vc_uuid               varchar(50)    not null, --activity uuid
vc_name               varchar(50)    not null, --activity name
int_limit             int(10)      ,           --activity wait timeout setting
vc_durationunit       varchar(3)    ,           --activity limit unit
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???)
vc_jointype           varchar(10)     ,         --activity join type. 'AND','OR','WEIGHT'
vc_splittype          varchar(10)     ,         --activity split type
vc_description        varchar(255)   ,          --activity description
primary key(vc_packageid,vc_processid,vc_uuid)
);


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

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

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