1 |
|
package org.kuali.student.lum.lu.ui.dependency.server; |
2 |
|
|
3 |
|
import java.util.ArrayList; |
4 |
|
import java.util.List; |
5 |
|
|
6 |
|
import org.kuali.student.core.statement.dto.ReqComponentInfo; |
7 |
|
import org.kuali.student.core.statement.dto.StatementTreeViewInfo; |
8 |
|
import org.kuali.student.core.statement.service.StatementService; |
9 |
|
import org.kuali.student.core.statement.ui.client.widgets.rules.ReqComponentInfoUi; |
10 |
|
import org.kuali.student.core.statement.ui.client.widgets.rules.RulesUtil; |
11 |
|
import org.kuali.student.lum.lu.ui.dependency.client.service.DependencyAnalysisRpcService; |
12 |
|
import org.kuali.student.lum.program.dto.ProgramRequirementInfo; |
13 |
|
import org.kuali.student.lum.program.service.ProgramService; |
14 |
|
|
15 |
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
16 |
|
|
|
|
| 0% |
Uncovered Elements: 40 (40) |
Complexity: 14 |
Complexity Density: 0.56 |
|
17 |
|
public class DependencyAnalysisRpcServlet extends RemoteServiceServlet implements DependencyAnalysisRpcService{ |
18 |
|
|
19 |
|
private static final long serialVersionUID = 1L; |
20 |
|
|
21 |
|
StatementService statementService; |
22 |
|
ProgramService programService; |
23 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
24 |
0
|
@Override... |
25 |
|
public String getRequirementComponentNL(String reqComponentId) { |
26 |
0
|
return null; |
27 |
|
} |
28 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
29 |
0
|
@Override... |
30 |
|
public List<String> getRequirementComponentNL(List<String> reqComponentIds) throws Exception{ |
31 |
0
|
List<String> reqComponents = new ArrayList<String>(); |
32 |
0
|
for (String reqComponentId:reqComponentIds){ |
33 |
0
|
String reqCompNL = statementService.getNaturalLanguageForReqComponent(reqComponentId, "KUALI.RULE", "en"); |
34 |
0
|
reqComponents.add(reqCompNL); |
35 |
|
} |
36 |
|
|
37 |
0
|
return reqComponents; |
38 |
|
} |
39 |
|
|
40 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
41 |
0
|
@Override... |
42 |
|
public ProgramRequirementInfo getProgramRequirement(String reqId) throws Exception { |
43 |
0
|
ProgramRequirementInfo programRequirementInfo = programService.getProgramRequirement(reqId, null, null); |
44 |
|
|
45 |
0
|
setProgReqNL(programRequirementInfo); |
46 |
0
|
return programRequirementInfo; |
47 |
|
} |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
0
|
public StatementService getStatementService() {... |
50 |
0
|
return statementService; |
51 |
|
} |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
53 |
0
|
public void setStatementService(StatementService statementService) {... |
54 |
0
|
this.statementService = statementService; |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
0
|
public ProgramService getProgramService() {... |
58 |
0
|
return programService; |
59 |
|
} |
60 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
61 |
0
|
public void setProgramService(ProgramService programService) {... |
62 |
0
|
this.programService = programService; |
63 |
|
} |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
0
|
private void setProgReqNL(ProgramRequirementInfo programRequirementInfo) throws Exception {... |
66 |
0
|
setReqCompNL(programRequirementInfo.getStatement()); |
67 |
|
} |
68 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 6 |
Complexity Density: 0.55 |
|
69 |
0
|
private void setReqCompNL(StatementTreeViewInfo tree) throws Exception {... |
70 |
0
|
List<StatementTreeViewInfo> statements = tree.getStatements(); |
71 |
0
|
List<ReqComponentInfo> reqComponentInfos = tree.getReqComponents(); |
72 |
|
|
73 |
0
|
if ((statements != null) && (statements.size() > 0)) { |
74 |
|
|
75 |
0
|
for (StatementTreeViewInfo statement : statements) { |
76 |
0
|
setReqCompNL(statement); |
77 |
|
} |
78 |
0
|
} else if ((reqComponentInfos != null) && (reqComponentInfos.size() > 0)) { |
79 |
|
|
80 |
0
|
for (int i = 0; i < reqComponentInfos.size(); i++) { |
81 |
0
|
ReqComponentInfoUi reqUi = RulesUtil.clone(reqComponentInfos.get(i)); |
82 |
0
|
reqUi.setNaturalLanguageTranslation(statementService.translateReqComponentToNL(reqUi, "KUALI.RULE", "en")); |
83 |
0
|
reqUi.setPreviewNaturalLanguageTranslation(statementService.translateReqComponentToNL(reqUi, "KUALI.RULE.PREVIEW", "en")); |
84 |
0
|
reqComponentInfos.set(i, reqUi); |
85 |
|
} |
86 |
|
} |
87 |
|
} |
88 |
|
|
89 |
|
} |