在Spring应用中引入Jbpm4开发应用

1.       执行创建的脚本

Java代码 复制代码  收藏代码
  1. create table JBPM4_DEPLOYMENT (   
  2.   
  3.         DBID_ bigint not null auto_increment,   
  4.   
  5.         NAME_ longtext,   
  6.   
  7.         TIMESTAMP_ bigint,   
  8.   
  9.         STATE_ varchar(255),   
  10.   
  11.         primary key (DBID_)   
  12.   
  13.     ) type=InnoDB;   
  14.   
  15.     
  16.   
  17.     create table JBPM4_DEPLOYPROP (   
  18.   
  19.         DBID_ bigint not null auto_increment,   
  20.   
  21.         DEPLOYMENT_ bigint,   
  22.   
  23.         OBJNAME_ varchar(255),   
  24.   
  25.         KEY_ varchar(255),   
  26.   
  27.         STRINGVAL_ varchar(255),   
  28.   
  29.         LONGVAL_ bigint,   
  30.   
  31.         primary key (DBID_)   
  32.   
  33.     ) type=InnoDB;   
  34.   
  35.     
  36.   
  37.     create table JBPM4_EXECUTION (   
  38.   
  39.         DBID_ bigint not null auto_increment,   
  40.   
  41.         CLASS_ varchar(255) not null,   
  42.   
  43.         DBVERSION_ integer not null,   
  44.   
  45.         ACTIVITYNAME_ varchar(255),   
  46.   
  47.         PROCDEFID_ varchar(255),   
  48.   
  49.         HASVARS_ bit,   
  50.   
  51.         NAME_ varchar(255),   
  52.   
  53.         KEY_ varchar(255),   
  54.   
  55.         ID_ varchar(255) unique,   
  56.   
  57.         STATE_ varchar(255),   
  58.   
  59.         SUSPHISTSTATE_ varchar(255),   
  60.   
  61.         PRIORITY_ integer,   
  62.   
  63.         HISACTINST_ bigint,   
  64.   
  65.         PARENT_ bigint,   
  66.   
  67.         INSTANCE_ bigint,   
  68.   
  69.         SUPEREXEC_ bigint,   
  70.   
  71.         SUBPROCINST_ bigint,   
  72.   
  73.         PARENT_IDX_ integer,   
  74.   
  75.         primary key (DBID_)   
  76.   
  77.     ) type=InnoDB;   
  78.   
  79.     
  80.   
  81.     create table JBPM4_HIST_ACTINST (   
  82.   
  83.         DBID_ bigint not null auto_increment,   
  84.   
  85.         CLASS_ varchar(255) not null,   
  86.   
  87.         DBVERSION_ integer not null,   
  88.   
  89.         HPROCI_ bigint,   
  90.   
  91.         TYPE_ varchar(255),   
  92.   
  93.         EXECUTION_ varchar(255),   
  94.   
  95.         ACTIVITY_NAME_ varchar(255),   
  96.   
  97.         START_ datetime,   
  98.   
  99.         END_ datetime,   
  100.   
  101.         DURATION_ bigint,   
  102.   
  103.         TRANSITION_ varchar(255),   
  104.   
  105.         NEXTIDX_ integer,   
  106.   
  107.         HTASK_ bigint,   
  108.   
  109.         primary key (DBID_)   
  110.   
  111.     ) type=InnoDB;   
  112.   
  113.     
  114.   
  115.     create table JBPM4_HIST_DETAIL (   
  116.   
  117.         DBID_ bigint not null auto_increment,   
  118.   
  119.         CLASS_ varchar(255) not null,   
  120.   
  121.         DBVERSION_ integer not null,   
  122.   
  123.         USERID_ varchar(255),   
  124.   
  125.         TIME_ datetime,   
  126.   
  127.         HPROCI_ bigint,   
  128.   
  129.         HPROCIIDX_ integer,   
  130.   
  131.         HACTI_ bigint,   
  132.   
  133.         HACTIIDX_ integer,   
  134.   
  135.         HTASK_ bigint,   
  136.   
  137.         HTASKIDX_ integer,   
  138.   
  139.         HVAR_ bigint,   
  140.   
  141.         HVARIDX_ integer,   
  142.   
  143.         MESSAGE_ longtext,   
  144.   
  145.         OLD_INT_ integer,   
  146.   
  147.         NEW_INT_ integer,   
  148.   
  149.         OLD_STR_ varchar(255),   
  150.   
  151.         NEW_STR_ varchar(255),   
  152.   
  153.         OLD_TIME_ datetime,   
  154.   
  155.         NEW_TIME_ datetime,   
  156.   
  157.         PARENT_ bigint,   
  158.   
  159.         PARENT_IDX_ integer,   
  160.   
  161.         primary key (DBID_)   
  162.   
  163.     ) type=InnoDB;   
  164.   
  165.     
  166.   
  167.     create table JBPM4_HIST_PROCINST (   
  168.   
  169.         DBID_ bigint not null,   
  170.   
  171.         DBVERSION_ integer not null,   
  172.   
  173.         ID_ varchar(255),   
  174.   
  175.         PROCDEFID_ varchar(255),   
  176.   
  177.         KEY_ varchar(255),   
  178.   
  179.         START_ datetime,   
  180.   
  181.         END_ datetime,   
  182.   
  183.         DURATION_ bigint,   
  184.   
  185.         STATE_ varchar(255),   
  186.   
  187.         ENDACTIVITY_ varchar(255),   
  188.   
  189.         NEXTIDX_ integer,   
  190.   
  191.         primary key (DBID_)   
  192.   
  193.     ) type=InnoDB;   
  194.   
  195.     
  196.   
  197.     create table JBPM4_HIST_TASK (   
  198.   
  199.         DBID_ bigint not null,   
  200.   
  201.         DBVERSION_ integer not null,   
  202.   
  203.         EXECUTION_ varchar(255),   
  204.   
  205.         OUTCOME_ varchar(255),   
  206.   
  207.         ASSIGNEE_ varchar(255),   
  208.   
  209.         PRIORITY_ integer,   
  210.   
  211.         STATE_ varchar(255),   
  212.   
  213.         CREATE_ datetime,   
  214.   
  215.         END_ datetime,   
  216.   
  217.         DURATION_ bigint,   
  218.   
  219.         NEXTIDX_ integer,   
  220.   
  221.         SUPERTASK_ bigint,   
  222.   
  223.         primary key (DBID_)   
  224.   
  225.     ) type=InnoDB;   
  226.   
  227.     
  228.   
  229.     create table JBPM4_HIST_VAR (   
  230.   
  231.         DBID_ bigint not null,   
  232.   
  233.         DBVERSION_ integer not null,   
  234.   
  235.         PROCINSTID_ varchar(255),   
  236.   
  237.         EXECUTIONID_ varchar(255),   
  238.   
  239.         VARNAME_ varchar(255),   
  240.   
  241.         VALUE_ varchar(255),   
  242.   
  243.         HPROCI_ bigint,   
  244.   
  245.         HTASK_ bigint,   
  246.   
  247.         primary key (DBID_)   
  248.   
  249.     ) type=InnoDB;   
  250.   
  251.     
  252.   
  253.     create table JBPM4_ID_GROUP (   
  254.   
  255.         DBID_ bigint not null auto_increment,   
  256.   
  257.         DBVERSION_ integer not null,   
  258.   
  259.         ID_ varchar(255),   
  260.   
  261.         NAME_ varchar(255),   
  262.   
  263.         TYPE_ varchar(255),   
  264.   
  265.         PARENT_ bigint,   
  266.   
  267.         primary key (DBID_)   
  268.   
  269.     ) type=InnoDB;   
  270.   
  271.     
  272.   
  273.     create table JBPM4_ID_MEMBERSHIP (   
  274.   
  275.         DBID_ bigint not null auto_increment,   
  276.   
  277.         DBVERSION_ integer not null,   
  278.   
  279.         USER_ bigint,   
  280.   
  281.         GROUP_ bigint,   
  282.   
  283.         NAME_ varchar(255),   
  284.   
  285.         primary key (DBID_)   
  286.   
  287.     ) type=InnoDB;   
  288.   
  289.     
  290.   
  291.     create table JBPM4_ID_USER (   
  292.   
  293.         DBID_ bigint not null auto_increment,   
  294.   
  295.         DBVERSION_ integer not null,   
  296.   
  297.         ID_ varchar(255),   
  298.   
  299.         PASSWORD_ varchar(255),   
  300.   
  301.         GIVENNAME_ varchar(255),   
  302.   
  303.         FAMILYNAME_ varchar(255),   
  304.   
  305.         BUSINESSEMAIL_ varchar(255),   
  306.   
  307.         primary key (DBID_)   
  308.   
  309.     ) type=InnoDB;   
  310.   
  311.     
  312.   
  313.     create table JBPM4_JOB (   
  314.   
  315.         DBID_ bigint not null auto_increment,   
  316.   
  317.         CLASS_ varchar(255) not null,   
  318.   
  319.         DBVERSION_ integer not null,   
  320.   
  321.         DUEDATE_ datetime,   
  322.   
  323.         STATE_ varchar(255),   
  324.   
  325.         ISEXCLUSIVE_ bit,   
  326.   
  327.         LOCKOWNER_ varchar(255),   
  328.   
  329.         LOCKEXPTIME_ datetime,   
  330.   
  331.         EXCEPTION_ longtext,   
  332.   
  333.         RETRIES_ integer,   
  334.   
  335.         PROCESSINSTANCE_ bigint,   
  336.   
  337.         EXECUTION_ bigint,   
  338.   
  339.         CFG_ bigint,   
  340.   
  341.         SIGNAL_ varchar(255),   
  342.   
  343.         EVENT_ varchar(255),   
  344.   
  345.         REPEAT_ varchar(255),   
  346.   
  347.         primary key (DBID_)   
  348.   
  349.     ) type=InnoDB;   
  350.   
  351.     
  352.   
  353.     create table JBPM4_LOB (   
  354.   
  355.         DBID_ bigint not null auto_increment,   
  356.   
  357.         DBVERSION_ integer not null,   
  358.   
  359.         BLOB_VALUE_ longblob,   
  360.   
  361.         DEPLOYMENT_ bigint,   
  362.   
  363.         NAME_ longtext,   
  364.   
  365.         primary key (DBID_)   
  366.   
  367.     ) type=InnoDB;   
  368.   
  369.     
  370.   
  371.     create table JBPM4_PARTICIPATION (   
  372.   
  373.         DBID_ bigint not null auto_increment,   
  374.   
  375.         DBVERSION_ integer not null,   
  376.   
  377.         GROUPID_ varchar(255),   
  378.   
  379.         USERID_ varchar(255),   
  380.   
  381.         TYPE_ varchar(255),   
  382.   
  383.         TASK_ bigint,   
  384.   
  385.         SWIMLANE_ bigint,   
  386.   
  387.         primary key (DBID_)   
  388.   
  389.     ) type=InnoDB;   
  390.   
  391.     
  392.   
  393.     create table JBPM4_SWIMLANE (   
  394.   
  395.         DBID_ bigint not null auto_increment,   
  396.   
  397.         DBVERSION_ integer not null,   
  398.   
  399.         NAME_ varchar(255),   
  400.   
  401.         ASSIGNEE_ varchar(255),   
  402.   
  403.         EXECUTION_ bigint,   
  404.   
  405.         primary key (DBID_)   
  406.   
  407.     ) type=InnoDB;   
  408.   
  409.     
  410.   
  411.     create table JBPM4_TASK (   
  412.   
  413.         DBID_ bigint not null auto_increment,   
  414.   
  415.         CLASS_ char(1) not null,   
  416.   
  417.         DBVERSION_ integer not null,   
  418.   
  419.         NAME_ varchar(255),   
  420.   
  421.         DESCR_ longtext,   
  422.   
  423.         STATE_ varchar(255),   
  424.   
  425.         SUSPHISTSTATE_ varchar(255),   
  426.   
  427.         ASSIGNEE_ varchar(255),   
  428.   
  429.         FORM_ varchar(255),   
  430.   
  431.         PRIORITY_ integer,   
  432.   
  433.         CREATE_ datetime,   
  434.   
  435.         DUEDATE_ datetime,   
  436.   
  437.         PROGRESS_ integer,   
  438.   
  439.         SIGNALLING_ bit,   
  440.   
  441.         EXECUTION_ID_ varchar(255),   
  442.   
  443.         ACTIVITY_NAME_ varchar(255),   
  444.   
  445.         HASVARS_ bit,   
  446.   
  447.         SUPERTASK_ bigint,   
  448.   
  449.         EXECUTION_ bigint,   
  450.   
  451.         PROCINST_ bigint,   
  452.   
  453.         SWIMLANE_ bigint,   
  454.   
  455.         TASKDEFNAME_ varchar(255),   
  456.   
  457.         primary key (DBID_)   
  458.   
  459.     ) type=InnoDB;   
  460.   
  461.     
  462.   
  463.     create table JBPM4_VARIABLE (   
  464.   
  465.         DBID_ bigint not null auto_increment,   
  466.   
  467.         CLASS_ varchar(255) not null,   
  468.   
  469.         DBVERSION_ integer not null,   
  470.   
  471.         KEY_ varchar(255),   
  472.   
  473.         CONVERTER_ varchar(255),   
  474.   
  475.         HIST_ bit,   
  476.   
  477.         EXECUTION_ bigint,   
  478.   
  479.         TASK_ bigint,   
  480.   
  481.         DATE_VALUE_ datetime,   
  482.   
  483.         DOUBLE_VALUE_ double precision,   
  484.   
  485.         LONG_VALUE_ bigint,   
  486.   
  487.         STRING_VALUE_ varchar(255),   
  488.   
  489.         TEXT_VALUE_ longtext,   
  490.   
  491.         LOB_ bigint,   
  492.   
  493.         EXESYS_ bigint,   
  494.   
  495.         primary key (DBID_)   
  496.   
  497.     ) type=InnoDB;   
  498.   
  499.     
  500.   
  501.     create index IDX_DEPLPROP_DEPL on JBPM4_DEPLOYPROP (DEPLOYMENT_);   
  502.   
  503.     
  504.   
  505.     alter table JBPM4_DEPLOYPROP   
  506.   
  507.         add index FK_DEPLPROP_DEPL (DEPLOYMENT_),   
  508.   
  509.         add constraint FK_DEPLPROP_DEPL   
  510.   
  511.         foreign key (DEPLOYMENT_)   
  512.   
  513.         references JBPM4_DEPLOYMENT (DBID_);   
  514.   
  515.     
  516.   
  517.     create index IDX_EXEC_SUPEREXEC on JBPM4_EXECUTION (SUPEREXEC_);   
  518.   
  519.     
  520.   
  521.     create index IDX_EXEC_INSTANCE on JBPM4_EXECUTION (INSTANCE_);   
  522.   
  523.     
  524.   
  525.     create index IDX_EXEC_SUBPI on JBPM4_EXECUTION (SUBPROCINST_);   
  526.   
  527.     
  528.   
  529.     create index IDX_EXEC_PARENT on JBPM4_EXECUTION (PARENT_);   
  530.   
  531.     
  532.   
  533.     alter table JBPM4_EXECUTION   
  534.   
  535.         add index FK_EXEC_PARENT (PARENT_),   
  536.   
  537.         add constraint FK_EXEC_PARENT   
  538.   
  539.         foreign key (PARENT_)   
  540.   
  541.         references JBPM4_EXECUTION (DBID_);   
  542.   
  543.     
  544.   
  545.     alter table JBPM4_EXECUTION   
  546.   
  547.         add index FK_EXEC_SUBPI (SUBPROCINST_),   
  548.   
  549.         add constraint FK_EXEC_SUBPI   
  550.   
  551.         foreign key (SUBPROCINST_)   
  552.   
  553.         references JBPM4_EXECUTION (DBID_);   
  554.   
  555.     
  556.   
  557.     alter table JBPM4_EXECUTION   
  558.   
  559.         add index FK_EXEC_INSTANCE (INSTANCE_),   
  560.   
  561.         add constraint FK_EXEC_INSTANCE   
  562.   
  563.         foreign key (INSTANCE_)   
  564.   
  565.         references JBPM4_EXECUTION (DBID_);   
  566.   
  567.     
  568.   
  569.     alter table JBPM4_EXECUTION   
  570.   
  571.         add index FK_EXEC_SUPEREXEC (SUPEREXEC_),   
  572.   
  573.         add constraint FK_EXEC_SUPEREXEC   
  574.   
  575.         foreign key (SUPEREXEC_)   
  576.   
  577.         references JBPM4_EXECUTION (DBID_);   
  578.   
  579.     
  580.   
  581.     create index IDX_HACTI_HPROCI on JBPM4_HIST_ACTINST (HPROCI_);   
  582.   
  583.     
  584.   
  585.     create index IDX_HTI_HTASK on JBPM4_HIST_ACTINST (HTASK_);   
  586.   
  587.     
  588.   
  589.     alter table JBPM4_HIST_ACTINST   
  590.   
  591.         add index FK_HACTI_HPROCI (HPROCI_),   
  592.   
  593.         add constraint FK_HACTI_HPROCI   
  594.   
  595.         foreign key (HPROCI_)   
  596.   
  597.         references JBPM4_HIST_PROCINST (DBID_);   
  598.   
  599.     
  600.   
  601.     alter table JBPM4_HIST_ACTINST   
  602.   
  603.         add index FK_HTI_HTASK (HTASK_),   
  604.   
  605.         add constraint FK_HTI_HTASK   
  606.   
  607.         foreign key (HTASK_)   
  608.   
  609.         references JBPM4_HIST_TASK (DBID_);   
  610.   
  611.     
  612.   
  613.     create index IDX_HDET_HACTI on JBPM4_HIST_DETAIL (HACTI_);   
  614.   
  615.     
  616.   
  617.     create index IDX_HDET_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);   
  618.   
  619.     
  620.   
  621.     create index IDX_HDETAIL_HACTI on JBPM4_HIST_DETAIL (HACTI_);   
  622.   
  623.     
  624.   
  625.     create index IDX_HDETAIL_HVAR on JBPM4_HIST_DETAIL (HVAR_);   
  626.   
  627.     
  628.   
  629.     create index IDX_HDETAIL_HTASK on JBPM4_HIST_DETAIL (HTASK_);   
  630.   
  631.     
  632.   
  633.     create index IDX_HDETAIL_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);   
  634.   
  635.     
  636.   
  637.     create index IDX_HDET_HVAR on JBPM4_HIST_DETAIL (HVAR_);   
  638.   
  639.     
  640.   
  641.     create index IDX_HDET_HTASK on JBPM4_HIST_DETAIL (HTASK_);   
  642.   
  643.     
  644.   
  645.     alter table JBPM4_HIST_DETAIL   
  646.   
  647.         add index FK_HDETAIL_HPROCI (HPROCI_),   
  648.   
  649.         add constraint FK_HDETAIL_HPROCI   
  650.   
  651.         foreign key (HPROCI_)   
  652.   
  653.         references JBPM4_HIST_PROCINST (DBID_);   
  654.   
  655.     
  656.   
  657.     alter table JBPM4_HIST_DETAIL   
  658.   
  659.         add index FK_HDETAIL_HACTI (HACTI_),   
  660.   
  661.         add constraint FK_HDETAIL_HACTI   
  662.   
  663.         foreign key (HACTI_)   
  664.   
  665.         references JBPM4_HIST_ACTINST (DBID_);   
  666.   
  667.     
  668.   
  669.     alter table JBPM4_HIST_DETAIL   
  670.   
  671.         add index FK_HDETAIL_HTASK (HTASK_),   
  672.   
  673.         add constraint FK_HDETAIL_HTASK   
  674.   
  675.         foreign key (HTASK_)   
  676.   
  677.         references JBPM4_HIST_TASK (DBID_);   
  678.   
  679.     
  680.   
  681.     alter table JBPM4_HIST_DETAIL   
  682.   
  683.         add index FK_HDETAIL_HVAR (HVAR_),   
  684.   
  685.         add constraint FK_HDETAIL_HVAR   
  686.   
  687.         foreign key (HVAR_)   
  688.   
  689.         references JBPM4_HIST_VAR (DBID_);   
  690.   
  691.     
  692.   
  693.     alter table JBPM4_HIST_TASK   
  694.   
  695.         add index FK_HSUPERT_SUB (SUPERTASK_),   
  696.   
  697.         add constraint FK_HSUPERT_SUB   
  698.   
  699.         foreign key (SUPERTASK_)   
  700.   
  701.         references JBPM4_HIST_TASK (DBID_);   
  702.   
  703.     
  704.   
  705.     create index IDX_HVAR_HPROCI on JBPM4_HIST_VAR (HPROCI_);   
  706.   
  707.     
  708.   
  709.     create index IDX_HVAR_HTASK on JBPM4_HIST_VAR (HTASK_);   
  710.   
  711.     
  712.   
  713.     alter table JBPM4_HIST_VAR   
  714.   
  715.         add index FK_HVAR_HPROCI (HPROCI_),   
  716.   
  717.         add constraint FK_HVAR_HPROCI   
  718.   
  719.         foreign key (HPROCI_)   
  720.   
  721.         references JBPM4_HIST_PROCINST (DBID_);   
  722.   
  723.     
  724.   
  725.     alter table JBPM4_HIST_VAR   
  726.   
  727.         add index FK_HVAR_HTASK (HTASK_),   
  728.   
  729.         add constraint FK_HVAR_HTASK   
  730.   
  731.         foreign key (HTASK_)   
  732.   
  733.         references JBPM4_HIST_TASK (DBID_);   
  734.   
  735.     
  736.   
  737.     create index IDX_GROUP_PARENT on JBPM4_ID_GROUP (PARENT_);   
  738.   
  739.     
  740.   
  741.     alter table JBPM4_ID_GROUP   
  742.   
  743.         add index FK_GROUP_PARENT (PARENT_),   
  744.   
  745.         add constraint FK_GROUP_PARENT   
  746.   
  747.         foreign key (PARENT_)   
  748.   
  749.         references JBPM4_ID_GROUP (DBID_);   
  750.   
  751.     
  752.   
  753.     create index IDX_MEM_USER on JBPM4_ID_MEMBERSHIP (USER_);   
  754.   
  755.     
  756.   
  757.     create index IDX_MEM_GROUP on JBPM4_ID_MEMBERSHIP (GROUP_);   
  758.   
  759.     
  760.   
  761.     alter table JBPM4_ID_MEMBERSHIP   
  762.   
  763.         add index FK_MEM_GROUP (GROUP_),   
  764.   
  765.         add constraint FK_MEM_GROUP   
  766.   
  767.         foreign key (GROUP_)   
  768.   
  769.         references JBPM4_ID_GROUP (DBID_);   
  770.   
  771.     
  772.   
  773.     alter table JBPM4_ID_MEMBERSHIP   
  774.   
  775.         add index FK_MEM_USER (USER_),   
  776.   
  777.         add constraint FK_MEM_USER   
  778.   
  779.         foreign key (USER_)   
  780.   
  781.         references JBPM4_ID_USER (DBID_);   
  782.   
  783.     
  784.   
  785.     create index IDX_JOBRETRIES on JBPM4_JOB (RETRIES_);   
  786.   
  787.     
  788.   
  789.     create index IDX_JOB_CFG on JBPM4_JOB (CFG_);   
  790.   
  791.     
  792.   
  793.     create index IDX_JOB_PRINST on JBPM4_JOB (PROCESSINSTANCE_);   
  794.   
  795.     
  796.   
  797.     create index IDX_JOB_EXE on JBPM4_JOB (EXECUTION_);   
  798.   
  799.     
  800.   
  801.     create index IDX_JOBLOCKEXP on JBPM4_JOB (LOCKEXPTIME_);   
  802.   
  803.     
  804.   
  805.     create index IDX_JOBDUEDATE on JBPM4_JOB (DUEDATE_);   
  806.   
  807.     
  808.   
  809.     alter table JBPM4_JOB   
  810.   
  811.         add index FK_JOB_CFG (CFG_),   
  812.   
  813.         add constraint FK_JOB_CFG   
  814.   
  815.         foreign key (CFG_)   
  816.   
  817.         references JBPM4_LOB (DBID_);   
  818.   
  819.     
  820.   
  821.     create index IDX_LOB_DEPLOYMENT on JBPM4_LOB (DEPLOYMENT_);   
  822.   
  823.     
  824.   
  825.     alter table JBPM4_LOB   
  826.   
  827.         add index FK_LOB_DEPLOYMENT (DEPLOYMENT_),   
  828.   
  829.         add constraint FK_LOB_DEPLOYMENT   
  830.   
  831.         foreign key (DEPLOYMENT_)   
  832.   
  833.         references JBPM4_DEPLOYMENT (DBID_);   
  834.   
  835.     
  836.   
  837.     create index IDX_PART_TASK on JBPM4_PARTICIPATION (TASK_);   
  838.   
  839.     
  840.   
  841.     alter table JBPM4_PARTICIPATION   
  842.   
  843.         add index FK_PART_SWIMLANE (SWIMLANE_),   
  844.   
  845.         add constraint FK_PART_SWIMLANE   
  846.   
  847.         foreign key (SWIMLANE_)   
  848.   
  849.         references JBPM4_SWIMLANE (DBID_);   
  850.   
  851.     
  852.   
  853.     alter table JBPM4_PARTICIPATION   
  854.   
  855.         add index FK_PART_TASK (TASK_),   
  856.   
  857.         add constraint FK_PART_TASK   
  858.   
  859.         foreign key (TASK_)   
  860.   
  861.         references JBPM4_TASK (DBID_);   
  862.   
  863.     
  864.   
  865.     create index IDX_SWIMLANE_EXEC on JBPM4_SWIMLANE (EXECUTION_);   
  866.   
  867.     
  868.   
  869.     alter table JBPM4_SWIMLANE   
  870.   
  871.         add index FK_SWIMLANE_EXEC (EXECUTION_),   
  872.   
  873.         add constraint FK_SWIMLANE_EXEC   
  874.   
  875.         foreign key (EXECUTION_)   
  876.   
  877.         references JBPM4_EXECUTION (DBID_);   
  878.   
  879.     
  880.   
  881.     create index IDX_TASK_SUPERTASK on JBPM4_TASK (SUPERTASK_);   
  882.   
  883.     
  884.   
  885.     alter table JBPM4_TASK   
  886.   
  887.         add index FK_TASK_SWIML (SWIMLANE_),   
  888.   
  889.         add constraint FK_TASK_SWIML   
  890.   
  891.         foreign key (SWIMLANE_)   
  892.   
  893.         references JBPM4_SWIMLANE (DBID_);   
  894.   
  895.     
  896.   
  897.     alter table JBPM4_TASK   
  898.   
  899.         add index FK_TASK_SUPERTASK (SUPERTASK_),   
  900.   
  901.         add constraint FK_TASK_SUPERTASK   
  902.   
  903.         foreign key (SUPERTASK_)   
  904.   
  905.         references JBPM4_TASK (DBID_);   
  906.   
  907.     
  908.   
  909.     create index IDX_VAR_EXESYS on JBPM4_VARIABLE (EXESYS_);   
  910.   
  911.     
  912.   
  913.     create index IDX_VAR_TASK on JBPM4_VARIABLE (TASK_);   
  914.   
  915.     
  916.   
  917.     create index IDX_VAR_EXECUTION on JBPM4_VARIABLE (EXECUTION_);   
  918.   
  919.     
  920.   
  921.     create index IDX_VAR_LOB on JBPM4_VARIABLE (LOB_);   
  922.   
  923.     
  924.   
  925.     alter table JBPM4_VARIABLE   
  926.   
  927.         add index FK_VAR_LOB (LOB_),   
  928.   
  929.         add constraint FK_VAR_LOB   
  930.   
  931.         foreign key (LOB_)   
  932.   
  933.         references JBPM4_LOB (DBID_);   
  934.   
  935.     
  936.   
  937.     alter table JBPM4_VARIABLE   
  938.   
  939.         add index FK_VAR_EXECUTION (EXECUTION_),   
  940.   
  941.         add constraint FK_VAR_EXECUTION   
  942.   
  943.         foreign key (EXECUTION_)   
  944.   
  945.         references JBPM4_EXECUTION (DBID_);   
  946.   
  947.     
  948.   
  949.     alter table JBPM4_VARIABLE   
  950.   
  951.         add index FK_VAR_EXESYS (EXESYS_),   
  952.   
  953.         add constraint FK_VAR_EXESYS   
  954.   
  955.         foreign key (EXESYS_)   
  956.   
  957.         references JBPM4_EXECUTION (DBID_);   
  958.   
  959.     
  960.   
  961.     alter table JBPM4_VARIABLE   
  962.   
  963.         add index FK_VAR_TASK (TASK_),   
  964.   
  965.         add constraint FK_VAR_TASK   
  966.   
  967.         foreign key (TASK_)   
  968.   
  969.         references JBPM4_TASK (DBID_);   
  970.   
  971.    
create table JBPM4_DEPLOYMENT (

        DBID_ bigint not null auto_increment,

        NAME_ longtext,

        TIMESTAMP_ bigint,

        STATE_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_DEPLOYPROP (

        DBID_ bigint not null auto_increment,

        DEPLOYMENT_ bigint,

        OBJNAME_ varchar(255),

        KEY_ varchar(255),

        STRINGVAL_ varchar(255),

        LONGVAL_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_EXECUTION (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        ACTIVITYNAME_ varchar(255),

        PROCDEFID_ varchar(255),

        HASVARS_ bit,

        NAME_ varchar(255),

        KEY_ varchar(255),

        ID_ varchar(255) unique,

        STATE_ varchar(255),

        SUSPHISTSTATE_ varchar(255),

        PRIORITY_ integer,

        HISACTINST_ bigint,

        PARENT_ bigint,

        INSTANCE_ bigint,

        SUPEREXEC_ bigint,

        SUBPROCINST_ bigint,

        PARENT_IDX_ integer,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_ACTINST (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        HPROCI_ bigint,

        TYPE_ varchar(255),

        EXECUTION_ varchar(255),

        ACTIVITY_NAME_ varchar(255),

        START_ datetime,

        END_ datetime,

        DURATION_ bigint,

        TRANSITION_ varchar(255),

        NEXTIDX_ integer,

        HTASK_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_DETAIL (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        USERID_ varchar(255),

        TIME_ datetime,

        HPROCI_ bigint,

        HPROCIIDX_ integer,

        HACTI_ bigint,

        HACTIIDX_ integer,

        HTASK_ bigint,

        HTASKIDX_ integer,

        HVAR_ bigint,

        HVARIDX_ integer,

        MESSAGE_ longtext,

        OLD_INT_ integer,

        NEW_INT_ integer,

        OLD_STR_ varchar(255),

        NEW_STR_ varchar(255),

        OLD_TIME_ datetime,

        NEW_TIME_ datetime,

        PARENT_ bigint,

        PARENT_IDX_ integer,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_PROCINST (

        DBID_ bigint not null,

        DBVERSION_ integer not null,

        ID_ varchar(255),

        PROCDEFID_ varchar(255),

        KEY_ varchar(255),

        START_ datetime,

        END_ datetime,

        DURATION_ bigint,

        STATE_ varchar(255),

        ENDACTIVITY_ varchar(255),

        NEXTIDX_ integer,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_TASK (

        DBID_ bigint not null,

        DBVERSION_ integer not null,

        EXECUTION_ varchar(255),

        OUTCOME_ varchar(255),

        ASSIGNEE_ varchar(255),

        PRIORITY_ integer,

        STATE_ varchar(255),

        CREATE_ datetime,

        END_ datetime,

        DURATION_ bigint,

        NEXTIDX_ integer,

        SUPERTASK_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_VAR (

        DBID_ bigint not null,

        DBVERSION_ integer not null,

        PROCINSTID_ varchar(255),

        EXECUTIONID_ varchar(255),

        VARNAME_ varchar(255),

        VALUE_ varchar(255),

        HPROCI_ bigint,

        HTASK_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_ID_GROUP (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        ID_ varchar(255),

        NAME_ varchar(255),

        TYPE_ varchar(255),

        PARENT_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_ID_MEMBERSHIP (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        USER_ bigint,

        GROUP_ bigint,

        NAME_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_ID_USER (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        ID_ varchar(255),

        PASSWORD_ varchar(255),

        GIVENNAME_ varchar(255),

        FAMILYNAME_ varchar(255),

        BUSINESSEMAIL_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_JOB (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        DUEDATE_ datetime,

        STATE_ varchar(255),

        ISEXCLUSIVE_ bit,

        LOCKOWNER_ varchar(255),

        LOCKEXPTIME_ datetime,

        EXCEPTION_ longtext,

        RETRIES_ integer,

        PROCESSINSTANCE_ bigint,

        EXECUTION_ bigint,

        CFG_ bigint,

        SIGNAL_ varchar(255),

        EVENT_ varchar(255),

        REPEAT_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_LOB (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        BLOB_VALUE_ longblob,

        DEPLOYMENT_ bigint,

        NAME_ longtext,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_PARTICIPATION (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        GROUPID_ varchar(255),

        USERID_ varchar(255),

        TYPE_ varchar(255),

        TASK_ bigint,

        SWIMLANE_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_SWIMLANE (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        NAME_ varchar(255),

        ASSIGNEE_ varchar(255),

        EXECUTION_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_TASK (

        DBID_ bigint not null auto_increment,

        CLASS_ char(1) not null,

        DBVERSION_ integer not null,

        NAME_ varchar(255),

        DESCR_ longtext,

        STATE_ varchar(255),

        SUSPHISTSTATE_ varchar(255),

        ASSIGNEE_ varchar(255),

        FORM_ varchar(255),

        PRIORITY_ integer,

        CREATE_ datetime,

        DUEDATE_ datetime,

        PROGRESS_ integer,

        SIGNALLING_ bit,

        EXECUTION_ID_ varchar(255),

        ACTIVITY_NAME_ varchar(255),

        HASVARS_ bit,

        SUPERTASK_ bigint,

        EXECUTION_ bigint,

        PROCINST_ bigint,

        SWIMLANE_ bigint,

        TASKDEFNAME_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_VARIABLE (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        KEY_ varchar(255),

        CONVERTER_ varchar(255),

        HIST_ bit,

        EXECUTION_ bigint,

        TASK_ bigint,

        DATE_VALUE_ datetime,

        DOUBLE_VALUE_ double precision,

        LONG_VALUE_ bigint,

        STRING_VALUE_ varchar(255),

        TEXT_VALUE_ longtext,

        LOB_ bigint,

        EXESYS_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create index IDX_DEPLPROP_DEPL on JBPM4_DEPLOYPROP (DEPLOYMENT_);

 

    alter table JBPM4_DEPLOYPROP

        add index FK_DEPLPROP_DEPL (DEPLOYMENT_),

        add constraint FK_DEPLPROP_DEPL

        foreign key (DEPLOYMENT_)

        references JBPM4_DEPLOYMENT (DBID_);

 

    create index IDX_EXEC_SUPEREXEC on JBPM4_EXECUTION (SUPEREXEC_);

 

    create index IDX_EXEC_INSTANCE on JBPM4_EXECUTION (INSTANCE_);

 

    create index IDX_EXEC_SUBPI on JBPM4_EXECUTION (SUBPROCINST_);

 

    create index IDX_EXEC_PARENT on JBPM4_EXECUTION (PARENT_);

 

    alter table JBPM4_EXECUTION

        add index FK_EXEC_PARENT (PARENT_),

        add constraint FK_EXEC_PARENT

        foreign key (PARENT_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_EXECUTION

        add index FK_EXEC_SUBPI (SUBPROCINST_),

        add constraint FK_EXEC_SUBPI

        foreign key (SUBPROCINST_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_EXECUTION

        add index FK_EXEC_INSTANCE (INSTANCE_),

        add constraint FK_EXEC_INSTANCE

        foreign key (INSTANCE_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_EXECUTION

        add index FK_EXEC_SUPEREXEC (SUPEREXEC_),

        add constraint FK_EXEC_SUPEREXEC

        foreign key (SUPEREXEC_)

        references JBPM4_EXECUTION (DBID_);

 

    create index IDX_HACTI_HPROCI on JBPM4_HIST_ACTINST (HPROCI_);

 

    create index IDX_HTI_HTASK on JBPM4_HIST_ACTINST (HTASK_);

 

    alter table JBPM4_HIST_ACTINST

        add index FK_HACTI_HPROCI (HPROCI_),

        add constraint FK_HACTI_HPROCI

        foreign key (HPROCI_)

        references JBPM4_HIST_PROCINST (DBID_);

 

    alter table JBPM4_HIST_ACTINST

        add index FK_HTI_HTASK (HTASK_),

        add constraint FK_HTI_HTASK

        foreign key (HTASK_)

        references JBPM4_HIST_TASK (DBID_);

 

    create index IDX_HDET_HACTI on JBPM4_HIST_DETAIL (HACTI_);

 

    create index IDX_HDET_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);

 

    create index IDX_HDETAIL_HACTI on JBPM4_HIST_DETAIL (HACTI_);

 

    create index IDX_HDETAIL_HVAR on JBPM4_HIST_DETAIL (HVAR_);

 

    create index IDX_HDETAIL_HTASK on JBPM4_HIST_DETAIL (HTASK_);

 

    create index IDX_HDETAIL_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);

 

    create index IDX_HDET_HVAR on JBPM4_HIST_DETAIL (HVAR_);

 

    create index IDX_HDET_HTASK on JBPM4_HIST_DETAIL (HTASK_);

 

    alter table JBPM4_HIST_DETAIL

        add index FK_HDETAIL_HPROCI (HPROCI_),

        add constraint FK_HDETAIL_HPROCI

        foreign key (HPROCI_)

        references JBPM4_HIST_PROCINST (DBID_);

 

    alter table JBPM4_HIST_DETAIL

        add index FK_HDETAIL_HACTI (HACTI_),

        add constraint FK_HDETAIL_HACTI

        foreign key (HACTI_)

        references JBPM4_HIST_ACTINST (DBID_);

 

    alter table JBPM4_HIST_DETAIL

        add index FK_HDETAIL_HTASK (HTASK_),

        add constraint FK_HDETAIL_HTASK

        foreign key (HTASK_)

        references JBPM4_HIST_TASK (DBID_);

 

    alter table JBPM4_HIST_DETAIL

        add index FK_HDETAIL_HVAR (HVAR_),

        add constraint FK_HDETAIL_HVAR

        foreign key (HVAR_)

        references JBPM4_HIST_VAR (DBID_);

 

    alter table JBPM4_HIST_TASK

        add index FK_HSUPERT_SUB (SUPERTASK_),

        add constraint FK_HSUPERT_SUB

        foreign key (SUPERTASK_)

        references JBPM4_HIST_TASK (DBID_);

 

    create index IDX_HVAR_HPROCI on JBPM4_HIST_VAR (HPROCI_);

 

    create index IDX_HVAR_HTASK on JBPM4_HIST_VAR (HTASK_);

 

    alter table JBPM4_HIST_VAR

        add index FK_HVAR_HPROCI (HPROCI_),

        add constraint FK_HVAR_HPROCI

        foreign key (HPROCI_)

        references JBPM4_HIST_PROCINST (DBID_);

 

    alter table JBPM4_HIST_VAR

        add index FK_HVAR_HTASK (HTASK_),

        add constraint FK_HVAR_HTASK

        foreign key (HTASK_)

        references JBPM4_HIST_TASK (DBID_);

 

    create index IDX_GROUP_PARENT on JBPM4_ID_GROUP (PARENT_);

 

    alter table JBPM4_ID_GROUP

        add index FK_GROUP_PARENT (PARENT_),

        add constraint FK_GROUP_PARENT

        foreign key (PARENT_)

        references JBPM4_ID_GROUP (DBID_);

 

    create index IDX_MEM_USER on JBPM4_ID_MEMBERSHIP (USER_);

 

    create index IDX_MEM_GROUP on JBPM4_ID_MEMBERSHIP (GROUP_);

 

    alter table JBPM4_ID_MEMBERSHIP

        add index FK_MEM_GROUP (GROUP_),

        add constraint FK_MEM_GROUP

        foreign key (GROUP_)

        references JBPM4_ID_GROUP (DBID_);

 

    alter table JBPM4_ID_MEMBERSHIP

        add index FK_MEM_USER (USER_),

        add constraint FK_MEM_USER

        foreign key (USER_)

        references JBPM4_ID_USER (DBID_);

 

    create index IDX_JOBRETRIES on JBPM4_JOB (RETRIES_);

 

    create index IDX_JOB_CFG on JBPM4_JOB (CFG_);

 

    create index IDX_JOB_PRINST on JBPM4_JOB (PROCESSINSTANCE_);

 

    create index IDX_JOB_EXE on JBPM4_JOB (EXECUTION_);

 

    create index IDX_JOBLOCKEXP on JBPM4_JOB (LOCKEXPTIME_);

 

    create index IDX_JOBDUEDATE on JBPM4_JOB (DUEDATE_);

 

    alter table JBPM4_JOB

        add index FK_JOB_CFG (CFG_),

        add constraint FK_JOB_CFG

        foreign key (CFG_)

        references JBPM4_LOB (DBID_);

 

    create index IDX_LOB_DEPLOYMENT on JBPM4_LOB (DEPLOYMENT_);

 

    alter table JBPM4_LOB

        add index FK_LOB_DEPLOYMENT (DEPLOYMENT_),

        add constraint FK_LOB_DEPLOYMENT

        foreign key (DEPLOYMENT_)

        references JBPM4_DEPLOYMENT (DBID_);

 

    create index IDX_PART_TASK on JBPM4_PARTICIPATION (TASK_);

 

    alter table JBPM4_PARTICIPATION

        add index FK_PART_SWIMLANE (SWIMLANE_),

        add constraint FK_PART_SWIMLANE

        foreign key (SWIMLANE_)

        references JBPM4_SWIMLANE (DBID_);

 

    alter table JBPM4_PARTICIPATION

        add index FK_PART_TASK (TASK_),

        add constraint FK_PART_TASK

        foreign key (TASK_)

        references JBPM4_TASK (DBID_);

 

    create index IDX_SWIMLANE_EXEC on JBPM4_SWIMLANE (EXECUTION_);

 

    alter table JBPM4_SWIMLANE

        add index FK_SWIMLANE_EXEC (EXECUTION_),

        add constraint FK_SWIMLANE_EXEC

        foreign key (EXECUTION_)

        references JBPM4_EXECUTION (DBID_);

 

    create index IDX_TASK_SUPERTASK on JBPM4_TASK (SUPERTASK_);

 

    alter table JBPM4_TASK

        add index FK_TASK_SWIML (SWIMLANE_),

        add constraint FK_TASK_SWIML

        foreign key (SWIMLANE_)

        references JBPM4_SWIMLANE (DBID_);

 

    alter table JBPM4_TASK

        add index FK_TASK_SUPERTASK (SUPERTASK_),

        add constraint FK_TASK_SUPERTASK

        foreign key (SUPERTASK_)

        references JBPM4_TASK (DBID_);

 

    create index IDX_VAR_EXESYS on JBPM4_VARIABLE (EXESYS_);

 

    create index IDX_VAR_TASK on JBPM4_VARIABLE (TASK_);

 

    create index IDX_VAR_EXECUTION on JBPM4_VARIABLE (EXECUTION_);

 

    create index IDX_VAR_LOB on JBPM4_VARIABLE (LOB_);

 

    alter table JBPM4_VARIABLE

        add index FK_VAR_LOB (LOB_),

        add constraint FK_VAR_LOB

        foreign key (LOB_)

        references JBPM4_LOB (DBID_);

 

    alter table JBPM4_VARIABLE

        add index FK_VAR_EXECUTION (EXECUTION_),

        add constraint FK_VAR_EXECUTION

        foreign key (EXECUTION_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_VARIABLE

        add index FK_VAR_EXESYS (EXESYS_),

        add constraint FK_VAR_EXESYS

        foreign key (EXESYS_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_VARIABLE

        add index FK_VAR_TASK (TASK_),

        add constraint FK_VAR_TASK

        foreign key (TASK_)

        references JBPM4_TASK (DBID_);

 


 

 

2.       加入依赖的jar包

Jbpm.jar

 

配置自己的Mysql 库

如在src下或其他源代码目录下,放置

 

Jpbm.cfg.xml

Java代码 复制代码  收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>   
  2.   
  3.     
  4.   
  5. <jbpm-configuration>   
  6.   
  7.   <import resource="jbpm.default.cfg.xml" />   
  8.   
  9.   <import resource="jbpm.tx.hibernate.cfg.xml" />   
  10.   
  11.   <import resource="jbpm.jpdl.cfg.xml" />   
  12.   
  13.   <import resource="jbpm.identity.cfg.xml" />   
  14.   
  15. </jbpm-configuration>  
<?xml version="1.0" encoding="UTF-8"?>

 

<jbpm-configuration>

  <import resource="jbpm.default.cfg.xml" />

  <import resource="jbpm.tx.hibernate.cfg.xml" />

  <import resource="jbpm.jpdl.cfg.xml" />

  <import resource="jbpm.identity.cfg.xml" />

</jbpm-configuration>


 

Jbpm.hibernate.cfg.xml

 

Java代码 复制代码  收藏代码
  1. <?xml version="1.0" encoding="utf-8"?>   
  2.   
  3.     
  4.   
  5. <!DOCTYPE hibernate-configuration PUBLIC   
  6.   
  7.           "-//Hibernate/Hibernate Configuration DTD 3.0//EN"  
  8.   
  9.           "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">   
  10.   
  11. <hibernate-configuration>   
  12.   
  13.   <session-factory>   
  14.   
  15.      <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>   
  16.   
  17.      <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>   
  18.   
  19.      <property name="hibernate.connection.url">jdbc:mysql://localhost/eoffice?useUnicode=true&amp;characterEncoding=utf-8</property>   
  20.   
  21.      <property name="hibernate.connection.username">root</property>   
  22.   
  23.      <property name="hibernate.connection.password">000</property>   
  24.   
  25.      <property name="hibernate.format_sql">true</property>   
  26.   
  27.      <mapping resource="jbpm.repository.hbm.xml" />   
  28.   
  29.      <mapping resource="jbpm.execution.hbm.xml" />   
  30.   
  31.      <mapping resource="jbpm.history.hbm.xml" />   
  32.   
  33.      <mapping resource="jbpm.task.hbm.xml" />   
  34.   
  35.      <mapping resource="jbpm.identity.hbm.xml" />   
  36.   
  37.   </session-factory>   
  38.   
  39. </hibernate-configuration>  
<?xml version="1.0" encoding="utf-8"?>

 

<!DOCTYPE hibernate-configuration PUBLIC

          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

  <session-factory>

     <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

     <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

     <property name="hibernate.connection.url">jdbc:mysql://localhost/eoffice?useUnicode=true&amp;characterEncoding=utf-8</property>

     <property name="hibernate.connection.username">root</property>

     <property name="hibernate.connection.password">000</property>

     <property name="hibernate.format_sql">true</property>

     <mapping resource="jbpm.repository.hbm.xml" />

     <mapping resource="jbpm.execution.hbm.xml" />

     <mapping resource="jbpm.history.hbm.xml" />

     <mapping resource="jbpm.task.hbm.xml" />

     <mapping resource="jbpm.identity.hbm.xml" />

  </session-factory>

</hibernate-configuration>



 

扩展流程中的角色与用户为自己系统中的用户及角色。

 

AppUser实体需要扩展org.jbpm.api.identity.User接口

AppRole实体需要扩展org.jbpm.api.identity.Group接口

 

实现自己系统中的IdentityService接口

 

如写一个类(UserSession)实现org.jbpm.pvm.internal.identity.spi.IdentitySession这个接口。

 

Java代码 复制代码  收藏代码
  1. public class UserSession implements IdentitySession{   
  2.   
  3.          
  4.   
  5.         //仅需要扩展以下方法即可   
  6.   
  7.     
  8.   
  9.          //---------------------------------methods above are not need overwrite--------------------------------------------   
  10.   
  11.      
  12.   
  13.     @Override  
  14.   
  15.     public Group findGroupById(String groupId) {   
  16.   
  17.        // TODO Auto-generated method stub   
  18.   
  19.        return null;   
  20.   
  21.     }   
  22.   
  23.     
  24.   
  25.     @Override  
  26.   
  27.     public List<Group> findGroupsByUser(String arg0) {   
  28.   
  29.        // TODO Auto-generated method stub   
  30.   
  31.        return null;   
  32.   
  33.     }   
  34.   
  35.     
  36.   
  37.     @Override  
  38.   
  39.     public List<Group> findGroupsByUserAndGroupType(String arg0, String arg1) {   
  40.   
  41.        // TODO Auto-generated method stub   
  42.   
  43.        return null;   
  44.   
  45.     }   
  46.   
  47.     
  48.   
  49.     @Override  
  50.   
  51.     public User findUserById(String arg0) {   
  52.   
  53.        // TODO Auto-generated method stub   
  54.   
  55.        return null;   
  56.   
  57.     }   
  58.   
  59.     
  60.   
  61.     @Override  
  62.   
  63.     public List<User> findUsers() {   
  64.   
  65.        // TODO Auto-generated method stub   
  66.   
  67.        return null;   
  68.   
  69.     }   
  70.   
  71.     
  72.   
  73.     @Override  
  74.   
  75.     public List<User> findUsersByGroup(String arg0) {   
  76.   
  77.        // TODO Auto-generated method stub   
  78.   
  79.        return null;   
  80.   
  81.     }   
  82.   
  83.     
  84.   
  85.     @Override  
  86.   
  87.     public List<User> findUsersById(String... arg0) {   
  88.   
  89.        // TODO Auto-generated method stub   
  90.   
  91.        return null;   
  92.   
  93.    }   
  94.   
  95. }  
public class UserSession implements IdentitySession{

      

        //仅需要扩展以下方法即可

 

         //---------------------------------methods above are not need overwrite--------------------------------------------

  

    @Override

    public Group findGroupById(String groupId) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<Group> findGroupsByUser(String arg0) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<Group> findGroupsByUserAndGroupType(String arg0, String arg1) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public User findUserById(String arg0) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<User> findUsers() {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<User> findUsersByGroup(String arg0) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<User> findUsersById(String... arg0) {

       // TODO Auto-generated method stub

       return null;

   }

}


加入用户及组的系统扩展实现配置。

Jbpm.identity.cfg.xml

Java代码 复制代码  收藏代码
  1.     
  2.   
  3. <?xml version="1.0" encoding="UTF-8"?>   
  4.   
  5.     
  6.   
  7. <jbpm-configuration>   
  8.   
  9.   <transaction-context>   
  10.   
  11.      <object class="com.htsoft.core.jbpm.UserSession"/>   
  12.   
  13.   </transaction-context>   
  14.   
  15. </jbpm-configuration>  
 

<?xml version="1.0" encoding="UTF-8"?>

 

<jbpm-configuration>

  <transaction-context>

     <object class="com.htsoft.core.jbpm.UserSession"/>

  </transaction-context>

</jbpm-configuration>



 

 

配置Jbpm.xml的Spring配置文件

Java代码 复制代码  收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>   
  2.   
  3.     
  4.   
  5. <beans xmlns="http://www.springframework.org/schema/beans"  
  6.   
  7.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  8.   
  9.     xsi:schemaLocation=" http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"  
  10.   
  11.     default-lazy-init="true">   
  12.   
  13.      
  14.   
  15.     <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">   
  16.   
  17.         <constructor-arg value="jbpm.cfg.xml" />   
  18.   
  19.     </bean>   
  20.   
  21.      
  22.   
  23.     <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />   
  24.   
  25.     <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />   
  26.   
  27.     <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />   
  28.   
  29.     <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>   
  30.   
  31.     <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>   
  32.   
  33.     <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"/>   
  34.   
  35.      
  36.   
  37.     <!--   
  38.   
  39.     <bean id="jbpmTemplate" class="com.bmsoft.jbpm.spring.JbpmTemplate">   
  40.   
  41.        <property name="processEngine" ref="processEngine"/>   
  42.   
  43.        <property name="proDefinitionService" ref="proDefinitionService"/>   
  44.   
  45.        <property name="dataSource" ref="dataSource"/>   
  46.   
  47.     </bean>   
  48.   
  49.      -->   
  50.   
  51. </beans>  
<?xml version="1.0" encoding="UTF-8"?>

 

<beans xmlns="http://www.springframework.org/schema/beans"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation=" http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"

    default-lazy-init="true">

  

    <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">

        <constructor-arg value="jbpm.cfg.xml" />

    </bean>

  

    <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />

    <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />

    <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />

    <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>

    <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>

    <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"/>

  

    <!--

    <bean id="jbpmTemplate" class="com.bmsoft.jbpm.spring.JbpmTemplate">

       <property name="processEngine" ref="processEngine"/>

       <property name="proDefinitionService" ref="proDefinitionService"/>

       <property name="dataSource" ref="dataSource"/>

    </bean>

     -->

</beans>


如下,在此则可以完成在Spring程序中引入Jpbm4的开发应用,后面取可以进行应用流程发布,表单会签等的操作了。

 qq:1848175569

猜你喜欢

转载自nongyuxia.iteye.com/blog/1850075