org.kuali.student.core.statement.naturallanguage
Class AbstractContext<T>

java.lang.Object
  extended by org.kuali.student.core.statement.naturallanguage.AbstractContext<T>
Type Parameters:
T - Type of context to create
All Implemented Interfaces:
Context<T>
Direct Known Subclasses:
BasicContextImpl

public abstract class AbstractContext<T>
extends Object
implements Context<T>

This is an abstract class for creating a map (containing token/data) used in template translations.


Field Summary
protected static String FIELDS_TOKEN
          These common shared tokens are needed since velocity doesn't allow periods in tokens.
 
Constructor Summary
AbstractContext()
           
 
Method Summary
 Map<String,Object> createContextMap(ReqComponentInfo reqComponent)
          Creates the context map (template data) for the requirement component.
protected  Map<String,String> getReqComponentFieldMap(ReqComponentInfo reqComponent)
          Gets requirement component fields as a map.
protected  String getReqComponentFieldValue(ReqComponentInfo reqComponent, String key)
          Gets the value of the ReqCompFieldInfo key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.student.core.statement.naturallanguage.Context
createContextMap
 

Field Detail

FIELDS_TOKEN

protected static final String FIELDS_TOKEN

These common shared tokens are needed since velocity doesn't allow periods in tokens.

E.g. kuali.reqComponent.field.type.totalCredits must either be convert to totalCredits or reqCompFieldType_totalCredits so a template would look like:

'Student must take $totalCredits of MATH 100'

or

'Student must take $reqCompFieldType_totalCredits of MATH 100'

See Also:
Constant Field Values
Constructor Detail

AbstractContext

public AbstractContext()
Method Detail

getReqComponentFieldMap

protected Map<String,String> getReqComponentFieldMap(ReqComponentInfo reqComponent)
                                              throws OperationFailedException
Gets requirement component fields as a map.

Parameters:
reqComponent - Requirement component
Returns:
Map of requirement component fields
Throws:
OperationFailedException

getReqComponentFieldValue

protected String getReqComponentFieldValue(ReqComponentInfo reqComponent,
                                           String key)
                                    throws OperationFailedException
Gets the value of the ReqCompFieldInfo key. See ReqCompFieldInfo#getKey()

Parameters:
reqComponent - Requirement component
key - ReqCompFieldInfo key
Returns:
Value of ReqCompFieldInfo
Throws:
OperationFailedException

createContextMap

public Map<String,Object> createContextMap(ReqComponentInfo reqComponent)
                                    throws OperationFailedException
Creates the context map (template data) for the requirement component. Also, adds the field token map to the context map.

Parameters:
reqComponent - Requirement component
Throws:
DoesNotExistException - If CLU, CluSet or relation does not exist
OperationFailedException


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.