|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AtpContextImpl | Line # 29 | 14 | 0% | 5 | 1 | 94.7% |
0.94736844
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(11) | |||
Result | |||
0.7368421
|
org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForCourse.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_admitted_org_duration_ProgramAsCluSet org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForCourse.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_admitted_org_duration_ProgramAsCluSet | 1 PASS | |
0.7368421
|
org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForCourse.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_notadmitted_org_duration_ProgramAsClu org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForCourse.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_notadmitted_org_duration_ProgramAsClu | 1 PASS | |
0.7368421
|
org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForProgram.testTranslateReqComponent_CompletionDuration_10Credits org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForProgram.testTranslateReqComponent_CompletionDuration_10Credits | 1 PASS | |
0.7368421
|
org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForCourse.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_notadmitted_org_duration_ProgramAsCluSet org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForCourse.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_notadmitted_org_duration_ProgramAsCluSet | 1 PASS | |
0.7368421
|
org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForCourse.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_admitted_org_duration_ProgramAsClu org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForCourse.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_course_program_admitted_org_duration_ProgramAsClu | 1 PASS | |
0.7368421
|
org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForProgram.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_program_duration_gpa_min org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForProgram.testGetNaturalLanguageForReqComponentType_kuali_reqComponent_type_program_duration_gpa_min | 1 PASS | |
0.7368421
|
org.kuali.student.lum.statement.config.context.AtpContextImplTest.testCreateContextMap_TokenValues org.kuali.student.lum.statement.config.context.AtpContextImplTest.testCreateContextMap_TokenValues | 1 PASS | |
0.7368421
|
org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForProgram.testTranslateReqComponent_CompletionDurationAfterEntry_3Credits org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForProgram.testTranslateReqComponent_CompletionDurationAfterEntry_3Credits | 1 PASS | |
0.7368421
|
org.kuali.student.lum.statement.config.context.AtpContextImplTest.testCreateContextMap_ContainsTokens org.kuali.student.lum.statement.config.context.AtpContextImplTest.testCreateContextMap_ContainsTokens | 1 PASS | |
0.7368421
|
org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForProgram.testTranslateReqComponent_CandidateStatusDuration_3Credits org.kuali.student.lum.statement.service.impl.TestStatementServiceImplForProgram.testTranslateReqComponent_CandidateStatusDuration_3Credits | 1 PASS | |
0.6315789
|
org.kuali.student.lum.statement.config.context.AtpContextImplTest.testCreateContextMap_NullTokenValues org.kuali.student.lum.statement.config.context.AtpContextImplTest.testCreateContextMap_NullTokenValues | 1 PASS | |
1 | /** | |
2 | * Copyright 2010 The Kuali Foundation Licensed under the | |
3 | * Educational Community License, Version 2.0 (the "License"); you may | |
4 | * not use this file except in compliance with the License. You may | |
5 | * obtain a copy of the License at | |
6 | * | |
7 | * http://www.osedu.org/licenses/ECL-2.0 | |
8 | * | |
9 | * Unless required by applicable law or agreed to in writing, | |
10 | * software distributed under the License is distributed on an "AS IS" | |
11 | * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
12 | * or implied. See the License for the specific language governing | |
13 | * permissions and limitations under the License. | |
14 | */ | |
15 | ||
16 | package org.kuali.student.lum.statement.config.context; | |
17 | ||
18 | import java.util.Map; | |
19 | ||
20 | import org.kuali.student.core.statement.dto.ReqComponentInfo; | |
21 | import org.kuali.student.core.atp.dto.AtpDurationTypeInfo; | |
22 | import org.kuali.student.core.atp.service.AtpService; | |
23 | import org.kuali.student.core.exceptions.OperationFailedException; | |
24 | import org.kuali.student.lum.statement.typekey.ReqComponentFieldTypes; | |
25 | ||
26 | /** | |
27 | * This class creates the template context for an academic time period. | |
28 | */ | |
29 | public class AtpContextImpl extends BasicContextImpl { | |
30 | ||
31 | private AtpService atpService; | |
32 | ||
33 | public final static String DURATION_TYPE_TOKEN = "durationType"; | |
34 | public final static String DURATION_TOKEN = "duration"; | |
35 | ||
36 | 7 | public void setAtpService(AtpService atpService) { |
37 | 7 | this.atpService = atpService; |
38 | } | |
39 | ||
40 | 11 | private AtpDurationTypeInfo getAtpDurationType(String atpDurationTypeKey) throws OperationFailedException { |
41 | 11 | if (atpDurationTypeKey == null) { |
42 | 1 | return null; |
43 | } | |
44 | 10 | try { |
45 | 10 | AtpDurationTypeInfo atpDurationType = this.atpService.getAtpDurationType(atpDurationTypeKey); |
46 | 10 | return atpDurationType; |
47 | } catch (Exception e) { | |
48 | 0 | throw new OperationFailedException(e.getMessage(), e); |
49 | } | |
50 | } | |
51 | ||
52 | /** | |
53 | * Creates the context map (template data) for the requirement component. | |
54 | * | |
55 | * @param reqComponent Requirement component | |
56 | * @throws OperationFailedException Creating context map fails | |
57 | */ | |
58 | 11 | public Map<String, Object> createContextMap(ReqComponentInfo reqComponent) throws OperationFailedException { |
59 | 11 | String durationTypeKey = getReqComponentFieldValue(reqComponent, ReqComponentFieldTypes.DURATION_TYPE_KEY.getId()); |
60 | 11 | String duration = getReqComponentFieldValue(reqComponent, ReqComponentFieldTypes.DURATION_KEY.getId()); |
61 | 11 | AtpDurationTypeInfo atpDurationType = getAtpDurationType(durationTypeKey); |
62 | ||
63 | 11 | Map<String, Object> contextMap = super.createContextMap(reqComponent); |
64 | 11 | contextMap.put(DURATION_TYPE_TOKEN, atpDurationType); |
65 | 11 | contextMap.put(DURATION_TOKEN, duration); |
66 | 11 | return contextMap; |
67 | } | |
68 | } |
|