| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.filter.script; |
| 21 |
|
|
| 22 |
|
import javax.inject.Inject; |
| 23 |
|
|
| 24 |
|
import org.xwiki.context.Execution; |
| 25 |
|
import org.xwiki.script.internal.safe.ScriptSafeProvider; |
| 26 |
|
import org.xwiki.script.service.ScriptService; |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
@version |
| 32 |
|
@since |
| 33 |
|
|
| |
|
| 50% |
Uncovered Elements: 4 (8) |
Complexity: 4 |
Complexity Density: 1 |
|
| 34 |
|
public abstract class AbstractFilterScriptService implements ScriptService |
| 35 |
|
{ |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
public static final String EXTENSIONERROR_KEY = "scriptservice.filter.error"; |
| 40 |
|
|
| 41 |
|
@Inject |
| 42 |
|
@SuppressWarnings("rawtypes") |
| 43 |
|
protected ScriptSafeProvider scriptProvider; |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
@Inject |
| 49 |
|
protected Execution execution; |
| 50 |
|
|
| 51 |
|
|
| 52 |
|
@param |
| 53 |
|
@param |
| 54 |
|
@return |
| 55 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 56 |
0 |
@SuppressWarnings("unchecked")... |
| 57 |
|
protected <T> T safe(T unsafe) |
| 58 |
|
{ |
| 59 |
0 |
return (T) this.scriptProvider.get(unsafe); |
| 60 |
|
} |
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
@return |
| 68 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 69 |
0 |
public Exception getLastError()... |
| 70 |
|
{ |
| 71 |
0 |
return (Exception) this.execution.getContext().getProperty(EXTENSIONERROR_KEY); |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 77 |
39 |
protected void resetError()... |
| 78 |
|
{ |
| 79 |
39 |
setError(null); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
|
| 83 |
|
@link |
| 84 |
|
|
| 85 |
|
@param |
| 86 |
|
@see |
| 87 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 88 |
41 |
protected void setError(Exception e)... |
| 89 |
|
{ |
| 90 |
41 |
this.execution.getContext().setProperty(EXTENSIONERROR_KEY, e); |
| 91 |
|
} |
| 92 |
|
} |