




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、基于web service的中企業(yè)管理工作流系統(tǒng)源代碼一、工作流引繁部分代碼1indepartment.java12、historymanage.java43、nodelnstance.java84、node.java155sworkflow.java19二、服務(wù)類代碼26indepartmentservice.java262、historyrecordservice.java273、instancenodeservice.java274、instanceworkfolwservice.java285xlogin.java326、userservice.java327 workflowserv
2、ice.java33三、客戶端部分代碼35increatenodelnfopage.jsp352srecord.jsp39userservice.wsdl424xinstancenodeservice.wsdl465slogin.wsdl53一、工作流引擎部分代碼1> department.javapackage workflow;import css.poolbean;import java.io.serializable;import java.sql.resultset;public class department implements serializable private
3、static fin al long serialversio nuid = -6919998195498831828l;public static poolbean pool = null;public int nld;public int getnld() return nld;public void setnld( int nld ) this.nld = nld;public string getnamef) return nname;public void setname(string nname) this. nn ame = nn ame;public string nname;
4、public void init(poolbean poolbean) this.refresh!);pool = poolbean;public void refreshf) this.nld = 0;this. nn ame =/創(chuàng)建一個部門* return boolean */public boolean createdepartment() boolean flag;string sql;try sql = "insert into department (d_name) values(川 + this.getname() + nld = pool.lnsert(sql);f
5、lag = true; catch (exception e) flag = false;e.getmessage();return flag;/* param i 部門的 id* return boolean*/public boolean open(int i) boolean flag = false;string sql;sql = “select d_name from department where id=h + i;tryresultset rs = pool.executequery(sql);while (rs.next() nn ame = rs.getstri ngd_
6、name“);flag = true;rs.close(); catch (exception e) flag = false;refresh();e.getmessage();return flag;/* return department*/public department openaii() string sql="n;sql=hselect id from department"int i=0;department departments=null;department department=new department);tryint cnt=pool.getc
7、ountval(sql);if(cnt=0) return null;departments二new departmentcnt;resultset rs=pool.executequery(sql);trywhile (rs.next()departme ntsi二 departme nt. ope ndepartme nt(rs.getl nt(”ict); i+;jcatch (exception ex)ex.getmessagef); finally tryrs.close);jcatch (exception exception) exception.getmessage();cat
8、ch (exception e)e.getmessage();return departments;/* param id 部門的 id* return 一個部門實例*/public department opendepartment(int id) department department = new department();string sql = hselect d_name from department where id=h + id; tryresultset rs = pool.executequery(sql);if (rs.next()department, nld =
9、id;department. nn ame = rs.getstri ngd_ name”);rs.close(); catch (exception e) this.refresh!);e.getmessage();return null;return department;public boolean delete(int departmentld)boolean flag=false;string sql=hdelete from department where id=m+departmentld; try flag=pool.execute( sql); catch( excepti
10、on e ) / todo: handle exceptionsystem.out.print( e.getmessage()+n delete department error!h); flag=false;return flag;2、historymanage.javapackage workflow;/* created with intellij idea.* user: lixiang* date: 13-3-7time:下午 1:28* to change this template use file | settings | file templates.*/import jav
11、a.sql.*;import css.pool;public class historymanage poolbean pool = new poolbean();public int getnld() return nid;public void setnld( int nid ) this.nld = nid;public int getnlnstanceid() return nlnstanceid;public void setnlnstanceid( int nlnstanceid ) this, nlnstan ceid = nlnstan ceid;public int getn
12、lnstancenodeid() return nlnstancenodeid;public void setnlnstancenodeid( int nlnstancenodeid ) this, nlnsta ncenodeid = nln sta ncenodeid; public stri ng get nn ote() return nnote;public void set nn ote( string nnote ) this. nnote = nn ote;public string getnbegindate() return nbegindate;public void s
13、etnbegindate( string nbegindate ) this. nbegi ndate = n begindate;public string getnenddate() return nenddate;public void setnenddate( string nenddate ) this. nen ddate = nen ddate;public string getnuserld() return nuserld;public void setnllserld( string nuserid ) this. nuserld = n userid;public boo
14、lean isntaskend() return ntaskend;public void setntaskend( boolean ntaskend ) this. ntaske nd = n taske nd;public boolean isnfinished() return nfinished;public void setnfinished( boolean nfinished ) this. nfin ished = nfin ished;public int nid = 0;public int nlnstanceid = 0;public int nlnstancenodei
15、d = 0;public string nnote =public string nbegindate = null;public string nenddate = null;public string nuserid =public boolean ntaskend = false;public boolean nfinished = false;public historyrecord() public void init(poolbean poolbean) pool = poolbean;public boolean open(int record id) boolean rtn =
16、 false;string sql = ''select * from historyrecord where id=h + recordid; trypoolbean pool = new poolbean();resultset rs = pool.executequery(sql);try 訐(rs.next() this.nld = recordid;this, nln sta ncenodeid = rs.getlnt(hj nsta nceno de_idh); this.nnote = rs.getstri ng(”no te");this.nbegin
17、date = rs.getstring(hbegi ndate” ); this. nenddate = rs.getstri nddate”); this.nllserld = rs.getstring("user_id"); string temp = rs.getstring(”taskenct); this, nlnsta nceid = rs.getlnt(hi nstancedn); string fi nished = rs.getstri ng(”fin ished"); if (tpareto(mlh) = 0) this. ntaskend =
18、 true;elsethis. ntaskend = false;if (pareto("1") = 0)this. nfinished = true;elsethis. nfinished = false;rtn = true; catch (exception ex) ex.pri ntstacktracef); finally rs.close); catch (exception ex) rtn 二 false;this.refresh);system.err.prj ntln (hgetnoderepeateltem:11 + ex.getmessage(); r
19、eturn rtn;public void refresh!) this.nld = 0;this, nlnsta nceid = 0;this, nlnsta ncenodeid = 0;this.nnote =this. nbegindate = n ull;this. nen ddate = null;this.nuserld =n"this. ntaske nd = false;this. nfin ished = false;public historyrecord openaii(int instanceld) historyrecord records = null;s
20、tring sql = “”;resultset rs = null;historyrecord historyrecord = new historyrecord();historyrecordn it(pool);int i = 0;try sql = ''select id from historyrecord where instance_id=h + instanceid; rs = pool.executequery(sql);int ent = pool.getcountval(sql);if (ent = 0) return null;records = new
21、 historyrecordcnt;while (rs.next() recordsi = historyrecord.ope nhr(rsgetlntict);i+;rs.close(); catch (exception e) this.refresh();e.getmessage();return records;public historyrecord openhr(int hrid) historyrecord historyrecord = new historyrecord();string sql = ''select * from historyrecord
22、where id=h + hrid; tryresultset rs = pool.executequery(sql);if (rs.next()historyrecord.nid = rs.getlnt("id");historyrecord. nlnstancenodeid = rs.getl nt(”i nstanceno de_idh); historyrecord. nnote = rs.getstri ngno teh);historyrecord. nbegindate = rs.getstring(hbegi ndate”); historyrecord.n
23、e nddate = rs.getstri ng(,"enddate,); historyrecord. nuserld = rs.getstring(huser_idh);historyrecord.ntaskend = !rs.getstring(”taskenct)equalsro”);historyrecord.nlnsta nceid = hrid; historyrecord.nfinished = !rs.getstring("finished").equals(ho"); catch (exception e) e.getmessagef
24、);return historyrecord;3、nodelnstance.javapackage workflow;/* created with intellij idea.* user: lixiang* date: 13-3-7* time:下午 1:29* to change this template use file | settings | file templates.*/*實例節(jié)點對象*/import java.io.serializable;import java.sql.*;import css.poolbean;public class nodelnstance im
25、plements serializable /*/private static final long serialversionllld = 4488882574138337559l;public pool pool = null; / 數(shù)據(jù)庫連接對象public long nid = 0; / 此 instancenode 對象的 idpublic long getnld() return nid;public void setnld( long nid ) this.nld = nid;public int getnlnstanceworkflowld() return nlnstance
26、workflowid;public void setnlnstanceworkflowld( int nlnstanceworkflowid ) this.nlnsta nceworkflowid = n instanceworkflowid;public int getnlndex() return nlndex;public void setnlndex( int nlndex ) this, nln dex = nln dex;public int getnnodeld() return nnodeld;public void setnnodeld( int nnodeld ) this
27、. nn odeld = nn odeld;public string getnuserld() return nuserid;public void setnllserld( string nuserid ) this, nil serld = n userid;public boolean isnactive) return nactive;public void setnactive( boolean nactive ) this.nactive = n active;public boolean isnfinished() return nfinished;public void se
28、tnfinished( boolean nfinished ) this. nfin ished = nfin ished;public boolean isntaskend() return ntaskend;public void setntaskend( boolean ntaskend ) this. ntaskend = n taske nd;public int getndepartment() return ndepartment;public void setndepartment( int ndepartment) this. ndepartme nt = n departm
29、e nt;public int nlnstanceworkflowid = 0;/ 此 instancenode 對象所屬的工作流實例的 id public int nlndex = 0; /此instancenode對象在工作流實例流程中的位置 public int nnodeld = 0; / 此 instancenode 對象對應(yīng)的 node 對象的 idpublic string nuserld =/ 此 instancenode 對象的責(zé)任人public boolean nactive = false; / 此 instancenode 對象是否為活動狀態(tài)public boolean
30、 nfinished = false; / 此 instancenode 對象的工作是否己經(jīng)完成 public boolean ntaskend = false; / 此 instancenode 對象的任務(wù)是否已經(jīng)結(jié)束 public int ndepartment = 0;* ntaskend和nfinished兩個屬性是有區(qū)別的:taskend*并不代表節(jié)點的任務(wù)已經(jīng)完成(finished),也可能是其它原因終止了這個節(jié)點的任 務(wù)。*例如文件申請時撰寫的文檔不符合標(biāo)準(zhǔn)將會被打回,此時節(jié)點己經(jīng)task end,但是 節(jié)點的任務(wù)并未完成。*/public instancenode() publ
31、ic void lnit( poolbean poolbean ) this.refresh();pool = poolbean;/*清空對象*/private void refresh() this.nld = 0;this.nlnsta nceworkflowid = 0;this, nln dex = 0;this. nn odeld = 0;this.nuserld = ""this. nactive = false;this. nfin ished = false;this. ntaskend = false;public boolean open( int in
32、stancenodeld ) boolean result = false;string sql = "select * from instancenode where id=" + instancenodeld;trystring tmp = ,"'poolbean dbe = new poolbean();resultset rs = dbe.executequery( sql );try if( rs.next() /從數(shù)據(jù)庫取出相應(yīng)的值并賦給各個屬性this. nid = instan cenodeld;this.nlnstanceworkflow
33、id = rs.getlnt( ”instanceict );this.nlndex = rs.getlnt( "indexorder");this.nnodeld = rs.getlnt("nodeid");this.ndepartment = rs.getlnt( "departmentd");/節(jié)點實例的責(zé)任人tmp = rs.getstring( "userid");if( tmp = null)this.nuserld = ""elsethis. nu serld = tmp;/節(jié)點實
34、例是否處于活動狀態(tài)。1:活動;0:不活動tmp = rs.getstring( hactiven);if( tmp != null) if( pareto( "1") = 0 ) this. nactive = true;elsethis. nactive = false; elsethis. nactive = false;/節(jié)點實例是否完成任務(wù)。1:完成;0:未完成tmp = rs.getstring( nstatush);if( pareto( "1") = 0 )this. nfin ished = true;elsethis. nfin ish
35、ed = false;where/得到這個節(jié)點的ntaskend屬性.sql = hselect taskend from historyrecord historyrecord.instancenoded=h + instancenodeld + h order by taskend desc"tmp = pool.getfirstvalf sql );if( paretof "1") = 0 )this. ntaskend = true;elsethis. ntaskend = false;result = true; catch( exception ex
36、) ex.pri ntstacktracef); finally rs.closeo;/關(guān)掉數(shù)據(jù)庫連接釋放資源 catch( exception ex ) result = false;this.refresh();system.err.println( ex.getmessagef);return result;/指定某個節(jié)點實例的責(zé)任人/調(diào)用此方法之前先調(diào)用open()方法public boolean setllserld( string userid ) string sql = ”;boolean result = false;if( this.nld = 0 )return fals
37、e;if( userid = null)return false;try sql = "update instancenode set userid=h, + userid + ,n where id=h + this.nld; pool.execute) sql);result = true; catch( exception exception ) result = false;system.err.println( exception.getmessagef);return result;/調(diào)用這個方法之前必須先調(diào)用open ()方法./返回對這個節(jié)點實例的監(jiān)控記錄的數(shù)目pub
38、lic int getnoderepeatecount() string sql = “”;int ent = 0;if( this.nld = 0 )return 0;sql = hselect * from historyrecord where instancenode_id=h + this.nld; tryent = pool.getcountvalf sql); catch( exception exception ) ent = 0;system.err.prjntln( exception.getmessagef);return ent;/調(diào)用這個方法z前必須先調(diào)用open (
39、)方法./返回對這個節(jié)點實例的監(jiān)控記錄的內(nèi)容/param: index,監(jiān)控記錄的索引public historyrecord getnoderepeateltem( int index ) string sql =h"int i = 0;historyrecord nr = new historyrecord();int ent = getnoderepeatecount();if( ent <= 0 )return null;if( index < 1)in dex = 1;訐(index > ent)index = ent;try pool bean dbe
40、= new poolbean();sql = ''select id from historyrecord where instancenode_id=h + this.nld;resultset rs = dbe.executequery( sql );try while( rs.next() i+;/取出和index相同索引的記錄訐(i = index ) nr.open( rs.getlntf "id");break; catch( exception ex ) ex.printstacktrace(); finally rs.close(); cat
41、ch( exception ex ) system.err.println( "getnoderepeateltem:h + ex.getmessage();return null;return nr;/*獲取某一所屬某一用戶id的所有記錄* param userid* return instanceworkflow 的一個數(shù)組*/public instanceworkflow openaii( string userid, int pagesize, int pagenow ) instanceworkflow instances = null;string sql =result
42、set rs = null;instanceworkflow instanceworkflow = new instanceworkflow();instanceworkflownit( pool);int i = 0;try string s = ''select m.id from (select w.id from workflowinstance wjnstancenode i where w.id=i.instanceid and i.userid=h, + userid + ,n and i.active=ll, and i.status=,o, limit 11
43、+ pagesize * ( pagenow -1) + m) as mh;sql = ''select workflowinstanee.id from workflowinstance ,instancenode where workflowi nstan ce.id=i nsta nceno de.i nsta nceid and in stance no de.userid=h, + userid + h, and instancenode.active=,l, and instancenode.status=,o, and workflowinstanee.id no
44、t in (h + s + h) limith + pagesize;rs = pool.executequery( sql);int ent = pool.getcountval( sql);if( ent = 0 )return null;instances = new instanceworkflow ent ;whilef rs.next() instances! i = instanceworkflow.openlwf( rs.getlnt( "id11);i+;rs.closef); catch( exception ee ) ee.pri ntstacktrace();
45、return instances;/*獲取總記錄*/public int getcount( string userid ) int ent = 0;string sql =try sql = ''select workflowinstance.id from workflowinstance,instancenode where workflowi nstan ce.id=i nsta nceno de.i nsta nceid and in stance no de.userid=h, + userid + ,h and insta nceno de.active=,l,
46、and in stance no de.status=,oh,;ent = pool.getcountval( sql); catch( exception e ) e.getmessagef);return ent;public in stancenode ope nn odes( long instan celd ) instancenode nodes = null;string sql =instancenode node = new instancenode();nodenit( pool);int i = 0;try sql = ''select id from i
47、nstancenode where instanceld=m + instanceid;resultset rs = pool.executequery( sql);int ent = pool.getcountval( sql);if( ent = 0 )return null;no des = new insta ncenode ent ;while( rs.next() no des i = no de.ope nn ode( rs.getl nt( "ict );i+;rs.closef); catch( exception e ) e.getmessagef);return
48、 nodes;public instan cenode ope nn ode( i ong id ) string sql =instancenode node = new instancenode();nodenit( pool);try sql = ''select * from instancenode where id=h + id;resultset rs = pool.executequery( sql);tryif( rs.next() node.nld = rs.getlnt( "id");node.nlnstanceworkflowid =
49、 rs.getlnt( hinstanceld");node.nlndex = rs.getlnt( "indexorder”);node.nnodeld = rs.getlnt( "nodeldh);node.ndepartment = rs.getlnt( "department_ict );if( rs.getstring( "userid") != null 11 !rs.getstring( "userid" ).equals(n") node.nuserid = rs.getstring( “
50、userlct );node.nfinished = rs.getlnt( ''status11) != 0;node.nactive = !rs.getstring( nactiveh).equals) h0h);rs.close(); catch( exception e ) e.getmessage(); finally rs.close(); catch( exception e ) no de.refresh);e.getmessagef);return node;4、node.javapackage workflow;/* created with intellij
51、 idea.* user: lixiang* date: 13-3-7time:下午 1:31* to change this template use file | settings | file templates.import css.poolbean;import java.io.serializable;import java.sql.resultset;public class node implements serializable public poolbean pool = null;public int nid = 0;節(jié)點序號public string nname = ,
52、h;節(jié)點名稱public int nlndex = 0;順序索引/public int nexpire=0;時間期限public int nworkflowid = 0; /工作流定義 id public string nandor = n0" 與或關(guān)系 public string ndescription = 描述 public int getdepartment() return ndepartment;public void setdepartment(int ndepartment) this. ndepartme nt = n departme nt;public int
53、ndepartment=o;部門 id構(gòu)造函數(shù)public node() this.refresh);public void init(poolbean poolbean) this.refresh!);pool = poolbean;設(shè)置、獲取節(jié)點的屬性public long getld() return nid;public void setld(int nid) this.nld = nid;public string getname() return nname;public void setname(string nname) this. nn ame = nn ame;public
54、 int getlndex() return nlndex;public void setlndex(int nlndex) this, nln dex = nln dex;public int getworkflowld() return nworkflowid;public void setworkflowld(int nworkflowid) this.nworkflowid = n workflowid;public string getdescription() return ndescription;public void setdescripti on (string n descriptio n) this. ndescripti on = n description;*清空對象*/ private void refresh() this.nld = 0; this. nn ame = this, nln dex = 0;this.nworkflowid = 0; /this.nandor = "0" this. ndescripti on = *打開一個節(jié)點* param nodeld:節(jié)點 id* return*/public bool
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年三明市農(nóng)業(yè)農(nóng)村局直屬事業(yè)單位選聘真題
- 2024年青海省郵政管理局下屬事業(yè)單位真題
- 企業(yè)數(shù)字化轉(zhuǎn)型的戰(zhàn)略價值試題及答案
- 2024年西安市曲江第六小學(xué)招聘筆試真題
- 2024年四川省骨科醫(yī)院招聘筆試真題
- 2024年貴州省能源局下屬事業(yè)單位真題
- 2024年貴陽市觀山湖區(qū)第十一小學(xué)招聘教師真題
- 2024年民生銀行成都研發(fā)中心招聘筆試真題
- VB考試模擬沖刺試題及答案
- 網(wǎng)絡(luò)管理員考試問題匯聚試題及答案
- 語文五年級 【知識精講】7.閱讀(2)文言文閱讀
- 社會心理學(xué)8-人際關(guān)系課件
- QC-R 596-2017高速鐵路板式無砟軌道自密實混凝土高清-無水印
- 鄰補角、對頂角、同位角、內(nèi)錯角、同旁內(nèi)角經(jīng)典習(xí)題-一對一專用
- 保密管理-保密教育培訓(xùn)簽到簿
- 常見病媒生物分類鑒定
- 手術(shù)室剖宮產(chǎn)護理查房-課件
- 隧道工程隧道洞口臨建施工方案
- DBJ∕T13-374-2021 福建省鋼筋桁架疊合樓板技術(shù)標(biāo)準(zhǔn)
- 事故池管理的有關(guān)規(guī)定
- 高中語文部編版選擇性必修下冊第四單元 單元學(xué)習(xí)導(dǎo)航 課件 (8張PPT)
評論
0/150
提交評論