KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openbravo > erpCommon > ad_forms > ShowSession


1 /*
2  *************************************************************************
3  * The contents of this file are subject to the Openbravo Public License
4  * Version 1.0 (the "License"), being the Mozilla Public License
5  * Version 1.1 with a permitted attribution clause; you may not use this
6  * file except in compliance with the License. You may obtain a copy of
7  * the License at http://www.openbravo.com/legal/license.html
8  * Software distributed under the License is distributed on an "AS IS"
9  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
10  * License for the specific language governing rights and limitations
11  * under the License.
12  * The Original Code is Openbravo ERP.
13  * The Initial Developer of the Original Code is Openbravo SL
14  * All portions are Copyright (C) 2001-2006 Openbravo SL
15  * All Rights Reserved.
16  * Contributor(s): ______________________________________.
17  ************************************************************************
18 */

19 package org.openbravo.erpCommon.ad_forms;
20
21 import org.openbravo.erpCommon.businessUtility.WindowTabs;
22 import org.openbravo.base.secureApp.HttpSecureAppServlet;
23 import org.openbravo.base.secureApp.VariablesSecureApp;
24 import org.openbravo.xmlEngine.XmlDocument;
25 import org.openbravo.erpCommon.utility.*;
26 import java.io.*;
27 import javax.servlet.*;
28 import javax.servlet.http.*;
29
30 import java.util.*;
31
32
33 public class ShowSession extends HttpSecureAppServlet {
34   
35   protected static final String JavaDoc windowId = "0";
36   protected static final String JavaDoc tableLevel = "2";
37
38   public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
39     VariablesSecureApp vars = new VariablesSecureApp(request);
40
41     if (!Utility.hasFormAccess(this, vars, "", "org.openbravo.erpCommon.ad_forms.ShowSession")) {
42       bdError(response, "AccessTableNoView", vars.getLanguage());
43       return;
44     }
45
46     if (vars.commandIn("REMOVE")) {
47       String JavaDoc preferences = vars.getRequestGlobalVariable("inpPreference", "ShowSession|preferences");
48       String JavaDoc global = vars.getRequestGlobalVariable("inpGlobal", "ShowSession|global");
49       String JavaDoc accounting = vars.getRequestGlobalVariable("inpAccounting", "ShowSession|accounting");
50       String JavaDoc windowG = vars.getRequestGlobalVariable("inpWindowGlobal", "ShowSession|windowGlobal");
51       String JavaDoc window = vars.getRequestGlobalVariable("inpWindow", "ShowSession|window");
52       String JavaDoc strSessionValue = vars.getRequiredStringParameter("inpSessionValue");
53       vars.removeSessionValue(strSessionValue);
54       printPageDataSheet(request, response, vars, preferences, global, accounting, windowG, window);
55     } else if (vars.commandIn("FIND")) {
56       String JavaDoc preferences = vars.getRequestGlobalVariable("inpPreference", "ShowSession|preferences");
57       String JavaDoc global = vars.getRequestGlobalVariable("inpGlobal", "ShowSession|global");
58       String JavaDoc accounting = vars.getRequestGlobalVariable("inpAccounting", "ShowSession|accounting");
59       String JavaDoc windowG = vars.getRequestGlobalVariable("inpWindowGlobal", "ShowSession|windowGlobal");
60       String JavaDoc window = vars.getRequestGlobalVariable("inpWindow", "ShowSession|window");
61       printPageDataSheet(request, response, vars, preferences, global, accounting, windowG, window);
62     } else if (vars.commandIn("SAVE_NEW")) {
63       String JavaDoc strNombre = vars.getRequiredStringParameter("inpNombreVariable");
64       String JavaDoc strValor = vars.getStringParameter("inpValorVariable");
65       vars.setSessionValue(strNombre, strValor);
66       response.sendRedirect(strDireccion + request.getServletPath());
67     } else if(vars.commandIn("SESSION")) {
68       String JavaDoc preferences = vars.getGlobalVariable("inpPreference", "ShowSession|preferences", "Y");
69       String JavaDoc global = vars.getGlobalVariable("inpGlobal", "ShowSession|global", "Y");
70       String JavaDoc accounting = vars.getGlobalVariable("inpAccounting", "ShowSession|accounting", "Y");
71       String JavaDoc windowG = vars.getGlobalVariable("inpWindowGlobal", "ShowSession|windowGlobal", "Y");
72       String JavaDoc window = vars.getGlobalVariable("inpWindow", "ShowSession|window", "0");
73       printPageDataSheet(request, response, vars, preferences, global, accounting, windowG, window);
74     } else if (vars.commandIn("SAVE_PREFERENCES")) {
75       String JavaDoc strTranslate = vars.getStringParameter("inpTranslate", "N");
76       String JavaDoc strAccounting = vars.getStringParameter("inpAccounting", "N");
77       String JavaDoc strFecha = vars.getStringParameter("inpFecha");
78       String JavaDoc strPassword = vars.getStringParameter("inpPassword");
79       String JavaDoc strTest = vars.getStringParameter("inpTest", "N");
80       String JavaDoc strRecordRange = vars.getGlobalVariable("inpRecordRange", "#RecordRange");
81       String JavaDoc strRecordRangeInfo = vars.getGlobalVariable("inpRecordRangeInfo", "#RecordRangeInfo");
82       String JavaDoc strTheme = vars.getGlobalVariable("inpTheme", "#Theme");
83       String JavaDoc strTransactionalRange = vars.getGlobalVariable("inpTransactionalRange", "#Transactional$Range");
84       vars.setSessionValue("#Date", strFecha);
85       vars.setSessionValue("#ShowTrl", strTranslate);
86       String JavaDoc strPreference = ShowSessionData.selectPreference(this, Utility.getContext(this, vars, "#User_Client", "ShowSession"), Utility.getContext(this, vars, "#User_Org", "ShowSession"), vars.getUser(), "ShowTrl");
87       ShowSessionData.updateRange(this, vars.getUser(), strRecordRange, strRecordRangeInfo, strTransactionalRange, strTheme);
88       if (!strPreference.equals("")) ShowSessionData.update(this, vars.getUser(), strTranslate, strPreference);
89       else {
90         strPreference = SequenceIdData.getSequence(this, "AD_Preference", vars.getClient());
91         ShowSessionData.insert(this, strPreference, vars.getClient(), vars.getOrg(), vars.getUser(), "ShowTrl", strTranslate);
92       }
93       vars.setSessionValue("#ShowAcct", strAccounting);
94       strPreference = ShowSessionData.selectPreference(this, Utility.getContext(this, vars, "#User_Client", "ShowSession"), Utility.getContext(this, vars, "#User_Org", "ShowSession"), vars.getUser(), "ShowAcct");
95       if (!strPreference.equals("")) ShowSessionData.update(this, vars.getUser(), strAccounting, strPreference);
96       else {
97         strPreference = SequenceIdData.getSequence(this, "AD_Preference", vars.getClient());
98         ShowSessionData.insert(this, strPreference, vars.getClient(), vars.getOrg(), vars.getUser(), "ShowAcct", strAccounting);
99       }
100       vars.setSessionValue("#ShowTest", strTest);
101       strPreference = ShowSessionData.selectPreference(this, Utility.getContext(this, vars, "#User_Client", "ShowSession"), Utility.getContext(this, vars, "#User_Org", "ShowSession"), vars.getUser(), "ShowTest");
102       ShowSessionData.updateRange(this, vars.getUser(), strRecordRange, strRecordRangeInfo, strTransactionalRange, strTheme);
103       if (!strPreference.equals("")) ShowSessionData.update(this, vars.getUser(), strTest, strPreference);
104       else {
105         strPreference = SequenceIdData.getSequence(this, "AD_Preference", vars.getClient());
106         ShowSessionData.insert(this, strPreference, vars.getClient(), vars.getOrg(), vars.getUser(), "ShowTest", strTest);
107       }
108       response.sendRedirect(strDireccion + request.getServletPath());
109     } else {
110       printPagePreferences(response, vars);
111     }
112   }
113
114   boolean existsWindow(Vector<Object JavaDoc> windows, String JavaDoc windowId) {
115     if (windows.size()==0) return false;
116     for (int i=0;i<windows.size();i++) {
117       String JavaDoc aux = (String JavaDoc)windows.elementAt(i);
118       if (aux.equals(windowId)) return true;
119     }
120     return false;
121   }
122
123   String JavaDoc windowName(ShowSessionData[] windows, String JavaDoc windowId) {
124     if (windows==null || windowId==null || windowId.equals("")) return "";
125     for (int i=0;i<windows.length;i++) {
126       if (windows[i].id.equals(windowId)) return windows[i].name;
127     }
128     return "";
129   }
130
131   ShowSessionStructureData[] orderStructure(ShowSessionStructureData[] data, ShowSessionData[] windows, boolean preferences, boolean global, boolean accounting, boolean windowGlobal, String JavaDoc window) {
132     ShowSessionStructureData[] resData=null;
133     try {
134       Vector<Object JavaDoc> vecPreferences = new Vector<Object JavaDoc>();
135       if (preferences && (window.equals("") || window.equals("0"))) {
136         for (int i=0;i<data.length;i++) {
137           if (data[i].isPreference && (data[i].window==null || data[i].window.equals(""))) {
138             boolean insertado=false;
139             data[i].window="";
140             data[i].windowName="";
141             for (int j=0;j<vecPreferences.size() && !insertado;j++) {
142               ShowSessionStructureData element = (ShowSessionStructureData) vecPreferences.elementAt(j);
143               if (element.name.compareTo(data[i].name)>=0) {
144                 vecPreferences.insertElementAt(data[i], j);
145                 insertado=true;
146               }
147             }
148             if (!insertado) {
149               vecPreferences.addElement(data[i]);
150             }
151           }
152         }
153       }
154       Vector<Object JavaDoc> vecPreferencesW = new Vector<Object JavaDoc>();
155       if (preferences && !window.equals("")) {
156         for (int i=0;i<data.length;i++) {
157           if (data[i].isPreference && (data[i].window!=null && !data[i].window.equals("") && (data[i].window.equals(window) || window.equals("0")))) {
158             boolean insertado = false;
159             data[i].windowName = windowName(windows, data[i].window);
160             for (int j=0;j<vecPreferencesW.size() && !insertado;j++) {
161               ShowSessionStructureData element = (ShowSessionStructureData) vecPreferencesW.elementAt(j);
162               if (element.windowName.compareTo(data[i].windowName)>0) {
163                 vecPreferencesW.insertElementAt(data[i], j);
164                 insertado=true;
165               } else if (element.windowName.compareTo(data[i].windowName)==0) {
166                 if (element.name.compareTo(data[i].name)>=0) {
167                   vecPreferencesW.insertElementAt(data[i], j);
168                   insertado=true;
169                 }
170               }
171             }
172             if (!insertado) {
173               vecPreferencesW.addElement(data[i]);
174             }
175           }
176         }
177       }
178
179       Vector<Object JavaDoc> vecGlobal = new Vector<Object JavaDoc>();
180       if (global) {
181         for (int i=0;i<data.length;i++) {
182           if (data[i].isGlobal) {
183             boolean insertado = false;
184             data[i].window="";
185             data[i].windowName="";
186             for (int j=0;j<vecGlobal.size() && !insertado;j++) {
187               ShowSessionStructureData element = (ShowSessionStructureData) vecGlobal.elementAt(j);
188               if (element.name.compareTo(data[i].name)>=0) {
189                 vecGlobal.insertElementAt(data[i], j);
190                 insertado=true;
191               }
192             }
193             if (!insertado) {
194               vecGlobal.addElement(data[i]);
195             }
196           }
197         }
198       }
199
200       Vector<Object JavaDoc> vecAccounting = new Vector<Object JavaDoc>();
201       if (accounting) {
202         for (int i=0;i<data.length;i++) {
203           if (data[i].isAccounting) {
204             boolean insertado = false;
205             data[i].window="";
206             data[i].windowName="";
207             for (int j=0;j<vecAccounting.size() && !insertado;j++) {
208               ShowSessionStructureData element = (ShowSessionStructureData) vecAccounting.elementAt(j);
209               if (element.name.compareTo(data[i].name)>=0) {
210                 vecAccounting.insertElementAt(data[i], j);
211                 insertado=true;
212               }
213             }
214             if (!insertado) {
215               vecAccounting.addElement(data[i]);
216             }
217           }
218         }
219       }
220
221       Vector<Object JavaDoc> vecWindowG = new Vector<Object JavaDoc>();
222       if (windowGlobal) {
223         for (int i=0;i<data.length;i++) {
224           if (!data[i].isAccounting && !data[i].isGlobal && !data[i].isPreference && (data[i].window==null || data[i].window.equals(""))) {
225             boolean insertado = false;
226             data[i].window="";
227             data[i].windowName="";
228             for (int j=0;j<vecWindowG.size() && !insertado;j++) {
229               ShowSessionStructureData element = (ShowSessionStructureData) vecWindowG.elementAt(j);
230               if (element.name.compareTo(data[i].name)>=0) {
231                 vecWindowG.insertElementAt(data[i], j);
232                 insertado=true;
233               }
234             }
235             if (!insertado) {
236               vecWindowG.addElement(data[i]);
237             }
238           }
239         }
240       }
241
242       Vector<Object JavaDoc> vecWindow = new Vector<Object JavaDoc>();
243       if (!window.equals("")) {
244         for (int i=0;i<data.length;i++) {
245           if (!data[i].isAccounting && !data[i].isGlobal && !data[i].isPreference && (data[i].window!=null && !data[i].window.equals("") && (data[i].window.equals(window) || window.equals("0")))) {
246             boolean insertado = false;
247             data[i].windowName = windowName(windows, data[i].window);
248             for (int j=0;j<vecWindow.size() && !insertado;j++) {
249               ShowSessionStructureData element = (ShowSessionStructureData) vecWindow.elementAt(j);
250               if (element.windowName.compareTo(data[i].windowName)>0) {
251                 vecWindow.insertElementAt(data[i], j);
252                 insertado=true;
253               } else if (element.windowName.compareTo(data[i].windowName)==0) {
254                 if (element.name.compareTo(data[i].name)>=0) {
255                   vecWindow.insertElementAt(data[i], j);
256                   insertado=true;
257                 }
258               }
259             }
260             if (!insertado) {
261               vecWindow.addElement(data[i]);
262             }
263           }
264         }
265       }
266
267       Vector<Object JavaDoc> vecCompleto = new Vector<Object JavaDoc>();
268       for (int i=0;i<vecPreferences.size();i++) {
269         vecCompleto.addElement(vecPreferences.elementAt(i));
270       }
271       for (int i=0;i<vecPreferencesW.size();i++) {
272         vecCompleto.addElement(vecPreferencesW.elementAt(i));
273       }
274       for (int i=0;i<vecGlobal.size();i++) {
275         vecCompleto.addElement(vecGlobal.elementAt(i));
276       }
277       for (int i=0;i<vecAccounting.size();i++) {
278         vecCompleto.addElement(vecAccounting.elementAt(i));
279       }
280       for (int i=0;i<vecWindowG.size();i++) {
281         vecCompleto.addElement(vecWindowG.elementAt(i));
282       }
283       for (int i=0;i<vecWindow.size();i++) {
284         vecCompleto.addElement(vecWindow.elementAt(i));
285       }
286       resData = new ShowSessionStructureData[vecCompleto.size()];
287       vecCompleto.copyInto(resData);
288       if (log4j.isDebugEnabled()) log4j.debug("ShowSession - orderStructure - Total: " + resData.length + "-" + resData[0].name);
289     } catch (Exception JavaDoc e) {
290       log4j.error("ShowSession - orderStructure - Ordering Session variables error " + e);
291     }
292     return resData;
293   }
294
295   ShowSessionStructureData[] compoundSession(HttpServletRequest request, VariablesSecureApp vars, Vector<Object JavaDoc> windows) {
296     if (log4j.isDebugEnabled()) log4j.debug("ShowSession - compoundSession - view session");
297     ShowSessionStructureData[] data=null;
298     HttpSession session = request.getSession(true);
299     Vector<Object JavaDoc> texto = new Vector<Object JavaDoc>();
300     try {
301       String JavaDoc sessionName;
302       Enumeration e = session.getAttributeNames();
303       while (e.hasMoreElements()) {
304         sessionName = (String JavaDoc)e.nextElement();
305         if (log4j.isDebugEnabled()) log4j.debug("ShowSession - compoundSession - session name: " + sessionName);
306         String JavaDoc realName = sessionName;
307         ShowSessionStructureData data1 = new ShowSessionStructureData();
308         if (realName.startsWith("P|")) {
309           data1.isPreference = true;
310           realName = realName.substring(2);
311         }
312         if (realName.startsWith("$")) {
313           data1.isAccounting = true;
314           realName = realName.substring(1);
315         }
316         if (realName.startsWith("#")) {
317           data1.isGlobal = true;
318           realName = realName.substring(1);
319         }
320         int pos=realName.indexOf("|");
321         if (pos!=-1) {
322           data1.window = realName.substring(0,pos);
323           if (!existsWindow(windows, data1.window)) windows.addElement(data1.window);
324           realName = realName.substring(pos+1);
325         }
326         
327         data1.completeName = sessionName;
328         data1.name = realName;
329         data1.value = vars.getSessionValue(sessionName);
330         texto.addElement(data1);
331       }
332       data = new ShowSessionStructureData[texto.size()];
333       texto.copyInto(data);
334     } catch (Exception JavaDoc e) {
335       log4j.error("ShowSession - compoundSession - Session variables error " + e);
336     }
337     return data;
338   }
339
340   void printPageDataSheet(HttpServletRequest request, HttpServletResponse response, VariablesSecureApp vars, String JavaDoc preferences, String JavaDoc global, String JavaDoc accounting, String JavaDoc windowG, String JavaDoc window) throws IOException, ServletException {
341     if (log4j.isDebugEnabled()) log4j.debug("ShowSession - printPageDataSheet - Output: data sheet");
342     response.setContentType("text/html; charset=UTF-8");
343     PrintWriter out = response.getWriter();
344     Vector<Object JavaDoc> windows = new Vector<Object JavaDoc>();
345     ShowSessionStructureData[] data = compoundSession(request, vars, windows);
346     XmlDocument xmlDocument;
347     if (data==null || data.length==0) {
348       String JavaDoc[] discard = {"sectionDetail"};
349       xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_forms/ShowSession", discard).createXmlDocument();
350     } else {
351       xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_forms/ShowSession").createXmlDocument();
352     }
353     StringBuffer JavaDoc strWindows = new StringBuffer JavaDoc();
354     Vector<Object JavaDoc> vecWindows = new Vector<Object JavaDoc>();
355     if (windows.size()!=0) {
356       strWindows.append("(");
357       for (int i=0;i<windows.size();i++) {
358         String JavaDoc aux = (String JavaDoc)windows.elementAt(i);
359         try {
360           int a=Integer.valueOf(aux).intValue();
361           if (i>0) strWindows.append(", ");
362           strWindows.append(aux);
363         } catch (Exception JavaDoc e) {
364           ShowSessionData d = new ShowSessionData();
365           d.id=aux;
366           d.name=aux;
367           vecWindows.addElement(d);
368         }
369       }
370       strWindows.append(")");
371     }
372     ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "ShowSession", false, "", "", "",false, "ad_forms", strReplaceWith, false, true);
373     toolbar.prepareSimpleToolBarTemplate();
374     xmlDocument.setParameter("toolbar", toolbar.toString());
375     xmlDocument.setParameter("direction", "var baseDirection = \"" + strReplaceWith + "/\";\n");
376     xmlDocument.setParameter("language", "LNG_POR_DEFECTO=\"" + vars.getLanguage() + "\";");
377     xmlDocument.setParameter("preference", preferences);
378     xmlDocument.setParameter("accounting", accounting);
379     xmlDocument.setParameter("global", global);
380     xmlDocument.setParameter("windowGlobal", windowG);
381     xmlDocument.setParameter("window", window);
382     try {
383       WindowTabs tabs = new WindowTabs(this, vars, "org.openbravo.erpCommon.ad_forms.ShowSession");
384       xmlDocument.setParameter("theme", vars.getTheme());
385       NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "ShowSession.html", classInfo.id, classInfo.type, strReplaceWith, tabs.breadcrumb());
386       xmlDocument.setParameter("navigationBar", nav.toString());
387       LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "ShowSession.html", strReplaceWith);
388       xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
389     } catch (Exception JavaDoc ex) {
390       throw new ServletException(ex);
391     }
392     {
393       OBError myMessage = vars.getMessage("ShowSession");
394       vars.removeMessage("ShowSession");
395       if (myMessage!=null) {
396         xmlDocument.setParameter("messageType", myMessage.getType());
397         xmlDocument.setParameter("messageTitle", myMessage.getTitle());
398         xmlDocument.setParameter("messageMessage", myMessage.getMessage());
399       }
400     }
401     ShowSessionData[] windowsData = (vars.getLanguage().equals("en_US")?ShowSessionData.select(this, strWindows.toString()):ShowSessionData.selectTrl(this, strWindows.toString(), vars.getLanguage()));
402     {
403       Vector<Object JavaDoc> v=new Vector<Object JavaDoc>();
404       ShowSessionData d = new ShowSessionData();
405       d.id="0";
406       d.name="All";
407       v.addElement(d);
408       for (int i=0;i<windowsData.length;i++) {
409         v.addElement(windowsData[i]);
410       }
411       for (int i=0;i<vecWindows.size();i++) {
412         v.addElement(vecWindows.elementAt(i));
413       }
414       windowsData = new ShowSessionData[v.size()];
415       v.copyInto(windowsData);
416     }
417     data = orderStructure(data, windowsData, preferences.equals("Y"), global.equals("Y"), accounting.equals("Y"), windowG.equals("Y"), window);
418     xmlDocument.setData("windows", windowsData);
419     xmlDocument.setData("structure1", data);
420
421     out.println(xmlDocument.print());
422     out.close();
423   }
424
425   void printPagePreferences(HttpServletResponse response, VariablesSecureApp vars) throws IOException, ServletException {
426     if (log4j.isDebugEnabled()) log4j.debug("ShowSession - printPagePreferences - Output: preferences");
427     
428     XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_forms/ShowSessionPreferences").createXmlDocument();
429     
430     xmlDocument.setParameter("calendar", vars.getLanguage().substring(0,2));
431     xmlDocument.setParameter("language", "LNG_POR_DEFECTO=\"" + vars.getLanguage() + "\";");
432     xmlDocument.setParameter("direction", "var baseDirection = \"" + strReplaceWith + "/\";\n");
433
434     xmlDocument.setParameter("translate", vars.getSessionValue("#ShowTrl", "N"));
435     xmlDocument.setParameter("accounting", vars.getSessionValue("#ShowAcct", "N"));
436     xmlDocument.setParameter("fecha", vars.getSessionValue("#Date", ""));
437     xmlDocument.setParameter("fechadisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
438     xmlDocument.setParameter("fechasaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
439     xmlDocument.setParameter("transactionalRange", vars.getSessionValue("#Transactional$Range", ""));
440     xmlDocument.setParameter("password", "N");
441     xmlDocument.setParameter("test", vars.getSessionValue("#ShowTest", "N"));
442     xmlDocument.setParameter("recordRange", vars.getSessionValue("#RecordRange"));
443     xmlDocument.setParameter("recordRangeInfo", vars.getSessionValue("#RecordRangeInfo"));
444     xmlDocument.setParameter("info", getInfo(vars));
445     xmlDocument.setParameter("theme", vars.getTheme());
446
447     ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "ShowSession", false, "", "", "",false, "ad_forms", strReplaceWith, false, true);
448     toolbar.prepareSimpleToolBarTemplate();
449     xmlDocument.setParameter("toolbar", toolbar.toString());
450     try {
451       WindowTabs tabs = new WindowTabs(this, vars, "org.openbravo.erpCommon.ad_forms.ShowSession");
452       xmlDocument.setParameter("theme", vars.getTheme());
453       NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "ShowSessionPreferences.html", classInfo.id, classInfo.type, strReplaceWith, tabs.breadcrumb());
454       xmlDocument.setParameter("navigationBar", nav.toString());
455       LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "ShowSessionPreferences.html", strReplaceWith);
456       xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
457     } catch (Exception JavaDoc ex) {
458       throw new ServletException(ex);
459     }
460     {
461       OBError myMessage = vars.getMessage("ShowSession");
462       vars.removeMessage("ShowSession");
463       if (myMessage!=null) {
464         xmlDocument.setParameter("messageType", myMessage.getType());
465         xmlDocument.setParameter("messageTitle", myMessage.getTitle());
466         xmlDocument.setParameter("messageMessage", myMessage.getMessage());
467       }
468     }
469
470     ComboTableData comboTableData = null;
471     try {
472       comboTableData = new ComboTableData(vars, this, "LIST", "Theme", "800102", "", Utility.getContext(this, vars, "#User_Org", "ShowSession"), Utility.getContext(this, vars, "#User_Client", "ShowSession"), 0);
473       Utility.fillSQLParameters(this, vars, null, comboTableData, "ShowSession", "");
474       xmlDocument.setData("reportTheme", "liststructure", comboTableData.select(true));
475     } catch (Exception JavaDoc ex) {}
476     comboTableData = null;
477
478     response.setContentType("text/html; charset=UTF-8");
479     PrintWriter out = response.getWriter();
480     out.println(xmlDocument.print());
481     out.close();
482   }
483
484   private String JavaDoc getInfo(VariablesSecureApp vars) throws ServletException {
485     StringBuffer JavaDoc script = new StringBuffer JavaDoc();
486     script.append(Utility.messageBD(this, "User", vars.getLanguage())).append(": ").append(ShowSessionData.usuario(this, vars.getUser())).append("\n");
487     script.append(Utility.messageBD(this, "Role", vars.getLanguage())).append(": ").append(ShowSessionData.rol(this, vars.getRole())).append("\n");
488     script.append(Utility.messageBD(this, "Client", vars.getLanguage())).append(": ").append(ShowSessionData.cliente(this, vars.getClient())).append("\n");
489     script.append(Utility.messageBD(this, "Org", vars.getLanguage())).append(": ").append(ShowSessionData.organizacion(this, vars.getOrg())).append("\n");
490     script.append(Utility.messageBD(this, "Web", vars.getLanguage())).append(": ").append(strReplaceWith).append("\n");
491     script.append(Utility.messageBD(this, "DB", vars.getLanguage())).append(": ").append(strBBDD).append("\n");
492     script.append(Utility.messageBD(this, "RecordRange", vars.getLanguage())).append(": ").append(vars.getSessionValue("#RecordRange")).append("\n");
493     script.append(Utility.messageBD(this, "SearchsRecordRange", vars.getLanguage())).append(": ").append(vars.getSessionValue("#RecordRangeInfo")).append("\n");
494     if (strVersion!=null && !strVersion.equals("")) script.append(Utility.messageBD(this, "SourceVersion", vars.getLanguage())).append(": ").append(strVersion).append("\n");
495     if (strParentVersion!=null && !strParentVersion.equals("")) script.append(Utility.messageBD(this, "VerticalSourceVersion", vars.getLanguage())).append(": ").append(strParentVersion).append("\n");
496     String JavaDoc strBBDDVersion = ShowSessionData.versionBBDD(this);
497     if (strBBDDVersion!=null && !strBBDDVersion.equals("")) script.append(Utility.messageBD(this, "DBVersion", vars.getLanguage())).append(": ").append(strBBDDVersion).append("\n");
498     String JavaDoc strBBDDParentVersion = ShowSessionData.versionVerticalBBDD(this);
499     if (strBBDDParentVersion!=null && !strBBDDParentVersion.equals("")) script.append(Utility.messageBD(this, "VerticalDBVersion", vars.getLanguage())).append(": ").append(strBBDDParentVersion).append("\n");
500     script.append(Utility.messageBD(this, "JavaVM", vars.getLanguage())).append(": ").append(System.getProperty("java.vm.name")).append("\n");
501     script.append(Utility.messageBD(this, "VersionJavaVM", vars.getLanguage())).append(": ").append(System.getProperty("java.vm.version")).append("\n");
502     script.append(Utility.messageBD(this, "SystemLanguage", vars.getLanguage())).append(": ").append(strSystemLanguage).append("\n");
503     script.append(Utility.messageBD(this, "JavaTMP", vars.getLanguage())).append(": ").append(System.getProperty("java.io.tmpdir")).append("\n");
504     script.append(Utility.messageBD(this, "UserFolder", vars.getLanguage())).append(": ").append(strFileProperties).append("\n");
505     script.append(Utility.messageBD(this, "OS", vars.getLanguage())).append(": ").append(System.getProperty("os.name")).append(" ").append(System.getProperty("os.version"));
506     script.append(" ").append(System.getProperty("sun.os.patch.level"));
507 ;
508
509     return script.toString();
510   }
511
512
513   public String JavaDoc getServletInfo() {
514     return "Servlet ShowSession. This Servlet was made by Wad constructor";
515   } // end of getServletInfo() method
516
}
517
518
Popular Tags