1 13 14 package org.ejbca.ui.web.admin.approval; 15 16 import java.io.UnsupportedEncodingException ; 17 import java.text.DateFormat ; 18 19 import javax.ejb.EJBException ; 20 21 import org.ejbca.core.model.approval.Approval; 22 import org.ejbca.ui.web.admin.configuration.EjbcaJSFHelper; 23 import org.ejbca.ui.web.admin.configuration.EjbcaWebBean; 24 25 31 public class ApprovalView { 32 33 private Approval approval; 34 35 public ApprovalView(Approval approval){ 36 this.approval=approval; 37 } 38 39 40 public Approval getApproval() { 41 return approval; 42 } 43 44 public String getApprovalDate(){ 45 DateFormat dateformat = DateFormat.getDateTimeInstance(); 46 return dateformat.format(approval.getApprovalDate()); 47 } 48 49 public String getApprovalAdmin(){ 50 return approval.getUsername(); 51 } 52 53 public String getAdminAction(){ 54 EjbcaWebBean ejbcawebbean = EjbcaJSFHelper.getBean().getEjbcaWebBean(); 55 56 if(approval.isApproved()){ 57 return ejbcawebbean.getText("APPROVED"); 58 } 59 return ejbcawebbean.getText("REJECTED"); 60 } 61 62 public String getViewApproverCertLink(){ 63 String link; 64 try { 65 link = EjbcaJSFHelper.getBean().getEjbcaWebBean().getBaseUrl() + EjbcaJSFHelper.getBean().getEjbcaWebBean().getGlobalConfiguration().getAdminWebPath() 66 + "viewcertificate.jsp?certsernoparameter=" + java.net.URLEncoder.encode(approval.getAdminCertSerialNumber().toString(16) + "," + approval.getAdminCertIssuerDN(),"UTF-8"); 67 } catch (UnsupportedEncodingException e) { 68 throw new EJBException (e); 69 } 70 71 return "viewcert('" + link + "')"; 72 } 73 74 public String getComment(){ 75 return approval.getComment(); 76 } 77 } 78 | Popular Tags |