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

File QuestionAskedEvent.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

0
4
5
1
87
25
5
1.25
0.8
5
1

Classes

Class Line # Actions
QuestionAskedEvent 35 4 0% 5 2
0.777777877.8%
 

Contributing tests

This file is covered by 111 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.status;
21   
22    import java.util.List;
23   
24    /**
25    * Event fired when an interactive job asks a question. The event listeners have the chance to answer the question
26    * before it reaches the user. The event is send with the following parameters:
27    * <ul>
28    * <li>source: the related {@link JobStatus} instance that can be used to access the question</li>
29    * <li>data: {@code null}</li>
30    * </ul>
31    *
32    * @version $Id: c63036aa58d7365539d7d4d4bd8fa73f886a928f $
33    * @since 7.1RC1
34    */
 
35    public class QuestionAskedEvent extends AbstractQuestionEvent
36    {
37    /**
38    * Flag indicating if the question that triggered the event has been answered by one of the event listeners.
39    */
40    private boolean answered;
41   
42    /**
43    * Creates a new event.
44    */
 
45  261 toggle public QuestionAskedEvent()
46    {
47    }
48   
49    /**
50    * Creates a new event for a question of the specified type.
51    *
52    * @param questionType the type of question that has been asked
53    */
 
54  0 toggle public QuestionAskedEvent(String questionType)
55    {
56  0 super(questionType);
57    }
58   
59    /**
60    * Creates a new event for a question of the specified type and a job with the given id.
61    *
62    * @param questionType the type of question that has been asked
63    * @param jobId the id of the job that raised the question that triggered this event
64    */
 
65  6 toggle public QuestionAskedEvent(String questionType, List<String> jobId)
66    {
67  6 super(questionType, jobId);
68    }
69   
70    /**
71    * Specify that the question that triggered this event has been answered. This method is normally called by an event
72    * listener that answers the question by modifying the object that represents the question.
73    */
 
74  2 toggle public void answered()
75    {
76  2 this.answered = true;
77    }
78   
79    /**
80    * @return {@code true} if the question that triggered this event has been answered by one of the event listeners,
81    * {@code false} otherwise
82    */
 
83  6 toggle public boolean isAnswered()
84    {
85  6 return this.answered;
86    }
87    }