1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.plugin.scheduler

File JobState.java

 

Coverage histogram

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

Code metrics

0
20
7
1
96
56
13
0.65
2.86
7
1.86

Classes

Class Line # Actions
JobState 30 20 0% 13 13
0.518518551.9%
 

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 com.xpn.xwiki.plugin.scheduler;
21   
22    import org.quartz.Trigger.TriggerState;
23   
24    /**
25    * Wrapper around the Quartz trigger's inner state of a Scheduler Job. This class allows to query the actual status of a
26    * Job as a String, typically to be displayed inside the Wiki
27    *
28    * @version $Id: 0d3a83b106e3c2f3f012a66f8e68776333c2dd2a $
29    */
 
30    public class JobState
31    {
32    public static final String STATE_NORMAL = "Normal";
33   
34    public static final String STATE_PAUSED = "Paused";
35   
36    public static final String STATE_BLOCKED = "Blocked";
37   
38    public static final String STATE_COMPLETE = "Complete";
39   
40    public static final String STATE_ERROR = "Error";
41   
42    public static final String STATE_NONE = "None";
43   
44    private TriggerState state;
45   
 
46  0 toggle @Deprecated
47    public JobState(int state)
48    {
49  0 setState(state);
50    }
51   
 
52  30 toggle public JobState(TriggerState state)
53    {
54  30 setQuartzState(state);
55    }
56   
 
57  0 toggle @Deprecated
58    public void setState(int state)
59    {
60  0 this.state = TriggerState.values()[state];
61    }
62   
 
63  30 toggle public void setQuartzState(TriggerState state)
64    {
65  30 this.state = state;
66    }
67   
 
68  0 toggle public int getState()
69    {
70  0 return this.state.ordinal();
71    }
72   
 
73  4 toggle public TriggerState getQuartzState()
74    {
75  4 return this.state;
76    }
77   
 
78  26 toggle public String getValue()
79    {
80  26 switch (this.state) {
81  12 case NORMAL:
82  12 return JobState.STATE_NORMAL;
83  0 case BLOCKED:
84  0 return JobState.STATE_BLOCKED;
85  0 case COMPLETE:
86  0 return JobState.STATE_COMPLETE;
87  0 case ERROR:
88  0 return JobState.STATE_ERROR;
89  2 case PAUSED:
90  2 return JobState.STATE_PAUSED;
91  12 case NONE:
92  0 default:
93  12 return JobState.STATE_NONE;
94    }
95    }
96    }