1 |
2741
|
costa
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Copyright: 2005 University of New Mexico and the
|
4 |
|
|
* Regents of the University of California and the
|
5 |
|
|
* National Center for Ecological Analysis and Synthesis
|
6 |
|
|
* '$Author$'
|
7 |
|
|
* '$Date$'
|
8 |
|
|
* '$Revision$'
|
9 |
|
|
*
|
10 |
|
|
* This program is free software; you can redistribute it and/or modify
|
11 |
|
|
* it under the terms of the GNU General Public License as published by
|
12 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
13 |
|
|
* (at your option) any later version.
|
14 |
|
|
*
|
15 |
|
|
* This program is distributed in the hope that it will be useful,
|
16 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
* GNU General Public License for more details.
|
19 |
|
|
*
|
20 |
|
|
* You should have received a copy of the GNU General Public License
|
21 |
|
|
* along with this program; if not, write to the Free Software
|
22 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23 |
|
|
*/
|
24 |
|
|
|
25 |
|
|
package edu.ucsb.nceas.metacat.advancedsearch;
|
26 |
|
|
|
27 |
|
|
/**
|
28 |
|
|
* @author dcosta
|
29 |
|
|
*
|
30 |
|
|
* The LTERSite class holds information about the LTER sites.
|
31 |
|
|
*/
|
32 |
|
|
public class LTERSite {
|
33 |
|
|
|
34 |
|
|
/* Instance variables */
|
35 |
|
|
public String site; // The three-letter uppercase acronym for this site.
|
36 |
|
|
|
37 |
|
|
public final String[] sites = {
|
38 |
|
|
"AND",
|
39 |
|
|
"ARC",
|
40 |
|
|
"BES",
|
41 |
|
|
"BNZ",
|
42 |
|
|
"CAP",
|
43 |
|
|
"CCE",
|
44 |
|
|
"CDR",
|
45 |
|
|
"CWT",
|
46 |
|
|
"FCE",
|
47 |
|
|
"GCE",
|
48 |
|
|
"HBR",
|
49 |
|
|
"HFR",
|
50 |
|
|
"JRN",
|
51 |
|
|
"KBS",
|
52 |
|
|
"KNZ",
|
53 |
|
|
"LNO",
|
54 |
|
|
"LUQ",
|
55 |
|
|
"MCM",
|
56 |
|
|
"MCR",
|
57 |
|
|
"NTL",
|
58 |
|
|
"NWT",
|
59 |
|
|
"PAL",
|
60 |
|
|
"PIE",
|
61 |
|
|
"SBC",
|
62 |
|
|
"SEV",
|
63 |
|
|
"SGS",
|
64 |
|
|
"VCR",
|
65 |
|
|
};
|
66 |
|
|
|
67 |
|
|
public final String[] siteKeywords = {
|
68 |
|
|
"Andrews LTER",
|
69 |
|
|
"Arctic LTER",
|
70 |
|
|
"Baltimore Ecosystem Study",
|
71 |
|
|
"Bonanza Creek",
|
72 |
|
|
"Central Arizona - Phoenix Urban",
|
73 |
|
|
"California Current Ecosystem",
|
74 |
|
|
"Cedar Creek",
|
75 |
|
|
"Coweeta",
|
76 |
|
|
"Florida Coastal Everglades",
|
77 |
|
|
"Georgia Coastal Ecosystems",
|
78 |
|
|
"Hubbard Brook",
|
79 |
|
|
"Harvard Forest",
|
80 |
|
|
"Jornada Basin",
|
81 |
|
|
"Kellogg Biological Station",
|
82 |
|
|
"Konza Prairie",
|
83 |
|
|
"LTER Network Office",
|
84 |
|
|
"Luquillo",
|
85 |
|
|
"McMurdo Dry Valleys",
|
86 |
|
|
"Moorea Coral Reef",
|
87 |
|
|
"North Temperate Lakes",
|
88 |
|
|
"Niwot Ridge",
|
89 |
|
|
"Palmer Station",
|
90 |
|
|
"Plum Island Ecosystem",
|
91 |
|
|
"Santa Barbara Coastal",
|
92 |
|
|
"Sevilleta",
|
93 |
|
|
"Shortgrass Steppe",
|
94 |
|
|
"Virginia Coastal Reserve",
|
95 |
|
|
};
|
96 |
|
|
|
97 |
|
|
public final String[] siteNames = {
|
98 |
|
|
"Andrews LTER",
|
99 |
|
|
"Arctic LTER",
|
100 |
|
|
"Baltimore Ecosystem Study",
|
101 |
|
|
"Bonanza Creek LTER",
|
102 |
|
|
"Central Arizona - Phoenix Urban LTER",
|
103 |
|
|
"California Current Ecosystem",
|
104 |
|
|
"Cedar Creek Natural History Area",
|
105 |
|
|
"Coweeta LTER",
|
106 |
|
|
"Florida Coastal Everglades LTER",
|
107 |
|
|
"Georgia Coastal Ecosystems LTER",
|
108 |
|
|
"Hubbard Brook LTER",
|
109 |
|
|
"Harvard Forest LTER",
|
110 |
|
|
"Jornada Basin LTER",
|
111 |
|
|
"Kellogg Biological Station LTER",
|
112 |
|
|
"Konza Prairie LTER",
|
113 |
|
|
"LTER Network Office",
|
114 |
|
|
"Luquillo LTER",
|
115 |
|
|
"McMurdo Dry Valleys LTER",
|
116 |
|
|
"Moorea Coral Reef",
|
117 |
|
|
"North Temperate Lakes LTER",
|
118 |
|
|
"Niwot Ridge LTER",
|
119 |
|
|
"Palmer Station LTER",
|
120 |
|
|
"Plum Island Ecosystem LTER",
|
121 |
|
|
"Santa Barbara Coastal LTER",
|
122 |
|
|
"Sevilleta LTER",
|
123 |
|
|
"Shortgrass Steppe",
|
124 |
|
|
"Virginia Coastal Reserve LTER",
|
125 |
|
|
};
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
/* Constructor
|
129 |
|
|
*
|
130 |
|
|
* @param site The three-letter acronym for this LTER site.
|
131 |
|
|
*
|
132 |
|
|
*/
|
133 |
|
|
public LTERSite(final String site) {
|
134 |
|
|
if (site != null) {
|
135 |
|
|
this.site = site.toUpperCase();
|
136 |
|
|
}
|
137 |
|
|
}
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
/**
|
141 |
|
|
* For a given site, return the packageId attribute search string for that
|
142 |
|
|
* site's EML documents.
|
143 |
|
|
*
|
144 |
|
|
* @return packageId The first few letters that uniquely identify a site's
|
145 |
|
|
* packageId. Typically "knb-lter-xyz", though there are
|
146 |
|
|
* some exceptions.
|
147 |
|
|
*/
|
148 |
|
|
public String getPackageId() {
|
149 |
|
|
final String packageId;
|
150 |
|
|
|
151 |
|
|
if (site == null) {
|
152 |
|
|
packageId = "";
|
153 |
|
|
}
|
154 |
|
|
else if (site.equals("SEV")) {
|
155 |
|
|
packageId = "sev.";
|
156 |
|
|
}
|
157 |
|
|
else {
|
158 |
|
|
packageId = "knb-lter-" + site.toLowerCase();
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
return packageId;
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
/**
|
166 |
|
|
* Get the keyword string for this site. This keyword string is OR'ed with the
|
167 |
|
|
* packageId to find documents that originated from this site.
|
168 |
|
|
*
|
169 |
|
|
* @return siteKeyword The site keyword string.
|
170 |
|
|
*/
|
171 |
|
|
public String getSiteKeyword() {
|
172 |
|
|
String siteKeyword = "";
|
173 |
|
|
|
174 |
|
|
if (isValidSite()) {
|
175 |
|
|
for (int i = 0; i < sites.length; i++) {
|
176 |
|
|
if (site.equals(sites[i])) {
|
177 |
|
|
siteKeyword = siteKeywords[i];
|
178 |
|
|
break;
|
179 |
|
|
}
|
180 |
|
|
}
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
return siteKeyword;
|
184 |
|
|
}
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
/**
|
188 |
|
|
* For a given site, return system attribute search string for that
|
189 |
|
|
* site's EML documents.
|
190 |
|
|
*
|
191 |
|
|
* @return system A string representing the system attribute used in a LTER
|
192 |
|
|
* site's EML documents.
|
193 |
|
|
*/
|
194 |
|
|
public String getSystem() {
|
195 |
|
|
final String system;
|
196 |
|
|
|
197 |
|
|
if (site == null) {
|
198 |
|
|
system = "";
|
199 |
|
|
}
|
200 |
|
|
else if (site.equals("CAP")) {
|
201 |
|
|
system = "ces_dataset";
|
202 |
|
|
}
|
203 |
|
|
else if (site.equals("CWT")) {
|
204 |
|
|
system = "cwt-lter";
|
205 |
|
|
}
|
206 |
|
|
else {
|
207 |
|
|
system = "knb";
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
return system;
|
211 |
|
|
}
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
/**
|
215 |
|
|
* Boolean to determine whether a given string is a valid LTER site.
|
216 |
|
|
*/
|
217 |
|
|
public boolean isValidSite() {
|
218 |
|
|
boolean isValid = false;
|
219 |
|
|
|
220 |
|
|
if (site != null) {
|
221 |
|
|
for (int i = 0; i < sites.length; i++) {
|
222 |
|
|
if (site.equals(sites[i])) {
|
223 |
|
|
isValid = true;
|
224 |
|
|
break;
|
225 |
|
|
}
|
226 |
|
|
}
|
227 |
|
|
}
|
228 |
|
|
|
229 |
|
|
return isValid;
|
230 |
|
|
}
|
231 |
|
|
|
232 |
|
|
}
|