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

File ReplayJobStatus.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart5.png
74% of files have more coverage

Code metrics

2
8
4
1
80
30
7
0.88
2
4
1.75

Classes

Class Line # Actions
ReplayJobStatus 34 8 0% 7 8
0.4285714342.9%
 

Contributing tests

This file is covered by 2 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.extension.job.history;
21   
22    import java.util.List;
23   
24    import org.xwiki.job.DefaultJobStatus;
25    import org.xwiki.logging.LoggerManager;
26    import org.xwiki.observation.ObservationManager;
27   
28    /**
29    * The status of the job that replays records from the extension job history.
30    *
31    * @version $Id: 83beab9578b5f23182f2772fff62e7221eab95cc $
32    * @since 7.1RC1
33    */
 
34    public class ReplayJobStatus extends DefaultJobStatus<ReplayRequest>
35    {
36    private int currentRecordNumber;
37   
38    /**
39    * Creates a new job status.
40    *
41    * @param request the request provided when the job was started
42    * @param observationManager the observation manager
43    * @param loggerManager the logger manager
44    */
 
45  4 toggle public ReplayJobStatus(ReplayRequest request, ObservationManager observationManager, LoggerManager loggerManager)
46    {
47  4 super(request, null, observationManager, loggerManager);
48    }
49   
50    /**
51    * @return the number of the history record that is currently being replayed
52    */
 
53  1 toggle public int getCurrentRecordNumber()
54    {
55  1 return currentRecordNumber;
56    }
57   
58    /**
59    * Sets the number of the history record that is currently being replayed.
60    *
61    * @param currentRecordNumber the current record number
62    */
 
63  2 toggle public void setCurrentRecordNumber(int currentRecordNumber)
64    {
65  2 this.currentRecordNumber = currentRecordNumber;
66    }
67   
68    /**
69    * @return the record that is currently being replayed
70    */
 
71  0 toggle public ExtensionJobHistoryRecord getCurrentRecord()
72    {
73  0 int index = this.currentRecordNumber;
74  0 List<ExtensionJobHistoryRecord> records = getRequest().getRecords();
75  0 if (records != null && index >= 0 && index < records.size()) {
76  0 return records.get(index);
77    }
78  0 return null;
79    }
80    }