1 7 8 package org.enhydra.snapper.presentation; 9 10 11 13 import java.sql.Timestamp ; 14 15 import org.enhydra.snapper.SnapperManager; 16 import org.enhydra.snapper.presentation.html.*; 17 import org.enhydra.snapper.spec.*; 18 import org.enhydra.xml.xmlc.XMLObject; 19 20 import com.lutris.appserver.server.httpPresentation.ClientPageRedirectException; 21 22 23 public class CreatedPresentation extends BasePO { 24 25 29 private static String SITE_NAME = "site_nameInput"; 30 private static String LANGUAGE = "site_languageInput"; 31 private static String MAX_SIZE = "site_MaxSizeInput"; 32 private static String MAX_AGE = "site_MaxAgeInput"; 33 private static String RTF = "site_RTFInput"; 34 private static String DOC = "site_DOCInput"; 35 private static String TXT = "site_TXTInput"; 36 private static String HTML = "site_HTMLInput"; 37 private static String MSG = "site_MSGInput"; 38 private static String PDF = "site_PDFInput"; 39 private static String XLS = "site_XLSInput"; 40 41 42 private static String EML = "site_EMLInput"; 43 private static String PPT = "site_PPTInput"; 44 private static String PPS = "site_PPSInput"; 45 private static String ZIP = "site_ZIPInput"; 46 private static String OO = "site_OOInput"; 47 48 private static String SEARCH = "site_SearchInput"; 49 private static String DL = "site_DownloadableInput"; 50 private static String INDEXDIR = "site_IndexDirInput"; 51 52 53 protected XMLObject getDOM() throws Exception { 54 55 CreatedHTML newCreated; 56 newCreated = (CreatedHTML)comms.xmlcFactory.create(CreatedHTML.class); 57 58 59 String name = comms.request.getParameter(SITE_NAME); 60 String language = comms.request.getParameter(LANGUAGE); 61 String size = comms.request.getParameter(MAX_SIZE); 62 String age = comms.request.getParameter(MAX_AGE); 63 String rtf = comms.request.getParameter(RTF); 64 String doc = comms.request.getParameter(DOC); 65 String txt = comms.request.getParameter(TXT); 66 String html = comms.request.getParameter(HTML); 67 String msg = comms.request.getParameter(MSG); 68 String pdf = comms.request.getParameter(PDF); 69 String xls = comms.request.getParameter(XLS); 70 String eml = comms.request.getParameter(EML); 71 String ppt = comms.request.getParameter(PPT); 72 String pps = comms.request.getParameter(PPS); 73 String zip = comms.request.getParameter(ZIP); 74 String oo = comms.request.getParameter(OO); 75 String search = comms.request.getParameter(SEARCH); 76 String dl = comms.request.getParameter(DL); 77 String id = comms.request.getParameter(INDEXDIR); 78 79 80 if (name.length() != 0 && language.length() != 0 81 && size.length() != 0 && age.length() != 0) { 82 83 try { 84 Site site = null; 85 site= SiteFactory.getSite("org.enhydra.snapper.business.SiteImpl"); 86 site.createNew(dbTransaction); 87 88 site.setName(name); 89 site.setLanguage(language); 90 site.setSize(size); 91 site.setAge(age); 92 site.setRTF(rtf); 93 site.setDOC(doc); 94 site.setTXT(txt); 95 site.setHTML(html); 96 site.setMSG(msg); 97 site.setPDF(pdf); 98 site.setXLS(xls); 99 site.setEML(eml); 100 site.setPPT(ppt); 101 site.setPPS(pps); 102 site.setZIP(zip); 103 site.setOO(oo); 104 site.setFILENR(0); 105 site.setQUERYNR(0); 106 site.setLASTQUERY(null); 107 site.setLASTUPDATE(null); 108 site.setSEARCH(search); 109 site.setDOWNLOAD(dl); 110 if(SnapperManager.getInstance().getFileSeparatorConvention()!=null && 111 SnapperManager.getInstance().getFileSeparatorConvention().equalsIgnoreCase("unix")) 112 id=id.replaceAll("\\\\","/"); 113 site.setINDEXDIR(id); 114 site.setLOCKED(null); 115 116 String option = comms.request.getParameter("R1"); 117 if (option.equals("V3")){ 118 site.setFILTERDB(comms.request.getParameter("site_FilterDBInput")); 119 site.setFILTERTABLE(comms.request.getParameter("site_FilterTableInput")); 120 site.setFILTERCOLUMN(comms.request.getParameter("site_FilterColumnInput")); 121 } 122 else { 123 site.setINCLUDEDB(comms.request.getParameter("site_IncludeDB")); 124 site.setINCLUDETABLE(comms.request.getParameter("site_IncludeTable")); 125 site.setINCLUDECOLUMN(comms.request.getParameter("site_IncludeColumn")); 126 site.setINCLUDECOLUMNMODIFIED(comms.request.getParameter("site_IncludeColumnModified")); 127 } 128 129 site.setMETADB(comms.request.getParameter("site_MetadataDB")); 130 site.setMETATABLE(comms.request.getParameter("site_MetadataTable")); 131 site.setMETAFILE(comms.request.getParameter("site_MetadataColumnFile")); 132 site.setMETAKEY(comms.request.getParameter("site_MetadataColumnKey")); 133 site.setMETAVALUE(comms.request.getParameter("site_MetadataColumnValue")); 134 135 site.setOTHER(comms.request.getParameter("site_OTHERInput")); 136 137 site.save(); 138 139 try{ 140 SnapperManager.getInstance().getLoggingManager().info("Site '" + name + "' successfully created!"); 141 } catch (Exception e){ 142 System.out.println("Site '" + name + "' successfully created!"); 143 } 144 145 } catch (Exception ex) { 146 newCreated.setTextCreated("Error creating Site!"); 147 try{ 148 SnapperManager.getInstance().getLoggingManager().error("Error creating Site!"); 149 } catch (Exception e){ 150 System.out.println("Error creating Site!"); 151 } 152 System.out.println(ex.toString());} 153 } 154 155 else { 156 throw new ClientPageRedirectException(comms.request.getAppFileURIPath("NewSitePresentation.po?err=notCreated")); 157 } 158 159 throw new ClientPageRedirectException(comms.request.getAppFileURIPath("SiteListPresentation.po")); 160 162 163 } 164 } 165 166 | Popular Tags |