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 016package org.kuali.student.r2.lum.statement.config.context; 017 018import java.util.HashMap; 019import java.util.Map; 020 021import org.kuali.student.r1.core.statement.dto.ReqComponentInfo; 022import org.kuali.student.r1.lum.statement.typekey.ReqComponentFieldTypes; 023import org.kuali.student.r2.common.dto.ContextInfo; 024import org.kuali.student.r2.common.exceptions.OperationFailedException; 025 026 027/** 028 * This class creates the template context for grade check type. 029 */ 030public class GpaContextImpl extends BasicContextImpl { 031 /** GPA template token */ 032 public final static String GPA_TOKEN = "gpa"; 033 034 035 /** 036 * Creates the context map (template data) for the requirement component. 037 * 038 * 039 * 040 * @param reqComponent Requirement component 041 * @param contextInfo 042 * @throws OperationFailedException Creating context map fails 043 */ 044 public Map<String, Object> createContextMap(ReqComponentInfo reqComponent, ContextInfo contextInfo) throws OperationFailedException { 045 Map<String, Object> contextMap = new HashMap<String, Object>(); 046 String gpa = getReqComponentFieldValue(reqComponent, ReqComponentFieldTypes.GPA_KEY.getId()); 047 if(gpa != null) { 048 contextMap.put(GPA_TOKEN, Double.valueOf(gpa)); 049 } 050 return contextMap; 051 } 052}