1 7 8 package org.enhydra.snapper.presentation; 9 10 11 13 import org.enhydra.snapper.Log; 14 import org.enhydra.snapper.presentation.html.*; 15 import org.enhydra.snapper.spec.*; 16 import org.enhydra.xml.xmlc.XMLObject; 17 18 import org.enhydra.snapper.SnapperManager; 19 20 import com.lutris.appserver.server.httpPresentation.ClientPageRedirectException; 21 22 23 public class UpdateSitePresentation 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 private static String EML = "site_EMLInput"; 42 private static String PPT = "site_PPTInput"; 43 private static String PPS = "site_PPSInput"; 44 private static String ZIP = "site_ZIPInput"; 45 private static String OO = "site_OOInput"; 46 47 private static String SEARCH = "site_SearchInput"; 48 private static String DL = "site_DownloadableInput"; 49 private static String INDEXDIR = "site_IndexDirInput"; 50 private static String DB = "site_FilterDBInput"; 51 private static String TABLE = "site_FilterTableInput"; 52 private static String COLUMN = "site_FilterColumnInput"; 53 54 55 protected XMLObject getDOM() throws Exception { 56 57 UpdateSiteHTML updateSite; 58 updateSite = (UpdateSiteHTML)comms.xmlcFactory.create(UpdateSiteHTML.class); 59 String action = comms.request.getParameter("action"); 60 if (action != null && action.equals("update")){ 61 String name = comms.request.getParameter(SITE_NAME); 62 String language = comms.request.getParameter(LANGUAGE); 63 String size = comms.request.getParameter(MAX_SIZE); 64 String age = comms.request.getParameter(MAX_AGE); 65 String rtf = comms.request.getParameter(RTF); 66 String doc = comms.request.getParameter(DOC); 67 String txt = comms.request.getParameter(TXT); 68 String html = comms.request.getParameter(HTML); 69 String msg = comms.request.getParameter(MSG); 70 String pdf = comms.request.getParameter(PDF); 71 String xls = comms.request.getParameter(XLS); 72 String eml = comms.request.getParameter(EML); 73 String ppt = comms.request.getParameter(PPT); 74 String pps = comms.request.getParameter(PPS); 75 String zip = comms.request.getParameter(ZIP); 76 String oo = comms.request.getParameter(OO); 77 String search = comms.request.getParameter(SEARCH); 78 String dl = comms.request.getParameter(DL); 79 String id = comms.request.getParameter(INDEXDIR); 80 String db = comms.request.getParameter(DB); 81 String table = comms.request.getParameter(TABLE); 82 String column = comms.request.getParameter(COLUMN); 83 try{ 84 Site site= SiteFactory.getSite("org.enhydra.snapper.business.SiteImpl").findSiteByID(comms.request.getParameter("site_oidInput"), dbTransaction); 85 site.setSize(size); 86 site.setAge(age); 87 site.setRTF(rtf); 88 site.setDOC(doc); 89 site.setTXT(txt); 90 site.setHTML(html); 91 site.setMSG(msg); 92 site.setPDF(pdf); 93 site.setXLS(xls); 94 site.setEML(eml); 95 site.setPPT(ppt); 96 site.setPPS(pps); 97 site.setZIP(zip); 98 site.setOO(oo); 99 site.setOTHER(comms.request.getParameter("site_OTHERInput")); 100 101 site.setSEARCH(search); 102 site.setDOWNLOAD(dl); 103 if(SnapperManager.getInstance().getFileSeparatorConvention()!=null && 104 SnapperManager.getInstance().getFileSeparatorConvention().equalsIgnoreCase("unix")) 105 id=id.replaceAll("\\\\","/"); 106 site.setINDEXDIR(id); 107 String option = comms.request.getParameter("R1"); 108 if (option.equals("VF")){ 109 site.setFILTERDB(comms.request.getParameter("site_FilterDBInput")); 110 site.setFILTERTABLE(comms.request.getParameter("site_FilterTableInput")); 111 site.setFILTERCOLUMN(comms.request.getParameter("site_FilterColumnInput")); 112 site.setINCLUDEDB(comms.request.getParameter("")); 113 site.setINCLUDETABLE(comms.request.getParameter("")); 114 site.setINCLUDECOLUMN(comms.request.getParameter("")); 115 site.setINCLUDECOLUMNMODIFIED(comms.request.getParameter("")); 116 117 } 118 else { 119 site.setFILTERDB(comms.request.getParameter("")); 120 site.setFILTERTABLE(comms.request.getParameter("")); 121 site.setFILTERCOLUMN(comms.request.getParameter("")); 122 site.setINCLUDEDB(comms.request.getParameter("site_IncludeDB")); 123 site.setINCLUDETABLE(comms.request.getParameter("site_IncludeTable")); 124 site.setINCLUDECOLUMN(comms.request.getParameter("site_IncludeColumn")); 125 site.setINCLUDECOLUMNMODIFIED(comms.request.getParameter("site_IncludeColumnModified")); 126 } 127 String includeDB = comms.request.getParameter("site_IncludeDB"); 128 if (includeDB != null && includeDB.length() != 0){ 129 site.setINCLUDEDB(includeDB); 130 site.setINCLUDETABLE(comms.request.getParameter("site_IncludeTable")); 131 site.setINCLUDECOLUMN(comms.request.getParameter("site_IncludeColumn")); 132 site.setINCLUDECOLUMNMODIFIED(comms.request.getParameter("site_IncludeColumnModified")); 133 } 134 135 String metaDB = comms.request.getParameter("site_MetadataDB"); 136 if (metaDB != null && metaDB.length()!= 0 ){ 137 site.setMETADB(metaDB); 138 site.setMETATABLE(comms.request.getParameter("site_MetadataTable")); 139 site.setMETAFILE(comms.request.getParameter("site_MetadataColumnFile")); 140 site.setMETAKEY(comms.request.getParameter("site_MetadataColumnKey")); 141 site.setMETAVALUE(comms.request.getParameter("site_MetadataColumnValue")); 142 143 } 144 site.save(); 145 } catch (Exception ex) {System.out.println(ex.toString());} 146 147 throw new ClientPageRedirectException(comms.request.getAppFileURIPath("SiteListPresentation.po")); 148 149 } 150 151 152 153 try { 154 Site site = null; 155 site= SiteFactory.getSite("org.enhydra.snapper.business.SiteImpl").findSiteByID(comms.request.getParameter("id"), dbTransaction); 156 updateSite.getElementTemplateLanguage().setValue(site.getLanguage()); 157 updateSite.getElementMaxAgeInput().setValue(String.valueOf(site.getAge())); 159 updateSite.getElementMaxSizeInput().setValue(String.valueOf(site.getSize())); 160 updateSite.getElementDOCInput().setChecked(site.getDOC()); 161 updateSite.getElementSite_EMLInput().setChecked(site.getEML()); 162 updateSite.getElementHTMLInput().setChecked(site.getHTML()); 163 updateSite.getElementSite_MSGInput().setChecked(site.getMSG()); 164 updateSite.getElementPDFInput().setChecked(site.getPDF()); 165 updateSite.getElementSite_PPSInput().setChecked(site.getPPS()); 166 updateSite.getElementSite_PPTInput().setChecked(site.getPPT()); 167 updateSite.getElementRTFInput().setChecked(site.getRTF()); 168 updateSite.getElementSite_OOInput().setChecked(site.getOO()); 169 updateSite.getElementTXTInput().setChecked(site.getTXT()); 170 updateSite.getElementXLSInput().setChecked(site.getXLS()); 171 updateSite.getElementSite_ZIPInput().setChecked(site.getZIP()); 172 updateSite.getElementSite_SearchInput().setChecked(site.getSEARCH()); 173 updateSite.getElementSite_DownloadableInput().setChecked(site.getDOWNLOAD()); 174 updateSite.getElementSite_IndexDirInput().setValue(site.getINDEXDIR()); 175 updateSite.getElementSite_FilterDBInput().setValue(site.getFILTERDB()); 176 updateSite.getElementSite_FilterColumnInput().setValue(site.getFILTERCOLUMN()); 177 updateSite.getElementSite_FilterTableInput().setValue(site.getFILTERTABLE()); 178 updateSite.getElementSite_oidInput().setValue(site.getID()); 179 updateSite.getElementSite_OTHERInput().setChecked(site.getOTHER()); 180 181 updateSite.getElementSite_FilterDBInput().setValue(site.getFILTERDB()); 182 updateSite.getElementSite_FilterTableInput().setValue(site.getFILTERTABLE()); 183 updateSite.getElementSite_FilterColumnInput().setValue(site.getFILTERCOLUMN()); 184 updateSite.getElementSite_IncludeDB().setValue(site.getINCLUDEDB()); 185 updateSite.getElementSite_IncludeTable().setValue(site.getINCLUDETABLE()); 186 updateSite.getElementSite_IncludeColumn().setValue(site.getINCLUDECOLUMN()); 187 updateSite.getElementSite_IncludeColumnModified().setValue(site.getINCLUDECOLUMNMODIFIED()); 188 updateSite.getElementSite_MetadataDB().setValue(site.getMETADB()); 189 updateSite.getElementSite_MetadataTable().setValue(site.getMETATABLE()); 190 updateSite.getElementSite_MetadataColumnFile().setValue(site.getMETAFILE()); 191 updateSite.getElementSite_MetadataColumnKey().setValue(site.getMETAKEY()); 192 updateSite.getElementSite_MetadataColumnValue().setValue(site.getMETAVALUE()); 193 194 updateSite.getElementAction().setValue("update"); 195 196 200 201 } catch (Exception ex) { 202 Log.logException(ex); 204 System.out.println(ex.toString());} 205 207 211 return updateSite; 213 214 215 } 216 } 217 218 | Popular Tags |