KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > transactions > security > UpdateMaster


1 package transactions.security;
2
3 import dinamica.*;
4
5 /**
6  * Insert user record and its roles
7  * <br><br>
8  * Creation date: 5/03/2004<br>
9  * Last Update: 5/03/2004<br>
10  * (c) 2004 Martin Cordova<br>
11  * This code is released under the LGPL license<br>
12  * @author Martin Cordova (dinamica@martincordova.com)
13  * */

14 public class UpdateMaster extends GenericTransaction
15 {
16
17     /* (non-Javadoc)
18      * @see dinamica.GenericTransaction#service(dinamica.Recordset)
19      */

20     public int service(Recordset inputParams) throws Throwable JavaDoc
21     {
22
23         int rc = super.service(inputParams);
24                 
25         //get sql template for insert-user
26
String JavaDoc sql = getResource("update.sql");
27         
28         //generate sql for insert-user
29
sql = this.getSQL(sql, inputParams);
30         
31         //get db connection
32
Db db = getDb();
33         
34         //insert user
35
db.exec(sql);
36
37         //delete all previous roles
38
sql = getSQL(getResource("delete-roles.sql"), inputParams);
39         db.exec(sql);
40         
41         //insert roles using utility reusable object
42
sql = getSQL(getResource("insert-roles.sql"), inputParams);
43         InsertRoles r = (InsertRoles)getObject("transactions.security.InsertRoles");
44         r.saveRoles(sql);
45         
46         return rc;
47         
48     }
49
50 }
51
Popular Tags