1 |
|
package org.kuali.student.common.messagebuilder.impl; |
2 |
|
|
3 |
|
import java.util.ArrayList; |
4 |
|
import java.util.List; |
5 |
|
|
6 |
|
import org.kuali.student.common.messagebuilder.MessageTreeBuilder; |
7 |
|
import org.kuali.student.common.messagebuilder.booleanmessage.ast.BooleanNode; |
8 |
|
import org.kuali.student.common.messagebuilder.impl.exceptions.MessageBuilderException; |
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 6 |
Complexity Density: 0.38 |
|
14 |
|
public class SuccessFailureMessageBuilder implements MessageTreeBuilder { |
15 |
|
|
16 |
|
private BooleanOperators booleanOperators; |
17 |
|
private SuccessMessageBuilder successMessageBuilder; |
18 |
|
private FailureMessageBuilder failureMessageBuilder; |
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
@param |
24 |
|
@param |
25 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
26 |
0
|
public SuccessFailureMessageBuilder(String andOperator, String orOperator) {... |
27 |
0
|
this.booleanOperators = new BooleanOperators(andOperator, orOperator); |
28 |
0
|
this.successMessageBuilder = new SuccessMessageBuilder(this.booleanOperators); |
29 |
0
|
this.failureMessageBuilder = new FailureMessageBuilder(this.booleanOperators); |
30 |
|
} |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@param |
36 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
37 |
0
|
public SuccessFailureMessageBuilder(BooleanOperators bo) {... |
38 |
0
|
this.booleanOperators = bo; |
39 |
0
|
this.successMessageBuilder = new SuccessMessageBuilder(this.booleanOperators); |
40 |
0
|
this.failureMessageBuilder = new FailureMessageBuilder(this.booleanOperators); |
41 |
|
} |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
@param |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
49 |
0
|
public String buildMessage(List<BooleanNode> nodeList) {... |
50 |
|
|
51 |
0
|
List<BooleanNode> rootNodeList = new ArrayList<BooleanNode>(); |
52 |
0
|
for(BooleanNode node : nodeList) { |
53 |
0
|
if(node.getParent() == null) { |
54 |
0
|
rootNodeList.add(node); |
55 |
|
} |
56 |
0
|
buildMessage(node); |
57 |
|
} |
58 |
0
|
if(rootNodeList.size() > 1) { |
59 |
0
|
throw new MessageBuilderException("Node list contains more than one root node: " + rootNodeList); |
60 |
|
} |
61 |
0
|
return rootNodeList.get(0).getNodeMessage(); |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@param |
69 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
70 |
0
|
private void buildMessage(final BooleanNode node) {... |
71 |
0
|
this.successMessageBuilder.buildSuccessMessage(node); |
72 |
0
|
this.failureMessageBuilder.buildFailureMessage(node); |
73 |
|
} |
74 |
|
} |