16
16
package edu .unc .lib .boxc .search .solr .config ;
17
17
18
18
import java .util .ArrayList ;
19
+ import java .util .Collections ;
19
20
import java .util .HashMap ;
20
21
import java .util .HashSet ;
21
22
import java .util .Iterator ;
@@ -173,6 +174,7 @@ public void setProperties(Properties properties) {
173
174
setQueryMaxLength (Integer .parseInt (properties .getProperty ("search.query.maxLength" , "255" )));
174
175
setDefaultOperator (properties .getProperty ("search.query.defaultOperator" , "" ));
175
176
populateCollectionFromProperty ("search.query.operators" , operators , properties , "," );
177
+ operators = Collections .unmodifiableSet (operators );
176
178
setDefaultPerPage (Integer .parseInt (properties .getProperty ("search.results.defaultPerPage" , "0" )));
177
179
setDefaultCollectionsPerPage (Integer .parseInt (properties .getProperty ("search.results.defaultCollectionsPerPage" ,
178
180
"0" )));
@@ -200,6 +202,10 @@ public void setProperties(Properties properties) {
200
202
"," );
201
203
populateCollectionFromProperty ("search.facet.defaultStructureBrowse" , facetNamesStructureBrowse ,
202
204
properties , "," );
205
+ facetNames = Collections .unmodifiableList (facetNames );
206
+ searchFacetNames = Collections .unmodifiableList (searchFacetNames );
207
+ collectionBrowseFacetNames = Collections .unmodifiableList (collectionBrowseFacetNames );
208
+ facetNamesStructureBrowse = Collections .unmodifiableList (facetNamesStructureBrowse );
203
209
try {
204
210
populateClassMapFromProperty ("search.facet.class." , "edu.unc.lib.boxc.search.solr.facets." ,
205
211
this .facetClasses , properties );
@@ -213,23 +219,35 @@ public void setProperties(Properties properties) {
213
219
populateCollectionFromProperty ("search.field.searchable" , searchableFields , properties , "," );
214
220
populateCollectionFromProperty ("search.field.rangeSearchable" , rangeSearchableFields , properties , "," );
215
221
populateCollectionFromProperty ("search.field.dateSearchable" , dateSearchableFields , properties , "," );
222
+ searchableFields = Collections .unmodifiableSet (searchableFields );
223
+ rangeSearchableFields = Collections .unmodifiableSet (rangeSearchableFields );
224
+ dateSearchableFields = Collections .unmodifiableSet (dateSearchableFields );
225
+
216
226
populateMapFromProperty ("search.field.paramName." , searchFieldParams , properties );
217
227
searchFieldKeys = getInvertedHashMap (searchFieldParams );
218
228
populateMapFromProperty ("search.field.display." , searchFieldLabels , properties );
219
229
populateMapFromProperty ("search.actions." , actions , properties );
220
230
populateMapFromProperty ("search.url.param." , searchStateParams , properties );
221
231
populateListMapFromProperty ("search.results.fields" , resultFields , properties );
232
+ searchFieldParams = Collections .unmodifiableMap (searchFieldParams );
233
+ searchFieldLabels = Collections .unmodifiableMap (searchFieldLabels );
234
+ actions = Collections .unmodifiableMap (actions );
235
+ searchStateParams = Collections .unmodifiableMap (searchStateParams );
236
+ resultFields = Collections .unmodifiableMap (resultFields );
222
237
223
238
// Populate sort types
224
239
setSortReverse (properties .getProperty ("search.sort.order.reverse" , "" ));
225
240
setSortNormal (properties .getProperty ("search.sort.order.normal" , "" ));
226
241
populateMapFromProperty ("search.sort.name." , sortDisplayNames , properties );
227
242
populateCollectionFromProperty ("search.sort.displayOrder" , sortDisplayOrder , properties , "\\ |" );
243
+ sortDisplayOrder = Collections .unmodifiableList (sortDisplayOrder );
228
244
229
245
// Access field names
230
246
this .setAllowPatronAccess (new Boolean (properties .getProperty ("search.access.allowPatrons" , "true" )));
231
247
populateCollectionFromProperty ("search.access.fields" , accessFields , properties , "," );
232
248
populateCollectionFromProperty ("search.access.filterableFields" , accessFilterableFields , properties , "," );
249
+ accessFields = Collections .unmodifiableSet (accessFields );
250
+ accessFilterableFields = Collections .unmodifiableSet (accessFilterableFields );
233
251
234
252
// Resource Types
235
253
setResourceTypeFile (properties .getProperty ("search.resource.type.file" , "" ));
@@ -242,6 +260,9 @@ public void setProperties(Properties properties) {
242
260
populateCollectionFromProperty ("search.resource.searchDefault" , defaultResourceTypes , properties , "," );
243
261
populateCollectionFromProperty ("search.resource.collectionDefault" , defaultCollectionResourceTypes ,
244
262
properties , "," );
263
+ resourceTypes = Collections .unmodifiableSet (resourceTypes );
264
+ defaultResourceTypes = Collections .unmodifiableList (defaultResourceTypes );
265
+ defaultCollectionResourceTypes = Collections .unmodifiableList (defaultCollectionResourceTypes );
245
266
246
267
Iterator <Map .Entry <Object , Object >> propIt = properties .entrySet ().iterator ();
247
268
while (propIt .hasNext ()) {
@@ -258,6 +279,7 @@ public void setProperties(Properties properties) {
258
279
this .sortTypes .put (propertyKey .substring (propertyKey .lastIndexOf ("." ) + 1 ), sortFields );
259
280
}
260
281
}
282
+ sortTypes = Collections .unmodifiableMap (sortTypes );
261
283
}
262
284
263
285
public int getFacetsPerGroup () {
0 commit comments