1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.bo.service.unicode; |
17 |
|
|
18 |
|
import java.io.IOException; |
19 |
|
|
20 |
|
import org.qedeq.base.io.Parameters; |
21 |
|
import org.qedeq.base.io.StringOutput; |
22 |
|
import org.qedeq.base.trace.Trace; |
23 |
|
import org.qedeq.kernel.bo.log.QedeqLog; |
24 |
|
import org.qedeq.kernel.bo.module.InternalServiceCall; |
25 |
|
import org.qedeq.kernel.bo.module.InternalServiceProcess; |
26 |
|
import org.qedeq.kernel.bo.module.KernelQedeqBo; |
27 |
|
import org.qedeq.kernel.bo.module.PluginExecutor; |
28 |
|
import org.qedeq.kernel.se.common.Plugin; |
29 |
|
import org.qedeq.kernel.se.common.SourceFileExceptionList; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@author |
39 |
|
|
|
|
| 0% |
Uncovered Elements: 39 (39) |
Complexity: 11 |
Complexity Density: 0.38 |
|
40 |
|
public final class Qedeq2UnicodeTextExecutor implements PluginExecutor { |
41 |
|
|
42 |
|
|
43 |
|
private static final Class CLASS = Qedeq2UnicodeTextExecutor.class; |
44 |
|
|
45 |
|
|
46 |
|
private StringOutput printer; |
47 |
|
|
48 |
|
|
49 |
|
private String language; |
50 |
|
|
51 |
|
|
52 |
|
private final Qedeq2UnicodeVisitor visitor; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
@param |
59 |
|
@param |
60 |
|
@param |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
62 |
0
|
Qedeq2UnicodeTextExecutor(final Plugin plugin, final KernelQedeqBo prop,... |
63 |
|
final Parameters parameters) { |
64 |
0
|
language = parameters.getString("language"); |
65 |
0
|
final boolean info = parameters.getBoolean("info"); |
66 |
|
|
67 |
0
|
int maxColumns = parameters.getInt("maximumColumn"); |
68 |
0
|
maxColumns = Math.max(10, maxColumns); |
69 |
0
|
visitor = new Qedeq2UnicodeVisitor(plugin, prop, info , maxColumns, false, false); |
70 |
|
} |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 5 |
Complexity Density: 0.33 |
|
72 |
0
|
public Object executePlugin(final InternalServiceCall call, final Object data) {... |
73 |
0
|
final String method = "executePlugin()"; |
74 |
0
|
String result = ""; |
75 |
0
|
try { |
76 |
0
|
QedeqLog.getInstance().logRequest("Show UTF-8 text", visitor.getQedeqBo().getUrl()); |
77 |
0
|
result = generateUtf8(call.getInternalServiceProcess(), language, "1"); |
78 |
0
|
QedeqLog.getInstance().logSuccessfulReply( |
79 |
|
"UTF-8 text was shown", visitor.getQedeqBo().getUrl()); |
80 |
|
} catch (final SourceFileExceptionList e) { |
81 |
0
|
final String msg = "Generation failed"; |
82 |
0
|
Trace.fatal(CLASS, this, method, msg, e); |
83 |
0
|
QedeqLog.getInstance().logFailureReply(msg, visitor.getQedeqBo().getUrl(), e.getMessage()); |
84 |
|
} catch (IOException e) { |
85 |
0
|
final String msg = "Generation failed"; |
86 |
0
|
Trace.fatal(CLASS, this, method, msg, e); |
87 |
0
|
QedeqLog.getInstance().logFailureReply(msg, visitor.getQedeqBo().getUrl(), e.getMessage()); |
88 |
|
} catch (final RuntimeException e) { |
89 |
0
|
Trace.fatal(CLASS, this, method, "unexpected problem", e); |
90 |
0
|
QedeqLog.getInstance().logFailureReply( |
91 |
|
"Generation failed", visitor.getQedeqBo().getUrl(), "unexpected problem: " |
92 |
0
|
+ (e.getMessage() != null ? e.getMessage() : e.toString())); |
93 |
|
} |
94 |
0
|
return result; |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
@param |
101 |
|
@param |
102 |
|
@param |
103 |
|
|
104 |
|
@return |
105 |
|
@throws |
106 |
|
@throws |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
108 |
0
|
public String generateUtf8(final InternalServiceProcess process, final String language,... |
109 |
|
final String level) throws SourceFileExceptionList, IOException { |
110 |
|
|
111 |
0
|
String lan = "en"; |
112 |
0
|
if (language != null) { |
113 |
0
|
lan = language; |
114 |
|
} |
115 |
0
|
printer = new StringOutput(); |
116 |
|
|
117 |
0
|
visitor.generateUtf8(process, printer, lan, level); |
118 |
0
|
return printer.toString(); |
119 |
|
} |
120 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
121 |
0
|
public String getLocationDescription() {... |
122 |
0
|
return visitor.getLocationDescription(); |
123 |
|
} |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
125 |
0
|
public double getVisitPercentage() {... |
126 |
0
|
return visitor.getVisitPercentage(); |
127 |
|
} |
128 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
129 |
0
|
public boolean getInterrupted() {... |
130 |
0
|
return visitor.getInterrupted(); |
131 |
|
} |
132 |
|
|
133 |
|
} |