01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: Remove.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package tutorial.friends;
09:
10: import com.uwyn.rife.engine.Element;
11: import com.uwyn.rife.template.Template;
12: import tutorial.friends.backend.FriendManager;
13:
14: /**
15: * Removes the database structure.
16: *
17: * We deliberately didn't split up the submission in a separate 'do' method
18: * (as we did in the Install element) to show both approaches
19: *
20: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
21: * @version $Revision: 3634 $
22: */
23: public class Remove extends Element {
24: /**
25: * The element's entry point.
26: */
27: public void processElement() {
28: Template template = getHtmlTemplate("remove");
29:
30: // only if the user confirmed, execute the removal
31: if (hasSubmission("confirmation")) {
32: FriendManager manager = new FriendManager();
33: manager.remove();
34: template.setBlock("content", "content_removed");
35: }
36:
37: print(template);
38: }
39: }
|