portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morci...@apache.org
Subject cvs commit: jakarta-jetspeed/xdocs changes.xml
Date Fri, 06 Dec 2002 21:42:35 GMT
morciuch    2002/12/06 13:42:35

  Modified:    docs/site changes.html
               src/java/org/apache/jetspeed/modules/actions/portlets
                        PsmlBrowseAction.java
               src/java/org/apache/jetspeed/modules/actions/portlets/security
                        UserBrowserAction.java
               webapp/WEB-INF/templates/vm/portlets/html user-browser.vm
               xdocs    changes.xml
  Log:
  Added pattern search functionality in User Browser (to be consistent with the Psml Browser).
By default the search is peformed using "startsWith" algorithm. Regular expression searches
are also supported as an option.
  
  Revision  Changes    Path
  1.79      +3 -0      jakarta-jetspeed/docs/site/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- changes.html	5 Dec 2002 18:05:19 -0000	1.78
  +++ changes.html	6 Dec 2002 21:42:34 -0000	1.79
  @@ -133,6 +133,9 @@
   </li>
   -->
   <li>
  +  Add - 2002/12/06 - UserBrowser now supports pattern searches (MO)
  +</li>
  +<li>
     Fixed - Bug 5441 - 2002/12/05 - Remove redundant JSP files in the template directory
(MO)
   </li>
   <li>
  
  
  
  1.10      +23 -19    jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/PsmlBrowseAction.java
  
  Index: PsmlBrowseAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/PsmlBrowseAction.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PsmlBrowseAction.java	5 Dec 2002 17:06:43 -0000	1.9
  +++ PsmlBrowseAction.java	6 Dec 2002 21:42:34 -0000	1.10
  @@ -77,6 +77,7 @@
   
   // regexp stuff
   import org.apache.regexp.RE;
  +import org.apache.regexp.RECompiler;
   
   /**
    * This action enables to browse any of the psml info, for displaying
  @@ -178,6 +179,23 @@
               if (filterValue != null && !filterValue.trim().equalsIgnoreCase(""))
               {
                   String filterType = rundata.getParameters().getString(this.FILTER_TYPE,
this.FILTER_TYPE_USER);
  +                boolean useRE = rundata.getParameters().getBoolean(this.FILTER_REGEXP);
  +                RE r = null;
  +                RECompiler rc = null;
  +                if (useRE)
  +                {
  +                    try 
  +                    {
  +                        rc = new RECompiler();
  +                        r = new RE();
  +                        r.setProgram(rc.compile(filterValue));
  +                    }
  +                    catch (org.apache.regexp.RESyntaxException rex)
  +                    {
  +                        Log.warn("PsmlBrowseAction: error processing regular expression
[" + filterValue + "]: " + 
  +                                 rex.toString());
  +                    }
  +                }
                   try 
                   {
                       while (i.hasNext())
  @@ -196,27 +214,13 @@
                               compareValue = profile.getGroupName();                    
   
                           }
   
  -                        boolean useRE = rundata.getParameters().getBoolean(this.FILTER_REGEXP);
  -                        if (useRE)
  +                        if (compareValue != null)
                           {
  -                            try 
  +                            if (useRE && r.match(compareValue))
                               {
  -                                RE r = new RE(filterValue);
  -                                r.setMatchFlags(RE.MATCH_CASEINDEPENDENT);
  -                                if (r.match(compareValue))
  -                                {
  -                                    entries.add(profile);
  -                                }
  +                                entries.add(profile);
                               } 
  -                            catch (Exception re)
  -                            {
  -                                Log.warn("PsmlBrowseAction: error processing regular expression
[" + filterValue + "]: " + 
  -                                         re.toString());
  -                            }
  -                        } 
  -                        else
  -                        {
  -                            if (compareValue != null && compareValue.startsWith(filterValue))
  +                            else if (compareValue.startsWith(filterValue))
                               {
                                   entries.add(profile);
                               }
  
  
  
  1.9       +43 -5     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/security/UserBrowserAction.java
  
  Index: UserBrowserAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/security/UserBrowserAction.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- UserBrowserAction.java	11 Oct 2002 20:07:17 -0000	1.8
  +++ UserBrowserAction.java	6 Dec 2002 21:42:34 -0000	1.9
  @@ -79,6 +79,10 @@
   import java.util.Iterator;
   import java.util.ArrayList;
   
  +// regexp stuff
  +import org.apache.regexp.RE;
  +import org.apache.regexp.RECompiler;
  +
   /**
    * This action sets up the template context for browsing of users in the Turbine database.
    *
  @@ -96,6 +100,9 @@
       /** name of the parameter that holds the filter value */
       public static final String FILTER_VALUE = "filter_value";
   
  +    /** name of the parameter that holds the regexp flag */
  +    public static final String FILTER_REGEXP = "filter_regexp";
  +
       /** name of the parameter that holds the filter type */
       public static final String FILTER_TYPE = "filter_type";
   
  @@ -161,15 +168,46 @@
               if (filterValue != null)
               {
                   String filterType = rundata.getParameters().getString(this.FILTER_TYPE,
this.FILTER_TYPE_USERNAME);
  +                boolean useRE = rundata.getParameters().getBoolean(this.FILTER_REGEXP);
  +                RE r = null;
  +                RECompiler rc = null;
  +                if (useRE)
  +                {
  +                    try 
  +                    {
  +                        rc = new RECompiler();
  +                        r = new RE();
  +                        r.setProgram(rc.compile(filterValue));
  +                    }
  +                    catch (org.apache.regexp.RESyntaxException rex)
  +                    {
  +                        Log.warn("UserBrowserAction: error processing regular expression
[" + filterValue + "]: " + 
  +                                 rex.toString());
  +                    }
  +                }
                   while (users.hasNext())
                   {
                       JetspeedUser user = (JetspeedUser) users.next();
  -                    if (filterType.equals(this.FILTER_TYPE_USERNAME) && user.getUserName().startsWith(filterValue))
  +                    String compareValue = null;
  +                    if (filterType.equals(this.FILTER_TYPE_USERNAME))
  +                    {
  +                        compareValue = user.getUserName();
  +                    } 
  +                    else if (filterType.equals(this.FILTER_TYPE_LASTNAME))
                       {
  -                        userList.add(user);
  -                    } else if (filterType.equals(this.FILTER_TYPE_LASTNAME) &&
user.getLastName().startsWith(filterValue))
  +                        compareValue = user.getLastName();
  +                    }
  +
  +                    if (compareValue != null)
                       {
  -                        userList.add(user);
  +                        if (useRE && r.match(compareValue))
  +                        {
  +                                userList.add(user);
  +                        }
  +                        else if (compareValue.startsWith(filterValue))
  +                        {
  +                            userList.add(user);
  +                        }
                       }
                   }
               } else {
  
  
  
  1.8       +3 -1      jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/user-browser.vm
  
  Index: user-browser.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/user-browser.vm,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- user-browser.vm	8 Nov 2002 22:12:22 -0000	1.7
  +++ user-browser.vm	6 Dec 2002 21:42:34 -0000	1.8
  @@ -9,6 +9,7 @@
   #set ( $headings = ["Username","First Name", "Last Name", "Email", "Actions"] )
   #set ( $filter = $data.getRequest().getParameter("filter_value") )
   #set ( $filter_type = $data.getRequest().getParameter("filter_type") )
  +#set ( $regexp = $data.getRequest().getParameter("filter_regexp") )
   
   #if ($pagelinks) <p align=right>$pagelinks</p> #end
   <form method="post">
  @@ -18,6 +19,7 @@
     <option value="filter_type_lastname" #if ($filter_type == "filter_type_lastname")
selected #end>Last Name</option>  
   </select>
   <input type="submit" value="Filter"/>
  +<INPUT TYPE="CHECKBOX" NAME="filter_regexp" #if($!regexp) checked #end/> Use regular
expressions
   <table>
   
     <tr>
  
  
  
  1.100     +4 -1      jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- changes.xml	5 Dec 2002 18:05:19 -0000	1.99
  +++ changes.xml	6 Dec 2002 21:42:35 -0000	1.100
  @@ -23,6 +23,9 @@
   </li>
   -->
   <li>
  +  Add - 2002/12/06 - UserBrowser now supports pattern searches (MO)
  +</li>
  +<li>
     Fixed - Bug 5441 - 2002/12/05 - Remove redundant JSP files in the template directory
(MO)
   </li>
   <li>
  
  
  

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