You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by wa...@apache.org on 2002/05/23 13:29:40 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/search RequestedResourceImpl.java

wam         02/05/23 04:29:40

  Modified:    src/share/org/apache/slide/search RequestedResourceImpl.java
  Log:
  define forbidden mime types for content search
  
  Revision  Changes    Path
  1.8       +23 -17    jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java
  
  Index: RequestedResourceImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RequestedResourceImpl.java	26 Apr 2002 15:19:12 -0000	1.7
  +++ RequestedResourceImpl.java	23 May 2002 11:29:40 -0000	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java,v 1.7 2002/04/26 15:19:12 wam Exp $
  - * $Revision: 1.7 $
  - * $Date: 2002/04/26 15:19:12 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/RequestedResourceImpl.java,v 1.8 2002/05/23 11:29:40 wam Exp $
  + * $Revision: 1.8 $
  + * $Date: 2002/05/23 11:29:40 $
    *
    * ====================================================================
    *
  @@ -87,7 +87,7 @@
    * equals, ...
    *
    * @author <a href="mailto:martin.wallmer@softwareag.com">Martin Wallmer</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class RequestedResourceImpl implements RequestedResource {
       
  @@ -106,11 +106,14 @@
       private SearchToken searchToken;
       
       /** coantains allowed on */
  -    static final private Set containsAllowedOn = new HashSet();
  +    static final private Set containsForbiddenOn = new HashSet();
       static {
  -        containsAllowedOn.add ("text/xml");
  -        containsAllowedOn.add ("application/text");
  -        containsAllowedOn.add ("text/plain");
  +        containsForbiddenOn.add ("image/gif");
  +        containsForbiddenOn.add ("image/jpeg");
  +        containsForbiddenOn.add ("image/pjpeg");
  +        containsForbiddenOn.add ("image/jpg");
  +        containsForbiddenOn.add ("audio/mpg");
  +        containsForbiddenOn.add ("audio/mpeg");
       };
       
       private static final int EQ =  1;
  @@ -308,7 +311,8 @@
       
       /**
        * compares two RequestedResources according to OrderByHint. NULL values are
  -     * always considered as lessThan. (see [DASL] 5.6)
  +     * always considered as lessThan. (see [DASL] 5.6). Called in orderBy context
  +     * May only return 0 if the URIs are equal.
        *
        * @param    otherResource       a  RequestedResource
        * @param    hint                an OrderByHint
  @@ -322,18 +326,20 @@
           Comparable otherValue = (Comparable) otherResource.getThisValue (hint.getProperty(), hint.getPropNamespace());
           Comparable thisValue = (Comparable) getThisValue (hint.getProperty(), hint.getPropNamespace());
           
  -        if (thisValue != null && otherValue != null)
  -            result = thisValue.compareTo(otherValue);
  +        if (getInternalHref().equals (otherResource.getInternalHref()))
  +            result = 0;
               
  -        else if (thisValue == null && otherValue != null)
  +        else if (thisValue != null && otherValue != null) {
  +            result = thisValue.compareTo(otherValue);
  +            if (result == 0)
  +                result = 1;
  +        }
  +        else if (thisValue == null)
               result = -1;
               
  -        else if (thisValue != null && otherValue == null)
  +        else if (otherValue == null)
               result = 1;
               
  -        else
  -            result = 0;
  -        
           if (hint.isAscending() == false)
               result = result * -1;
           
  @@ -369,7 +375,7 @@
           
           if (property != null) {
               String contentType = (String) property.getValue();
  -            if (containsAllowedOn.contains (contentType)) {
  +            if (!containsForbiddenOn.contains (contentType)) {
                   
                   try {
                       NodeRevisionContent revisionContent = contentHelper.retrieve (slideToken, revisionDescriptors, revisionDescriptor);
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>