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

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