M
- the type of the modelpublic abstract class AbstractController<M> extends neo.nursery.AbstractNurseryService implements Controller<M>
Modifier and Type | Field and Description |
---|---|
protected org.apache.log4j.Logger |
mLogger |
Constructor and Description |
---|
AbstractController() |
Modifier and Type | Method and Description |
---|---|
void |
cleanup(String pWidgetName,
javax.servlet.http.HttpServletRequest pRequest)
This method should clean up the object(s) that was put in the request in
createModel method. |
M |
createModel(String pWidgetName,
String pViewName,
neo.xredsys.presentation.PresentationArticle pWidgetContent,
javax.servlet.http.HttpServletRequest pRequest,
javax.servlet.ServletContext pApplication,
javax.servlet.jsp.PageContext pPageContext,
Boolean pFlush)
Creates the model for the given widget with the given view.
|
String |
getDefaultViewName() |
protected abstract Object |
getFromModel(M pModel,
String pKey)
This method retrieves the value corresponding to the given key in the model
|
protected abstract M |
getNewModel()
This method creates and returns a new model
|
protected M |
getWidgetModel(String pWidgetName,
String pViewName,
neo.xredsys.presentation.PresentationArticle pWidgetContent,
neo.xredsys.content.type.ArticleType pArticleType) |
protected void |
includeJSPControllers(String pWidgetName,
String pViewName,
javax.servlet.ServletContext pApplication,
javax.servlet.jsp.PageContext pPageContext,
Boolean pFlush)
This method ensures that jsp controllers are invoked if present
|
protected void |
includeProcessors(String pWidgetName,
M pWidgetContext,
javax.servlet.http.HttpServletRequest pRequest) |
protected void |
populateModelForView(M pModel,
String pViewName,
neo.xredsys.content.type.ArticleType pArticleType,
neo.xredsys.presentation.PresentationArticle pWidgetContent)
This method reads the values of view-specific fields and puts them in the model
|
protected abstract void |
putInModel(M pModel,
String pKey,
Object pValue)
This method puts the given key-value pair in the model
|
protected void |
readCommonFields(M pModel,
neo.xredsys.content.type.ArticleType pArticleType,
neo.xredsys.presentation.PresentationArticle pWidgetContent)
This method reads the fields from the panels which are common to all widgets and puts them in the model
|
void |
setDefaultViewName(String pDefaultViewName) |
protected void |
startService() |
protected void |
stopService() |
protected Object |
transform(String pFieldName,
Object pFieldValue,
String pPanelName)
This method can be used to transform the value of a particular field before it is placed in the model
|
doStartService, doStopService, stopIdleService
assertServiceRunning, getServiceDescription, getServiceMessage, getServiceState, isServiceEnabled, isServiceFailed, isServiceIdle, isServiceRunning, isServiceShutdownFailed, isServiceStopped, setServiceDescription, setServiceEnabled, start, stop, validateIsTrue, validateNotNull
public final M createModel(String pWidgetName, String pViewName, neo.xredsys.presentation.PresentationArticle pWidgetContent, javax.servlet.http.HttpServletRequest pRequest, javax.servlet.ServletContext pApplication, javax.servlet.jsp.PageContext pPageContext, Boolean pFlush)
1. First, the model is created by invoking getNewModel() 2. Then readCommonFields() method is invoked to read the fields in the panels that are common to all widgets 3. Then populateModelForView() method is invoked to read view-specific fields and put them in the model 4. Finally, includeJSPControllers() method is invoked to ensure that JSP controllers are invoked, if present.
createModel
in interface Controller<M>
pWidgetName
- the widget namepViewName
- the name of the view. If pViewName is null
it is up to the controller to decide which view to usepWidgetContent
- the content of the widgetpRequest
- the requestpApplication
- the servlet contextpPageContext
- the page contextpFlush
- if this is set true then buffer will be flushed otherwise notprotected M getWidgetModel(String pWidgetName, String pViewName, neo.xredsys.presentation.PresentationArticle pWidgetContent, neo.xredsys.content.type.ArticleType pArticleType)
protected void includeProcessors(String pWidgetName, M pWidgetContext, javax.servlet.http.HttpServletRequest pRequest)
protected abstract M getNewModel()
protected abstract void putInModel(M pModel, String pKey, Object pValue)
pModel
- the modelpKey
- the keypValue
- the valueprotected abstract Object getFromModel(M pModel, String pKey)
pModel
- the modelpKey
- the keyprotected void populateModelForView(M pModel, String pViewName, neo.xredsys.content.type.ArticleType pArticleType, neo.xredsys.presentation.PresentationArticle pWidgetContent)
pModel
- the modelpViewName
- the view namepArticleType
- the type of the widgetpWidgetContent
- the PresentationArticle
object corresponding to the widgetprotected void includeJSPControllers(String pWidgetName, String pViewName, javax.servlet.ServletContext pApplication, javax.servlet.jsp.PageContext pPageContext, Boolean pFlush)
pWidgetName
- the name of the widgetpViewName
- the view namepApplication
- the servlet contextpPageContext
- the page contextprotected Object transform(String pFieldName, Object pFieldValue, String pPanelName)
pFieldName
- the name of the fieldpFieldValue
- the valuepPanelName
- the name of the panel to which the current field belongsprotected void readCommonFields(M pModel, neo.xredsys.content.type.ArticleType pArticleType, neo.xredsys.presentation.PresentationArticle pWidgetContent)
pModel
- the modelpArticleType
- the widget typepWidgetContent
- the PresentationArticle
object corresponding to the widgetpublic void cleanup(String pWidgetName, javax.servlet.http.HttpServletRequest pRequest)
Controller
createModel
method.cleanup
in interface Controller<M>
public String getDefaultViewName()
public void setDefaultViewName(String pDefaultViewName)
protected void startService() throws IllegalStateException, IllegalArgumentException, Exception
startService
in class neo.nursery.AbstractNurseryService
IllegalStateException
IllegalArgumentException
Exception
protected void stopService() throws IllegalStateException, Exception
stopService
in class neo.nursery.AbstractNurseryService
IllegalStateException
Exception
© 1998- 2017 Escenic AS