org.apache.slide.search.basic
Class ComparableResourceImpl

java.lang.Object
  extended byorg.apache.slide.search.basic.ComparableResourceImpl
All Implemented Interfaces:
ComparableResource, RequestedResource

public class ComparableResourceImpl
extends java.lang.Object
implements ComparableResource

Represents one Resource. Implements operators like greaterThan, equals, ...

Version:
$Revision: 1.9.2.1 $

Field Summary
protected  PropertyProvider propertyProvider
          The PropertyProvider to use (may be null).
protected  NodeRevisionDescriptor revisionDescriptor
          the latest revision of this resource
protected  QueryScope scope
          The scope.
 
Constructor Summary
protected ComparableResourceImpl()
           
  ComparableResourceImpl(ObjectNode objectNode, SearchToken searchToken, QueryScope scope, PropertyProvider propertyProvider)
          Constructs a RequestedResource.
  ComparableResourceImpl(ObjectNode objectNode, SlideToken slideToken, Content contentHelper, QueryScope scope, PropertyProvider propertyProvider)
          Constructs a RequestedResource.
 
Method Summary
 int compareTo(ComparableResource otherResource, CompareHint hint)
          compares two RequestedResources according to OrderByHint.
 int contains(java.lang.String literal)
          Checks, if the content of the resource contains a specific literal.
 boolean equals(java.lang.Object otherObject)
           
 int equals(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is EQUAL the matching property within this item.
 java.util.Iterator getAllProperties()
          Returns all properties as an Iterator of NodeProperty objects.
 java.util.Iterator getAllPropertiesNames()
          Returns an Iterator of PropertyName of all properties.
 java.lang.String getExternalHref()
          Deprecated.  
 java.lang.String getInternalHref()
          href accessor
 NodeProperty getProperty(PropertyName propertyName)
          Returns the property with the given propertyName.
protected  NodeProperty getProperty(java.lang.String propName)
          Returns the NodeProperty with the given name and default namespace.
 NodeProperty getProperty(java.lang.String name, java.lang.String namespace)
          Returns the property with the given name and namespace.
 java.lang.Object getThisValue(java.lang.String propName, java.lang.String propNamespace)
          Method getThisValue
 java.lang.String getUri()
          Returns the URI of the resource.
 int greaterThan(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is greater than the matching property within this item.
 int greaterThanEquals(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is greater or equal than the matching property within this item.
 int hashCode()
           
 boolean isCollection(NodeRevisionDescriptor revisionDescriptor)
          Method isCollection
 boolean isDefined(java.lang.String propName, java.lang.String propNamespace)
          Method isDefined
 int lowerThan(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is lower than the matching property within this item.
 int lowerThanEquals(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          Checks, if a property, represented by its name and value (as String), is lower or equal than the matching property within this item.
 int propContains(java.lang.String propName, java.lang.String propNamespace, java.lang.String literal)
          checks, if a properties' value contains a literal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

revisionDescriptor

protected NodeRevisionDescriptor revisionDescriptor
the latest revision of this resource


propertyProvider

protected PropertyProvider propertyProvider
The PropertyProvider to use (may be null).


scope

protected QueryScope scope
The scope.

Constructor Detail

ComparableResourceImpl

public ComparableResourceImpl(ObjectNode objectNode,
                              SearchToken searchToken,
                              QueryScope scope,
                              PropertyProvider propertyProvider)
                       throws SlideException
Constructs a RequestedResource.

Parameters:
objectNode - the ObjectNode for this resource
searchToken - the SearchToken for this request
scope - the scope of the query.
propertyProvider - the PropertyProvider to use (may be null).
Throws:
BadQueryException
SlideException

ComparableResourceImpl

public ComparableResourceImpl(ObjectNode objectNode,
                              SlideToken slideToken,
                              Content contentHelper,
                              QueryScope scope,
                              PropertyProvider propertyProvider)
                       throws SlideException
Constructs a RequestedResource.

Parameters:
objectNode - the ObjectNode for this resource
slideToken - the slideToken for this request
contentHelper - you won't believe, the ContentHelper
scope - the scope of the query.
propertyProvider - the PropertyProvider to use (may be null).
Throws:
BadQueryException
SlideException

ComparableResourceImpl

protected ComparableResourceImpl()
Method Detail

greaterThan

public int greaterThan(java.lang.String propName,
                       java.lang.String propNamespace,
                       java.lang.String literal)
Checks, if a property, represented by its name and value (as String), is greater than the matching property within this item.

Specified by:
greaterThan in interface ComparableResource
Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

greaterThanEquals

public int greaterThanEquals(java.lang.String propName,
                             java.lang.String propNamespace,
                             java.lang.String literal)
Description copied from interface: ComparableResource
Checks, if a property, represented by its name and value (as String), is greater or equal than the matching property within this item.

Specified by:
greaterThanEquals in interface ComparableResource
Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

lowerThan

public int lowerThan(java.lang.String propName,
                     java.lang.String propNamespace,
                     java.lang.String literal)
Description copied from interface: ComparableResource
Checks, if a property, represented by its name and value (as String), is lower than the matching property within this item.

Specified by:
lowerThan in interface ComparableResource
Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

lowerThanEquals

public int lowerThanEquals(java.lang.String propName,
                           java.lang.String propNamespace,
                           java.lang.String literal)
Description copied from interface: ComparableResource
Checks, if a property, represented by its name and value (as String), is lower or equal than the matching property within this item.

Specified by:
lowerThanEquals in interface ComparableResource
Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

equals

public int equals(java.lang.String propName,
                  java.lang.String propNamespace,
                  java.lang.String literal)
Checks, if a property, represented by its name and value (as String), is EQUAL the matching property within this item.

Specified by:
equals in interface ComparableResource
Parameters:
propName - the name of the property to check
literal - the value as String to check again
Returns:
Literals.TRUE, Literals.FALSE or Literals.UNKNOWN

propContains

public int propContains(java.lang.String propName,
                        java.lang.String propNamespace,
                        java.lang.String literal)
checks, if a properties' value contains a literal

Specified by:
propContains in interface ComparableResource
Parameters:
propName - a String
literal - a String
Returns:
Literal.TRUE, if propName's value contains literal

getInternalHref

public java.lang.String getInternalHref()
href accessor

Specified by:
getInternalHref in interface ComparableResource
Returns:
the href of this item

getExternalHref

public java.lang.String getExternalHref()
Deprecated.  

Method getExternalHref

Specified by:
getExternalHref in interface ComparableResource
Returns:
a String

getThisValue

public java.lang.Object getThisValue(java.lang.String propName,
                                     java.lang.String propNamespace)
Method getThisValue

Specified by:
getThisValue in interface ComparableResource
Parameters:
propName - the property name
Returns:
the value of the property within this item

getProperty

protected NodeProperty getProperty(java.lang.String propName)
Returns the NodeProperty with the given name and default namespace.

Parameters:
propName - the name of the property.
Returns:
the requested NodeProperty.

getUri

public java.lang.String getUri()
Returns the URI of the resource.

Specified by:
getUri in interface RequestedResource
Returns:
the URI of the resource.

getProperty

public NodeProperty getProperty(PropertyName propertyName)
                         throws SlideException
Returns the property with the given propertyName.

Specified by:
getProperty in interface RequestedResource
Parameters:
propertyName - the PropertyName of the property.
Returns:
the property with the given npropertyNameame.
Throws:
SlideException

getProperty

public NodeProperty getProperty(java.lang.String name,
                                java.lang.String namespace)
                         throws SlideException
Returns the property with the given name and namespace.

Specified by:
getProperty in interface RequestedResource
Parameters:
name - the name of the property.
namespace - the namespace URI of the property.
Returns:
the property with the given name and namespace.
Throws:
SlideException

getAllPropertiesNames

public java.util.Iterator getAllPropertiesNames()
                                         throws SlideException
Returns an Iterator of PropertyName of all properties.

Specified by:
getAllPropertiesNames in interface RequestedResource
Returns:
an Iterator of PropertyName.
Throws:
SlideException

getAllProperties

public java.util.Iterator getAllProperties()
                                    throws SlideException
Returns all properties as an Iterator of NodeProperty objects.

Specified by:
getAllProperties in interface RequestedResource
Returns:
all properties as an Iterator of NodeProperty objects.
Throws:
SlideException

isCollection

public boolean isCollection(NodeRevisionDescriptor revisionDescriptor)
Method isCollection

Parameters:
revisionDescriptor - a NodeRevisionDescriptor
Returns:
a boolean

compareTo

public int compareTo(ComparableResource otherResource,
                     CompareHint hint)
compares two RequestedResources according to OrderByHint. NULL values are always considered as lessThan. (see [DASL] 5.6). Called in orderBy context May only return 0 if the URIs are equal.

Specified by:
compareTo in interface ComparableResource
Parameters:
otherResource - a RequestedResource
hint - an OrderByHint
Returns:
an int

isDefined

public boolean isDefined(java.lang.String propName,
                         java.lang.String propNamespace)
Method isDefined

Specified by:
isDefined in interface ComparableResource
Parameters:
propName - a String
Returns:
true if propName is defined in this resource.

contains

public int contains(java.lang.String literal)
Checks, if the content of the resource contains a specific literal.

Specified by:
contains in interface ComparableResource
Parameters:
literal - a String
Returns:
true if literal is contained in this resources' content

equals

public boolean equals(java.lang.Object otherObject)

hashCode

public int hashCode()