1 package dinamica.security; 2 3 import dinamica.*; 4 import javax.sql.DataSource ; 5 import java.sql.*; 6 7 15 public class GetProfile extends GenericTransaction 16 { 17 18 21 public int service(Recordset inputParams) throws Throwable 22 { 23 24 super.service(inputParams); 25 26 String jndiName = (String )getContext().getAttribute("dinamica.security.datasource"); 28 if (jndiName==null) 29 throw new Throwable ("Context attribute [dinamica.security.datasource] is null, check your security filter configuration."); 30 31 DataSource ds = Jndi.getDataSource(jndiName); 33 Connection conn = ds.getConnection(); 34 this.setConnection(conn); 35 36 try 37 { 38 39 Db db = getDb(); 41 42 Recordset user = db.get(getSQL(getResource("getrecord.sql"), inputParams)); 44 user.next(); 45 46 Recordset s = db.get(getSQL(getResource("styles.sql"), inputParams)); 48 49 publish("getrecord.sql", user); 50 publish("styles.sql", s); 51 52 } 53 catch (Throwable e) 54 { 55 throw e; 56 } 57 finally 58 { 59 if (conn!=null) 60 conn.close(); 61 } 62 63 return 0; 64 65 } 66 67 } 68 | Popular Tags |