PAJES 2.3.9

org.pajes.db.entity
Class Editor

java.lang.Object
  extended byorg.pajes.db.entity.MaintenanceDisplayElement
      extended byorg.pajes.db.entity.Viewer
          extended byorg.pajes.db.entity.Editor
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
DefaultEditor

public abstract class Editor
extends Viewer

Abstract super-class of all classes that create a Paje to edit or display an Entity object.

All sub-classes MUST have a no-parameter constructor.

See Also:
Serialized Form

Constructor Summary
Editor()
           
 
Method Summary
protected  void build(TraversableElement form)
          Populates the input field elements on the specified form.
 void init(Manager manager, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, boolean isNew)
          Deprecated. 2.1.1 - use init(Manager, ServletContext) and setRequest(HttpServletRequest, boolean).
 boolean isNew()
          Returns true if a new Entity should be created, rather than retrieving an existing Entity.
protected  Entity retrieve()
          Returns the Entity object to be displayed.
 void setRequest(javax.servlet.http.HttpServletRequest request, boolean isNew)
          Sets the request that this instance of the Editor will show.
 
Methods inherited from class org.pajes.db.entity.Viewer
getEntity, getPaje, getScope, init, setRequest
 
Methods inherited from class org.pajes.db.entity.MaintenanceDisplayElement
clone, getManager, getRequest, getServletContext, init, init, isInitialised
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Editor

public Editor()
Method Detail

isNew

public boolean isNew()
Returns true if a new Entity should be created, rather than retrieving an existing Entity.

Returns:
true if a new Entity should be created, of false if an existing Entity should be retrieved.

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest request,
                       boolean isNew)
                throws EntityNotFoundException,
                       java.io.IOException,
                       java.sql.SQLException
Sets the request that this instance of the Editor will show.

Parameters:
request - the request object.
isNew - true if a new entity is being created.
Throws:
EntityNotFoundException - if the Entity to be edited does not exist.
java.io.IOException - if an IO exception occurs.
java.sql.SQLException - if an error occurs retrieving the Entity objects.

init

public void init(Manager manager,
                 javax.servlet.ServletContext context,
                 javax.servlet.http.HttpServletRequest request,
                 boolean isNew)
          throws EntityNotFoundException,
                 java.io.IOException,
                 java.sql.SQLException
Deprecated. 2.1.1 - use init(Manager, ServletContext) and setRequest(HttpServletRequest, boolean).

Deprecated.

Parameters:
manager - the Manager that manages the Entity object to be viewed.
context - the ServletContext.
request - the request object.
isNew - true if the editor Paje is to be returned empty so that a new Entity may be created, or false if an Entity is to be retrieved based on the request parameters, and then used to populate the form input fields.
Throws:
EntityNotFoundException - if the Entity to be edited does not exist.
java.io.IOException - if an IO exception occurs.
java.sql.SQLException - if an error occurs retrieving the Entity objects.

build

protected void build(TraversableElement form)
              throws EntityNotFoundException,
                     java.io.IOException,
                     java.sql.SQLException
Populates the input field elements on the specified form.

If the isNew() method returns false, the required Entity object specified by the scope is retrieved. If it returns true, a new Entity will be created by calling Manager.create().

Overrides:
build in class Viewer
Parameters:
form - the form on which the input field elements are to be populated.
Throws:
EntityNotFoundException - if the Entity does not exist.
java.io.IOException - if an IO exception occurs.
java.sql.SQLException - if an error occurs retrieving the Entity object.
See Also:
Entity.assignInputFieldValues(org.pajes.html.TraversableElement)

retrieve

protected Entity retrieve()
                   throws EntityNotFoundException,
                          java.sql.SQLException
Returns the Entity object to be displayed. The method is called by the Viewer.init(org.pajes.db.entity.Manager, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest) method, before calling the init(org.pajes.db.entity.Manager, javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, boolean) method.

This implementation returns either a new Entity, or the Entity returned by Viewer.retrieve(), depending upon whether the request is to edit a new Entity or not.

Overrides:
retrieve in class Viewer
Returns:
the Entity object to be edited.
Throws:
EntityNotFoundException - if the Entity requested by the Scope does not exist.
java.sql.SQLException - if an error occurs retrieving the Entity objects.
See Also:
Viewer.getScope()

PAJES 2.3.9

Copyright © 2002-2003 Viridian Pty Limited. All Rights Reserved.