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

File AbstractJobEvent.java

 

Coverage histogram

../../../../img/srcFileCovDistChart9.png
41% of files have more coverage

Code metrics

0
10
9
1
124
52
9
0.9
1.11
9
1

Classes

Class Line # Actions
AbstractJobEvent 32 10 0% 9 2
0.894736889.5%
 

Contributing tests

This file is covered by 229 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.job.event;
21   
22    import java.util.List;
23   
24    import org.xwiki.job.Request;
25   
26    /**
27    * Common implementation for job events.
28    *
29    * @version $Id: a3b2ed2d1b0d0ca0c7e9e4b4dfd53d0e50bcaf09 $
30    * @since 4.0M1
31    */
 
32    abstract class AbstractJobEvent implements JobEvent
33    {
34    /**
35    * Serializable identifier.
36    */
37    private static final long serialVersionUID = 1L;
38   
39    /**
40    * Related job request.
41    */
42    private Request request;
43   
44    /**
45    * Related job id.
46    */
47    private List<String> jobId;
48   
49    /**
50    * Related job type.
51    */
52    private String jobType;
53   
54    /**
55    * Default constructor.
56    */
 
57  913 toggle AbstractJobEvent()
58    {
59    }
60   
61    /**
62    * @param jobType the event related job type
63    */
 
64  256 toggle protected AbstractJobEvent(String jobType)
65    {
66  256 this.jobType = jobType;
67    }
68   
69    /**
70    * @param jobId the event related job id
71    * @param jobType the event related job type
72    * @param request the event related job request
73    * @since 4.1M2
74    */
 
75  65916 toggle protected AbstractJobEvent(List<String> jobId, String jobType, Request request)
76    {
77  65906 this.jobId = jobId;
78  65910 this.jobType = jobType;
79  65910 this.request = request;
80    }
81   
 
82  0 toggle @Override
83    public List<String> getJobId()
84    {
85  0 return this.jobId;
86    }
87   
 
88  86250 toggle @Override
89    public String getJobType()
90    {
91  86250 return this.jobType;
92    }
93   
 
94  21768 toggle @Override
95    public Request getRequest()
96    {
97  21776 return this.request;
98    }
99   
 
100  194818 toggle @Override
101    public boolean matches(Object event)
102    {
103  194826 return this.getClass() == event.getClass() && matchesJobId((JobEvent) event)
104    && matchesJobType((JobEvent) event);
105    }
106   
107    /**
108    * @param event the event to match
109    * @return <code>true</code> if the passed event matches this event, <code>false</code> otherwise.
110    */
 
111  194819 toggle private boolean matchesJobId(JobEvent event)
112    {
113  194819 return this.jobId == null || this.jobId.equals(event.getJobId());
114    }
115   
116    /**
117    * @param event the event to match
118    * @return <code>true</code> if the passed event matches this event, <code>false</code> otherwise.
119    */
 
120  194804 toggle private boolean matchesJobType(JobEvent event)
121    {
122  194802 return this.jobType == null || this.jobType.equals(event.getJobType());
123    }
124    }