code: public static Comparable<?> getComparable(ValueData value, int type) throws UnsupportedEncodingException,
        IllegalStateException, IOException, IllegalNameException, RepositoryException
     {
        switch (type)
        {
           case PropertyType.BINARY :
              return null;
           case PropertyType.BOOLEAN :
              return ComparableBoolean.valueOf(ValueDataUtil.getBoolean(value));
           case PropertyType.DATE :
              return new Long(ValueDataUtil.getDate(value).getTimeInMillis());
           case PropertyType.DOUBLE :
              return new Double(ValueDataUtil.getDouble(value));
           case PropertyType.LONG :
              return new Long(ValueDataUtil.getLong(value));
           case PropertyType.NAME :
              return new QPathEntry(ValueDataUtil.getName(value), 1);
           case PropertyType.PATH :
              return ValueDataUtil.getPath(value);
           case PropertyType.REFERENCE :
              return ValueDataUtil.getReference(value);
           case PropertyType.STRING :
              return ValueDataUtil.getString(value);
           default :
              return null;
        }
     }
docs: Returns a comparable for the internal <code>value</code>.
  
  @param value an internal value.
  @return a comparable for the given <code>value</code>.