source: SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUSearchRetrieveResponse.java @ 2168

Last change on this file since 2168 was 2168, checked in by oschonef, 12 years ago
  • update copyright
  • add missing copyright statements
  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
1/**
2 * This software is copyright (c) 2011-2012 by
3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
4 * This is free software. You can redistribute it
5 * and/or modify it under the terms described in
6 * the GNU General Public License v3 of which you
7 * should have received a copy. Otherwise you can download
8 * it from
9 *
10 *   http://www.gnu.org/licenses/gpl-3.0.txt
11 *
12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
13 *
14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
15 *  GNU General Public License v3
16 */
17package eu.clarin.sru.client;
18
19import java.util.Collections;
20import java.util.List;
21
22import org.w3c.dom.Document;
23
24
25
26/**
27 * A response to a <em>searchRetrieve</em> request.
28 */
29public final class SRUSearchRetrieveResponse extends
30        SRUAbstractResponse<SRUSearchRetrieveRequest> {
31    private final int numberOfRecords;
32    private final String resultSetId;
33    private final int resultSetIdleTime;
34    private final List<SRURecord> records;
35    private final int nextRecordPosition;
36
37
38    SRUSearchRetrieveResponse(SRUSearchRetrieveRequest request,
39            List<SRUDiagnostic> diagnostics, Document extraResponseData,
40            int numberOfRecords, String resultSetId, int resultSetIdleTime,
41            List<SRURecord> records, int nextRecordPosition) {
42        super(request, diagnostics, extraResponseData);
43        this.numberOfRecords = numberOfRecords;
44        this.resultSetId = resultSetId;
45        this.resultSetIdleTime = resultSetIdleTime;
46        this.records = (records != null && !records.isEmpty())
47                ? Collections.unmodifiableList(records) : null;
48        this.nextRecordPosition = nextRecordPosition;
49    }
50
51
52    /**
53     * Get the number of records.
54     *
55     * @return the number of records or <code>-1</code> if not available
56     */
57    public int getNumberOfRecords() {
58        return numberOfRecords;
59    }
60
61
62    /**
63     * Get the result set id.
64     *
65     * @return the result set id or <code>-1</code> if not available
66     */
67    public String getResultSetId() {
68        return resultSetId;
69    }
70
71
72    /**
73     * Get the result set idle time.
74     *
75     * @return the result set idle time or <code>-1</code> if not available
76     */
77    public int getResultSetIdleTime() {
78        return resultSetIdleTime;
79    }
80
81
82    /**
83     * Get the list of records.
84     *
85     * @return the list of records or <code>null</code> if none
86     */
87    public List<SRURecord> getRecords() {
88        return records;
89    }
90
91
92    /**
93     * Check, if response contains any records.
94     *
95     * @return <code>true</code> of response contains records,
96     *         <code>false</code> otherwise
97     */
98    public boolean hasRecords() {
99        return records != null;
100    }
101
102
103    /**
104     * Get the next record position.
105     *
106     * @return the next record position or <code>-1</code> if not available
107     */
108    public int getNextRecordPosition() {
109        return nextRecordPosition;
110    }
111
112} // class SRUSearchRetrieveResponse
Note: See TracBrowser for help on using the repository browser.