1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rest.internal.resources.job; |
21 |
|
|
22 |
|
import java.util.Collection; |
23 |
|
|
24 |
|
import javax.inject.Named; |
25 |
|
|
26 |
|
import org.xwiki.job.event.status.JobStatus; |
27 |
|
import org.xwiki.logging.LogLevel; |
28 |
|
import org.xwiki.logging.event.LogEvent; |
29 |
|
import org.xwiki.rest.XWikiJobResource; |
30 |
|
import org.xwiki.rest.XWikiRestException; |
31 |
|
import org.xwiki.rest.internal.DomainObjectFactory; |
32 |
|
import org.xwiki.rest.model.jaxb.JobLog; |
33 |
|
import org.xwiki.rest.resources.job.JobLogResource; |
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
39 |
|
@Named("org.xwiki.rest.internal.resources.job.JobLogResourceImpl") |
|
|
| 53.8% |
Uncovered Elements: 6 (13) |
Complexity: 3 |
Complexity Density: 0.38 |
|
40 |
|
public class JobLogResourceImpl extends XWikiJobResource implements JobLogResource |
41 |
|
{ |
|
|
| 50% |
Uncovered Elements: 6 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
42 |
7 |
@Override... |
43 |
|
public JobLog getJobLog(String jobId, String level, String fromLevel) throws XWikiRestException |
44 |
|
{ |
45 |
7 |
JobStatus jobStatus = getRealJobStatus(jobId); |
46 |
|
|
47 |
7 |
Collection<LogEvent> log; |
48 |
7 |
if (level != null) { |
49 |
7 |
log = jobStatus.getLog().getLogs(LogLevel.valueOf(level.toUpperCase())); |
50 |
0 |
} else if (fromLevel != null) { |
51 |
0 |
log = jobStatus.getLog().getLogsFrom(LogLevel.valueOf(fromLevel.toUpperCase())); |
52 |
|
} else { |
53 |
0 |
log = jobStatus.getLog(); |
54 |
|
} |
55 |
7 |
return DomainObjectFactory.createLog(objectFactory, uriInfo.getAbsolutePath(), log); |
56 |
|
} |
57 |
|
} |