juergen     2002/06/05 06:37:35

  Added:       src/share/org/apache/slide/search/basic
                        NotContainsExpression.java NotEQExpression.java
                        NotGTEExpression.java NotGTExpression.java
                        NotIsCollectionExpression.java
                        NotIsDefinedExpression.java
                        NotIsPrincipalExpression.java NotLTEExpression.java
                        NotLTExpression.java NotNormalizer.java
                        NotPropContainsExpression.java
  Log:
  Initial revision.
  (ralf)
  
  Revision  Changes    Path
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotContainsExpression.java
  
  Index: NotContainsExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotContainsExpression.java,v
 1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  import org.apache.slide.search.InvalidQueryException;
  
  import org.apache.slide.content.NodeProperty.NamespaceCache;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-contains</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotContainsExpression extends ContainsExpression {
      
      /**
       * Creates a <code>not-contains</code> expression according to Element e
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotContainsExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          String  resourceTypeValue =
              (String) item.getThisValue (Literals.RESOURCETYPE, 
NamespaceCache.DEFAULT_URI);
          boolean isCollection = resourceTypeValue.indexOf("collection") >= 0;
  
          return !isCollection && !super.compare(item);
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return (Literals.NOT_CONTAINS + " (" + searchedText + ")");
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotEQExpression.java
  
  Index: NotEQExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotEQExpression.java,v 
1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  
  import org.apache.slide.search.InvalidQueryException;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-eq</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotEQExpression extends EQExpression {
      
      /**
       * Creates a <code>not-eq</code> expression according to Element e.
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotEQExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          return item.isDefined(property, propNamespace) && (!super.compare(item));
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return super.toString(Literals.NOT_EQ);
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotGTEExpression.java
  
  Index: NotGTEExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotGTEExpression.java,v
 1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  
  import org.apache.slide.search.InvalidQueryException;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-gte</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotGTEExpression extends GTEExpression {
      
      /**
       * Creates a <code>not-gte</code> expression according to Element e.
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotGTEExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          return item.isDefined(property, propNamespace) && (!super.compare(item));
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return super.toString(Literals.NOT_GTE);
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotGTExpression.java
  
  Index: NotGTExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotGTExpression.java,v 
1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  
  import org.apache.slide.search.InvalidQueryException;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-gt</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotGTExpression extends GTExpression {
      
      /**
       * Creates a <code>not-gt</code> expression according to Element e.
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotGTExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          return item.isDefined(property, propNamespace) && (!super.compare(item));
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return super.toString(Literals.NOT_GT);
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotIsCollectionExpression.java
  
  Index: NotIsCollectionExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotIsCollectionExpression.java,v
 1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  
  import org.apache.slide.search.InvalidQueryException;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-is-collection</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotIsCollectionExpression extends IsCollectionExpression {
      
      /**
       * Creates a <code>not-is-collection</code> expression according to Element e.
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotIsCollectionExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          return ! super.compare(item);
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return Literals.NOT_ISCOLLECTION;
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotIsDefinedExpression.java
  
  Index: NotIsDefinedExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotIsDefinedExpression.java,v
 1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  
  import org.apache.slide.search.InvalidQueryException;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-isdefined</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotIsDefinedExpression extends IsDefinedExpression {
      
      /**
       * Creates a <code>not-isdefined</code> expression according to Element e.
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotIsDefinedExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          return ! super.compare(item);
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return Literals.NOT_ISDEFINED;
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotIsPrincipalExpression.java
  
  Index: NotIsPrincipalExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotIsPrincipalExpression.java,v
 1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  
  import org.apache.slide.search.InvalidQueryException;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-is-principal</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotIsPrincipalExpression extends IsPrincipalExpression {
      
      /**
       * Creates a <code>not-is-principal</code> expression according to Element e.
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotIsPrincipalExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          return ! super.compare(item);
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return Literals.NOT_ISPRINCIPAL;
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotLTEExpression.java
  
  Index: NotLTEExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotLTEExpression.java,v
 1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  
  import org.apache.slide.search.InvalidQueryException;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-lte</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotLTEExpression extends LTEExpression {
      
      /**
       * Creates a <code>not-lte</code> expression according to Element e.
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotLTEExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          return item.isDefined(property, propNamespace) && (!super.compare(item));
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return super.toString(Literals.NOT_LTE);
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotLTExpression.java
  
  Index: NotLTExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotLTExpression.java,v 
1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  
  import org.apache.slide.search.InvalidQueryException;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-lt</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotLTExpression extends LTExpression {
      
      /**
       * Creates a <code>not-lt</code> expression according to Element e.
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotLTExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          return item.isDefined(property, propNamespace) && (!super.compare(item));
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return super.toString(Literals.NOT_LT);
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotNormalizer.java
  
  Index: NotNormalizer.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotNormalizer.java,v 
1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.jdom.Element;
  import org.jdom.Namespace;
  import org.jdom.JDOMException;
  
  import org.jdom.input.DOMBuilder;
  
  import org.jdom.output.DOMOutputter;
  
  import org.apache.slide.search.BadQueryException;
  import org.apache.slide.search.InvalidQueryException;
  
  import org.apache.slide.content.NodeProperty.NamespaceCache;
  
  import java.util.List;
  import java.util.Iterator;
  
  /**
   * This class recursivly removes all <code>&lt;not&gt;</code> expressions
   * and replaces their successors by appropriate negated expressions. Since
   * an example explains more than a thousand words:
   *
   * <pre>
   * &lt;D:not&gt;
   *    &lt;D:or&gt;
   *       &lt;D:lt&gt;
   *          &lt;D:prop&gt;
   *             &lt;D:getcontentlength&gt;
   *          &lt;/D:prop&gt;
   *          &lt;D:literal&gt;1000&lt;/D:literal&gt;
   *       &lt;/D:lt&gt;
   *       &lt;D:eq&gt;
   *          &lt;D:prop&gt;
   *             &lt;D:getcontenttype&gt;
   *          &lt;/D:prop&gt;
   *          &lt;D:literal&gt;text/xml&lt;/D:literal&gt;
   *       &lt;/D:eq&gt;
   *    &lt;/D:or&gt;
   * &lt;/D:not&gt;
   * </pre>
   *
   * will be transformed to
   *
   * <pre>
   * &lt;D:and&gt;
   *    &lt;D:not-lt&gt;
   *       &lt;D:prop&gt;
   *          &lt;D:getcontentlength&gt;
   *       &lt;/D:prop&gt;
   *       &lt;D:literal&gt;1000&lt;/D:literal&gt;
   *    &lt;/D:not-lt&gt;
   *    &lt;D:not-eq&gt;
   *       &lt;D:prop&gt;
   *          &lt;D:getcontenttype&gt;
   *       &lt;/D:prop&gt;
   *       &lt;D:literal&gt;text/xml&lt;/D:literal&gt;
   *    &lt;/D:not-eq&gt;
   * &lt;/D:and&gt;
   * </pre>
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotNormalizer {
      
      /**
       * The message of the {@link org.apache.slide.search.InvalidQueryException
       * InvalidQueryException} which is thrown by {@link #getQueryWithoutNotExpression
       * getQueryWithoutNotExpression} if a <code>&lt;not&gt;</code> expression has
       * NOT exactly one successor.
       */
      public static final String BAD_NOT_EXPRESSION_EXCEPTION_MESSAGE =
          "not expression must contain exactly one nested expression";
      
      /**
       * Returns the transformed query where all <code>&lt;not&gt;</code> elements
       * has been removed.
       *
       * @param      expressionElement  the (root) Element of the query to transform.
       *
       * @return     the transformed query where all <code>&lt;not&gt;</code> elements
       *             has been removed.
       *
       * @throws     BadQueryException  if transformin the query failed
       *                                (see {@link 
#BAD_NOT_EXPRESSION_EXCEPTION_MESSAGE
       *                                 BAD_NOT_EXPRESSION_EXCEPTION_MESSAGE}).
       */
      public Element getQueryWithoutNotExpression(Element expressionElement) throws 
BadQueryException {
          return getProcessedElement(expressionElement, false);
      }
      
      /**
       * Returns the transformed query where all <code>&lt;not&gt;</code> elements
       * has been removed.
       *
       * @param      expressionElement  the (root) Element of the query to transform.
       *
       * @return     the transformed query where all <code>&lt;not&gt;</code> elements
       *             has been removed.
       *
       * @throws     BadQueryException  if transformin the query failed
       *                                (see {@link 
#BAD_NOT_EXPRESSION_EXCEPTION_MESSAGE
       *                                 BAD_NOT_EXPRESSION_EXCEPTION_MESSAGE}).
       */
      public org.w3c.dom.Element getQueryWithoutNotExpression(org.w3c.dom.Element 
expressionElement)  throws BadQueryException {
          
          Element jdomExpressionElement= new DOMBuilder().build(expressionElement);
          try {
              return new 
DOMOutputter().output(getQueryWithoutNotExpression(jdomExpressionElement));
          }
          catch (JDOMException e) {
              throw new BadQueryException(e.getMessage());
          }
      }
      
      /**
       * Returns the appropriate replacement for the given 
<code>expressionElement</code>.
       * If <code>negate</code> is true, the Element has to be negated.
       *
       * @param      expressionElement  the Element for which to return the
       *                                appropriate replacement.
       * @param      negate             if <code>negate</code> is true, the given
       *                                Element has to be negated.
       *
       * @return     the appropriate replacement for the given 
<code>expressionElement</code>.
       *
       * @throws     BadQueryException  if the Element could not be processed.
       */
      protected Element getProcessedElement(Element expressionElement, boolean negate) 
throws BadQueryException {
          
          Element result = null;
          
          if ( Literals.NOT.equals(expressionElement.getName()) &&
              NamespaceCache.DEFAULT_URI.equals(expressionElement.getNamespaceURI()) ) 
{
              
              List children = expressionElement.getChildren();
              if (children.size() != 1) {
                  throw new 
InvalidQueryException(BAD_NOT_EXPRESSION_EXCEPTION_MESSAGE);
              }
              return getProcessedElement((Element)children.get(0), ! negate);
          }
          
          if (negate) {
              result = getNegatedQueryElement(expressionElement);
          }
          else {
              result = getNamedClone(expressionElement, expressionElement.getName(), 
expressionElement.getNamespace());
          }
          Iterator childrenIterator = expressionElement.getChildren().iterator();
          while (childrenIterator.hasNext()) {
              result.addContent(getProcessedElement((Element)childrenIterator.next(), 
negate));
          }
          
          return result;
      }
      
      /**
       * Returns the negation of the given <code>expressionElement</code>.
       *
       * @param      expressionElement  the Element to return the appropriate
       *                                negation for.
       *
       * @return     the negation of the given <code>expressionElement</code>.
       *
       * @throws     BadQueryException  if the Element could not be processed.
       */
      protected Element getNegatedQueryElement(Element expressionElement) throws 
BadQueryException {
          
          if (NamespaceCache.DEFAULT_URI.equals(expressionElement.getNamespaceURI())) {
              return getNegatedDAVQueryElement(expressionElement);
          }
          if (NamespaceCache.SLIDE_URI.equals(expressionElement.getNamespaceURI())) {
              return getNegatedSlideQueryElement(expressionElement);
          }
          else {
              return getNegatedUnknownQueryElement(expressionElement);
          }
      }
      
      
      /**
       * Returns the negation of the given <code>expressionElement</code>,
       * which is neither in <code>DAV:</code> nor
       * <code>http://jakarta.apache.org/slide/</code> namespace.
       *
       * @param      expressionElement  the Element to return the appropriate
       *                                negation for.
       *
       * @return     the negation of the given <code>expressionElement</code>.
       *
       * @throws     BadQueryException  if the Element could not be processed.
       */
      protected Element getNegatedUnknownQueryElement(Element expressionElement) 
throws BadQueryException {
          return getNamedClone(expressionElement, expressionElement.getName(), 
expressionElement.getNamespace());
      }
      
      /**
       * Returns the negation of the given <code>expressionElement</code>,
       * which is in the <code>DAV:</code> namespace.
       *
       * @param      expressionElement  the Element to return the appropriate
       *                                negation for.
       *
       * @return     the negation of the given <code>expressionElement</code>.
       *
       * @throws     BadQueryException  if the Element could not be processed.
       */
      protected Element getNegatedDAVQueryElement(Element expressionElement) throws 
BadQueryException {
          
          String name = expressionElement.getName();
          
          if (Literals.AND.equals(name)) {
              return getNamedClone(expressionElement, Literals.OR, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.OR.equals(name)) {
              return getNamedClone(expressionElement, Literals.AND, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.GT.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_GT, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.NOT_GT.equals(name)) {
              return getNamedClone(expressionElement, Literals.GT, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.GTE.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_GTE, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.NOT_GTE.equals(name)) {
              return getNamedClone(expressionElement, Literals.GTE, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.LT.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_LT, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.NOT_LT.equals(name)) {
              return getNamedClone(expressionElement, Literals.LT, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.LTE.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_LTE, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.NOT_LTE.equals(name)) {
              return getNamedClone(expressionElement, Literals.LTE, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.EQ.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_EQ, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.NOT_EQ.equals(name)) {
              return getNamedClone(expressionElement, Literals.EQ, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.CONTAINS.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_CONTAINS, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.NOT_CONTAINS.equals(name)) {
              return getNamedClone(expressionElement, Literals.CONTAINS, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.ISCOLLECTION.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_ISCOLLECTION, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.NOT_ISCOLLECTION.equals(name)) {
              return getNamedClone(expressionElement, Literals.ISCOLLECTION, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.ISDEFINED.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_ISDEFINED, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          if (Literals.NOT_ISDEFINED.equals(name)) {
              return getNamedClone(expressionElement, Literals.ISDEFINED, 
NamespaceCache.DEFAULT_NAMESPACE);
          }
          return getNamedClone(expressionElement, expressionElement.getName(), 
expressionElement.getNamespace());
      }
      
      /**
       * Returns the negation of the given <code>expressionElement</code>,
       * which is in the <code>http://jakarta.apache.org/slide/</code> namespace.
       *
       * @param      expressionElement  the Element to return the appropriate
       *                                negation for.
       *
       * @return     the negation of the given <code>expressionElement</code>.
       *
       * @throws     BadQueryException  if the Element could not be processed.
       */
      protected Element getNegatedSlideQueryElement(Element expressionElement) throws 
BadQueryException {
          
          String name = expressionElement.getName();
          
          if (Literals.ISPRINCIPAL.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_ISPRINCIPAL, 
NamespaceCache.SLIDE_NAMESPACE);
          }
          if (Literals.NOT_ISPRINCIPAL.equals(name)) {
              return getNamedClone(expressionElement, Literals.ISPRINCIPAL, 
NamespaceCache.SLIDE_NAMESPACE);
          }
          if (Literals.PROPCONTAINS.equals(name)) {
              return getNamedClone(expressionElement, Literals.NOT_PROPCONTAINS, 
NamespaceCache.SLIDE_NAMESPACE);
          }
          if (Literals.NOT_PROPCONTAINS.equals(name)) {
              return getNamedClone(expressionElement, Literals.PROPCONTAINS, 
NamespaceCache.SLIDE_NAMESPACE);
          }
          return getNamedClone(expressionElement, expressionElement.getName(), 
expressionElement.getNamespace());
      }
      
      /**
       * Creates a new Element with the given <code>newName</code> in the
       * <code>newNamespace</code> and sets the value (text) and attributes
       * of the given <code>source</code> element.
       *
       * @param      source        the Element from which to copy the value and 
attributes.
       * @param      newName       the name to use for the Element to create.
       * @param      newNamespace  the Namespace to use for the Element to create.
       *
       * @return     the created Element.
       */
      protected Element getNamedClone(Element source, String newName, Namespace 
newNamespace) {
          
          Element copy = new Element(newName, newNamespace);
          copy.setText(source.getText());
          copy.setAttributes(source.getAttributes());
          return copy;
      }
  }
  
  
  
  
  1.1                  
jakarta-slide/src/share/org/apache/slide/search/basic/NotPropContainsExpression.java
  
  Index: NotPropContainsExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/NotPropContainsExpression.java,v
 1.1 2002/06/05 13:37:35 juergen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/05 13:37:35 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Slide", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  package org.apache.slide.search.basic;
  
  // import list
  import org.apache.slide.search.RequestedResource;
  
  import org.apache.slide.search.InvalidQueryException;
  
  import org.jdom.Element;
  
  /**
   * Represents a <code>not-propcontains</code> expression.
   *
   * @version $Revision: 1.1 $
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Ralf Stuckert</a>
   **/
  public class NotPropContainsExpression extends PropContainsExpression {
      
      /**
       * Creates a <code>not-propcontains</code> expression according to Element e.
       *
       * @param e jdom element, that describes the expression
       *
       */
      protected NotPropContainsExpression (Element e) throws InvalidQueryException {
          super (e);
      }
         
      /**
       * Checks if the content of item contains searchedText
       *
       * @param    item                the reuquestedResource to be searched
       *
       * @return   a boolean
       *
       */
      protected boolean compare (RequestedResource item) {
          return item.isDefined(property, propNamespace) && (!super.compare(item));
      }
      
  
      /**
       * For debugging purpose.
       *
       * @return   This expression as string
       *
       */
      public String toString () {
          return super.toString (Literals.NOT_PROPCONTAINS);
      }
  }
  
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to