source: SRUClient/tags/SRUClient-0.9.5/src/main/java/eu/clarin/sru/client/SRUSearchRetrieveResponse.java @ 6079

Last change on this file since 6079 was 6079, checked in by Oliver Schonefeld, 9 years ago
  • tag version 0.9.5
  • Property svn:eol-style set to native
File size: 3.2 KB
Line 
1/**
2 * This software is copyright (c) 2012-2014 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
22
23
24/**
25 * A response to a <em>searchRetrieve</em> request.
26 */
27public final class SRUSearchRetrieveResponse extends
28        SRUAbstractResponse<SRUSearchRetrieveRequest> {
29    private final int numberOfRecords;
30    private final String resultSetId;
31    private final int resultSetIdleTime;
32    private final List<SRURecord> records;
33    private final int nextRecordPosition;
34
35
36    SRUSearchRetrieveResponse(SRUSearchRetrieveRequest request,
37            List<SRUDiagnostic> diagnostics,
38            List<SRUExtraResponseData> extraResponseData,
39            int totalBytesTransferred,
40            long timeTotal,
41            long timeQueued,
42            long timeNetwork,
43            long timeParsing,
44            int numberOfRecords,
45            String resultSetId,
46            int resultSetIdleTime,
47            List<SRURecord> records,
48            int nextRecordPosition) {
49        super(request, diagnostics, extraResponseData, totalBytesTransferred,
50                timeTotal, timeQueued, timeNetwork, timeParsing);
51        this.numberOfRecords = numberOfRecords;
52        this.resultSetId = resultSetId;
53        this.resultSetIdleTime = resultSetIdleTime;
54        this.records = (records != null && !records.isEmpty())
55                ? Collections.unmodifiableList(records)
56                : null;
57        this.nextRecordPosition = nextRecordPosition;
58    }
59
60
61    /**
62     * Get the number of records.
63     *
64     * @return the number of records or <code>-1</code> if not available
65     */
66    public int getNumberOfRecords() {
67        return numberOfRecords;
68    }
69
70
71    /**
72     * Get the result set id.
73     *
74     * @return the result set id or <code>-1</code> if not available
75     */
76    public String getResultSetId() {
77        return resultSetId;
78    }
79
80
81    /**
82     * Get the result set idle time.
83     *
84     * @return the result set idle time or <code>-1</code> if not available
85     */
86    public int getResultSetIdleTime() {
87        return resultSetIdleTime;
88    }
89
90
91    /**
92     * Get the list of records.
93     *
94     * @return the list of records or <code>null</code> if none
95     */
96    public List<SRURecord> getRecords() {
97        return records;
98    }
99
100
101    /**
102     * Check, if response contains any records.
103     *
104     * @return <code>true</code> of response contains records,
105     *         <code>false</code> otherwise
106     */
107    public boolean hasRecords() {
108        return records != null;
109    }
110
111
112    /**
113     * Get the next record position.
114     *
115     * @return the next record position or <code>-1</code> if not available
116     */
117    public int getNextRecordPosition() {
118        return nextRecordPosition;
119    }
120
121} // class SRUSearchRetrieveResponse
Note: See TracBrowser for help on using the repository browser.