KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > jsp > taglib > edit > CommitTag


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.bridge.jsp.taglib.edit;
11
12 import org.mmbase.bridge.jsp.taglib.util.Attribute;
13 import javax.servlet.jsp.JspTagException JavaDoc;
14
15 import org.mmbase.bridge.jsp.taglib.CloudReferrerTag;
16 import org.mmbase.bridge.Transaction;
17
18 import org.mmbase.util.logging.*;
19
20 /**
21  * This tag can be used inside a transaction tag, to commit it. It also
22  * serves as a baseclass for e.g. CancelTag
23  *
24  * @author Michiel Meeuwissen
25  * @version $Id: CommitTag.java,v 1.18 2006/04/29 17:15:20 michiel Exp $
26  */

27
28 public class CommitTag extends CloudReferrerTag {
29     // perhaps it would be nicer to extend CloudReferrer to TransactionReferrer first.
30

31     private static final Logger log = Logging.getLoggerInstance(CommitTag.class);
32
33     private Attribute transaction = Attribute.NULL;
34     public void setTransaction(String JavaDoc t) throws JspTagException JavaDoc {
35         transaction = getAttribute(t);
36     }
37
38     protected void doAction(Transaction t) {
39
40         t.commit();
41     }
42
43     public int doStartTag() throws JspTagException JavaDoc{
44         // find the parent transaction:
45
TransactionTag tt = (TransactionTag) findParentTag(TransactionTag.class, (String JavaDoc) transaction.getValue(this), true);
46         Transaction trans = (Transaction) tt.getCloudVar();
47         doAction(trans);
48         return SKIP_BODY;
49     }
50 }
51
Popular Tags