⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 approvaldatautil.java

📁 一个免费的CA,基于EJB平台的,老师叫我们测试,现把之共享出来让大家参考
💻 JAVA
字号:
/************************************************************************* *                                                                       * *  EJBCA: The OpenSource Certificate Authority                          * *                                                                       * *  This software is free software; you can redistribute it and/or       * *  modify it under the terms of the GNU Lesser General Public           * *  License as published by the Free Software Foundation; either         * *  version 2.1 of the License, or any later version.                    * *                                                                       * *  See terms of license at gnu.org.                                     * *                                                                       * *************************************************************************/package org.ejbca.core.model.approval;import java.io.ByteArrayInputStream;import java.io.IOException;import java.io.ObjectInputStream;import java.util.ArrayList;import java.util.Collection;import javax.ejb.EJBException;import org.apache.log4j.Logger;import org.ejbca.util.Base64;/** * Class containing utils for extracting data from the approvaldata table. * is used by the Entity and Session bean only. *  *  * @author Philip Vendil * @version $Id: ApprovalDataUtil.java,v 1.3 2006/08/09 07:29:48 herrvendil Exp $ */public class ApprovalDataUtil  { 		private static final Logger log = Logger.getLogger(ApprovalDataUtil.class);	public static Collection getApprovals(String stringdata) {    	ArrayList retval = new ArrayList();    	try{    		ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64.decode(stringdata.getBytes())));    		    		int size = ois.readInt();    		for(int i=0;i<size;i++){    			Approval next = (Approval) ois.readObject();    			retval.add(next);    		}    		    	} catch (IOException e) {    		log.error("Error building approvals.",e);    		throw new EJBException(e);    	} catch (ClassNotFoundException e) {    		log.error("Error building approvals.",e);    		throw new EJBException(e);    	}    	    	return retval;    }        public static ApprovalRequest getApprovalRequest(String stringdata) {    	ApprovalRequest retval = null;    	    	try {    		    		ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64.decode(stringdata.getBytes())));			retval= (ApprovalRequest) ois.readObject();		} catch (IOException e) {			log.error("Error building approval request.",e);			throw new EJBException(e);		} catch (ClassNotFoundException e) {			log.error("Error building approval request.",e);			throw new EJBException(e);		}				return retval;    }}

⌨️ 快捷键说明

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