/** * Set the DSpaceObject that is the container for this browse. If this * is not of type Collection or Community, this method will throw an * exception * * @param dso the container object; a Community or Collection * @throws BrowseException if browse error */ public void setBrowseContainer(DSpaceObject dso) throws BrowseException { if (dso instanceof Collection) { this.collection = (Collection) dso; } else if (dso instanceof Community) { this.community = (Community) dso; } else { throw new BrowseException("The container must be a community or a collection"); } }
return e.getMessage(); } catch (BrowseException e) { return e.getMessage();
throw new IOException(e.getMessage(), e);
/** * Set the DSpaceObject that is the container for this browse. If this * is not of type Collection or Community, this method will throw an * exception * * @param dso the container object; a Community or Collection * @throws BrowseException if browse error */ public void setBrowseContainer(DSpaceObject dso) throws BrowseException { if (dso instanceof Collection) { this.collection = (Collection) dso; } else if (dso instanceof Community) { this.community = (Community) dso; } else { throw new BrowseException("The container must be a community or a collection"); } }
bis = BrowseIndex.getBrowseIndices(); } catch (BrowseException e) { log.error(e.getMessage(), e); throw new IllegalStateException(e);
/** * Construct a new object which will obtain the configuration for itself. * * @throws BrowseException if browse error */ public CrossLinks() throws BrowseException { int i = 1; while (true) { String field = "webui.browse.link." + i; String config = ConfigurationManager.getProperty(field); if (config == null) { break; } String[] parts = config.split(":"); if (parts.length != 2) { throw new BrowseException("Invalid configuration for " + field + ": " + config); } links.put(parts[1], parts[0]); i++; } }
throw new BrowseException("There is no configuration for webui.itemlist.columns"); throw new BrowseException(e);
/** * Pass in some SQL. If print is set to true this will output to the * screen. If file is set to true, this will write to the file specified. * * @param sql SQL string * @throws BrowseException if browse error */ public void sql(String sql) throws BrowseException { if (isPrint()) { System.out.println(sql); } if (isFile()) { try { BufferedWriter out = new BufferedWriter(new FileWriter(fileName, isAppend())); out.write(sql + "\n"); out.close(); setAppend(true); } catch (IOException e) { throw new BrowseException(e); } } }
/** * Get an instance of the relevant Read Only DAO class, which will * conform to the BrowseDAO interface * * @param context the DSpace context * @return the relevant DAO * @throws BrowseException if browse error */ public static BrowseDAO getInstance(Context context) throws BrowseException { String className = ConfigurationManager.getProperty("browseDAO.class"); if (className == null) { // SOLR implementation is the default since DSpace 4.0 return new SolrBrowseDAO(context); } try { return (BrowseDAO) Class .forName(ConfigurationManager.getProperty("browseDAO.class")) .getConstructor(Context.class).newInstance(context); } catch (Exception e) { throw new BrowseException("The configuration for browseDAO is invalid: " + className, e); } } }
throw new BrowseException("Browse Index configuration is not valid: webui.browse.index." + number + " = " + definition); throw new BrowseException("Error in SortOptions", se);
@Override public String doMaxQuery(String column, String table, int itemID) throws BrowseException { DiscoverQuery query = new DiscoverQuery(); query.setQuery("search.resourceid:" + itemID + " AND search.resourcetype:" + Constants.ITEM); query.setMaxResults(1); DiscoverResult resp = null; try { resp = searcher.search(context, query); } catch (SearchServiceException e) { throw new BrowseException(e); } if (resp.getTotalSearchResults() > 0) { SearchDocument doc = resp.getSearchDocument( resp.getDspaceObjects().get(0)).get(0); return (String) doc.getSearchFieldValues(column).get(0); } return null; }
throw new BrowseException("Error in SortOptions", se);
|| !itemsDiscoverable); } catch (SearchServiceException e) { throw new BrowseException(e);
resp = searcher.search(context, query, includeUnDiscoverable); } catch (SearchServiceException e) { throw new BrowseException(e);
} catch (SQLException e) { log.error("caught exception: ", e); throw new BrowseException(e);
} catch (SQLException e) { log.error("caught exception: ", e); throw new BrowseException(e);