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

File ProgressScripService.java

 

Coverage histogram

../../../../img/srcFileCovDistChart6.png
69% of files have more coverage

Code metrics

0
7
7
1
108
44
7
1
1
7
1

Classes

Class Line # Actions
ProgressScripService 40 7 0% 7 6
0.571428657.1%
 

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.job.script;
21   
22    import javax.inject.Inject;
23    import javax.inject.Named;
24    import javax.inject.Singleton;
25   
26    import org.xwiki.component.annotation.Component;
27    import org.xwiki.job.event.status.JobProgressManager;
28    import org.xwiki.logging.Message;
29    import org.xwiki.script.service.ScriptService;
30   
31    /**
32    * Some script oriented helpers to impact current progress.
33    *
34    * @version $Id: 2e8f8e81c4effe32ef4587c678fe5d03e3249712 $
35    * @since 7.1M2
36    */
37    @Component
38    @Singleton
39    @Named("progress")
 
40    public class ProgressScripService implements ScriptService
41    {
42    @Inject
43    private JobProgressManager progress;
44   
45    /**
46    * Push new progression level with unknown number of steps.
47    */
 
48  0 toggle public void pushLevel()
49    {
50  0 this.progress.pushLevelProgress(this);
51    }
52   
53    /**
54    * Push new progression level.
55    *
56    * @param steps number of steps in this new level
57    */
 
58  11196 toggle public void pushLevel(int steps)
59    {
60  11196 this.progress.pushLevelProgress(steps, this);
61    }
62   
63    /**
64    * Pop current progression level.
65    */
 
66  11196 toggle public void popLevel()
67    {
68  11196 this.progress.popLevelProgress(this);
69    }
70   
71    /**
72    * Close current step if any and move to next one.
73    */
 
74  0 toggle public void startStep()
75    {
76  0 this.progress.startStep(this);
77    }
78   
79    /**
80    * Close current step if any and move to next one.
81    *
82    * @param name the name of the step
83    */
 
84  22736 toggle public void startStep(String name)
85    {
86  22737 this.progress.startStep(this, name);
87    }
88   
89    /**
90    * Close current step if any and move to next one.
91    *
92    * @param translationKey the key used to find the translation of the step message
93    * @param message the default message associated to the step
94    * @param arguments the arguments to insert in the step message
95    */
 
96  0 toggle public void startStep(String translationKey, String message, Object... arguments)
97    {
98  0 this.progress.startStep(this, new Message(translationKey, message, arguments));
99    }
100   
101    /**
102    * Close current step.
103    */
 
104  22737 toggle public void endStep()
105    {
106  22737 this.progress.endStep(this);
107    }
108    }