org.openmrs.module
Class Extension

java.lang.Object
  extended by org.openmrs.module.Extension

public abstract class Extension
extends java.lang.Object

An extension is a small snippet of code that is run at certain "extension points" throughout the user interface

An extension is not necessarily tied to only one certain point. If all of the need return values are defined it can be used to extend any point. A module can contain many extensions for many different points.


Nested Class Summary
static class Extension.MEDIA_TYPE
          All media types allowed by the module extension system.
 
Field Summary
static java.lang.String extensionIdSeparator
          String separating the pointId and media type in an extension id
 
Constructor Summary
Extension()
          default constructor
 
Method Summary
 java.lang.String getExtensionId()
          Get the extension point id
abstract  Extension.MEDIA_TYPE getMediaType()
          Sets the content type of this extension.
 java.lang.String getModuleId()
          Get this extension's module id
 java.lang.String getOverrideContent(java.lang.String bodyContent)
          If this method returns a non-null value then the return value will be used as the default content for this extension at this extension point
 java.util.Map<java.lang.String,java.lang.String> getParameterMap()
          Get all of the parameters given to this extension point
 java.lang.String getPointId()
          Get the point id
 void initialize(java.util.Map<java.lang.String,java.lang.String> parameterMap)
          Called before being displayed each time
 void setModuleId(java.lang.String moduleId)
          Set the module id of this extension
 void setParameterMap(java.util.Map<java.lang.String,java.lang.String> parameterMap)
          Parameters given at the extension point This method is usually called only during extension initialization
 void setPointId(java.lang.String pointId)
          Set the point id
static java.lang.String toExtensionId(java.lang.String pointId, Extension.MEDIA_TYPE mediaType)
          Convert the given pointId and mediaType to an extensionId.
 java.lang.String toString()
          Get the string representation of this extension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

extensionIdSeparator

public static final java.lang.String extensionIdSeparator
String separating the pointId and media type in an extension id

See Also:
toExtensionId(String, MEDIA_TYPE), Constant Field Values
Constructor Detail

Extension

public Extension()
default constructor

Method Detail

initialize

public void initialize(java.util.Map<java.lang.String,java.lang.String> parameterMap)
Called before being displayed each time

Parameters:
parameterMap -

getPointId

public java.lang.String getPointId()
Get the point id

Returns:
the String Point Id

setPointId

public void setPointId(java.lang.String pointId)
Set the point id

Parameters:
pointId -

getParameterMap

public java.util.Map<java.lang.String,java.lang.String> getParameterMap()
Get all of the parameters given to this extension point

Returns:
key-value parameter map

setParameterMap

public void setParameterMap(java.util.Map<java.lang.String,java.lang.String> parameterMap)
Parameters given at the extension point This method is usually called only during extension initialization

Parameters:
parameterMap - key-value parameter map

getMediaType

public abstract Extension.MEDIA_TYPE getMediaType()
Sets the content type of this extension. If null is returned this extension should work across all medium types

Returns:
type of the medium that this extension works for

getExtensionId

public java.lang.String getExtensionId()
Get the extension point id

Returns:
the String Extension Id

getOverrideContent

public java.lang.String getOverrideContent(java.lang.String bodyContent)
If this method returns a non-null value then the return value will be used as the default content for this extension at this extension point

Returns:
override content

getModuleId

public final java.lang.String getModuleId()
Get this extension's module id

Returns:
the String Module Id

setModuleId

public final void setModuleId(java.lang.String moduleId)
Set the module id of this extension

Parameters:
moduleId -

toString

public final java.lang.String toString()
Get the string representation of this extension

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

toExtensionId

public static final java.lang.String toExtensionId(java.lang.String pointId,
                                                   Extension.MEDIA_TYPE mediaType)
Convert the given pointId and mediaType to an extensionId. The extension id is usually pointid|mediaType if mediatype is null, extension id is just point id

Parameters:
pointId -
mediaType -
Returns:
string extension id

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change