001/** 002 * Copyright 2005-2015 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krms.impl.repository.language; 017 018import java.util.HashMap; 019import java.util.Map; 020 021/** 022 * This is an abstract class for creating a map (containing token/data) used 023 * in template translations. 024 */ 025public abstract class AbstractTranslationContext implements TranslationContext { 026 /** 027 * <p>These common shared tokens are needed since velocity doesn't 028 * allow periods in tokens.</p> 029 * <p>E.g. kuali.reqComponent.field.type.totalCredits must either be convert to 030 * totalCredits or reqCompFieldType_totalCredits so a template would look 031 * like:</p> 032 * <p>'Student must take $totalCredits of MATH 100'</p> 033 * or 034 * <p>'Student must take $reqCompFieldType_totalCredits of MATH 100'</p> 035 */ 036 protected final static String FIELDS_TOKEN = "fields"; 037 038 /** 039 * Creates the context map (template data) for the requirement component. 040 * Also, adds the field token map to the context map. 041 * 042 * @param parameters 043 * @throws org.kuali.student.r2.common.exceptions.DoesNotExistException If CLU, CluSet or relation does not exist 044 */ 045 @Override 046 public Map<String, Object> createContextMap(Map<String, Object> parameters) { 047 Map<String, Object> contextMap = new HashMap<String, Object>(); 048 contextMap.put(FIELDS_TOKEN, parameters); 049 return contextMap; 050 } 051}