org.openscience.nmrshiftdb.portlets
Class PredictPortlet

java.lang.Object
  extended by org.apache.jetspeed.portal.portlets.AbstractPortlet
      extended by org.openscience.nmrshiftdb.portlets.PredictPortlet
All Implemented Interfaces:
java.io.Serializable, org.apache.jetspeed.portal.Portlet, org.apache.jetspeed.portal.PortletState, org.apache.jetspeed.services.portletcache.Cacheable, org.apache.turbine.services.cache.Refreshable

public class PredictPortlet
extends org.apache.jetspeed.portal.portlets.AbstractPortlet

This is the portlet handling predictions spectra/molecules...

Author:
Stefan Kuhn
See Also:
Serialized Form

Field Summary
private static libsvm.svm_model[] model
           
 
Fields inherited from class org.apache.jetspeed.portal.portlets.AbstractPortlet
content
 
Fields inherited from interface org.apache.jetspeed.portal.Portlet
PORTLET_MAXIMIZED, PORTLET_MINIMIZED, PORTLET_NORMAL
 
Constructor Summary
PredictPortlet()
           
 
Method Summary
private static void doWithh(org.openscience.cdk.interfaces.IMolecule mol, org.apache.turbine.util.RunData runData)
          Sets molh as an attribute into the session, key mol, and saturates, normalizes, adds hs, places these.
 org.apache.ecs.ConcreteElement getContent(org.apache.turbine.util.RunData runData)
          Gets the content to be displayed in the portlet as HTML
static org.apache.velocity.VelocityContext getContext(javax.servlet.http.HttpSession session, boolean calculated, boolean measured, java.lang.StringBuffer messages, java.lang.Object servconorrundata, javax.servlet.http.HttpServletRequest request, boolean print)
          Builds a context for the predict page.
private  java.lang.String predictPage(java.lang.StringBuffer messages, org.apache.turbine.util.RunData runData, javax.servlet.http.HttpSession session)
          Puts together the prediction page
 
Methods inherited from class org.apache.jetspeed.portal.portlets.AbstractPortlet
allowClose, allowCustomize, allowInfo, allowMaximize, allowMinimize, allowPrintFriendly, allowView, clearContent, getAllowEdit, getAllowMaximize, getAllowView, getAttribute, getContent, getContent, getCreationTime, getDescription, getDescription, getExpirationMillis, getExpire, getHandle, getHandle, getID, getImage, getImage, getInstance, getName, getPortletConfig, getTitle, getTitle, init, isCacheable, isClosed, isMinimized, isShowTitleBar, providesCustomization, refresh, setAttribute, setCacheable, setCachedObject, setClosed, setContent, setContent, setContent, setCreationTime, setDescription, setExpirationMillis, setHandle, setID, setImage, setMinimized, setName, setPortletConfig, setTitle, setTitle, supportsType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

private static libsvm.svm_model[] model
Constructor Detail

PredictPortlet

public PredictPortlet()
Method Detail

getContext

public static org.apache.velocity.VelocityContext getContext(javax.servlet.http.HttpSession session,
                                                             boolean calculated,
                                                             boolean measured,
                                                             java.lang.StringBuffer messages,
                                                             java.lang.Object servconorrundata,
                                                             javax.servlet.http.HttpServletRequest request,
                                                             boolean print)
                                                      throws java.io.IOException,
                                                             java.io.FileNotFoundException,
                                                             java.lang.Exception
Builds a context for the predict page.

Parameters:
session - The current session.
calculated - Use calculated.
measured - Use measured.
messages - Messages to display.
servconorrundata - Description of Parameter
request - Description of Parameter
print - Description of Parameter
Returns:
The context value.
Throws:
java.io.IOException - Description of Exception.
java.io.FileNotFoundException - Description of Exception.
java.lang.Exception - Description of Exception

doWithh

private static void doWithh(org.openscience.cdk.interfaces.IMolecule mol,
                            org.apache.turbine.util.RunData runData)
                     throws java.lang.Exception
Sets molh as an attribute into the session, key mol, and saturates, normalizes, adds hs, places these.

Parameters:
molh - The molecule to treat.
runData - The current runData
Throws:
java.lang.Exception - Description of Exception

getContent

public org.apache.ecs.ConcreteElement getContent(org.apache.turbine.util.RunData runData)
Gets the content to be displayed in the portlet as HTML

Specified by:
getContent in interface org.apache.jetspeed.portal.Portlet
Overrides:
getContent in class org.apache.jetspeed.portal.portlets.AbstractPortlet
Parameters:
runData - Created by turbine
Returns:
The content to be displayed as the portlet
Since:

predictPage

private java.lang.String predictPage(java.lang.StringBuffer messages,
                                     org.apache.turbine.util.RunData runData,
                                     javax.servlet.http.HttpSession session)
                              throws java.lang.Exception
Puts together the prediction page

Parameters:
messages - Collected messages for the user
runData - The RunData object from turbine
session - The current session
Returns:
The content to be displayed as the portlet
Throws:
java.lang.Exception - Description of Exception