1 package enhydraManager.presentation; 2 3 import enhydraManager.spec.*; 4 import java.util.Vector ; 6 import java.io.IOException ; 7 8 import com.lutris.appserver.server.httpPresentation.HttpPresentation; 10 import com.lutris.appserver.server.httpPresentation.HttpPresentationComms; 11 import com.lutris.appserver.server.httpPresentation.HttpPresentationException; 12 import org.w3c.dom.html.HTMLAnchorElement; 13 import org.w3c.dom.Node ; 14 15 public class DetailPresentation implements HttpPresentation { 16 17 private static DetailHTML detail; 18 19 public void run(HttpPresentationComms comms) throws HttpPresentationException, IOException { 20 21 try{ 22 OutputList(comms); 23 }catch(Exception e){ 24 e.printStackTrace(); 25 } 26 } 27 28 29 public static void OutputList(HttpPresentationComms comms) throws Exception { 30 31 String host = null; 32 String appid = null; 33 String sesid = null; 34 String service = null; 35 try { 36 service = comms.request.getParameter("service"); 37 host = comms.request.getParameter("host"); 38 appid = comms.request.getParameter("appid"); 39 sesid = comms.request.getParameter("sesid"); 40 } catch (Exception e) {} 41 42 43 ApplicationSession applicationSession=ApplicationSessionFactory.getApplicationSession("enhydraManager.business.ApplicationSessionImpl"); 44 Vector [] lists=applicationSession.getList(service,host,appid,sesid); 45 46 Vector sessionAtributes = lists[0]; 47 Vector sessionAttValues = lists[1]; 48 49 String sessionParam= null; 50 String sessionValue = null; 51 52 detail = (DetailHTML)comms.xmlcFactory.create(DetailHTML.class); 53 54 Node sessionElementRow = detail.getElementSessions_data_row(); 55 Node no_entries_row = detail.getElementNo_entries_row(); 56 Node sessions_data_row = detail.getElementSessions_data_row(); 57 58 detail.setTextSessionID(sesid + " Session List"); 59 60 if (sessionAtributes.size() == 0) { 61 62 sessions_data_row.getParentNode().removeChild(sessions_data_row); 63 64 }else if (sessionAtributes.size()==sessionAttValues.size()){ 65 no_entries_row.getParentNode().removeChild(no_entries_row); 66 for (int i=0; i<sessionAtributes.size(); i++) { 67 68 sessionParam= (String ) sessionAtributes.elementAt(i); 69 sessionValue= (String ) sessionAttValues.elementAt(i); 70 try { 71 detail.setTextSessionParam(sessionParam); 72 } catch (IllegalArgumentException ex){ 73 detail.setTextSessionParam("Couldn't get Parameter Name!"); 74 } 75 try { 76 detail.setTextSessionValue(sessionValue); 77 } catch (IllegalArgumentException ex){ 78 detail.setTextSessionValue("Couldn't get Prameter Value!"); 79 } 80 sessionElementRow.getParentNode().insertBefore(sessionElementRow.cloneNode(true), 81 sessionElementRow); 82 } 83 sessionElementRow.getParentNode().removeChild(sessionElementRow); 84 } 85 comms.response.writeDOM(detail); 86 } 87 } 88 89 | Popular Tags |