org.melati.admin
Class Admin

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.melati.servlet.ConfigServlet
              extended by org.melati.servlet.PoemServlet
                  extended by org.melati.servlet.TemplateServlet
                      extended by org.melati.admin.Admin
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Admin
extends TemplateServlet

Melati template servlet for database administration.

This class defines doTemplateRequest(Melati, ServletTemplateContext) and methods it calls to interpret requests, depending on the current table and object, if any.

Java methods with names ending "Template" and taking a ServletTemplateContext and Melati as arguments are generally called by doTemplateRequest(Melati, ServletTemplateContext)) to implement corresponding request methods. modifyTemplate(ServletTemplateContext, Melati) and associated methods are slight variations.

#adminTemplate(ServletTemplateContext, String) is called in all cases to return the template path. The name of the template is usually the same as the request method but not if the same template is used for more than one method or the template served depends on how request processing proceeds.

These methods are called to modify the context:

See Also:
Serialized Form
'To do something:'
Review working of where clause for dates, Move Nav icons into PrimarySelect, Make Top.login JS agnostic, Make Chooser JS agnostic, Make Navigation JS agnostic, Rename Left template to Table

Field Summary
 
Fields inherited from class org.melati.servlet.TemplateServlet
templateEngine
 
Fields inherited from class org.melati.servlet.ConfigServlet
melatiConfig, sysAdminEmail, sysAdminName
 
Constructor Summary
Admin()
           
 
Method Summary
protected static java.lang.String addTemplate(ServletTemplateContext context, Melati melati)
          Returns the Add template after placing the table and fields for the new row in the context using any field values already in the context.
protected static java.lang.String addUpdateTemplate(ServletTemplateContext context, Melati melati)
          Returns the Updated template after creating a new row using field data in the context.
protected static java.lang.String adminTemplate(java.lang.String name)
          Return the resource path for an admin template.
protected static org.melati.poem.Persistent create(org.melati.poem.Table table, ServletTemplateContext context)
          Creates a row for a table using field data in a template context.
protected static java.lang.String deleteTemplate(ServletTemplateContext context, Melati melati)
           
protected  java.lang.String doTemplateRequest(Melati melati, ServletTemplateContext context)
          Override this method to build up your own output.
protected static java.lang.String dsdTemplate(ServletTemplateContext context)
           
protected static java.lang.String duplicateTemplate(ServletTemplateContext context, Melati melati)
           
protected static java.lang.String modifyTemplate(ServletTemplateContext context, Melati melati)
          Implements request method "Update".
protected static ServletTemplateContext popupSelect(ServletTemplateContext context, Melati melati)
           
protected static java.lang.String popupSelectTemplate(ServletTemplateContext context, Melati melati)
          Implements the field search/selection request method.
protected static java.lang.String primarySelectTemplate(ServletTemplateContext context, Melati melati)
           
protected static ServletTemplateContext selection(ServletTemplateContext context, Melati melati)
          Modifies the context in preparation for serving a template to view a selection of rows.
protected static java.lang.String selectionRightTemplate(ServletTemplateContext context, Melati melati)
          Implements request to display a selection of records from a table in the right hand pane.
protected static java.lang.String selectionTemplate(ServletTemplateContext context, Melati melati)
          Return template for a selection of records from a table.
protected static java.lang.String selectionWindowPrimarySelectTemplate(ServletTemplateContext context, Melati melati)
           
protected static java.lang.String selectionWindowSelectionTemplate(ServletTemplateContext context, Melati melati)
           
protected static java.lang.String setupTemplate(ServletTemplateContext context, Melati melati)
           
protected static java.lang.String updateTemplate(ServletTemplateContext context, Melati melati)
          Returns the Updated template after modifying the current row according to field values in the context.
protected static java.lang.String uploadDoneTemplate(ServletTemplateContext context)
          Finished uploading.
protected static java.lang.String uploadTemplate(ServletTemplateContext context)
           
 
Methods inherited from class org.melati.servlet.TemplateServlet
addExtension, doPoemRequest, error, init, prePoemSession
 
Methods inherited from class org.melati.servlet.PoemServlet
_handleException, dbBusyMessage, destroy, doConfiguredRequest, getSysAdminEmail, getSysAdminName, handleException, poemContext, poemContextWithLDB
 
Methods inherited from class org.melati.servlet.ConfigServlet
doGet, doPost, melatiConfig, setSysAdminEmail, setSysAdminName, writeConnectionPendingException, writeError
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Admin

public Admin()
Method Detail

create

protected static org.melati.poem.Persistent create(org.melati.poem.Table table,
                                                   ServletTemplateContext context)
Creates a row for a table using field data in a template context.


adminTemplate

protected static final java.lang.String adminTemplate(java.lang.String name)
Return the resource path for an admin template.


dsdTemplate

protected static java.lang.String dsdTemplate(ServletTemplateContext context)
Returns:
a DSD for the database

primarySelectTemplate

protected static java.lang.String primarySelectTemplate(ServletTemplateContext context,
                                                        Melati melati)
                                                 throws org.melati.poem.PoemException
Returns:
primary select template
Throws:
org.melati.poem.PoemException

selectionTemplate

protected static java.lang.String selectionTemplate(ServletTemplateContext context,
                                                    Melati melati)
Return template for a selection of records from a table.


selectionRightTemplate

protected static java.lang.String selectionRightTemplate(ServletTemplateContext context,
                                                         Melati melati)
Implements request to display a selection of records from a table in the right hand pane.

Returns:
SelectionRight template.

selection

protected static ServletTemplateContext selection(ServletTemplateContext context,
                                                  Melati melati)
Modifies the context in preparation for serving a template to view a selection of rows.

Any form fields in the context with names starting "field_" are assumed to hold values that must be matched in selected rows (if not null).

An encoding of the resulting whereClause is added to the context. "AND" is replaced by an & separator.

The resulting orderClause is added to the context.

A form field with name "start" is assumed to hold the number of the start row in the result set. The default is zero. The next 20 rows are selected and added as to the context as "results".

Returns:
The modified context.
See Also:
#adminTemplate(ServletTemplateContext, String)

popupSelectTemplate

protected static java.lang.String popupSelectTemplate(ServletTemplateContext context,
                                                      Melati melati)
                                               throws org.melati.poem.PoemException
Implements the field search/selection request method.

Throws:
org.melati.poem.PoemException

popupSelect

protected static ServletTemplateContext popupSelect(ServletTemplateContext context,
                                                    Melati melati)
                                             throws org.melati.poem.PoemException
Throws:
org.melati.poem.PoemException

selectionWindowPrimarySelectTemplate

protected static java.lang.String selectionWindowPrimarySelectTemplate(ServletTemplateContext context,
                                                                       Melati melati)
                                                                throws org.melati.poem.PoemException
Returns:
primary select template
Throws:
org.melati.poem.PoemException

selectionWindowSelectionTemplate

protected static java.lang.String selectionWindowSelectionTemplate(ServletTemplateContext context,
                                                                   Melati melati)
Returns:
select template (a selection of records from a table)

addTemplate

protected static java.lang.String addTemplate(ServletTemplateContext context,
                                              Melati melati)
                                       throws org.melati.poem.PoemException
Returns the Add template after placing the table and fields for the new row in the context using any field values already in the context. If the table is a table meta data table, or a column meta data table then the appropriate extras are added to the co0ntext. The Form does not normally contain values, but this could be used as a mechanism for providing defaults.

Throws:
org.melati.poem.PoemException

addUpdateTemplate

protected static java.lang.String addUpdateTemplate(ServletTemplateContext context,
                                                    Melati melati)
                                             throws org.melati.poem.PoemException
Returns the Updated template after creating a new row using field data in the context.

If successful the template will say so while reloading according to the returnTarget and returnURL values from the Form in context.

Throws:
org.melati.poem.PoemException

updateTemplate

protected static java.lang.String updateTemplate(ServletTemplateContext context,
                                                 Melati melati)
                                          throws org.melati.poem.PoemException
Returns the Updated template after modifying the current row according to field values in the context.

If successful the template will say so while reloading according to the returnTarget and returnURL values from the Form in context.

Throws:
org.melati.poem.PoemException

deleteTemplate

protected static java.lang.String deleteTemplate(ServletTemplateContext context,
                                                 Melati melati)
                                          throws org.melati.poem.PoemException
Throws:
org.melati.poem.PoemException

duplicateTemplate

protected static java.lang.String duplicateTemplate(ServletTemplateContext context,
                                                    Melati melati)
                                             throws org.melati.poem.PoemException
Throws:
org.melati.poem.PoemException

modifyTemplate

protected static java.lang.String modifyTemplate(ServletTemplateContext context,
                                                 Melati melati)
                                          throws FormParameterException
Implements request method "Update".

Calls another method depending on the requested action.

Throws:
FormParameterException
See Also:
updateTemplate(ServletTemplateContext, Melati), deleteTemplate(ServletTemplateContext, Melati), duplicateTemplate(ServletTemplateContext, Melati)

uploadTemplate

protected static java.lang.String uploadTemplate(ServletTemplateContext context)
                                          throws org.melati.poem.PoemException
Throws:
org.melati.poem.PoemException

uploadDoneTemplate

protected static java.lang.String uploadDoneTemplate(ServletTemplateContext context)
                                              throws org.melati.poem.PoemException
Finished uploading. If you want the system to display the file you need to set your melati-wide FormDataAdaptorFactory, in org.melati.MelatiConfig.properties, to something that returns a valid URL, for instance, PoemFileDataAdaptorFactory; (remember to set your UploadDir and UploadURL in the Setting table).

Parameters:
context - the ServletTemplateContext in use
Returns:
a template name
Throws:
org.melati.poem.PoemException

setupTemplate

protected static java.lang.String setupTemplate(ServletTemplateContext context,
                                                Melati melati)

doTemplateRequest

protected java.lang.String doTemplateRequest(Melati melati,
                                             ServletTemplateContext context)
                                      throws java.lang.Exception
Description copied from class: TemplateServlet
Override this method to build up your own output.

Specified by:
doTemplateRequest in class TemplateServlet
Parameters:
melati - the current Melati
context - the current ServletTemplateContext
Returns:
a Template name, possibly excluding extension.
Throws:
java.lang.Exception


Copyright © 2000-2008 PanEris. All Rights Reserved.