📄 approvaldatabean.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.ejb.approval;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.io.ObjectOutputStream;import java.util.ArrayList;import java.util.Collection;import java.util.Date;import java.util.Iterator;import javax.ejb.CreateException;import javax.ejb.EJBException;import org.apache.log4j.Logger;import org.ejbca.core.ejb.BaseEntityBean;import org.ejbca.core.model.approval.Approval;import org.ejbca.core.model.approval.ApprovalDataUtil;import org.ejbca.core.model.approval.ApprovalDataVO;import org.ejbca.core.model.approval.ApprovalException;import org.ejbca.core.model.approval.ApprovalRequest;import org.ejbca.core.model.approval.ApprovalRequestExecutionException;import org.ejbca.core.model.approval.ApprovalRequestExpiredException;import org.ejbca.util.Base64;import org.ejbca.util.CertTools;/** * Entity bean should not be used directly, use though Session beans. * * Entity Bean representing approval data used to control request and their approvals. * Information stored: * <pre> * id (Primary key), unique row id * approvalid Constructed from action data as actiontype, admin, username etc. It should * result in the same approvalid if the admin tries to request the same action twice. * approvaltype type of action that should be approved, should be one of ApprovalDataVO.APPROVALTYPE_ * constants ex: ApprovalDataVO.APPROVALTYPE_VIEWHARDTOKENDATA * endentityprofileid For RA specific approval requests should the related end entity profile id be specified * for non ra request should this field be set to ApprovalDataVO.ANY_ENDENTITYPROFILE * caid For CA specific approval requests should the related ca id be specified * for non ca request should this field be set to ApprovalDataVO.ANY_CA * reqadmincertissuerdn The issuerdn of the administrator certificate that generated the request. * reqadmincertsn The serialnumber of the administrator certificate that generated the request. String in Hex * status Should be one of ApprovalDataVO.STATUS_WAITINGFORAPPROVAL, STATUS_APPROVED, STATUS_REJECTED, STATUS_EXPIRED, STATUS_EXPIREDANDNOTIFIED, STATUS_EXECUTED * approvaldata Stringrepresentation of data of approvals made by one or more administrators * requestdata Data containing information about the request displayed for the approval administrator. * requestdate Date the request for approval were added * expiredate Date the request for action or the approvel action will expire, Long.MAX_VALUE * means that the request/approval never expires * remainingapprovals Indicates the number of approvals that remains in order to execute the action * </pre> * * @ejb.bean * description="This enterprise bean entity represents an approval request or approved request" * display-name="ApprovalDataEB" * name="ApprovalData" * jndi-name="ApprovalData" * local-jndi-name="ApprovalDataLocal" * view-type="local" * type="CMP" * reentrant="True" * cmp-version="2.x" * transaction-type="Container" * schema="ApprovalDataBean" * primkey-field="id" * * @ejb.pk generate="false" * class="java.lang.Integer" * * @ejb.persistence table-name = "ApprovalData" * * @ejb.home * generate="local" * local-extends="javax.ejb.EJBLocalHome" * local-class="org.ejbca.core.ejb.approval.ApprovalDataLocalHome" * * @ejb.interface * generate="local" * local-extends="javax.ejb.EJBLocalObject" * local-class="org.ejbca.core.ejb.approval.ApprovalDataLocal" * * @ejb.finder * description="findByApprovalId" * signature="Collection findByApprovalId(int approvalid)" * query="SELECT OBJECT(a) from ApprovalDataBean a WHERE a.approvalid=?1" * * @ejb.finder * description="findByApprovalIdNonExpired" * signature="Collection findByApprovalIdNonExpired(int approvalid)" * query="SELECT OBJECT(a) from ApprovalDataBean a WHERE a.approvalid=?1 and (a.status=-1 or a.status=0 or a.status=-3)" * * @ejb.finder * description="findAll" * signature="Collection findAll()" * query="SELECT OBJECT(a) from ApprovalDataBean a" * * @ejb.transaction type="Required" * * @jonas.jdbc-mapping * jndi-name="${datasource.jndi-name}" * * @author Philip Vendil * @version $Id: ApprovalDataBean.java,v 1.7 2006/10/07 14:10:31 anatom Exp $ */public abstract class ApprovalDataBean extends BaseEntityBean { private static final Logger log = Logger.getLogger(ApprovalDataBean.class); /** * unique row id * * @ejb.pk-field * @ejb.persistence column-name="id" * @ejb.interface-method view-type="local" */ public abstract Integer getId(); /** * unique row id * */ public abstract void setId(Integer id); /** * Constructed from action data as actiontype, admin, username etc. It should * result in the same approvalid if the admin tries to request the same action twice. * * @ejb.pk-field * @ejb.persistence column-name="approvalid" */ public abstract int getApprovalid(); /** * Constructed from action data as actiontype, admin, username etc. It should * result in the same approvalid if the admin tries to request the same action twice. * */ public abstract void setApprovalid(int approvalid); /** * Type of action that should be approved, should be one of ApprovalDataVO.APPROVALTYPE_ * constants ex: ApprovalDataVO.APPROVALTYPE_ADDUSER * * @ejb.persistence column-name="approvaltype" */ public abstract int getApprovaltype(); /** * Type of action that should be approved, should be one of ApprovalDataVO.APPROVALTYPE_ * constants ex: ApprovalDataVO.APPROVALTYPE_ADDUSER * */ public abstract void setApprovaltype(int approvaltype); /** * For RA specific approval requests should the related end entity profile id be specified * for non ra request should this field be set to ApprovalDataVO.ANY_ENDENTITYPROFILE * * @ejb.persistence column-name="endentityprofileid" * @ejb.interface-method view-type="local" */ public abstract int getEndentityprofileid(); /** * For RA specific approval requests should the related end entity profile id be specified * for non ra request should this field be set to ApprovalDataVO.ANY_ENDENTITYPROFILE * */ public abstract void setEndentityprofileid(int endentityprofileid); /** * For CA specific approval requests should the related ca id be specified * for non ca request should this field be set to ApprovalDataVO.ANY_CA * * @ejb.persistence column-name="caid" * @ejb.interface-method view-type="local" */ public abstract int getCaid(); /** * For CA specific approval requests should the related ca id be specified * for non ca request should this field be set to ApprovalDataVO.ANY_CA * */ public abstract void setCaid(int caid); /** * The issuerdn of the administrator certificate that generated the request. * * @ejb.persistence column-name="reqadmincertissuerdn" */ public abstract String getReqadmincertissuerdn(); /** * The issuerdn of the administrator certificate that generated the request. * */ public abstract void setReqadmincertissuerdn(String reqadmincertissuerdn); /** * The serialnumber of the administrator certificate that generated the request. String in Hex. * * @ejb.persistence column-name="reqadmincertsn" */ public abstract String getReqadmincertsn(); /** * The serialnumber of the administrator certificate that generated the request. String in Hex. * */ public abstract void setReqadmincertsn(String reqadmincertsn); /** * Should be one of ApprovalDataVO.STATUS_WAITINGFORAPPROVAL, STATUS_APPROVED, * STATUS_REJECTED, STATUS_EXPIRED * * @ejb.persistence column-name="status" * @ejb.interface-method view-type="local" */ public abstract int getStatus(); /** * Should be one of ApprovalDataVO.STATUS_WAITINGFORAPPROVAL, STATUS_APPROVED, * STATUS_REJECTED, STATUS_EXPIRED * */ public abstract void setStatus(int status); /** * Stringrepresentation of data of approvals made by one or more administrators * * @ejb.persistence jdbc-type="LONGVARCHAR" column-name="approvaldata" */ public abstract String getApprovaldata(); /** * Stringrepresentation of data of approvals made by one or more administrators */ public abstract void setApprovaldata(String approvaldata); /** * Data containing information about the request displayed for the approval administrator. * * @ejb.persistence jdbc-type="LONGVARCHAR" column-name="requestdata" */ public abstract String getRequestdata(); /** * Data containing information about the request displayed for the approval administrator. */ public abstract void setRequestdata(String requestdata); /** * Date the request for approval were added * * @ejb.persistence column-name="requestdate" */ public abstract long getRequestdate(); /** * Date the request for approval were added * */ public abstract void setRequestdate(long requestdate); /** * Date the request for action or the approvel action will expire, Long.MAX_VALUE * means that the request/approval never expires * * @ejb.persistence column-name="expiredate" */ public abstract long getExpiredate(); /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -