|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.slide.search.basic.NotNormalizer
This class recursivly removes all <not> expressions
and replaces their successors by appropriate negated expressions. Since
an example explains more than a thousand words:
<D:not>
<D:or>
<D:lt>
<D:prop>
<D:getcontentlength>
</D:prop>
<D:literal>1000</D:literal>
</D:lt>
<D:eq>
<D:prop>
<D:getcontenttype>
</D:prop>
<D:literal>text/xml</D:literal>
</D:eq>
</D:or>
</D:not>
will be transformed to
<D:and>
<D:not-lt>
<D:prop>
<D:getcontentlength>
</D:prop>
<D:literal>1000</D:literal>
</D:not-lt>
<D:not-eq>
<D:prop>
<D:getcontenttype>
</D:prop>
<D:literal>text/xml</D:literal>
</D:not-eq>
</D:and>
| Field Summary | |
static java.lang.String |
BAD_NOT_EXPRESSION_EXCEPTION_MESSAGE
The message of the InvalidQueryException which is thrown by getQueryWithoutNotExpression if a <not> expression has
NOT exactly one successor. |
| Constructor Summary | |
NotNormalizer()
|
|
| Method Summary | |
protected org.jdom.Element |
getNamedClone(org.jdom.Element source,
java.lang.String newName,
org.jdom.Namespace newNamespace)
Creates a new Element with the given newName in the
newNamespace and sets the value (text) and attributes
of the given source element. |
protected org.jdom.Element |
getNegatedDAVQueryElement(org.jdom.Element expressionElement)
Returns the negation of the given expressionElement,
which is in the DAV: namespace. |
protected org.jdom.Element |
getNegatedQueryElement(org.jdom.Element expressionElement)
Returns the negation of the given expressionElement. |
protected org.jdom.Element |
getNegatedSlideQueryElement(org.jdom.Element expressionElement)
Returns the negation of the given expressionElement,
which is in the http://jakarta.apache.org/slide/ namespace. |
protected org.jdom.Element |
getNegatedUnknownQueryElement(org.jdom.Element expressionElement)
Returns the negation of the given expressionElement,
which is neither in DAV: nor
http://jakarta.apache.org/slide/ namespace. |
protected org.jdom.Element |
getProcessedElement(org.jdom.Element expressionElement,
boolean negate)
Returns the appropriate replacement for the given expressionElement. |
org.jdom.Element |
getQueryWithoutNotExpression(org.jdom.Element expressionElement)
Returns the transformed query where all <not> elements
has been removed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String BAD_NOT_EXPRESSION_EXCEPTION_MESSAGE
InvalidQueryException which is thrown by getQueryWithoutNotExpression if a <not> expression has
NOT exactly one successor.
| Constructor Detail |
public NotNormalizer()
| Method Detail |
public org.jdom.Element getQueryWithoutNotExpression(org.jdom.Element expressionElement)
throws BadQueryException
<not> elements
has been removed.
expressionElement - the (root) Element of the query to transform.
<not> elements
has been removed.
BadQueryException - if transformin the query failed
(see BAD_NOT_EXPRESSION_EXCEPTION_MESSAGE).
protected org.jdom.Element getProcessedElement(org.jdom.Element expressionElement,
boolean negate)
throws BadQueryException
expressionElement.
If negate is true, the Element has to be negated.
expressionElement - the Element for which to return the
appropriate replacement.negate - if negate is true, the given
Element has to be negated.
expressionElement.
BadQueryException - if the Element could not be processed.
protected org.jdom.Element getNegatedQueryElement(org.jdom.Element expressionElement)
throws BadQueryException
expressionElement.
expressionElement - the Element to return the appropriate
negation for.
expressionElement.
BadQueryException - if the Element could not be processed.
protected org.jdom.Element getNegatedUnknownQueryElement(org.jdom.Element expressionElement)
throws BadQueryException
expressionElement,
which is neither in DAV: nor
http://jakarta.apache.org/slide/ namespace.
expressionElement - the Element to return the appropriate
negation for.
expressionElement.
BadQueryException - if the Element could not be processed.
protected org.jdom.Element getNegatedDAVQueryElement(org.jdom.Element expressionElement)
throws BadQueryException
expressionElement,
which is in the DAV: namespace.
expressionElement - the Element to return the appropriate
negation for.
expressionElement.
BadQueryException - if the Element could not be processed.
protected org.jdom.Element getNegatedSlideQueryElement(org.jdom.Element expressionElement)
throws BadQueryException
expressionElement,
which is in the http://jakarta.apache.org/slide/ namespace.
expressionElement - the Element to return the appropriate
negation for.
expressionElement.
BadQueryException - if the Element could not be processed.
protected org.jdom.Element getNamedClone(org.jdom.Element source,
java.lang.String newName,
org.jdom.Namespace newNamespace)
newName in the
newNamespace and sets the value (text) and attributes
of the given source element.
source - the Element from which to copy the value and attributes.newName - the name to use for the Element to create.newNamespace - the Namespace to use for the Element to create.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||