workflow_statexmlbean.java

来自「java开发的办公系统 1.系统管理 (地区管理,部门管理,菜单管理,用户管理」· Java 代码 · 共 909 行 · 第 1/3 页

JAVA
909
字号
	  	           			if(fi!=null)	  	           				fi.close();	  	           			if(fw!=null)	  	           				fw.close();	  	           		}	  	           		catch(Exception e){	  	           			e.printStackTrace();	  	           		}	 	            }	 	            return idList;	 	        }	    /**	    * update xml information	    */	        public  boolean editXML(Workflow_stateItem item){	        	FileInputStream fi = null;		        FileWriter fw=null;		        boolean b=false;	            try{	            	fi = new FileInputStream(path);	                SAXBuilder sb = new SAXBuilder();	                Document doc = sb.build(fi);	                Element root = doc.getRootElement();	                List list = root.getChildren();	                for(int i=0;i<list.size();i++){	                	Element row=(Element)list.get(i); 	               		Element index= row.getChild("id"); 	               		if(index.getText().trim().equals(item.getId().trim())){ 	               			Element id= row.getChild("id"); 	               			id.setText(item.getId()); 	               			Element workflow_id= row.getChild("workflow_id"); 	               			workflow_id.setText(item.getWorkflow_id()); 	               			Element name= row.getChild("name"); 	               			name.setText(item.getName()); 	               			Element approval_type= row.getChild("approval_type"); 	               			approval_type.setText(item.getApproval_type()); 	               			Element appraisal_method= row.getChild("appraisal_method"); 	               			appraisal_method.setText(item.getAppraisal_method()); 	               			Element approval_user= row.getChild("approval_user"); 	               			approval_user.setText(item.getApproval_user()); 	               			Element approval_name= row.getChild("approval_name"); 	               			approval_name.setText(item.getApproval_name()); 	               			Element approval_departmentid= row.getChild("approval_departmentid"); 	               			approval_departmentid.setText(item.getApproval_departmentid()); 	               			Element approval_department= row.getChild("approval_department"); 	               			approval_department.setText(item.getApproval_department()); 	               			Element receive_user= row.getChild("receive_user"); 	               			receive_user.setText(item.getReceive_user()); 	               			Element receive_name= row.getChild("receive_name"); 	               			receive_name.setText(item.getReceive_name()); 	               			Element state_type= row.getChild("state_type"); 	               			state_type.setText(item.getState_type()); 	               			Element x= row.getChild("x"); 	               			x.setText(item.getX()); 	               			Element width= row.getChild("width"); 	               			width.setText(item.getWidth()); 	               			Element y= row.getChild("y"); 	               			y.setText(item.getY()); 	               			Element height= row.getChild("height"); 	               			height.setText(item.getHeight()); 	               			XMLOutputter outer=new XMLOutputter();  	               			fw=new FileWriter(path); 	               			Format fm=Format.getPrettyFormat(); 	               			fm.setEncoding("gb2312"); 	               			outer.setFormat(fm);  	               			outer.output(doc,fw); 	               			outer.output(doc,System.out); 	               		}	                }	                b= true;	            }	            catch(Exception e){	                System.err.println(e+"error");	 	            }	            finally{ 	           		try{ 	           			if(fi!=null) 	           				fi.close(); 	           			if(fw!=null) 	           				fw.close(); 	           		} 	           		catch(Exception e){ 	           			e.printStackTrace(); 	           		}	            }	            return b;	        }	        		    /**	 	    * update xml information	 	    */	 	        public  boolean UpdateMoveItem(Workflow_stateItem item){	 	        	FileInputStream fi = null;	 		        FileWriter fw=null;	 		        boolean b=false;	 	            try{	 	            	fi = new FileInputStream(path);	 	                SAXBuilder sb = new SAXBuilder();	 	                Document doc = sb.build(fi);	 	                Element root = doc.getRootElement();	 	                List list = root.getChildren();	 	                for(int i=0;i<list.size();i++){	 	                	Element row=(Element)list.get(i);	  	               		Element index= row.getChild("id");	  	               		if(index.getText().trim().equals(item.getId().trim())){	  	               			Element x=row.getChild("x");	  	               			x.setText(item.getX());	  	               			Element width=row.getChild("width");	  	               			width.setText(item.getWidth());	  	               			Element y=row.getChild("y");	  	               			y.setText(item.getY());	  	               			Element height=row.getChild("height");	  	               			height.setText(item.getHeight());	  	               			XMLOutputter outer=new XMLOutputter(); 	  	               			fw=new FileWriter(path);	  	               			Format fm=Format.getPrettyFormat();	  	               			fm.setEncoding("gb2312");	  	               			outer.setFormat(fm); 	  	               			outer.output(doc,fw);	  	               			outer.output(doc,System.out);	  	               		}	 	                }	 	                b= true;	 	            }	 	            catch(Exception e){	 	                System.err.println(e+"error");	 	                return false;	 	            }	 	            finally{	  	           		try{	  	           			if(fi!=null)	  	           				fi.close();	  	           			if(fw!=null)	  	           				fw.close();	  	           		}	  	           		catch(Exception e){	  	           			e.printStackTrace();	  	           		}	 	            }	 	            return b;	 	        }	 	       			    /**		 	    * update xml information		 	    */		 	        public  boolean updateFunc(String func_ids,String id){		 	        	FileInputStream fi = null;		 		        FileWriter fw=null;		 		        boolean b=false;		 	            try{		 	            	fi = new FileInputStream(path);		 	                SAXBuilder sb = new SAXBuilder();		 	                Document doc = sb.build(fi);		 	                Element root = doc.getRootElement();		 	                List list = root.getChildren();		 	                for(int i=0;i<list.size();i++){		 	                	Element row=(Element)list.get(i);		  	               		Element index= row.getChild("id");		  	               		if(index.getText().trim().equals(id)){		  	               			Element func_id=row.getChild("func_id");		  	               			func_id.setText(func_ids);		  	               			XMLOutputter outer=new XMLOutputter(); 		  	               			fw=new FileWriter(path);		  	               			Format fm=Format.getPrettyFormat();		  	               			fm.setEncoding("gb2312");		  	               			outer.setFormat(fm); 		  	               			outer.output(doc,fw);		  	               			outer.output(doc,System.out);		  	               		}		 	                }		 	                b= true;		 	            }		 	            catch(Exception e){		 	                System.err.println(e+"error");		 	                return false;		 	            }		 	            finally{		  	           		try{		  	           			if(fi!=null)		  	           				fi.close();		  	           			if(fw!=null)		  	           				fw.close();		  	           		}		  	           		catch(Exception e){		  	           			e.printStackTrace();		  	           		}		 	            }		 	            return b;		 	        }		 	        		        public  boolean updateItem(Workflow_stateItem item){		        	FileInputStream fi = null;			        FileWriter fw=null;			        boolean b=false;		            try{		            	fi = new FileInputStream(path);		                SAXBuilder sb = new SAXBuilder();		                Document doc = sb.build(fi);		                Element root = doc.getRootElement();		                List list = root.getChildren();		                for(int i=0;i<list.size();i++){		                	Element row=(Element)list.get(i);	 	               		if(row.getChild("id").getText().trim().equals(item.getId().trim())){	 	               			Element workflow_id=row.getChild("workflow_id");	 	               			workflow_id.setText(item.getWorkflow_id());	 	               			Element name=row.getChild("name");	 	               			name.setText(item.getName());	 	               			Element approval_type=row.getChild("approval_type");	 	               			approval_type.setText(item.getApproval_type());	 	               			Element appraisal_method=row.getChild("appraisal_method");	 	               			appraisal_method.setText(item.getAppraisal_method());	 	               			Element approval_user=row.getChild("approval_user");	 	               			approval_user.setText(item.getApproval_user());	 	               			Element approval_name=row.getChild("approval_name");	 	               			approval_name.setText(item.getApproval_name());	 	               			Element approval_departmentid=row.getChild("approval_departmentid");	 	               			approval_departmentid.setText(item.getApproval_departmentid());	 	               			Element approval_department=row.getChild("approval_department");	 	               			approval_department.setText(item.getApproval_department());	 	               			Element receive_user=row.getChild("receive_user");	 	               			receive_user.setText(item.getReceive_user());	 	               			Element receive_name=row.getChild("receive_name");	 	               			receive_name.setText(item.getReceive_name());	 	               			Element state_type=row.getChild("state_type");	 	               			state_type.setText(item.getState_type());	 	               			Element x=row.getChild("x");	 	               			x.setText(item.getX());	 	               			Element width=row.getChild("width");	 	               			width.setText(item.getWidth());	 	               			Element y=row.getChild("y");	 	               			y.setText(item.getY());	 	               			Element height=row.getChild("height");	 	               			height.setText(item.getHeight());	 	               			XMLOutputter outer=new XMLOutputter(); 	 	               			fw=new FileWriter(path);	 	               			Format fm=Format.getPrettyFormat();	 	               			fm.setEncoding("gb2312");	 	               			outer.setFormat(fm); 	 	               			outer.output(doc,fw);	 	               			outer.output(doc,System.out);	 	               		}		                }		                b=true;		            }		            catch(Exception e){		                System.err.println(e+"error");		            }		            finally{	 	           		try{	 	           			if(fi!=null)	 	           				fi.close();	 	           			if(fw!=null)	 	           				fw.close();	 	           		}	 	           		catch(Exception e){	 	           			e.printStackTrace();	 	           		}		            }		            return b;		        }		        }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?