Revision 8134
Added by Jing Tao over 11 years ago
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/resourcemap/ResourceMapSubprocessor.java | ||
---|---|---|
1 | 1 |
/** |
2 |
* '$RCSfile$' |
|
3 |
* Purpose: A class that gets Accession Number, check for uniqueness |
|
4 |
* and register it into db |
|
5 |
* Copyright: 2000 Regents of the University of California and the |
|
6 |
* National Center for Ecological Analysis and Synthesis |
|
7 |
* Authors: Jivka Bojilova, Matt Jones |
|
8 |
* |
|
9 |
* '$Author: leinfelder $' |
|
10 |
* '$Date: 2011-11-02 20:40:12 -0700 (Wed, 02 Nov 2011) $' |
|
11 |
* '$Revision: 6595 $' |
|
12 |
* |
|
13 | 2 |
* This program is free software; you can redistribute it and/or modify |
14 | 3 |
* it under the terms of the GNU General Public License as published by |
15 | 4 |
* the Free Software Foundation; either version 2 of the License, or |
... | ... | |
114 | 103 |
@Override |
115 | 104 |
public Map<String, SolrDoc> processDocument(String identifier, Map<String, SolrDoc> docs, |
116 | 105 |
Document doc) throws IOException, EncoderException, SAXException, |
117 |
XPathExpressionException, ParserConfigurationException, SolrServerException, NotImplemented, NotFound, UnsupportedType, OREParserException { |
|
106 |
XPathExpressionException, ParserConfigurationException, SolrServerException, NotImplemented, NotFound, UnsupportedType, OREParserException, ResourceMapException {
|
|
118 | 107 |
SolrDoc resourceMapDoc = docs.get(identifier); |
119 | 108 |
List<SolrDoc> processedDocs = processResourceMap(resourceMapDoc, doc); |
120 | 109 |
Map<String, SolrDoc> processedDocsMap = new HashMap<String, SolrDoc>(); |
... | ... | |
125 | 114 |
} |
126 | 115 |
|
127 | 116 |
private List<SolrDoc> processResourceMap(SolrDoc indexDocument, Document resourceMapDocument) |
128 |
throws XPathExpressionException, IOException, SAXException, ParserConfigurationException, EncoderException, SolrServerException, NotImplemented, NotFound, UnsupportedType, OREParserException{ |
|
117 |
throws XPathExpressionException, IOException, SAXException, ParserConfigurationException, EncoderException, SolrServerException, NotImplemented, NotFound, UnsupportedType, OREParserException, ResourceMapException{
|
|
129 | 118 |
//ResourceMap resourceMap = new ResourceMap(resourceMapDocument); |
130 | 119 |
ResourceMap resourceMap = new ResourceMap(resourceMapDocument); |
131 | 120 |
List<String> documentIds = resourceMap.getAllDocumentIDs();//this list includes the resourceMap id itself. |
... | ... | |
145 | 134 |
return mergedDocuments; |
146 | 135 |
} |
147 | 136 |
|
148 |
private List<SolrDoc> getSolrDocs(String resourceMapId, List<String> ids) throws SolrServerException, IOException, ParserConfigurationException, SAXException, XPathExpressionException, NotImplemented, NotFound, UnsupportedType { |
|
137 |
private List<SolrDoc> getSolrDocs(String resourceMapId, List<String> ids) throws SolrServerException, IOException, ParserConfigurationException, SAXException, XPathExpressionException, NotImplemented, NotFound, UnsupportedType, ResourceMapException {
|
|
149 | 138 |
List<SolrDoc> list = new ArrayList<SolrDoc>(); |
150 | 139 |
if(ids != null) { |
151 | 140 |
for(String id : ids) { |
... | ... | |
153 | 142 |
if(doc != null) { |
154 | 143 |
list.add(doc); |
155 | 144 |
} else if ( !id.equals(resourceMapId)) { |
156 |
throw new SolrServerException("Solr index doesn't have the information about the id "+id+" which is a component in the resource map "+resourceMapId+". Metacat-Index can't process the resource map prior to its components.");
|
|
145 |
throw new ResourceMapException("Solr index doesn't have the information about the id "+id+" which is a component in the resource map "+resourceMapId+". Metacat-Index can't process the resource map prior to its components.");
|
|
157 | 146 |
} |
158 | 147 |
} |
159 | 148 |
} |
Also available in: Unified diff
Use the ResourceMapException when a component of a resource map isn't found in the solr index.