001 /** 002 * Copyright 2010 The Kuali Foundation Licensed under the 003 * Educational Community License, Version 2.0 (the "License"); you may 004 * not use this file except in compliance with the License. You may 005 * obtain a copy of the License at 006 * 007 * http://www.osedu.org/licenses/ECL-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, 010 * software distributed under the License is distributed on an "AS IS" 011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 012 * or implied. See the License for the specific language governing 013 * permissions and limitations under the License. 014 */ 015 016 package org.kuali.student.lum.statement.config.context; 017 018 import java.util.HashMap; 019 import java.util.Map; 020 021 import org.kuali.student.common.exceptions.OperationFailedException; 022 import org.kuali.student.core.statement.dto.ReqComponentInfo; 023 import org.kuali.student.lum.statement.typekey.ReqComponentFieldTypes; 024 025 /** 026 * This class creates the template context for grade check type. 027 */ 028 public class GpaContextImpl extends BasicContextImpl { 029 /** GPA template token */ 030 public final static String GPA_TOKEN = "gpa"; 031 032 033 /** 034 * Creates the context map (template data) for the requirement component. 035 * 036 * @param reqComponent Requirement component 037 * @throws OperationFailedException Creating context map fails 038 */ 039 public Map<String, Object> createContextMap(ReqComponentInfo reqComponent) throws OperationFailedException { 040 Map<String, Object> contextMap = new HashMap<String, Object>(); 041 String gpa = getReqComponentFieldValue(reqComponent, ReqComponentFieldTypes.GPA_KEY.getId()); 042 if(gpa != null) { 043 contextMap.put(GPA_TOKEN, Double.valueOf(gpa)); 044 } 045 return contextMap; 046 } 047 }