001: /*
002: * Copyright 2006 Day Management AG, Switzerland. All rights reserved.
003: */
004: package javax.jcr.query;
005:
006: import javax.jcr.Value;
007: import javax.jcr.RepositoryException;
008: import javax.jcr.ItemNotFoundException;
009: import javax.jcr.Node;
010:
011: /**
012: * A row in the query result table.
013: */
014: public interface Row {
015:
016: /**
017: * Returns an array of all the values in the same order as the
018: * column names returned by {@link QueryResult#getColumnNames()}.
019: *
020: * @return a <code>Value</code> array.
021: * @throws RepositoryException if an error occurs
022: */
023: public Value[] getValues() throws RepositoryException;
024:
025: /**
026: * Returns the value of the indicated column in this <code>Row</code>.
027: * <p/>
028: * If <code>columnName</code> is not among the column names of the query result
029: * table, an <code>ItemNotFoundException</code> is thrown.
030: *
031: * @param columnName name of query result table column
032: * @return a <code>Value</code>
033: * @throws ItemNotFoundException if <code>columnName</code> s not among the
034: * column names of the query result table.
035: * @throws RepositoryException if anopther error occurs.
036: */
037: public Value getValue(String columnName)
038: throws ItemNotFoundException, RepositoryException;
039:
040: /**
041: * Returns the <code>Node</code> corresponding to this <code>Row</code>.
042: * <p/>
043: * A <code>RepositoryException</code> is thrown if this <code>Row</code>
044: * contains values from more than one node. This will be the case when more
045: * than one selector is included among the columns specified for the query.
046: *
047: * @return a <code>Node</code>
048: * @throws RepositoryException if this query has more than one selector
049: * (and therefore, this <code>Row</code> corresponds to more than one
050: * <code>Node</code>) or if another error occurs.
051: * @since JCR 2.0
052: */
053: public Node getNode() throws RepositoryException;
054:
055: /**
056: * Returns the <code>Node</code> corresponding to this <code>Row</code> and
057: * the specified selector.
058: *
059: * @param selectorName a <code>String</code>
060: * @return a <code>Node</code>
061: * @throws RepositoryException if <code>selectorName</code> is not the alias
062: * of a selector in this query or if another error occurs.
063: * @since JCR 2.0
064: */
065: public Node getNode(String selectorName) throws RepositoryException;
066:
067: /**
068: * Equivalent to <code>Row.getNode().getPath()</code>. However, some
069: * implementations may be able gain efficiency by not resolving the actual
070: * <code>Node</code>.
071: *
072: * @return a <code>String</code>
073: * @throws RepositoryException if this query has more than one selector
074: * (and therefore, this <code>Row</code> corresponds to more than one
075: * <code>Node</code>) or if another error occurs.
076: * @since JCR 2.0
077: */
078: public String getPath() throws RepositoryException;
079:
080: /**
081: * Equivalent to <code>Row.getNode(selectorName).getPath()</code>. However, some
082: * implementations may be able gain efficiency by not resolving the actual
083: * <code>Node</code>.
084: *
085: * @param selectorName a <code>String</code>
086: * @return a <code>String</code>
087: * @throws RepositoryException if <code>selectorName</code> is not the alias
088: * of a selector in this query or if another error occurs.
089: * @since JCR 2.0
090: */
091: public String getPath(String selectorName)
092: throws RepositoryException;
093:
094: /**
095: * Returns the full text search score for this row associated with the
096: * default selector. This corresponds to the score of a particular node.
097: * <p/>
098: * If no <code>FullTextSearchScore</code> AQM object is associated with the
099: * default selector this method will still return a value. However, in that
100: * case the returned value may not be meaningful or may simply reflect the
101: * minimum possible relevance level (for example, in some systems this might
102: * be a score of 0).
103: * <p/>
104: * Note, in JCR-SQL2 a <code>FullTextSearchScore</code> AQM object is represented
105: * by a <code>SCORE()</code> function. In JCR-JQOM it is represented by a
106: * Java object of type <code>javax.jcr.query.qom.FullTextSearchScore</code>.
107: *
108: * @return a <code>double</code>
109: * @throws RepositoryException if this query has more than one selector
110: * (and therefore, this <code>Row</code> corresponds to more than one
111: * <code>Node</code>) or if another error occurs.
112: * @since JCR 2.0
113: */
114: public double getScore() throws RepositoryException;
115:
116: /**
117: * Returns the full text search score for this row associated with the
118: * specified selector. This corresponds to the score of a particular node.
119: * <p/>
120: * If no <code>FullTextSearchScore</code> AQM object is associated with the
121: * selector <code>selectorName</code> this method will still return a value.
122: * However, in that case the returned value may not be meaningful or may
123: * simply reflect the minimum possible relevance level (for example, in some
124: * systems this might be a score of 0).
125: * <p/>
126: * Note, in JCR-SQL2 a <code>FullTextSearchScore</code> AQM object is represented
127: * by a <code>SCORE()</code> function. In JCR-JQOM it is represented by a
128: * Java object of type <code>javax.jcr.query.qom.FullTextSearchScore</code>.
129: *
130: * @param selectorName a <code>String</code>
131: * @return a <code>String</code>
132: * @throws RepositoryException if <code>selectorName</code> is not the alias
133: * of a selector in this query or if another error occurs.
134: * @since JCR 2.0
135: */
136: public double getScore(String selectorName)
137: throws RepositoryException;
138: }
|