KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > interceptors > BLOBTESTEventInterceptor


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/examples/bookstore/WEB-INF/src/interceptors/BLOBTESTEventInterceptor.java,v 1.4 2004/08/18 12:25:54 hkollmann Exp $
3  * $Revision: 1.4 $
4  * $Date: 2004/08/18 12:25:54 $
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 interceptors;
25
26 import org.dbforms.config.DbFormsConfig;
27 import org.dbforms.config.FieldValue;
28 import org.dbforms.config.FieldValues;
29 import org.dbforms.config.Table;
30 import org.dbforms.config.ValidationException;
31
32 import org.dbforms.event.DbEventInterceptorSupport;
33
34 import org.dbforms.util.ParseUtil;
35
36 import java.sql.Connection JavaDoc;
37
38 import javax.servlet.http.HttpServletRequest JavaDoc;
39
40
41
42 /**
43  * @author Viviana
44  * @version
45  */

46 public class BLOBTESTEventInterceptor extends DbEventInterceptorSupport {
47    /**
48     * DOCUMENT ME!
49     *
50     * @param request DOCUMENT ME!
51     * @param table DOCUMENT ME!
52     * @param fieldValues DOCUMENT ME!
53     * @param config DOCUMENT ME!
54     * @param con DOCUMENT ME!
55     *
56     * @return DOCUMENT ME!
57     *
58     * @throws ValidationException DOCUMENT ME!
59     */

60    public int preUpdate(HttpServletRequest JavaDoc request,
61                         Table table,
62                         FieldValues fieldValues,
63                         DbFormsConfig config,
64                         Connection JavaDoc con) throws ValidationException {
65       String JavaDoc deleteImage1 = ParseUtil.getParameter(request, "delete_image1");
66
67       if ("true".equalsIgnoreCase(deleteImage1)) {
68          //here something that deletes the field "FILE" of the "BLOBTEST"
69
// table
70
//without deleting the entire record (in my table I have a lot of
71
// others fields
72
//I would preserve)
73
//this way don't work for me
74
FieldValue fv = fieldValues.get("FILE");
75          fv.setFileHolder(null);
76
77          //this way don't work for me
78
setValue(table, fieldValues, "FILE", null);
79       }
80
81       return GRANT_OPERATION;
82    }
83 }
84
Popular Tags