1 /***
2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
6 *
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is pow2ACL library.
13 *
14 * The Initial Owner of the Original Code is Power Of Two S.R.L.
15 * Portions created by Power Of Two S.R.L. are Copyright (C) Power Of Two S.R.L.
16 * All Rights Reserved.
17 *
18 * Contributor(s):
19 */
20
21 package com.pow2.acl.dbforms.interceptors;
22 import java.sql.Connection;
23
24 import java.util.Hashtable;
25 import javax.servlet.http.HttpServletRequest;
26
27 import org.apache.log4j.Category;
28
29 import com.pow2.dao.DAO;
30 import org.dbforms.DbFormsConfig;
31
32 import org.dbforms.event.DbEventInterceptor;
33 import org.dbforms.event.DbEventInterceptorSupport;
34 import org.dbforms.event.ValidationException;
35
36 /***
37 * DbForm interceptor (hook up class) for ACL Group table.
38 *
39 * @author foxat
40 * @created 13 maggio 2002
41 */
42 public class GroupInterceptor extends com.pow2.dbforms.Interceptor
43 {
44 /***
45 * Delete all the group related records from ACL_USER_GROUP_ROLE table;
46 *
47 * @param request Description of the Parameter
48 * @param fieldValues Description of the Parameter
49 * @param config Description of the Parameter
50 * @param con Description of the Parameter
51 * @return Description of the Return Value
52 * @exception ValidationException Description of the Exception
53 */
54 public int preDelete(HttpServletRequest request,
55 Hashtable fieldValues,
56 DbFormsConfig config,
57 Connection con)
58 throws ValidationException
59 {
60 String cond = ("GROUP_ID = " + fieldValues.get("GROUP_ID"));
61 return delete("ACL_USER_GROUP_ROLE", cond, con);
62 }
63
64
65 /***
66 * Calculate and set a new key for the new Group entry.
67 *
68 * @param request Description of the Parameter
69 * @param fieldValues Description of the Parameter
70 * @param config Description of the Parameter
71 * @param con Description of the Parameter
72 * @return Description of the Return Value
73 * @exception ValidationException Description of the Exception
74 */
75 public int preInsert(HttpServletRequest request,
76 Hashtable fieldValues,
77 DbFormsConfig config,
78 Connection con)
79 throws ValidationException
80 {
81 fieldValues.put("GROUP_ID", String.valueOf(getNewKey()));
82 return GRANT_OPERATION;
83 }
84 }
This page was automatically generated by Maven