1 /*
2 * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/event/EventHelper.java,v 1.9 2004/10/17 07:02:26 hkollmann Exp $
3 * $Revision: 1.9 $
4 * $Date: 2004/10/17 07:02:26 $
5 *
6 * DbForms - a Rapid Application Development Framework
7 * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24 package org.dbforms.event;
25
26 import org.dbforms.util.ParseUtil;
27 import org.dbforms.util.StringUtil;
28
29 import javax.servlet.http.HttpServletRequest;
30
31
32
33 /***
34 * EventUtil class.
35 *
36 * @author Luca Fossato
37 *
38 */
39 public class EventHelper {
40 /***
41 * Gets the name of the destination table.
42 *
43 * @param request the request object
44 * @param action the action string
45 *
46 * @return the destination table string
47 */
48 public static final String getDestinationTableName(HttpServletRequest request,
49 String action) {
50 return ParseUtil.getParameter(request, "data" + action + "_destTable");
51 }
52
53
54 /***
55 * Gets the table id value.
56 *
57 * @param action the action string
58 *
59 * @return the table id value
60 */
61 public static final int getTableId(String action) {
62 int res = -1;
63
64 try {
65 res = StringUtil.getEmbeddedStringAsInteger(action, 2, '_');
66 } catch (Exception e) {
67 res = -1;
68 }
69
70 return res;
71 }
72 }