Changeset 8172
- Timestamp:
- 20/03/12 15:14:43 (9 years ago)
- Location:
- mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/CommonMethods.java
r8126 r8172 35 35 * the SELECT clause where the fields used by the ORDER BY clause have to be 36 36 * added. 37 * @throws AssembleQueryException 38 * @throws NdgExecutionException 37 * @throws AssembleQueryException 39 38 * */ 40 39 StringBuffer getOrderBy(RetrieveCriteriaType criteria, StringBuffer sqlCmd) throws AssembleQueryException { … … 66 65 // name? 67 66 if (order.getOrderByDirection() != null) { 68 ListNamesItem direction = DiscoveryDictionaryDPWS.getOrderDirection(order 69 .getOrderByDirection().toString()); 70 /* 71 * -- Append direction for the ORDER BY specific field -- 72 */ 73 orderSQL.append(" "); 74 orderSQL.append(direction.getName()); 67 try { 68 ListNamesItem direction = DiscoveryDictionaryDPWS.getOrderDirection(order 69 .getOrderByDirection().toString()); 70 /* 71 * -- Append direction for the ORDER BY specific field -- 72 */ 73 orderSQL.append(" "); 74 orderSQL.append(direction.getName()); 75 } catch (NdgExecutionException e) { 76 throw new AssembleQueryException(e); 77 } 78 75 79 } 76 80 -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/DiscoveryService.java
r8126 r8172 141 141 } catch (SQLException e) { 142 142 throw new NdgExecutionException(e); 143 } catch (NdgSQLException e) { 144 throw new NdgExecutionException(e); 145 } catch (AssembleQueryException e) { 146 throw new NdgExecutionException(e); 147 } catch (ResourceNotAvailable e) { 143 } catch (NdgException e) { 148 144 throw new NdgExecutionException(e); 149 145 } finally { … … 165 161 throw new NdgExecutionException(e); 166 162 } catch (NdgSQLException e) { 167 throw new NdgExecutionException(e);168 } catch (AssembleQueryException e) {169 throw new NdgExecutionException(e);170 } catch (ResourceNotAvailable e) {171 163 throw new NdgExecutionException(e); 172 164 } catch (NdgException e) { -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/PresentHelper.java
r8126 r8172 20 20 import ndg.common.exception.AssembleQueryException; 21 21 import ndg.common.exception.NdgException; 22 import ndg.common.exception.NdgExecutionException; 22 23 import ndg.common.exception.NdgSQLException; 23 24 import ndg.common.exception.ResourceNotAvailable; … … 98 99 @Override 99 100 void assembleSearchQuery(StringBuffer selectSQL, StringBuffer fromSQL, StringBuffer whereSQL, 100 SearchCriteria criteria, RetrieveCriteriaType retrieveType) {101 SearchCriteria criteria, RetrieveCriteriaType retrieveType) throws AssembleQueryException { 101 102 102 103 String customInfo = "dataset_metadata_update_date, original_document.authors, original_document.parameters, original_document.resource_type, original_document.topic_category, original_document.lineage, original_document.limitations_public_access, original_document.data_originator, original_document.original_format_name, original_document.resource_locator"; 103 104 104 105 String recDetail = retrieveType == null ? null : retrieveType.getRecordDetail(); 105 ListNamesItem detail = DiscoveryDictionaryDPWS.getRecordDetails(recDetail); 106 ListNamesItem detail; 107 try { 108 detail = DiscoveryDictionaryDPWS.getRecordDetails(recDetail); 109 } catch (NdgExecutionException e) { 110 throw new AssembleQueryException(e); 111 } 106 112 /** all the IFs should be revisited */ 107 113 /* … … 141 147 /* ----- FORMAT ----- */ 142 148 String formType = retrieveType != null ? retrieveType.getRecordDetail() : null; 143 ListNamesItem details = DiscoveryDictionaryDPWS.getRecordDetails(formType); 149 ListNamesItem details = null; 150 try { 151 details = DiscoveryDictionaryDPWS.getRecordDetails(formType); 152 } catch (NdgExecutionException e) { 153 throw new AssembleQueryException(e); 154 } 155 144 156 if (details.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_FULL)) { 145 157 String metaFormat = retrieveType == null ? null : retrieveType.getMetadataFormat(); … … 149 161 150 162 private void preapareFormatCondition(StringBuffer selectSQL, StringBuffer fromSQL, StringBuffer whereSQL, 151 String format) { 152 ListNamesItem docFormat = DiscoveryDictionaryDPWS.getMetadataFormat(format); 163 String format) throws AssembleQueryException { 164 ListNamesItem docFormat = null; 165 try { 166 docFormat = DiscoveryDictionaryDPWS.getMetadataFormat(format); 167 } catch (NdgExecutionException e) { 168 throw new AssembleQueryException(e); 169 } 170 153 171 154 172 checkFROMComma(selectSQL, false); … … 245 263 } 246 264 List<OriginalDocument> searchResult = executeSearch(conn, sqlQuery); 247 248 ListNamesItem detail = DiscoveryDictionaryDPWS.getRecordDetails(type == null ? null : type 249 .getRecordDetail()); 265 266 ListNamesItem detail; 267 try { 268 detail = DiscoveryDictionaryDPWS.getRecordDetails(type == null ? null : type 269 .getRecordDetail()); 270 } catch (NdgExecutionException e) { 271 throw new AssembleQueryException(e); 272 } 250 273 if (detail.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_FULL) 251 274 || detail.getLabel().equals(DiscoveryDictionaryDPWS.RECORD_DETAIL_DOCUMENT_SUMMARY)) { -
mauRepo/revitalizationProject/branches/MEDIN/dpws/src/main/java/ndg/services/revitalization/ejb/discovery/SearchHelper.java
r8126 r8172 82 82 */ 83 83 public List<OriginalDocument> doSearch() throws NdgException, ResourceNotAvailable { 84 DiscoveryDictionaryDPWS.refreshListNames();85 86 84 List<OriginalDocument> searchResult = null; 87 85 searchResult = searchDocuments(searchType); … … 140 138 try { 141 139 preapareTermSearch(fromSQL, whereSQL, criteria.getTermSearch()); 140 /* -- is a SpatialSearch? -- */ 141 preapareSpatialSearch(fromSQL, whereSQL, criteria.getSpatialSearch()); 142 143 /* -- is a TemporalSearch? -- */ 144 preapareTemporalSearch(fromSQL, whereSQL, criteria.getTemporalSearch()); 145 146 /* -- defines the ResourceLocator status? -- */ 147 Boolean rl = criteria.getResourceLocator() != null ? criteria.getResourceLocator().getValue() : null; 148 preapareResourceLocatorSearch(fromSQL, whereSQL, rl); 149 150 /* -- has Scope request? -- */ 151 preapareScopeSearch(fromSQL, whereSQL, searchType.getScope()); 152 153 /* -- has an OriginalFormat request? -- */ 154 preapareOriginalFormatSearch(fromSQL, whereSQL, searchType.getOriginalFormat()); 142 155 } catch (NdgExecutionException e) { 143 156 throw new AssembleQueryException(e); 144 } 145 146 /* -- is a SpatialSearch? -- */ 147 preapareSpatialSearch(fromSQL, whereSQL, criteria.getSpatialSearch()); 148 149 /* -- is a TemporalSearch? -- */ 150 preapareTemporalSearch(fromSQL, whereSQL, criteria.getTemporalSearch()); 151 152 /* -- defines the ResourceLocator status? -- */ 153 Boolean rl = criteria.getResourceLocator() != null ? criteria.getResourceLocator().getValue() : null; 154 preapareResourceLocatorSearch(fromSQL, whereSQL, rl); 155 156 /* -- has Scope request? -- */ 157 preapareScopeSearch(fromSQL, whereSQL, searchType.getScope()); 158 159 /* -- has an OriginalFormat request? -- */ 160 preapareOriginalFormatSearch(fromSQL, whereSQL, searchType.getOriginalFormat()); 157 } 161 158 } 162 159 … … 233 230 234 231 private void preapareTermSearch(StringBuffer fromSQL, StringBuffer whereSQL, List<TermSearchType> oterms) 235 throws AssembleQueryException , NdgExecutionException{232 throws AssembleQueryException { 236 233 if (oterms == null || oterms.size() == 0) { 237 234 return; … … 244 241 TermParser parser = new TermParser(); 245 242 String[] phrases = null; 246 List<TermSearchType> terms = aggregateTermTarget(oterms); 243 List<TermSearchType> terms; 244 try { 245 terms = aggregateTermTarget(oterms); 246 } catch (NdgExecutionException e) { 247 throw new AssembleQueryException(e); 248 } 247 249 for (TermSearchType termType : terms) { 248 250 String term = termType.getTerm(); … … 258 260 term = parser.parseTerm(term); 259 261 260 ListNamesItem listNamesItem = EJBBeanFactory.getDiscoveryService().getNamesListItemByLabel(termType.getTermTarget()); 262 ListNamesItem listNamesItem; 263 try { 264 listNamesItem = EJBBeanFactory.getDiscoveryService().getNamesListItemByLabel(termType.getTermTarget()); 265 } catch (NoResultException e) { 266 throw new AssembleQueryException(e); 267 } catch (NdgExecutionException e) { 268 throw new AssembleQueryException(e); 269 } 261 270 //logHelper.logMessage("Search term - TermTarget: " + term + " - " + termTarget, Level.DEBUG); 262 271 … … 307 316 } 308 317 309 private void preapareTemporalSearch(StringBuffer fromSQL, StringBuffer whereSQL, TemporalType temporalType) {318 private void preapareTemporalSearch(StringBuffer fromSQL, StringBuffer whereSQL, TemporalType temporalType) throws NdgExecutionException { 310 319 if (temporalType == null || temporalType.getDateRange() == null 311 320 || temporalType.getDateRange().getDate().size() == 0) { … … 408 417 } 409 418 410 private void preapareSpatialSearch(StringBuffer fromSQL, StringBuffer whereSQL, SpatialType spatialType) {419 private void preapareSpatialSearch(StringBuffer fromSQL, StringBuffer whereSQL, SpatialType spatialType) throws NdgExecutionException { 411 420 if (spatialType == null) { 412 421 return; … … 466 475 } 467 476 468 private void preapareScopeSearch(StringBuffer fromSQL, StringBuffer whereSQL, List<String> scopes) {477 private void preapareScopeSearch(StringBuffer fromSQL, StringBuffer whereSQL, List<String> scopes) throws NdgExecutionException { 469 478 if (scopes == null || scopes.size() == 0) { 470 479 return; … … 504 513 } 505 514 506 void preapareOriginalFormatSearch(StringBuffer fromSQL, StringBuffer whereSQL, String originalFormat) {515 void preapareOriginalFormatSearch(StringBuffer fromSQL, StringBuffer whereSQL, String originalFormat) throws NdgExecutionException { 507 516 if (originalFormat == null) { 508 517 return;
Note: See TracChangeset
for help on using the changeset viewer.