1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.ui.server.gwt; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import org.apache.log4j.Logger; |
22 | |
import org.kuali.student.common.ui.client.service.StatementRpcService; |
23 | |
import org.kuali.student.core.statement.dto.ReqComponentInfo; |
24 | |
import org.kuali.student.core.statement.dto.ReqComponentTypeInfo; |
25 | |
import org.kuali.student.core.statement.dto.StatementTreeViewInfo; |
26 | |
import org.kuali.student.core.statement.dto.StatementTypeInfo; |
27 | |
import org.kuali.student.core.statement.service.StatementService; |
28 | |
|
29 | |
import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
30 | |
|
31 | 0 | public class StatementRpcServlet extends RemoteServiceServlet implements StatementRpcService { |
32 | |
|
33 | 0 | final static Logger LOG = Logger.getLogger(StatementRpcServlet.class); |
34 | |
|
35 | |
private StatementService statementService; |
36 | |
|
37 | |
private static final long serialVersionUID = 822326113643828855L; |
38 | |
|
39 | |
@Override |
40 | |
public List<StatementTypeInfo> getStatementTypesForStatementType(String statementTypeKey) throws Exception { |
41 | 0 | List<String> statementTypeNames = statementService.getStatementTypesForStatementType(statementTypeKey); |
42 | 0 | List<StatementTypeInfo> statementTypes = new ArrayList<StatementTypeInfo>(); |
43 | 0 | for (String statementTypeName : statementTypeNames) { |
44 | 0 | statementTypes.add(statementService.getStatementType(statementTypeName)); |
45 | |
} |
46 | 0 | return statementTypes; |
47 | |
} |
48 | |
|
49 | |
public List<ReqComponentTypeInfo> getReqComponentTypesForStatementType(String luStatementTypeKey) throws Exception { |
50 | |
|
51 | 0 | List<ReqComponentTypeInfo> reqComponentTypeInfoList = null; |
52 | |
try { |
53 | 0 | reqComponentTypeInfoList = statementService.getReqComponentTypesForStatementType(luStatementTypeKey); |
54 | 0 | } catch (Exception ex) { |
55 | 0 | LOG.error(ex); |
56 | 0 | throw new Exception("Unable to find Requirement Component Types based on LU Statement Type Key:" + luStatementTypeKey, ex); |
57 | 0 | } |
58 | |
|
59 | 0 | return reqComponentTypeInfoList; |
60 | |
} |
61 | |
|
62 | |
@Override |
63 | |
public String translateStatementTreeViewToNL(StatementTreeViewInfo statementTreeViewInfo, String nlUsageTypeKey, String language) throws Exception { |
64 | 0 | return statementService.translateStatementTreeViewToNL(statementTreeViewInfo, nlUsageTypeKey, language); |
65 | |
} |
66 | |
|
67 | |
@Override |
68 | |
public String translateReqComponentToNL(ReqComponentInfo reqComponentInfo, String nlUsageTypeKey, String language) throws Exception { |
69 | 0 | return statementService.translateReqComponentToNL(reqComponentInfo, nlUsageTypeKey, language); |
70 | |
} |
71 | |
|
72 | |
public void setStatementService(StatementService statementService) { |
73 | 0 | this.statementService = statementService; |
74 | 0 | } |
75 | |
} |