commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject cvs commit: jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util StorageBean.java ScrollerBean.java ProcessBeanBase.java ProcessBean.java
Date Thu, 31 Oct 2002 14:27:45 GMT
husted      2002/10/31 06:27:45

  Modified:    scaffold/src/java/org/apache/commons/scaffold/util
                        StorageBean.java ScrollerBean.java
                        ProcessBeanBase.java ProcessBean.java
  Log:
  + ScrollerBean: Change getParameters to scrollerParams to avoid conflict with StorageBean
method. Add scrollOffset property. Change searchKey to searchValue to avoid confusion as to
purpose. Change return type to Object for using with non-string fields.
  + ScrollerBean: streamline interface and implementation; change to use standard calls rather
than like
  + Scroller/ScrollerBeanBase: change to use count and collection rather than *like.
  + ScrollerBean,ScrollerBeanBase: Initial versions.
  
  Revision  Changes    Path
  1.6       +2 -52     jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/StorageBean.java
  
  Index: StorageBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/StorageBean.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StorageBean.java	28 Oct 2002 15:17:13 -0000	1.5
  +++ StorageBean.java	31 Oct 2002 14:27:45 -0000	1.6
  @@ -155,7 +155,7 @@
       /**
        * Count of matching entries.
        * @param command Name of command to execute
  -     * @param parameter A parameter to be used with command
  +     * @param parameter A parameter to be used with command, if any
        * @return Count of matching entries
        * @exception Resource exception if data access error occurs
        */
  @@ -166,19 +166,6 @@
   
   
       /**
  -     * Count of matching entries using LIKE statement
  -     * @param command Name of command to execute
  -     * @param parameter A String parameter to be used with LIKE command
  -     * @return Count of matching entries
  -     * @exception Resource exception if data access error occurs
  -     */
  -    public int countLike(
  -            String command,
  -            String parameter)
  -            throws ResourceException;
  -
  -
  -    /**
        * Lookup command and execute "update" query to create a table,
        * seed it with data, et cetera.
        * <p>
  @@ -236,43 +223,6 @@
        * @param parameters An array of parameters to be used with command
        */
       public Collection findCollection(
  -            Object target,
  -            String command,
  -            Object[] parameters) throws ResourceException;
  -
  -
  -    /**
  -     * Retrieve a collection of beans from data storage.
  -     * <p>
  -     * @return Collection with entry or empty collection
  -     * @exception throws PropertiesException, ResourceException
  -     * if data access error occurs
  -     * @param target Object to use as factory when populating
  -     * (e.g. this).
  -     * @param command Name of the data access command
  -     * collection
  -     * @param parameter A String parameter to be used with command
  -     */
  -    public Collection findCollectionLike(
  -            Object target,
  -            String command,
  -            String parameter) throws ResourceException;
  -
  -
  -
  -    /**
  -     * Retrieve a collection of beans from data storage.
  -     * <p>
  -     * @return Collection with entry or empty collection
  -     * @exception throws PropertiesException, ResourceException
  -     * if data access error occurs
  -     * @param target Object to use as factory when populating
  -     * (e.g. this).
  -     * @param command Name of the data access command
  -     * collection
  -     * @param parameter A String parameter to be used with command
  -     */
  -    public Collection findCollectionLike(
               Object target,
               String command,
               Object[] parameters) throws ResourceException;
  
  
  
  1.2       +78 -75    jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ScrollerBean.java
  
  Index: ScrollerBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ScrollerBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ScrollerBean.java	28 Oct 2002 19:45:57 -0000	1.1
  +++ ScrollerBean.java	31 Oct 2002 14:27:45 -0000	1.2
  @@ -22,74 +22,75 @@
        * The relative position of the first entry in this set.
        * @returns the position to start this set
        */
  -    public int getScrollFrom();
  +    public Integer getScrollFrom();
   
  -    public void setScrollFrom(int scrollFrom);
  +    public void setScrollFrom(Integer scrollFrom);
  +
  +
  +    /**
  +     * The number of entries before the first entry in the set
  +     * (One less than scrollFrom) [0].
  +     * @returns Offset to next entry
  +     */
  +    public Integer scrollOffset();
   
   
       /**
        * The number of entries to return [Scroller.SCROLL_ROWS].
        * @returns Entries per page.
        */
  -    public int getScrollRows();
  +    public int scrollRows();
   
   
       /**
  -     * The total number of entries in search list.
  -     * The default behavior returns a "like" search count
  -     * of entries matching the searchKey.
  -     * Override to provide functionality.
  -     * @returns total entries
  -     * @exception May throw an exception on data access error
  +     * Returns the String to use to retrieve the
  +     * appropriate query to count the entries matching this search.
  +     * Must be overridden or provide functionality.
  +     * @returns Value of count key
        */
  -    public int getEntryCount() throws ResourceException;
  +    public String countKey();
   
   
       /**
  -     * Return new scroller using the
  -     * current starting point (getScrollFrom),
  -     * the default limit (set.SCROLL_ROWS),
  -     * and current count from Access (countCurrent).
  -     * @returns new Scroller using current and default settings.
  -     * @exception ResourceException on data access error
  +     * Returns whether this search takes a parameter
  +     * (e.g. primary key) [false].
  +     * Override this method to return true and
  +     * <code>getParameter</code> to return the
  +     * required parameter.
  +     * @returns True if this search uses a parameter
        */
  -    public Scroller getScroller(int entries) throws ResourceException;
  +    public boolean hasParameter();
   
   
       /**
  -     * Returns the String to use to retrieve the
  -     * appropriate query for this search.
  +     * Returns the value used in the search [null].
  +     * This can be the literal value used in the
  +     * query or (if hasParameter==false) a description
  +     * of what the search returns.
        * Must be overridden or provide functionality.
  -     * @returns Value of command key
  +     * @returns Value of search parameter
        */
  -    public String getCommandKey();
  +    public Object searchValue();
   
   
       /**
  -     * Return the array of parameters required by
  -     * insert and update commands for this object.
  -     * The default behavior sets the first parameter to
  -     * parameter, and the next two to the offset and
  -     * default number of scroller rolls.
  -     * Override for a different query pattern.
  -     * @returns Parameters for query
  -     * @exception ResourceException on data access error
  +     * The total number of entries in search list.
  +     * The default behavior returns a "like" search count
  +     * of entries matching the searchKey.
  +     * Override to provide functionality.
  +     * @returns total entries
  +     * @exception May throw an exception on data access error
        */
  -    public Object[] getParameters(Object parameter) throws ResourceException;
  +    public int entryCount() throws ResourceException;
   
   
       /**
  -     * Returns the collection representing the result of the Search [null].
  -     * The default behavior performs a "like" search for the parameter
  -     * Override for an other search type.
  -     * Subclasses may ignor parameter argument
  -     * when <code>isParameter</code> is false.
  -     * @param target Bean to use for entries
  -     * @param parameter Value to use to match entries
  -     * @returns Collection with the result of the search
  +     * Returns the String to use to retrieve the
  +     * appropriate query for this search.
  +     * Must be overridden or provide functionality.
  +     * @returns Value of command key
        */
  -    public Collection getResult(Object target, Object parameter)
  -            throws ResourceException;
  +    public String commandKey();
   
   
       /**
  @@ -99,63 +100,65 @@
        * Must be overridden or provide functionality.
        * @returns The search property
        */
  -    public String getSearchProperty();
  +    public String searchProperty();
   
   
       /**
  -     * Returns the String to use to describe the value
  -     * used in the search [null].
  -     * This can be the literal value used in the
  -     * query or (if isParameter==false) a description
  -     * of what the search returns.
  -     * Must be overridden or provide functionality.
  -     * @returns Value of search key
  +     * Whether to branch to "failure" if list returns zero entries.
        */
  -    public String getSearchKey();
  +    public boolean failsOnEmpty ();
   
   
       /**
  -     * Returns the String to use to retrieve the
  -     * appropriate query to count the entries matching this search.
  -     * Must be overridden or provide functionality.
  -     * @returns Value of count key
  +     * Returns the message token for an empty result
  +     * [Tokens.DATA_ACCESS_EMPTY].
  +     * May be used when isFailOnEmpty is true.
  +     * @returns Message token for an empty result.
        */
  -    public String getCountKey();
  +    public String tokenEmptyMessage();
   
   
       /**
  -     * Returns whether this search takes a parameter
  -     * (e.g. primary key) [false].
  -     * Override this method to return true and
  -     * <code>getParameter</code> to return the
  -     * required parameter.
  -     * @returns True if this search uses a parameter
  +     * Returns the dispatch token for an empty result
  +     * [Tokens.FAILURE].
  +     * May be used when isFailOnEmpty is true.
  +     * @returns Message token for an empty result.
        */
  -    public boolean isParameter();
  +    public String tokenEmptyDispatch();
   
   
       /**
  -     * Whether to branch to "failure" if list returns zero entries.
  +     * Return the array of parameters needed to select the
  +     * entries for this set.
  +     * @parameter The additional parameter needed to select
  +     * this set, if any.
        */
  -    public boolean isFailsOnEmpty ();
  +    public Object[] scrollerParams(String parameter);
   
   
       /**
  -     * Returns the message token for an empty result
  -     * [Tokens.DATA_ACCESS_EMPTY].
  -     * May be used when isFailOnEmpty is true.
  -     * @returns Message token for an empty result.
  +     * Returns the collection representing the result of the Search [null].
  +     * The default behavior performs a "like" search for the parameter
  +     * Override for an other search type.
  +     * Subclasses may ignor parameter argument
  +     * when <code>isParameter</code> is false.
  +     * @param target Bean to use for entries
  +     * @param parameter Value to use to match entries
  +     * @returns Collection with the result of the search
        */
  -    public String getTokenEmptyMessage();
  +    public Collection result(Object target, Object parameter)
  +            throws ResourceException;
   
   
       /**
  -     * Returns the dispatch token for an empty result
  -     * [Tokens.FAILURE].
  -     * May be used when isFailOnEmpty is true.
  -     * @returns Message token for an empty result.
  +     * Return new scroller using the
  +     * current starting point (getScrollFrom),
  +     * the default limit (set.SCROLL_ROWS),
  +     * and current count from Access (countCurrent).
  +     * @returns new Scroller using current and default settings.
  +     * @exception ResourceException on data access error
        */
  -    public String getTokenEmptyDispatch();
  +    public Scroller newScroller(int entries) throws ResourceException;
   
   
       /**
  @@ -164,7 +167,7 @@
       public Object scrollerSearch() throws Exception;
   
   
  -} // end ScrollerBeanBase
  +} // end ScrollerBean
   
   
   /*
  
  
  
  1.6       +1 -17     jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ProcessBeanBase.java
  
  Index: ProcessBeanBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ProcessBeanBase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ProcessBeanBase.java	18 Oct 2002 20:45:49 -0000	1.5
  +++ ProcessBeanBase.java	31 Oct 2002 14:27:45 -0000	1.6
  @@ -59,22 +59,6 @@
       }
   
   
  -    /**
  -     * The entry (or page) from which to scroll [0].
  -     */
  -    protected int scrollFrom = Scroller.FROM  ;
  -
  -    public int getScrollFrom() {
  -        return scrollFrom;
  -    }
  -
  -    public void setScrollFrom(int scrollFrom) {
  -        this.scrollFrom = scrollFrom;
  -    }
  -
  -
  -
  -
   // --------------------------------------------------------- Public Methods
   
   
  
  
  
  1.4       +1 -17     jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ProcessBean.java
  
  Index: ProcessBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/scaffold/src/java/org/apache/commons/scaffold/util/ProcessBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProcessBean.java	18 Oct 2002 20:45:49 -0000	1.3
  +++ ProcessBean.java	31 Oct 2002 14:27:45 -0000	1.4
  @@ -73,22 +73,6 @@
   
   
   
  -    /**
  -     * Return the scrollFrom property.
  -     * The ScrollFrom propery can be used to update a Scroller
  -     * object as to the next starting point for a result list.
  -     * @return the scrollFrom
  -     */
  -    public int getScrollFrom();
  -
  -
  -    /**
  -     * Set the scrollFrom
  -     * @param scrollFrom The new scrollFrom
  -     */
  -    public void setScrollFrom(int scrollFrom);
  -
  -
   // ------------------------------------------------------- Public Methods
   
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message