portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/browser DatabaseBrowserAction.java
Date Mon, 05 Aug 2002 22:11:29 GMT
taylor      2002/08/05 15:11:28

  Modified:    src/java/org/apache/jetspeed/modules/actions/portlets/browser
                        DatabaseBrowserAction.java
  Log:
  Added new method called populate which will be overwritten by child classes
  if they want to take some specific actions to poulate data in the user defined object.
  Also changed all Vectors related to the Result Set, to ArrayLists.
  
  Revision  Changes    Path
  1.24      +22 -8     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/browser/DatabaseBrowserAction.java
  
  Index: DatabaseBrowserAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/browser/DatabaseBrowserAction.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- DatabaseBrowserAction.java	5 Aug 2002 20:38:40 -0000	1.23
  +++ DatabaseBrowserAction.java	5 Aug 2002 22:11:28 -0000	1.24
  @@ -319,9 +319,9 @@
       protected void getRows(VelocityPortlet portlet, RunData rundata, String sql,
                              int windowSize) throws Exception
       {
  -        Vector resultSetVector = new Vector();
  -        Vector resultSetTitleVector = new Vector();
  -        Vector resultSetTypeVector = new Vector();
  +        List resultSetVector = new ArrayList();
  +        List resultSetTitleVector = new ArrayList();
  +        List resultSetTypeVector = new ArrayList();
           DBConnection dbConn = null;
           PreparedStatement selectStmt = null;
           ResultSet rs = null;
  @@ -399,9 +399,10 @@
               /*
               this while loop adds each row to the resultSetVector
               */
  +            int index = 0;
               while(rs.next())
               {
  -                Vector row = new Vector(columnNum);
  +                List row = new ArrayList(columnNum);
                   for(int i = 1; i <= columnNum; i++)
                   {
                       if( columnDisplayed[i-1] )
  @@ -421,10 +422,12 @@
                       {
                           Class c = Class.forName(usrObj.getType());
                           row.add(c.newInstance());
  +                        populate(index, i, row);
                       }
                   }
   
                   resultSetVector.add(row);
  +                index++;
               }
               BrowserIterator iterator =
                   new DatabaseBrowserIterator( resultSetVector, resultSetTitleVector,
  @@ -688,11 +691,11 @@
                   userObjectList = new ArrayList();
                   int userObjectIndex = 0;
                   StringTokenizer tokenizer1 = new StringTokenizer(userObjNames, ",");
  -                StringTokenizer tokenizer2 = new StringTokenizer(userObjTypes, ",");
  -                while(tokenizer1.hasMoreTokens() && tokenizer2.hasMoreTokens())
  +                StringTokenizer tokenizer3 = new StringTokenizer(userObjTypes, ",");
  +                while(tokenizer1.hasMoreTokens() && tokenizer3.hasMoreTokens())
                   {
                       userObjectList.add(userObjectIndex,
  -                                       new ActionParameter(tokenizer1.nextToken(), null,
tokenizer2.nextToken()));
  +                                       new ActionParameter(tokenizer1.nextToken(), null,
tokenizer3.nextToken()));
                       userObjectIndex++;
                   }
                   context.put(USER_OBJECTS, userObjectList);
  @@ -767,6 +770,17 @@
               setParameterToTemp(portlet, rundata, LINKS_READ, LINKS_READ);
           }
   
  +    }
  +
  +    /**
  +     * This method should be overwritten every time the user object needs to be
  +     * populated with some user specific constraints. As an example if the user wanted
  +     * to track the parent of an object based on some calculation per row, it could be
  +     * done here.
  +     *
  +     */
  +    public void populate(int rowIndex, int columnIndex, List row)
  +    {
       }
   
   
  
  
  

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


Mime
View raw message