PAJES 2.3.9

org.pajes.db.entity
Class Viewer

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

public abstract class Viewer
extends MaintenanceDisplayElement
implements java.io.Serializable

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

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

See Also:
Serialized Form

Constructor Summary
Viewer()
           
 
Method Summary
protected  void build(TraversableElement container)
          Populates the tags in the specified container.
protected  Entity getEntity()
          Returns the Entity to be viewed.
abstract  Paje getPaje()
          Returns the Paje to view an Entity object.
protected  Scope getScope()
          Returns the Scope will retrieve the Entity to be viewed.
 void init(Manager manager, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request)
          Deprecated. 2.1.1 - use init(Manager, ServletContext) and setRequest(HttpServletRequest).
protected  Entity retrieve()
          Returns the Entity object to be displayed.
 void setRequest(javax.servlet.http.HttpServletRequest request)
          Sets the request that this instance of the Viewer will show.
 
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

Viewer

public Viewer()
Method Detail

getPaje

public abstract Paje getPaje()
                      throws java.io.IOException
Returns the Paje to view an Entity object.

Sub-class implementations should build or acquire a Paje instance (either by building the Paje on the fly, or creating one from a PajeFactory), and then call the build(org.pajes.html.TraversableElement) method to populate the named tags.

Returns:
the populated Paje.
Throws:
java.io.IOException - if an IO exception occurs.
See Also:
build(org.pajes.html.TraversableElement)

setRequest

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

Overrides:
setRequest in class MaintenanceDisplayElement
Parameters:
request - the request object.
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)
          throws EntityNotFoundException,
                 java.io.IOException,
                 java.sql.SQLException
Deprecated. 2.1.1 - use init(Manager, ServletContext) and setRequest(HttpServletRequest).

Deprecated.

Parameters:
manager - the Manager that manages the Entity object to be viewed.
context - the ServletContext.
request - the request object.
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.

getEntity

protected Entity getEntity()
Returns the Entity to be viewed.

Returns:
the current Entity.

getScope

protected Scope getScope()
Returns the Scope will retrieve the Entity to be viewed. The default implementation assumes that there is sufficient information in the HttpServletRequest to uniquely identify the Entity.

Sub-classes may over-ride this method to return a scope that, for example, imposes additional constraints.

Returns:
the Scope.
See Also:
retrieve()

build

protected void build(TraversableElement container)
              throws EntityNotFoundException,
                     java.io.IOException,
                     java.sql.SQLException
Populates the tags in the specified container.

Parameters:
container - The container with the tags 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.assignTagContents(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 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) method.

The default implementation returns the Entity that meets the scope.

Returns:
the Entity object to be viewed.
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:
getScope()

PAJES 2.3.9

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