Keel 2.1RC2

org.keel.apps.crud.models
Class CrudBase

java.lang.Object
  extended byorg.keel.services.model.StandardModel
      extended byorg.keel.services.model.StandardLogEnabledModel
          extended byorg.keel.services.model.SecurableStandardLogEnabledModel
              extended byorg.keel.apps.crud.models.CrudBase
All Implemented Interfaces:
Configurable, LogEnabled, Model, Securable
Direct Known Subclasses:
CompList, GetBase, List, OperationList, Prompt, Query, SelectPersistent, UpdateBase, UserCompList, UserOperationList

public abstract class CrudBase
extends SecurableStandardLogEnabledModel

Base class for all "crud". This class provides the execute() method which all subclasses need to override.

Version:
$Revision: 1.14 $ $Date: 2004/03/18 23:41:38 $
Author:
Michael Nash

Field Summary
protected static java.lang.String ADD
           
private  boolean countRecords
           
protected static java.lang.String CRUD
           
private  java.lang.String currentDomainName
           
private  int currentPage
           
private  Persistent currentPersistent
           
private  java.lang.String currentPersistentName
           
protected static java.lang.String DELETE
           
private  int endRecord
           
private  java.util.Map fixedFields
           
private  java.lang.String fixedFieldsParam
           
protected static java.lang.String LIST
           
private  Output masterDetail
           
protected  boolean noPaging
           
protected  java.lang.String prefix
           
protected static java.lang.String PROMPT
           
protected static java.lang.String PROMPT_ADD
           
protected static java.lang.String PROMPT_QUERY
           
protected static java.lang.String PROMPT_UPDATE
           
protected static java.lang.String QUERY
           
protected static java.lang.String SELECT_PERSISTENT
           
private  boolean showNext
           
private  boolean showPrev
           
private  java.lang.String sortFieldsParam
           
private  int startRecord
           
protected  java.lang.String suffix
           
protected static java.lang.String UPDATE
           
 
Fields inherited from class org.keel.services.model.SecurableStandardLogEnabledModel
 
Fields inherited from class org.keel.services.model.StandardLogEnabledModel
log
 
Fields inherited from class org.keel.services.model.StandardModel
configuration
 
Fields inherited from interface org.keel.services.model.Model
ROLE
 
Constructor Summary
CrudBase()
           
 
Method Summary
protected  void addCriteria(Command c, ModelRequest req)
          Fetch the search criteria from the context, and then add each search criteria element to the given command
protected  void addParameters(Command c)
           
protected  boolean countRecords()
          Return true if configuration indicates that we count records.
protected  java.lang.String decode(java.lang.String orig)
          Remove %20 from a string replacing it with spaces
 ModelResponse execute(ModelRequest req)
          All of the sub-classes of this class extend the execute method to perform their functionality.
protected  int getCurrentPage(ModelRequest req)
          Returns the currentPage.
protected  int getEndRecord()
          Returns the endRecord.
protected  java.util.Map getFixedFields()
          Returns the fixedFields.
protected  Output getMasterDetail()
          Returns the masterDetail.
protected  int getPageNumber(ModelRequest req)
          Parse out the currently requested page number
protected  Persistent getPersistent(ModelRequest req)
          Given a class name that contains a Persistent, instantiate an instance of the object & return it.
protected  java.lang.String getPersistentName()
           
protected  void getPrefixes(ModelRequest req)
           
protected  java.lang.String getSortFieldsParam()
           
protected  int getStartRecord()
          Returns the startRecord.
protected  boolean isShowNext()
          Returns the showNext.
protected  boolean isShowPrev()
          Returns the showPrev.
protected  void saveSettings(ModelRequest req)
           
protected  void setCurrentPage(int currentPage)
          Sets the currentPage.
protected  void setEndRecord(int endRecord)
          Sets the endRecord.
private  void setFixedFields()
           
protected  void setShowNext(boolean showNext)
          Sets the showNext.
protected  void setShowPrev(boolean showPrev)
          Sets the showPrev.
protected  void setStartRecord(int startRecord)
          Sets the startRecord.
protected  void showEditLink(ModelRequest req, ModelResponse res, java.lang.String fieldName, java.lang.String oneFieldValue, Persistent currentRecord, Output myElement)
          Write a hyperlink command that allows edit of the current key
protected  void showOptions(ModelRequest req, ModelResponse res)
          Display a small table of icons giving the user the option to proceed directly to a search, add, or list function from this form.
protected  void showUserName(ModelRequest req, ModelResponse res, java.lang.String theDescrip)
           
 
Methods inherited from class org.keel.services.model.SecurableStandardLogEnabledModel
getAuthorizationManager, setAuthorizationManager
 
Methods inherited from class org.keel.services.model.StandardLogEnabledModel
enableLogging
 
Methods inherited from class org.keel.services.model.StandardModel
configure, getConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRUD

protected static java.lang.String CRUD

QUERY

protected static java.lang.String QUERY

DELETE

protected static java.lang.String DELETE

PROMPT

protected static java.lang.String PROMPT

PROMPT_ADD

protected static java.lang.String PROMPT_ADD

UPDATE

protected static java.lang.String UPDATE

PROMPT_UPDATE

protected static java.lang.String PROMPT_UPDATE

ADD

protected static java.lang.String ADD

LIST

protected static java.lang.String LIST

PROMPT_QUERY

protected static java.lang.String PROMPT_QUERY

SELECT_PERSISTENT

protected static java.lang.String SELECT_PERSISTENT

currentPersistent

private Persistent currentPersistent

currentDomainName

private java.lang.String currentDomainName

currentPersistentName

private java.lang.String currentPersistentName

fixedFieldsParam

private java.lang.String fixedFieldsParam

fixedFields

private java.util.Map fixedFields

sortFieldsParam

private java.lang.String sortFieldsParam

currentPage

private int currentPage

startRecord

private int startRecord

endRecord

private int endRecord

showPrev

private boolean showPrev

showNext

private boolean showNext

masterDetail

private Output masterDetail

countRecords

private boolean countRecords

noPaging

protected boolean noPaging

prefix

protected java.lang.String prefix

suffix

protected java.lang.String suffix
Constructor Detail

CrudBase

public CrudBase()
Method Detail

getSortFieldsParam

protected java.lang.String getSortFieldsParam()

getCurrentPage

protected int getCurrentPage(ModelRequest req)
Returns the currentPage.

Returns:
int

countRecords

protected boolean countRecords()
Return true if configuration indicates that we count records. Performance is better on large sets if we don't do this.


getEndRecord

protected int getEndRecord()
Returns the endRecord.

Returns:
int

getFixedFields

protected java.util.Map getFixedFields()
Returns the fixedFields.

Returns:
HashMap

getStartRecord

protected int getStartRecord()
Returns the startRecord.

Returns:
int

setCurrentPage

protected void setCurrentPage(int currentPage)
Sets the currentPage.

Parameters:
currentPage - The currentPage to set

setEndRecord

protected void setEndRecord(int endRecord)
Sets the endRecord.

Parameters:
endRecord - The endRecord to set

setStartRecord

protected void setStartRecord(int startRecord)
Sets the startRecord.

Parameters:
startRecord - The startRecord to set

getMasterDetail

protected Output getMasterDetail()
Returns the masterDetail.

Returns:
Output

isShowNext

protected boolean isShowNext()
Returns the showNext.

Returns:
boolean

isShowPrev

protected boolean isShowPrev()
Returns the showPrev.

Returns:
boolean

setShowNext

protected void setShowNext(boolean showNext)
Sets the showNext.

Parameters:
showNext - The showNext to set

setShowPrev

protected void setShowPrev(boolean showPrev)
Sets the showPrev.

Parameters:
showPrev - The showPrev to set

decode

protected java.lang.String decode(java.lang.String orig)
Remove %20 from a string replacing it with spaces

Parameters:
orig - Original string
Returns:
String Result string with %20 replaced by spaces

getPrefixes

protected void getPrefixes(ModelRequest req)

execute

public ModelResponse execute(ModelRequest req)
                      throws ModelException
All of the sub-classes of this class extend the execute method to perform their functionality.

Throws:
ModelException

saveSettings

protected void saveSettings(ModelRequest req)
                     throws PersistenceException,
                            ModelException
Throws:
PersistenceException
ModelException

showOptions

protected void showOptions(ModelRequest req,
                           ModelResponse res)
                    throws PersistenceException,
                           ModelException
Display a small table of icons giving the user the option to proceed directly to a search, add, or list function from this form. Only the functions this user are allowed to do are shown

Throws:
PersistenceException - If an error occurrs determining what functions this user is allowed to perform
ControllerException
ModelException

showUserName

protected void showUserName(ModelRequest req,
                            ModelResponse res,
                            java.lang.String theDescrip)
                     throws ModelException
Parameters:
theDescrip -
Throws:
ControllerException
ModelException

getPersistentName

protected java.lang.String getPersistentName()

getPersistent

protected Persistent getPersistent(ModelRequest req)
                            throws ModelException,
                                   PersistenceException
Given a class name that contains a Persistent, instantiate an instance of the object & return it. Also associates the current user name (from the session) with the object so that requests to maniupluate the object can be passed through appropriate security

Parameters:
req - The ModelRequest
Returns:
A Persistent from the class of the given name
Throws:
PersistenceException - if the object cannot be created or set up
ModelException

getPageNumber

protected int getPageNumber(ModelRequest req)
                     throws ModelException
Parse out the currently requested page number

Throws:
ModelException

setFixedFields

private void setFixedFields()
                     throws PersistenceException
Throws:
PersistenceException

showEditLink

protected void showEditLink(ModelRequest req,
                            ModelResponse res,
                            java.lang.String fieldName,
                            java.lang.String oneFieldValue,
                            Persistent currentRecord,
                            Output myElement)
                     throws PersistenceException,
                            ModelException
Write a hyperlink command that allows edit of the current key

Parameters:
fieldName - The name of the field to have the hyperlink
oneFieldValue - The value of the field
currentRecord - A Persistent of the current record
myElement - The cell in the table representing the current field of the current record
Throws:
PersistenceException - If the information to build the link cannot be retrieved from the persistent
ModelException

addParameters

protected void addParameters(Command c)

addCriteria

protected void addCriteria(Command c,
                           ModelRequest req)
Fetch the search criteria from the context, and then add each search criteria element to the given command


Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.