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

File AbstractActionExecutionEvent.java

 

Coverage histogram

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

Code metrics

8
16
7
1
107
54
12
0.75
2.29
7
1.71

Classes

Class Line # Actions
AbstractActionExecutionEvent 33 16 0% 12 0
1.0100%
 

Contributing tests

No tests hitting this source file were found.

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 java.io.Serializable;
23   
24    import org.apache.commons.lang3.StringUtils;
25   
26    /**
27    * Base class for all action execution related events.
28    *
29    * @version $Id: ea1731306ec1afb49305d1187a6f64349a1264f0 $
30    * @since 3.2M3
31    */
32    // TODO: use the enumerated Action class when it's implemented
 
33    public abstract class AbstractActionExecutionEvent implements Serializable, ActionExecutionEvent
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    /**
42    * The name of the executed action.
43    */
44    private String actionName;
45   
46    /**
47    * Match any {@link ActionExecutedEvent}.
48    */
 
49  143 toggle public AbstractActionExecutionEvent()
50    {
51   
52    }
53   
54    /**
55    * Constructor initializing the action name of the event.
56    *
57    * @param actionName the name of the action
58    */
 
59  73721 toggle public AbstractActionExecutionEvent(String actionName)
60    {
61  73717 this.actionName = actionName;
62    }
63   
 
64  587859 toggle @Override
65    public String getActionName()
66    {
67  587887 return this.actionName;
68    }
69   
 
70  6 toggle @Override
71    public int hashCode()
72    {
73  6 if (getActionName() == null) {
74  2 return 0;
75    }
76  4 return getActionName().hashCode();
77    }
78   
 
79  24 toggle @Override
80    public boolean equals(Object object)
81    {
82  24 if (object != null && getClass().isAssignableFrom(object.getClass())) {
83  18 return StringUtils.equals(getActionName(), ((ActionExecutionEvent) object).getActionName());
84    }
85  6 return false;
86    }
87   
 
88  203889 toggle @Override
89    public boolean matches(Object otherEvent)
90    {
91  203911 if (otherEvent == null) {
92  4 return false;
93    }
94  203890 boolean isMatching = false;
95  203939 if (getClass().isAssignableFrom(otherEvent.getClass())) {
96  203923 ActionExecutionEvent actionEvent = (ActionExecutionEvent) otherEvent;
97  203910 isMatching = getActionName() == null || getActionName().equals(actionEvent.getActionName());
98    }
99  203905 return isMatching;
100    }
101   
 
102  6 toggle @Override
103    public String toString()
104    {
105  6 return getClass() + " (" + getActionName() + ")";
106    }
107    }