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 | */ |
---|
17 | package eu.clarin.sru.client; |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | /** |
---|
22 | * A record data implementation to hold surrogate diagnostics. |
---|
23 | */ |
---|
24 | public final class SRUSurrogateRecordData implements SRURecordData { |
---|
25 | /** |
---|
26 | * The record schema for SRU surrogate records. |
---|
27 | */ |
---|
28 | public static final String RECORD_SCHEMA = |
---|
29 | "info:srw/schema/1/diagnostic-v1.1"; |
---|
30 | private final SRUDiagnostic diagnostic; |
---|
31 | |
---|
32 | |
---|
33 | SRUSurrogateRecordData(SRUDiagnostic diagnostic) { |
---|
34 | this.diagnostic = diagnostic; |
---|
35 | } |
---|
36 | |
---|
37 | |
---|
38 | @Override |
---|
39 | public String getRecordSchema() { |
---|
40 | return RECORD_SCHEMA; |
---|
41 | } |
---|
42 | |
---|
43 | |
---|
44 | @Override |
---|
45 | public boolean isTransient() { |
---|
46 | return false; |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | /** |
---|
51 | * Get the surrogate diagnostic. |
---|
52 | * |
---|
53 | * @return the surrogate diagnostic |
---|
54 | */ |
---|
55 | public SRUDiagnostic getDiagnostic() { |
---|
56 | return diagnostic; |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | /** |
---|
61 | * Convenience method to get diagnostic's identifying URI. |
---|
62 | * |
---|
63 | * @return diagnostic code |
---|
64 | */ |
---|
65 | public String getURI() { |
---|
66 | return diagnostic.getURI(); |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | /** |
---|
71 | * Convenience method to get supplementary information for this diagnostic. |
---|
72 | * The format for this value is often specified by the diagnostic code. |
---|
73 | * |
---|
74 | * @return supplementary information |
---|
75 | */ |
---|
76 | public String getDetails() { |
---|
77 | return diagnostic.getDetails(); |
---|
78 | } |
---|
79 | |
---|
80 | |
---|
81 | /** |
---|
82 | * Convenience method to get human readable message. |
---|
83 | * |
---|
84 | * @return human readable message |
---|
85 | */ |
---|
86 | public String getMessage() { |
---|
87 | return diagnostic.getMessage(); |
---|
88 | } |
---|
89 | |
---|
90 | } // class SRUSurrogateRecordData |
---|