1 32 33 package com.knowgate.http.portlets; 34 35 import java.util.Enumeration ; 36 import java.util.ResourceBundle ; 37 import java.util.Locale ; 38 import java.util.Date ; 39 40 import javax.portlet.PortletConfig; 41 import javax.portlet.PortletContext; 42 43 import java.sql.Connection ; 44 import java.sql.PreparedStatement ; 45 import java.sql.SQLException ; 46 import java.sql.Timestamp ; 47 48 import com.knowgate.debug.DebugFile; 49 import com.knowgate.dataobjs.DB; 50 51 55 56 public class HipergatePortletConfig implements PortletConfig { 57 58 private HipergatePortletContext oCtx; 59 60 public HipergatePortletConfig() { 61 oCtx = new HipergatePortletContext(); 62 } 63 64 public String getPortletName () { 65 return null; 66 } 67 68 public PortletContext getPortletContext() { 69 return oCtx; 70 } 71 72 public ResourceBundle getResourceBundle(Locale locale) { 73 return null; 74 } 75 76 public String getInitParameter(String name) { 77 return oCtx.getInitParameter(name); 78 } 79 80 public Enumeration getInitParameterNames() { 81 return oCtx.getInitParameterNames(); 82 } 83 84 86 95 public static void touch (Connection oCon, String sUserId, String sPortletNm, String sWrkAId) 96 throws SQLException { 97 98 if (DebugFile.trace) { 99 DebugFile.writeln("Begin HipergatePortletConfig.touch([Connection],"+sUserId+","+sPortletNm+","+sWrkAId+")"); 100 DebugFile.incIdent(); 101 } 102 103 PreparedStatement oStm = null; 104 int iAffected = 0; 105 106 try { 107 oStm = oCon.prepareStatement("UPDATE " + DB.k_x_portlet_user + " SET " + DB.dt_modified + "=? WHERE " + DB.gu_user + "=? AND " + DB.nm_portlet + "=? AND " + DB.gu_workarea + "=?"); 108 try { oStm.setQueryTimeout(2000); } catch (SQLException ignore) {} 109 oStm.setTimestamp(1, new Timestamp (new Date ().getTime())); 110 oStm.setString(2, sUserId); 111 oStm.setString(3, sPortletNm); 112 oStm.setString(4, sWrkAId); 113 iAffected = oStm.executeUpdate(); 114 oStm.close(); 115 oStm = null; 116 } 117 catch (SQLException sqle) { 118 DebugFile.decIdent(); 119 try { if (null!=oStm) oStm.close(); } catch (SQLException ignore) {} 120 throw new SQLException (sqle.getMessage(),sqle.getSQLState(), sqle.getErrorCode()); 121 } 122 if (DebugFile.trace) { 123 DebugFile.decIdent(); 124 DebugFile.writeln("End HipergatePortletConfig.touch() : " + String.valueOf(iAffected)); 125 } 126 } } 128 | Popular Tags |