1 13 14 package org.ejbca.core.ejb.ca.caadmin; 15 16 import org.apache.log4j.Logger; 17 import org.ejbca.core.ejb.BaseEntityBean; 18 import org.ejbca.core.model.ca.certificateprofiles.CACertificateProfile; 19 import org.ejbca.core.model.ca.certificateprofiles.CertificateProfile; 20 import org.ejbca.core.model.ca.certificateprofiles.EndUserCertificateProfile; 21 import org.ejbca.core.model.ca.certificateprofiles.RootCACertificateProfile; 22 23 24 import javax.ejb.CreateException ; 25 import java.util.HashMap ; 26 27 28 75 public abstract class CertificateProfileDataBean extends BaseEntityBean { 76 private static final Logger log = Logger.getLogger(CertificateProfileDataBean.class); 77 78 83 public abstract Integer getId(); 84 85 87 public abstract void setId(Integer id); 88 89 93 public abstract String getCertificateProfileName(); 94 95 98 public abstract void setCertificateProfileName(String certificateprofilename); 99 100 104 public abstract HashMap getData(); 105 106 108 public abstract void setData(HashMap data); 109 110 115 public CertificateProfile getCertificateProfile() { 116 CertificateProfile returnval = null; 117 118 switch (((Integer ) (getData().get(CertificateProfile.TYPE))).intValue()) { 119 case CertificateProfile.TYPE_ROOTCA: 120 returnval = new RootCACertificateProfile(); 121 122 break; 123 case CertificateProfile.TYPE_SUBCA: 124 returnval = new CACertificateProfile(); 125 break; 126 case CertificateProfile.TYPE_ENDENTITY: 127 default : 128 returnval = new EndUserCertificateProfile(); 129 } 130 131 returnval.loadData(getData()); 132 133 return returnval; 134 } 135 136 141 public void setCertificateProfile(CertificateProfile profile) { 142 setData((HashMap ) profile.saveData()); 143 } 144 145 149 157 public Integer ejbCreate(Integer id, String certificateprofilename, 158 CertificateProfile certificateprofile) throws CreateException { 159 setId(id); 160 setCertificateProfileName(certificateprofilename); 161 setCertificateProfile(certificateprofile); 162 log.debug("Created certificateprofile " + certificateprofilename); 163 164 return id; 165 } 166 167 public void ejbPostCreate(Integer id, String certificateprofilename, 168 CertificateProfile certificateprofile) { 169 } 171 } 172 | Popular Tags |