1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.observation.event

File ActionExecutionEvent.java

 

Coverage histogram

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

Code metrics

4
11
5
1
89
39
7
0.64
2.2
5
1.4

Classes

Class Line # Actions
ActionExecutionEvent 33 11 0% 7 0
1.0100%
 

Contributing tests

This file is covered by 4 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.observation.event;
21   
22    import java.io.Serializable;
23   
24    /**
25    * An event triggered whenever a client request (action) is processed, like <tt>/upload/</tt> or <tt>/view/</tt>. A
26    * specific event corresponds to only one {@link #actionName action type}.
27    *
28    * @version $Id: ff9ba59deb6771abe3d26b28f6451da2f04d25d9 $
29    * @deprecated since 3.2M3, use the {@code org.xwiki.bridge.event.ActionExecutedEvent} class from XWiki Platform instead
30    */
31    // TODO: use the enumerated Action class when it's implemented...
32    @Deprecated
 
33    public class ActionExecutionEvent implements Event, Serializable
34    {
35    /**
36    * The version identifier for this Serializable class. Increment only if the <i>serialized</i> form of the class
37    * changes.
38    */
39    private static final long serialVersionUID = 1L;
40   
41    /** The name of the executed action. */
42    private String actionName;
43   
44    /**
45    * Constructor initializing the action name of the event.
46    *
47    * @param actionName the name of the executed action
48    */
 
49  17 toggle public ActionExecutionEvent(String actionName)
50    {
51  17 this.actionName = actionName;
52    }
53   
54    /**
55    * Gets the name of the action causing this event.
56    *
57    * @return the action causing this event, like <code>upload</code> or <code>login</code>
58    */
 
59  40 toggle public String getActionName()
60    {
61  40 return this.actionName;
62    }
63   
 
64  4 toggle @Override
65    public int hashCode()
66    {
67  4 return getActionName().hashCode();
68    }
69   
 
70  12 toggle @Override
71    public boolean equals(Object object)
72    {
73  12 if (object instanceof ActionExecutionEvent) {
74  11 return getActionName().equals(((ActionExecutionEvent) object).getActionName());
75    }
76  1 return getActionName().equals(object);
77    }
78   
 
79  7 toggle @Override
80    public boolean matches(Object otherEvent)
81    {
82  7 boolean isMatching = false;
83  7 if (this.getClass().isAssignableFrom(otherEvent.getClass())) {
84  6 ActionExecutionEvent actionEvent = (ActionExecutionEvent) otherEvent;
85  6 isMatching = getActionName().equals(actionEvent.getActionName());
86    }
87  7 return isMatching;
88    }
89    }