1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.bridge.event

File ActionExecutingEvent.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
6
6
1
94
36
6
1
1
6
1

Classes

Class Line # Actions
ActionExecutingEvent 40 6 0% 6 0
1.0100%
 

Contributing tests

This file is covered by 36 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.bridge.event;
21   
22    import org.xwiki.observation.event.BeginEvent;
23    import org.xwiki.observation.event.CancelableEvent;
24   
25    /**
26    * An event triggered whenever a client request (action) is processed, like <tt>/upload/</tt> or <tt>/view/</tt>. A
27    * specific event corresponds to only one {@link #actionName action type}.
28    * <p>
29    * The event also send the following parameters:
30    * </p>
31    * <ul>
32    * <li>source: the current {com.xpn.xwiki.doc.XWikiDocument} instance</li>
33    * <li>data: the current {com.xpn.xwiki.XWikiContext} instance</li>
34    * </ul>
35    *
36    * @version $Id: a31d8166bb2986eee08ed06e05f29abf4d6663cb $
37    * @since 3.2M3
38    */
39    // TODO: use the enumerated Action class when it's implemented
 
40    public class ActionExecutingEvent extends AbstractActionExecutionEvent implements CancelableEvent, BeginEvent
41    {
42    /**
43    * Flag storing the state of this event.
44    */
45    private boolean canceled;
46   
47    /**
48    * The reason why the event was canceled.
49    */
50    private String reason;
51   
52    /**
53    * Match any {@link ActionExecutingEvent}.
54    */
 
55  112 toggle public ActionExecutingEvent()
56    {
57   
58    }
59   
60    /**
61    * Constructor initializing the action name of the event.
62    *
63    * @param actionName the name of the executed action
64    */
 
65  9611 toggle public ActionExecutingEvent(String actionName)
66    {
67  9610 super(actionName);
68    }
69   
 
70  9507 toggle @Override
71    public boolean isCanceled()
72    {
73  9511 return this.canceled;
74    }
75   
 
76  1 toggle @Override
77    public void cancel()
78    {
79  1 this.canceled = true;
80    }
81   
 
82  1 toggle @Override
83    public void cancel(String reason)
84    {
85  1 this.canceled = true;
86  1 this.reason = reason;
87    }
88   
 
89  3 toggle @Override
90    public String getReason()
91    {
92  3 return this.reason;
93    }
94    }