org.openscience.nmrshiftdb.portlets
Class SubmitPortlet

java.lang.Object
  extended by org.apache.jetspeed.portal.portlets.AbstractPortlet
      extended by org.openscience.nmrshiftdb.portlets.SubmitPortlet
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 SubmitPortlet
extends org.apache.jetspeed.portal.portlets.AbstractPortlet

This is the portlet handlang submitting spectra/molecules...

Author:
Stefan Kuhn
See Also:
Serialized Form

Field Summary
 
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
SubmitPortlet()
           
 
Method Summary
 boolean alreadyids(DBLiterature lit, DBMolecule mol)
          Tells if there are already ids for this molecule and this literature.
static void doEmailForReviewAndSerialize(SubmittingData subData, org.apache.turbine.util.RunData runData, org.apache.jetspeed.om.security.turbine.TurbineUser reviewer)
          Sends an email to the reviewer and serializes the data
static boolean doReview(SubmittingData subData, java.util.Date now, org.apache.jetspeed.om.security.turbine.TurbineUser user, org.apache.turbine.util.RunData runData)
          Does everything connected with the review process.
 org.apache.ecs.ConcreteElement getContent(org.apache.turbine.util.RunData runData)
          Gets the content to be displayed in the portlet as HTML.
private  void saveSubdataToDisk(SubmittingData subData, org.apache.turbine.util.RunData runData)
          Saves the submitting data object to disk
private  java.lang.String submitPage(java.lang.String messages, SubmittingData subData, org.apache.turbine.util.RunData runData, javax.servlet.http.HttpSession session)
          Puts together the submit 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
 

Constructor Detail

SubmitPortlet

public SubmitPortlet()
Method Detail

doEmailForReviewAndSerialize

public static void doEmailForReviewAndSerialize(SubmittingData subData,
                                                org.apache.turbine.util.RunData runData,
                                                org.apache.jetspeed.om.security.turbine.TurbineUser reviewer)
                                         throws java.io.IOException,
                                                java.io.FileNotFoundException,
                                                java.lang.Exception
Sends an email to the reviewer and serializes the data

Parameters:
runData - The runData object
reviewer - The reviewer the spectrum is assigned to
subData - Description of Parameter
Throws:
java.io.IOException - Problems writing serialized file
java.io.FileNotFoundException - Nmrshfiftdb.properties not found
java.lang.Exception - Description of Exception

doReview

public static boolean doReview(SubmittingData subData,
                               java.util.Date now,
                               org.apache.jetspeed.om.security.turbine.TurbineUser user,
                               org.apache.turbine.util.RunData runData)
                        throws java.lang.Exception
Does everything connected with the review process.

Parameters:
subData - The current SubmittingData object.
now - The Date considered to be input time.
user - The user doing the submit.
runData - The current RunData object.
Returns:
True=a reviewer did an edit; false=somebody else edited or it was a new submit.
Throws:
java.lang.Exception - Database problems.

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.

alreadyids

public boolean alreadyids(DBLiterature lit,
                          DBMolecule mol)
                   throws java.lang.Exception
Tells if there are already ids for this molecule and this literature.

Parameters:
lit - The literature to check.
mol - The molecule to check.
Returns:
true/false.
Throws:
java.lang.Exception - Databse problems.

submitPage

private java.lang.String submitPage(java.lang.String messages,
                                    SubmittingData subData,
                                    org.apache.turbine.util.RunData runData,
                                    javax.servlet.http.HttpSession session)
                             throws java.lang.Exception
Puts together the submit page

Parameters:
messages - Collected messages for the user
subData - submittingData object from session
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

saveSubdataToDisk

private void saveSubdataToDisk(SubmittingData subData,
                               org.apache.turbine.util.RunData runData)
Saves the submitting data object to disk

Parameters:
subData - The submittinData object
runData - The current runData object