luetzkendorf 2004/11/01 09:53:12
Modified: src/share/org/apache/slide/search/basic
ComparableResourceImpl.java
Log:
small fix that allows propcontains on XMLValue'd properties too, some cleanup
Revision Changes Path
1.11 +18 -11
jakarta-slide/src/share/org/apache/slide/search/basic/ComparableResourceImpl.java
Index: ComparableResourceImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/ComparableResourceImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ComparableResourceImpl.java 1 Sep 2004 15:46:32 -0000 1.10
+++ ComparableResourceImpl.java 1 Nov 2004 17:53:12 -0000 1.11
@@ -222,8 +222,12 @@
public int propContains (String propName, String propNamespace, String literal)
{
Object o = getThisValue (propName, propNamespace);
- if (o instanceof String == false)
- return Literals.UNKNOWN;
+ if (o == null) return Literals.FALSE;
+
+ if (! (o instanceof String)) {
+ // allow propcontains on XMLValues too
+ o = o.toString();
+ }
String thisValue = (String)o;
if (thisValue.indexOf(literal) == -1)
@@ -585,14 +589,14 @@
private int compare (String propName, String propNamespace, String literal, int
op) {
int result = Literals.FALSE;
- Object thisValue = getThisValue (propName, propNamespace);
- if (thisValue == null)
- return Literals.UNKNOWN;
+// Object thisValue = getThisValue (propName, propNamespace);
+// if (thisValue == null)
+// return Literals.UNKNOWN;
- Object otherValue = null;
+ //Object otherValue = null;
try {
- otherValue = getOtherValue (thisValue, literal);
+ //otherValue = getOtherValue (thisValue, literal);
switch (op)
{
@@ -652,6 +656,9 @@
return getUri().hashCode();
}
+ public String toString() {
+ return getUri();
+ }
/**
* Dummy Exception to indicate UNKNOWN state
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]