1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.lum.program.server; |
17 |
|
|
18 |
|
import java.util.ArrayList; |
19 |
|
import java.util.Iterator; |
20 |
|
import java.util.List; |
21 |
|
|
22 |
|
import org.kuali.student.common.ui.client.widgets.rules.ReqComponentInfoUi; |
23 |
|
import org.kuali.student.common.ui.server.gwt.BaseRpcGwtServletAbstract; |
24 |
|
import org.kuali.student.core.statement.dto.ReqComponentInfo; |
25 |
|
import org.kuali.student.core.statement.dto.ReqComponentTypeInfo; |
26 |
|
import org.kuali.student.core.statement.dto.StatementTreeViewInfo; |
27 |
|
import org.kuali.student.core.statement.dto.StatementTypeInfo; |
28 |
|
import org.kuali.student.core.statement.service.StatementService; |
29 |
|
import org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo; |
30 |
|
import org.kuali.student.lum.lu.dto.CluInfo; |
31 |
|
import org.kuali.student.lum.lu.service.LuService; |
32 |
|
import org.kuali.student.lum.program.client.rpc.StatementRpcService; |
33 |
|
|
34 |
|
import com.google.gwt.user.client.rpc.AsyncCallback; |
35 |
|
import org.apache.log4j.Logger; |
36 |
|
|
|
|
| 0% |
Uncovered Elements: 75 (75) |
Complexity: 19 |
Complexity Density: 0.37 |
|
37 |
|
public class StatementRpcServlet extends BaseRpcGwtServletAbstract<LuService> implements StatementRpcService { |
38 |
|
|
39 |
|
final static Logger LOG = Logger.getLogger(StatementRpcServlet.class); |
40 |
|
|
41 |
|
private StatementService statementService; |
42 |
|
private LuService luService; |
43 |
|
|
44 |
|
private static final long serialVersionUID = 822326113643828855L; |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 44 (44) |
Complexity: 9 |
Complexity Density: 0.3 |
|
46 |
0
|
public List<StatementTypeInfo> getStatementTypesForStatementTypeForCourse(String statementTypeKey) throws Exception {... |
47 |
|
|
48 |
|
|
49 |
0
|
String[] desiredSequenceEnrollmentElig = {"kuali.statement.type.course.academicReadiness.studentEligibilityPrereq", |
50 |
|
"kuali.statement.type.course.academicReadiness.coreq", |
51 |
|
"kuali.statement.type.course.recommendedPreparation", |
52 |
|
"kuali.statement.type.course.academicReadiness.antireq"}; |
53 |
|
|
54 |
0
|
String[] desiredSequenceCreditConstraints = {"kuali.statement.type.course.credit.restriction", |
55 |
|
"kuali.statement.type.course.credit.repeatable"}; |
56 |
|
|
57 |
0
|
List<StatementTypeInfo> statementTypesSorted = new ArrayList<StatementTypeInfo>(); |
58 |
|
|
59 |
0
|
List<String> statementTypeNames = statementService.getStatementTypesForStatementType(statementTypeKey); |
60 |
|
|
61 |
0
|
for (String statementTypeName : statementTypeNames) { |
62 |
0
|
StatementTypeInfo stmtInfo = statementService.getStatementType(statementTypeName); |
63 |
|
|
64 |
0
|
statementTypesSorted.add(statementService.getStatementType(statementTypeName)); |
65 |
|
|
66 |
|
|
67 |
0
|
List<String> subStmtInfos = stmtInfo.getAllowedStatementTypes(); |
68 |
0
|
List<StatementTypeInfo> statementTypesOrig = new ArrayList<StatementTypeInfo>(); |
69 |
0
|
if ((subStmtInfos != null) && !subStmtInfos.isEmpty()) { |
70 |
0
|
List<String> subStatementTypeNames = statementService.getStatementTypesForStatementType(statementTypeName); |
71 |
0
|
for (String subStatementTypeName : subStatementTypeNames) { |
72 |
0
|
statementTypesOrig.add(statementService.getStatementType(subStatementTypeName)); |
73 |
|
} |
74 |
0
|
if (statementTypeName.contains("kuali.statement.type.course.enrollmentEligibility")) { |
75 |
0
|
for (String stmtType : desiredSequenceEnrollmentElig) { |
76 |
0
|
Iterator<StatementTypeInfo> iter = statementTypesOrig.iterator(); |
77 |
0
|
while (iter.hasNext()) { |
78 |
0
|
StatementTypeInfo stmtT = iter.next(); |
79 |
0
|
if (stmtT.getId().equals(stmtType)) { |
80 |
0
|
statementTypesSorted.add(stmtT); |
81 |
0
|
break; |
82 |
|
} |
83 |
|
} |
84 |
|
} |
85 |
|
} |
86 |
0
|
if (statementTypeName.contains("kuali.statement.type.course.creditConstraints")) { |
87 |
0
|
for (String stmtType : desiredSequenceCreditConstraints) { |
88 |
0
|
Iterator<StatementTypeInfo> iter = statementTypesOrig.iterator(); |
89 |
0
|
while (iter.hasNext()) { |
90 |
0
|
StatementTypeInfo stmtT = iter.next(); |
91 |
0
|
if (stmtT.getId().equals(stmtType)) { |
92 |
0
|
statementTypesSorted.add(stmtT); |
93 |
0
|
break; |
94 |
|
} |
95 |
|
} |
96 |
|
} |
97 |
|
} |
98 |
|
} |
99 |
|
} |
100 |
|
|
101 |
0
|
return statementTypesSorted; |
102 |
|
} |
103 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
104 |
0
|
@Override... |
105 |
|
public List<StatementTypeInfo> getStatementTypesForStatementType(String statementTypeKey) throws Exception { |
106 |
0
|
List<String> statementTypeNames = statementService.getStatementTypesForStatementType(statementTypeKey); |
107 |
0
|
List<StatementTypeInfo> statementTypes = new ArrayList<StatementTypeInfo>(); |
108 |
0
|
for (String statementTypeName : statementTypeNames) { |
109 |
0
|
statementTypes.add(statementService.getStatementType(statementTypeName)); |
110 |
|
} |
111 |
0
|
return statementTypes; |
112 |
|
} |
113 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
114 |
0
|
public List<ReqComponentTypeInfo> getReqComponentTypesForStatementType(String luStatementTypeKey) throws Exception {... |
115 |
|
|
116 |
0
|
List<ReqComponentTypeInfo> reqComponentTypeInfoList; |
117 |
0
|
try { |
118 |
0
|
reqComponentTypeInfoList = statementService.getReqComponentTypesForStatementType(luStatementTypeKey); |
119 |
|
} catch (Exception ex) { |
120 |
0
|
LOG.error(ex); |
121 |
0
|
throw new Exception("Unable to find Requirement Component Types based on LU Statement Type Key:" + luStatementTypeKey, ex); |
122 |
|
} |
123 |
|
|
124 |
0
|
return reqComponentTypeInfoList; |
125 |
|
} |
126 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
0
|
@Override... |
128 |
|
public String translateStatementTreeViewToNL(StatementTreeViewInfo statementTreeViewInfo, String nlUsageTypeKey, String language) throws Exception { |
129 |
0
|
return statementService.translateStatementTreeViewToNL(statementTreeViewInfo, nlUsageTypeKey, language); |
130 |
|
} |
131 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
132 |
0
|
@Override... |
133 |
|
public String translateReqComponentToNL(ReqComponentInfo reqComponentInfo, String nlUsageTypeKey, String language) throws Exception { |
134 |
0
|
return statementService.translateReqComponentToNL(reqComponentInfo, nlUsageTypeKey, language); |
135 |
|
} |
136 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
137 |
0
|
@Override... |
138 |
|
public List<String> translateReqComponentToNLs(ReqComponentInfoUi reqComponentInfo, String[] nlUsageTypeKeys, String language) throws Exception { |
139 |
0
|
List<String> nls = new ArrayList<String>(nlUsageTypeKeys.length); |
140 |
0
|
for (String typeKey : nlUsageTypeKeys) { |
141 |
0
|
nls.add(statementService.translateReqComponentToNL(reqComponentInfo, typeKey, language)); |
142 |
|
} |
143 |
0
|
return nls; |
144 |
|
} |
145 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
146 |
0
|
@Override... |
147 |
|
public CluInfo getClu(String cluId) throws Exception { |
148 |
0
|
return luService.getClu(cluId); |
149 |
|
} |
150 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
151 |
0
|
@Override... |
152 |
|
public VersionDisplayInfo getCurrentVersion(String refObjectTypeURI, String refObjectId) throws Exception { |
153 |
0
|
return luService.getCurrentVersion(refObjectTypeURI, refObjectId); |
154 |
|
} |
155 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
156 |
0
|
public void setStatementService(StatementService statementService) {... |
157 |
0
|
this.statementService = statementService; |
158 |
|
} |
159 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
160 |
0
|
public void setLuService(LuService luService) {... |
161 |
0
|
this.luService = luService; |
162 |
|
} |
163 |
|
} |