1 package sessionViewer.presentation; 2 3 import sessionViewer.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 appid = null; 32 String sesid = null; 33 try { 34 appid = comms.request.getParameter("appid"); 35 sesid = comms.request.getParameter("sesid"); 36 } catch (Exception e) {} 37 38 39 ApplicationSession applicationSession=ApplicationSessionFactory.getApplicationSession("sessionViewer.business.ApplicationSessionImpl"); 40 Vector [] lists=applicationSession.getList(appid,sesid); 41 42 Vector sessionAtributes = lists[0]; 43 Vector sessionAttValues = lists[1]; 44 45 String sessionParam= null; 46 String sessionValue = null; 47 48 detail = (DetailHTML)comms.xmlcFactory.create(DetailHTML.class); 49 50 Node sessionElementRow = detail.getElementSessions_data_row(); 51 Node no_entries_row = detail.getElementNo_entries_row(); 52 Node sessions_data_row = detail.getElementSessions_data_row(); 53 54 detail.setTextSessionID(sesid + " Session List"); 55 56 if (sessionAtributes.size() == 0) { 57 58 sessions_data_row.getParentNode().removeChild(sessions_data_row); 59 60 }else if (sessionAtributes.size()==sessionAttValues.size()){ 61 no_entries_row.getParentNode().removeChild(no_entries_row); 62 for (int i=0; i<sessionAtributes.size(); i++) { 63 64 sessionParam= (String ) sessionAtributes.elementAt(i); 65 sessionValue= (String ) sessionAttValues.elementAt(i); 66 try { 67 detail.setTextSessionParam(sessionParam); 68 } catch (IllegalArgumentException ex){ 69 detail.setTextSessionParam("Couldn't get Parameter Name!"); 70 } 71 try { 72 detail.setTextSessionValue(sessionValue); 73 } catch (IllegalArgumentException ex){ 74 detail.setTextSessionValue("Couldn't get Prameter Value!"); 75 } 76 sessionElementRow.getParentNode().insertBefore(sessionElementRow.cloneNode(true), 77 sessionElementRow); 78 } 79 sessionElementRow.getParentNode().removeChild(sessionElementRow); 80 } 81 comms.response.writeDOM(detail); 82 } 83 } 84 85 | Popular Tags |