source: OAIProvider/trunk/src/main/java/eu/clarin/oai/provider/RecordList.java @ 1911

Last change on this file since 1911 was 1911, checked in by oschonef, 12 years ago
  • first round of major refactoring to simply the provider
    • result sets converted to iterator/cursor-mode (better streaming support)
    • delegate serializing of records to Result and ResultList?
    • prepare getting rid of over-engineered and complicated MetadataFormats? classes (not done, yet)

HEADS UP: breaks existing API

  • Property svn:eol-style set to native
File size: 4.1 KB
Line 
1package eu.clarin.oai.provider;
2
3import java.util.Date;
4import java.util.List;
5
6import javax.xml.stream.XMLStreamException;
7import javax.xml.stream.XMLStreamWriter;
8
9/**
10 * A list of items from the repository as the result of a query. Used by the
11 * <em>ListRecords</em> and <em>ListIdentifiers</em> verb. This can also be a
12 * partial list if the repository wants do flow-control.
13 *
14 * A <code>RecordList</code> object maintains a cursor pointing to its
15 * current record. Initially the cursor is positioned before the first row.
16 * The next method moves the cursor to the next row, and because it returns
17 * <code>false</code> when there are no more records in the
18 * <code>RecordList</code> object, it can be used in a while loop to iterate through the
19 * result set.
20 */
21public interface RecordList {
22
23    /**
24     * Get the size of the complete result list.
25     *
26     * @return the size of the complete result list or <code>-1</code>, if the
27     *         repository cannot calculate the total size.
28     * @see #getSize()
29     */
30    public int getTotalSize();
31
32
33    /**
34     * Return <code>true</code>, if no more partial result lists are available
35     * for this request. In other words, this method should return
36     * <code>true</code> either if this list contains all appropriate records
37     * for the request or if this result list is the last partial list for the
38     * request. This is needed for flow-control.
39     *
40     * @return <code>true</code> if no more results are available in subsequent
41     *         requests, <code>false</code> otherwise
42     */
43    public boolean isListComplete();
44
45
46    /**
47     * Release resources as this record list instance is about to be discarded.
48     */
49    public void close();
50
51   
52    /**
53     * Returns <code>true</code> if the list has more records. (In other words,
54     * returns <code>true</code> if <code>nextRecord</code> would return an
55     * element rather than throwing an exception.)
56     *
57     * @return <code>true</code> if the list has more records
58     */
59    public boolean next();
60
61   
62    /**
63     * Get the localId of the record. The returned object must be compatible
64     * with repository's implementation of <code>parseLocalId</code> and
65     * <code>unparseLocalId</code>.
66     *
67     * @returns the local Id object of the record
68     */
69    public Object getLocalId();
70
71    /**
72     * Get the last changed timestamp of the item.
73     *
74     * @return the last changed timestamp of the item
75     */
76    public Date getDatestamp();
77
78    /**
79     * set deletion state of the record.
80     *
81     * @return <code>true</code> of the record is deleted, <code>false</code>
82     *         otherwise
83     * @see Repository#getDeletedNotion()           
84     */
85    public boolean isDeleted();
86
87    /**
88     * Get the sets to which this record belongs to.
89     *
90     * @return the list of sets to which the records belongs to or
91     *         <code>null</code> if it does not belong to any sets or the
92     *         repository does not support set
93     */
94    public List<String> getSetSpecs();
95
96   
97    public void writeRecord(XMLStreamWriter writer) throws XMLStreamException;
98   
99    // /**
100    // * Gets the next record in the list. RecordList implementations must set
101    // * the appropriate values to the passed Record instance.
102    // *
103    // * @param record
104    // * a Record instance to gather the record data
105    // * @see Record
106    // * @throws NoSuchElementException - iteration has no more results.
107    // */
108    // public void nextRecord(Record record);
109    //
110    // /**
111    // * Return <code>true</code>, if no more partial result lists are
112    // * available for this request. In other words, this method should return
113    // * <code>true</code> either if this list contains all appropriate records
114    // * for the request or if this result list is the last partial list for the
115    // * request. This is needed for flow-control.
116    // *
117    // * @return <code>true</code> if no more results are available in
118    // * subsequent requests, <code>false</code> otherwise
119    // */
120    // public boolean isListComplete();
121    //
122
123} // class RecordList
Note: See TracBrowser for help on using the repository browser.