Skip to content

Commit fcbb2d9

Browse files
authored
Merge pull request #1673 from mbenson/MODE-2731
MODE-2731 - Support fully-qualified pseudocolumn names in JCR queries
2 parents 8107a72 + c5921b6 commit fcbb2d9

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

modeshape-jcr/src/main/java/org/modeshape/jcr/query/JcrQueryResult.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.modeshape.jcr.query.QueryResults.Columns;
4343
import org.modeshape.jcr.query.engine.process.RestartableSequence;
4444
import org.modeshape.jcr.query.engine.process.SecureSequence;
45+
import org.modeshape.jcr.value.Name;
4546

4647
/**
4748
* The results of a query. This is not thread-safe because it relies upon JcrSession, which is not thread-safe. Also, although the
@@ -498,27 +499,29 @@ protected Value getValue( String columnName,
498499
String propertyName = iterator.getPropertyNameForColumnName(columnName);
499500
if (propertyName == null) return null;
500501

501-
if (PseudoColumns.contains(propertyName, true)) {
502-
if (PseudoColumns.isPath(propertyName)) {
502+
Name qName = iterator.context.getExecutionContext().getValueFactories().getNameFactory().create(propertyName);
503+
504+
if (PseudoColumns.contains(qName, true)) {
505+
if (PseudoColumns.isPath(qName)) {
503506
return iterator.jcrPath(cachedNode);
504507
}
505-
if (PseudoColumns.isName(propertyName)) {
508+
if (PseudoColumns.isName(qName)) {
506509
return iterator.jcrName(cachedNode);
507510
}
508-
if (PseudoColumns.isLocalName(propertyName)) {
511+
if (PseudoColumns.isLocalName(qName)) {
509512
return iterator.jcrLocalName(cachedNode);
510513
}
511-
if (PseudoColumns.isDepth(propertyName)) {
514+
if (PseudoColumns.isDepth(qName)) {
512515
return iterator.jcrDepth(cachedNode);
513516
}
514-
if (PseudoColumns.isId(propertyName)) {
517+
if (PseudoColumns.isId(qName)) {
515518
return iterator.jcrId(cachedNode);
516519
}
517-
if (PseudoColumns.isScore(propertyName)) {
520+
if (PseudoColumns.isScore(qName)) {
518521
float score = batchAtRow.getScore(nodeIndex);
519522
return iterator.jcrDouble(score);
520523
}
521-
if (PseudoColumns.isUuid(propertyName)) {
524+
if (PseudoColumns.isUuid(qName)) {
522525
return iterator.jcrUuid(cachedNode);
523526
}
524527
}

0 commit comments

Comments
 (0)