1 13 14 package org.ejbca.core.model.hardtoken.profiles; 15 16 import java.awt.print.Printable ; 17 import java.awt.print.PrinterException ; 18 import java.io.IOException ; 19 import java.io.StringReader ; 20 21 import org.ejbca.core.model.ra.UserDataVO; 22 23 24 25 26 36 public abstract class HardTokenProfileWithVisualLayout extends HardTokenProfileWithPINEnvelope implements IVisualLayoutSettings{ 37 38 40 protected static final String VISUALLAYOUTTYPE = "visuallayouttype"; 41 protected static final String VISUALLAYOUTFILENAME = "visuallayoutfilename"; 42 protected static final String VISUALLAYOUTDATA = "visuallayoutdata"; 43 44 45 private SVGImageManipulator visualsvgimagemanipulator = null; 46 47 public HardTokenProfileWithVisualLayout() { 49 super(); 50 51 setVisualLayoutType(IVisualLayoutSettings.VISUALLAYOUTTYPE_GENERALLABEL); 52 setVisualLayoutTemplateFilename(""); 53 } 54 55 57 60 public int getVisualLayoutType() { 61 return ((Integer ) data.get(VISUALLAYOUTTYPE)).intValue(); 62 } 63 64 67 public void setVisualLayoutType(int type) { 68 data.put(VISUALLAYOUTTYPE, new Integer (type)); 69 } 70 71 74 public String getVisualLayoutTemplateFilename() { 75 return (String ) data.get(VISUALLAYOUTFILENAME); 76 } 77 78 81 public void setVisualLayoutTemplateFilename(String filename) { 82 data.put(VISUALLAYOUTFILENAME, filename); 83 } 84 85 88 public String getVisualLayoutData() { 89 return (String ) data.get(VISUALLAYOUTDATA); 90 } 91 92 95 public void setVisualLayoutData(String templatedata) { 96 data.put(VISUALLAYOUTDATA, templatedata); 97 } 98 99 102 public Printable printVisualValidity(UserDataVO userdata, String [] pincodes, String [] pukcodes, String hardtokensn, String copyoftokensn) throws IOException , PrinterException { 103 Printable returnval = null; 104 105 if(getVisualLayoutData() != null){ 106 if(visualsvgimagemanipulator == null) 107 visualsvgimagemanipulator = new SVGImageManipulator(new StringReader (getVisualLayoutData()), 108 getVisualValidity(), 109 getHardTokenSNPrefix()); 110 111 returnval = visualsvgimagemanipulator.print(userdata, pincodes, pukcodes, hardtokensn, copyoftokensn); 112 } 113 114 115 return returnval; 116 } 117 118 119 } 120 | Popular Tags |