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 Fri, 10 May 2002 00:41:29 GMT
taylor      02/05/09 17:41:29

  Modified:    src/java/org/apache/jetspeed/modules/actions/portlets/browser
                        DatabaseBrowserAction.java
  Log:
  Changed the flow of reading registry based link parameters - instead of per request reading
from the registry, it reads only once during initialization and stores a variable in rundata.getUser.setTemp()
signalling that it has read the variavles.
  
  Revision  Changes    Path
  1.18      +71 -44    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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DatabaseBrowserAction.java	7 May 2002 05:02:30 -0000	1.17
  +++ DatabaseBrowserAction.java	10 May 2002 00:41:28 -0000	1.18
  @@ -112,7 +112,7 @@
    * according to the quey speciified by the user.
    *
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  - * @version $Id: DatabaseBrowserAction.java,v 1.17 2002/05/07 05:02:30 taylor Exp $
  + * @version $Id: DatabaseBrowserAction.java,v 1.18 2002/05/10 00:41:28 taylor Exp $
    */
   public class DatabaseBrowserAction extends VelocityPortletAction implements BrowserQuery
   {
  @@ -120,7 +120,7 @@
       private static final String START = "start";
       private static final String CUSTOMIZE_TEMPLATE = "customizeTemplate";
       private static final String WINDOW_SIZE = "windowSize";
  -    private static final String PRIMARY_KEY = "primaryKey";
  +    private static final String LINKS_READ = "linksRead";
       private static final String ROW_LINK = "rowLinks";
       private static final String TABLE_LINK = "tableLinks";
       private static final String ROW_LINK_IDS = "row-link-ids";
  @@ -190,48 +190,6 @@
                                          RunData rundata )
       {
           int resultSetSize, next, prev, windowSize;
  -        List rowList, tableList;
  -
  -        String pk = getParameterFromRegistry(portlet,PRIMARY_KEY,null);
  -        context.put(PRIMARY_KEY, pk);
  -
  -        String rowLinkIds= getParameterFromRegistry(portlet,ROW_LINK_IDS,null);
  -        String rowLinkClasses= getParameterFromRegistry(portlet,ROW_LINK_TARGETS,null);
  -        String rowLinkTypes= getParameterFromRegistry(portlet,ROW_LINK_TYPES,null);
  -        if( rowLinkIds != null && rowLinkIds.length() > 0 )
  -        {
  -            rowList = new ArrayList();
  -            int rowIndex = 0;
  -            StringTokenizer tokenizer1 = new StringTokenizer(rowLinkIds, ",");
  -            StringTokenizer tokenizer2 = new StringTokenizer(rowLinkClasses, ",");
  -            StringTokenizer tokenizer3 = new StringTokenizer(rowLinkTypes, ",");
  -            while(tokenizer1.hasMoreTokens() && tokenizer2.hasMoreTokens() &&
tokenizer3.hasMoreTokens())
  -            {
  -                rowList.add(rowIndex,
  -                            new ActionParameter(tokenizer1.nextToken(), tokenizer2.nextToken(),
tokenizer3.nextToken()));
  -                rowIndex++;
  -            }
  -            context.put(ROW_LINK, rowList);
  -        }
  -
  -        String tableLinkIds= getParameterFromRegistry(portlet,TABLE_LINK_IDS,null);
  -        String tableLinkClasses= getParameterFromRegistry(portlet,TABLE_LINK_TARGETS,null);
  -        String tableLinkTypes= getParameterFromRegistry(portlet,TABLE_LINK_TYPES,null);
  -        if( tableLinkIds != null && tableLinkIds.length() > 0 )
  -        {
  -            tableList = new ArrayList();
  -            int tableIndex = 0;
  -            StringTokenizer tokenizer1 = new StringTokenizer(tableLinkIds, ",");
  -            StringTokenizer tokenizer2 = new StringTokenizer(tableLinkClasses, ",");
  -            StringTokenizer tokenizer3 = new StringTokenizer(tableLinkTypes, ",");
  -            while(tokenizer1.hasMoreTokens() && tokenizer2.hasMoreTokens() &&
tokenizer3.hasMoreTokens())
  -            {
  -                tableList.add(tableIndex,
  -                              new ActionParameter(tokenizer1.nextToken(), tokenizer2.nextToken(),
tokenizer3.nextToken()));
  -                tableIndex++;
  -            }
  -            context.put(TABLE_LINK, tableList);
  -        }
   
           BrowserIterator iterator = getDatabaseBrowserIterator(portlet, rundata);
           String sortColName = getRequestParameter(portlet, rundata, SORT_COLUMN_NAME);
  @@ -266,6 +224,8 @@
                   iterator.setTop(start);
               }
   
  +            readLinkParameters(portlet, rundata, context);
  +
               if(iterator != null)
               {
                   resultSetSize = iterator.getResultSetSize();
  @@ -670,6 +630,73 @@
       public List getSQLParameters()
       {
           return sqlParameters;
  +    }
  +
  +    protected void readLinkParameters(VelocityPortlet portlet, RunData rundata, Context
context)
  +    {
  +        List rowList, tableList;
  +        Object linksRead = getParameterFromTemp(portlet, rundata, LINKS_READ);
  +        if(linksRead != null && ((String)linksRead).equals(LINKS_READ))
  +        {
  +            Object tmp = getParameterFromTemp(portlet, rundata, ROW_LINK);
  +            if(tmp != null)
  +            {
  +                context.put(ROW_LINK, (List)tmp);
  +                //System.out.println("rowListSize"+ ((List)tmp).size());
  +            }
  +            tmp = getParameterFromTemp(portlet, rundata, TABLE_LINK);
  +            if(tmp != null)
  +            {
  +                context.put(TABLE_LINK, (List)tmp);
  +                //System.out.println("tableListSize: "+((List)tmp).size());
  +            }
  +        }
  +        else
  +        {
  +            String rowLinkIds= getParameterFromRegistry(portlet,ROW_LINK_IDS,null);
  +            String rowLinkClasses= getParameterFromRegistry(portlet,ROW_LINK_TARGETS,null);
  +            String rowLinkTypes= getParameterFromRegistry(portlet,ROW_LINK_TYPES,null);
  +            if( rowLinkIds != null && rowLinkIds.length() > 0 )
  +            {
  +                rowList = new ArrayList();
  +                int rowIndex = 0;
  +                StringTokenizer tokenizer1 = new StringTokenizer(rowLinkIds, ",");
  +                StringTokenizer tokenizer2 = new StringTokenizer(rowLinkClasses, ",");
  +                StringTokenizer tokenizer3 = new StringTokenizer(rowLinkTypes, ",");
  +                while(tokenizer1.hasMoreTokens() && tokenizer2.hasMoreTokens()
&& tokenizer3.hasMoreTokens())
  +                {
  +                    rowList.add(rowIndex,
  +                                new ActionParameter(tokenizer1.nextToken(), tokenizer2.nextToken(),
tokenizer3.nextToken()));
  +                    rowIndex++;
  +                }
  +                context.put(ROW_LINK, rowList);
  +                setParameterToTemp(portlet, rundata, ROW_LINK, rowList);
  +                //System.out.println("readLink: rowListSize"+rowList.size());
  +            }
  +
  +            String tableLinkIds= getParameterFromRegistry(portlet,TABLE_LINK_IDS,null);
  +            String tableLinkClasses= getParameterFromRegistry(portlet,TABLE_LINK_TARGETS,null);
  +            String tableLinkTypes= getParameterFromRegistry(portlet,TABLE_LINK_TYPES,null);
  +            if( tableLinkIds != null && tableLinkIds.length() > 0 )
  +            {
  +                tableList = new ArrayList();
  +                int tableIndex = 0;
  +                StringTokenizer tokenizer1 = new StringTokenizer(tableLinkIds, ",");
  +                StringTokenizer tokenizer2 = new StringTokenizer(tableLinkClasses, ",");
  +                StringTokenizer tokenizer3 = new StringTokenizer(tableLinkTypes, ",");
  +                while(tokenizer1.hasMoreTokens() && tokenizer2.hasMoreTokens()
&& tokenizer3.hasMoreTokens())
  +                {
  +                    tableList.add(tableIndex,
  +                                  new ActionParameter(tokenizer1.nextToken(), tokenizer2.nextToken(),
tokenizer3.nextToken()));
  +                    tableIndex++;
  +                }
  +                context.put(TABLE_LINK, tableList);
  +                setParameterToTemp(portlet, rundata, TABLE_LINK, tableList);
  +                //System.out.println("readLink: tableListSize: "+tableList.size());
  +            }
  +            setParameterToTemp(portlet, rundata, LINKS_READ, LINKS_READ);
  +        }
  +
       }
   
   
  
  
  

--
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