diff --git a/common/src/main/java/org/fao/geonet/utils/XmlRequest.java b/common/src/main/java/org/fao/geonet/utils/XmlRequest.java index eccb6ca4f3e..7b6a3b69c59 100644 --- a/common/src/main/java/org/fao/geonet/utils/XmlRequest.java +++ b/common/src/main/java/org/fao/geonet/utils/XmlRequest.java @@ -118,7 +118,7 @@ protected final Element executeAndReadResponse(HttpRequestBase httpMethod) throw final ClientHttpResponse httpResponse = doExecute(httpMethod); if (httpResponse.getRawStatusCode() > 399) { - httpMethod.releaseConnection(); + httpMethod.releaseConnection(); throw new BadServerResponseEx(httpResponse.getStatusText() + " -- URI: " + httpMethod.getURI() + " -- Response Code: " + httpResponse.getRawStatusCode()); diff --git a/common/src/main/java/org/fao/geonet/utils/XmlResolver.java b/common/src/main/java/org/fao/geonet/utils/XmlResolver.java index 6323217eda4..70f6316634b 100644 --- a/common/src/main/java/org/fao/geonet/utils/XmlResolver.java +++ b/common/src/main/java/org/fao/geonet/utils/XmlResolver.java @@ -127,10 +127,10 @@ public LSInput resolveResource(String type, String namespaceURI, String publicId } } } catch (MalformedURLException e) { // leave this to someone else? - e.printStackTrace(); + Log.error(Log.XML_RESOLVER, e.getMessage(), e); return result; } catch (URISyntaxException e) { // leave this to someone else? - e.printStackTrace(); + Log.error(Log.XML_RESOLVER, e.getMessage(), e); return result; } @@ -141,8 +141,7 @@ public LSInput resolveResource(String type, String namespaceURI, String publicId try { elResult = isXmlInCache(externalRef.toString()); } catch (CacheException e) { - Log.error(Log.XML_RESOLVER, "Request to cache for " + externalRef + " failed."); - e.printStackTrace(); + Log.error(Log.XML_RESOLVER, "Request to cache for " + externalRef + " failed.", e); } if (elResult == null) { // use XMLRequest to get the XML diff --git a/core/src/main/java/jeeves/config/springutil/LogoutUserSessionHandler.java b/core/src/main/java/jeeves/config/springutil/LogoutUserSessionHandler.java index 63980a8ab52..0f0e083f7ee 100644 --- a/core/src/main/java/jeeves/config/springutil/LogoutUserSessionHandler.java +++ b/core/src/main/java/jeeves/config/springutil/LogoutUserSessionHandler.java @@ -50,6 +50,7 @@ public void logout(HttpServletRequest request, UserSession userSession = (UserSession) tmp; userSession.clear(); } + httpSession.invalidate(); } } diff --git a/core/src/main/java/org/fao/geonet/constants/Geonet.java b/core/src/main/java/org/fao/geonet/constants/Geonet.java index b072b4a1ae9..fce9db2dfc2 100644 --- a/core/src/main/java/org/fao/geonet/constants/Geonet.java +++ b/core/src/main/java/org/fao/geonet/constants/Geonet.java @@ -99,6 +99,11 @@ public final class Geonet { public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy_HHmm"); public static final String BATCHEDIT_BACKUP_BUCKET = "https://s3-ap-southeast-2.amazonaws.com/ga-ecat3-batchedit/"; + public static final String BATCHEDIT_REPORT = "be_report"; + public static final String BATCHEDIT_BACKUP = "be_backup"; + public static final String BATCHEDIT_PROGRESS = "be_progress"; + public static final String CSV_DOWNLOAD_STATUS = "csv_download_status"; + /** * Container for file names. */ @@ -479,6 +484,8 @@ public static final class SearchResult { */ public static final String ECAT_ID = "eCatId"; + public static final String KEYWORD = "keyword"; + /** * Attrset used in Z39.50 search */ @@ -545,6 +552,7 @@ public static final class SortBy { public static final String RATING = "rating"; public static final String POPULARITY = "popularity"; public static final String DATE = "changeDate"; + public static final String PUBLICATION_DATE = "publicationDate"; /** * Parameter name: {@value #_TITLE} - Title not tokenized mainly used for sorting @@ -552,6 +560,7 @@ public static final class SortBy { */ public static final String TITLE = "title"; public static final String SCALE_DENOMINATOR = "denominator"; + public static final String ECATID = "eCatId"; } } diff --git a/core/src/main/java/org/fao/geonet/guiservices/schemas/GetSchemaInfo.java b/core/src/main/java/org/fao/geonet/guiservices/schemas/GetSchemaInfo.java index 65af53a9de7..7f47a2fdfa2 100644 --- a/core/src/main/java/org/fao/geonet/guiservices/schemas/GetSchemaInfo.java +++ b/core/src/main/java/org/fao/geonet/guiservices/schemas/GetSchemaInfo.java @@ -30,6 +30,7 @@ import org.fao.geonet.GeonetContext; import org.fao.geonet.constants.Geonet; import org.fao.geonet.kernel.SchemaManager; +import org.fao.geonet.utils.Log; import org.jdom.Element; import java.nio.file.Path; @@ -69,8 +70,7 @@ public Element exec(Element params, ServiceContext context) throws Exception { schemas.addContent(schemaElem); } } catch (Exception e) { - context.error("Failed to load guiservices for schema " + schema + ": " + e.getMessage()); - e.printStackTrace(); + Log.error(Geonet.GEONETWORK, "Failed to load guiservices for schema "+schema+": "+e.getMessage(), e); } } diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/BatchEditReport.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/BatchEditReport.java index 966d312a45e..0375ca46904 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/BatchEditReport.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/BatchEditReport.java @@ -10,17 +10,25 @@ public class BatchEditReport implements Serializable { private List processInfo; public List getErrorInfo() { - if (errorInfo == null) { - errorInfo = new ArrayList<>(); + if(this.errorInfo == null){ + return new ArrayList(); } - return errorInfo; + return new ArrayList(this.errorInfo); + } + + public void setErrorInfo(List errorInfo) { + this.errorInfo = new ArrayList(errorInfo); } public List getProcessInfo() { - if (processInfo == null) { - processInfo = new ArrayList<>(); + if(this.processInfo == null){ + return new ArrayList(); } - return processInfo; + return new ArrayList(this.processInfo); + } + + public void setProcessInfo(List processInfo) { + this.processInfo = new ArrayList(processInfo); } } diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/CSVBatchEdit.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/CSVBatchEdit.java index c7277f52bcb..ae965c1eed8 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/CSVBatchEdit.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/CSVBatchEdit.java @@ -105,6 +105,7 @@ public BatchEditReport removeOrAddElements(ApplicationContext context, ServiceCo XPath _xpath, Document metadata, List listOfUpdates, String mode) { BatchEditReport report = new BatchEditReport(); + final SchemaManager schemaManager = context.getBean(SchemaManager.class); String headerVal = header.getKey(); EditElement editElement = EditElementFactory.getElementType(headerVal); @@ -117,6 +118,9 @@ public BatchEditReport removeOrAddElements(ApplicationContext context, ServiceCo } if(StringUtils.isNotEmpty(csvr.get(headerVal).trim())){ + + List errs = report.getErrorInfo(); + if(editElement != null){ if(checkDependencies(headerVal, csvr) && mode.equals("remove")){ @@ -133,7 +137,7 @@ public BatchEditReport removeOrAddElements(ApplicationContext context, ServiceCo } catch (Exception e) { //Log.error(Geonet.SEARCH_ENGINE, "Unable to remove existing element for eCatId/UUID " + id +" for the value " + csvr.get(headerVal) +", " + e.getLocalizedMessage()); - report.getErrorInfo().add("Unable to remove existing element for the value " + csvr.get(headerVal) +", " + e.getMessage()); + errs.add("Unable to remove existing element for the value " + csvr.get(headerVal) +", " + e.getMessage()); } } @@ -150,7 +154,7 @@ public BatchEditReport removeOrAddElements(ApplicationContext context, ServiceCo } } catch (Exception e) { //Log.error(Geonet.SEARCH_ENGINE, "Unable to set the attribute for eCatId/UUID " + id +" for the value " + csvr.get(headerVal) +", " + e.getMessage()); - report.getErrorInfo().add("Unable to set the attribute for the value, " + headerVal + ": "+ csvr.get(headerVal) +", " + e.getMessage()); + errs.add("Unable to set the attribute for the value, " + headerVal + ": "+ csvr.get(headerVal) +", " + e.getMessage()); } } else { try { @@ -165,9 +169,10 @@ public BatchEditReport removeOrAddElements(ApplicationContext context, ServiceCo } } catch (Exception e) { //Log.error(Geonet.SEARCH_ENGINE, "Unable to set text for eCatId/UUID " + id +" for the value " + csvr.get(headerVal) +", " + e.getLocalizedMessage()); - report.getErrorInfo().add("Unable to set text for the value, " + headerVal + ": "+ csvr.get(headerVal) +", " + e.getMessage()); + errs.add("Unable to set text for the value, " + headerVal + ": "+ csvr.get(headerVal) +", " + e.getMessage()); } } + report.setErrorInfo(errs); } return report; diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/ConstraintsEditElement.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/ConstraintsEditElement.java index 9a585b40a1a..7f205311238 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/ConstraintsEditElement.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/ConstraintsEditElement.java @@ -39,7 +39,9 @@ public void removeAndAddElement(CSVBatchEdit batchEdit, ApplicationContext conte } }catch(BatchEditException e){ - report.getErrorInfo().add(e.getMessage()); + List errs = report.getErrorInfo(); + errs.add(e.getMessage()); + report.setErrorInfo(errs); } diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/ContactEditElement.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/ContactEditElement.java index 64d93115a46..a5ee46d1bd3 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/ContactEditElement.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/ContactEditElement.java @@ -90,7 +90,9 @@ public void removeAndAddElement(CSVBatchEdit batchEdit, ApplicationContext conte } } }catch(BatchEditException e){ - report.getErrorInfo().add(e.getMessage()); + List errs = report.getErrorInfo(); + errs.add(e.getMessage()); + report.setErrorInfo(errs); } } diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/CustomElement.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/CustomElement.java index 9e14b65bb93..d5cc819c771 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/CustomElement.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/CustomElement.java @@ -59,7 +59,9 @@ public void removeAndAddElement(CSVBatchEdit batchEdit, ApplicationContext conte }catch(Exception e){ - report.getErrorInfo().add("Unable to process : " + headerVal + ", exception: " +e.getMessage()); + List errs = report.getErrorInfo(); + errs.add("Unable to process : " + headerVal + ", exception: " +e.getMessage()); + report.setErrorInfo(errs); } } diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/DateEditElement.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/DateEditElement.java index 97e68a8ebce..283ccb5c289 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/DateEditElement.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/DateEditElement.java @@ -26,7 +26,6 @@ import org.apache.commons.csv.CSVRecord; import org.fao.geonet.constants.Geonet; import org.fao.geonet.exceptions.BatchEditException; -import org.fao.geonet.utils.Log; import org.jdom.Element; import org.jdom.output.XMLOutputter; import org.jdom.xpath.XPath; @@ -60,7 +59,9 @@ public void removeAndAddElement(CSVBatchEdit batchEdit, ApplicationContext conte try { rootE = getCitationDateElement(batchEdit, values); } catch (BatchEditException e) { - report.getErrorInfo().add(e.getMessage()); + List errs = report.getErrorInfo(); + errs.add(e.getMessage()); + report.setErrorInfo(errs); } String strEle = out.outputString(rootE); diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/EditElementFactory.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/EditElementFactory.java index d966547baf4..1e3ee1c5e6b 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/EditElementFactory.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/EditElementFactory.java @@ -20,7 +20,6 @@ package org.fao.geonet.kernel.batchedit; import org.fao.geonet.constants.Geonet; -import org.fao.geonet.utils.Log; /** * diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/KeywordEditElement.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/KeywordEditElement.java index e7723ddead3..94cd420ce96 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/KeywordEditElement.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/KeywordEditElement.java @@ -68,7 +68,9 @@ public void removeAndAddElement(CSVBatchEdit batchEdit, ApplicationContext conte rootE = getKeywordElementWithThesaurus(keyword, context, serContext); } catch (BatchEditException e) { - report.getErrorInfo().add(e.getMessage()); + List errs = report.getErrorInfo(); + errs.add(e.getMessage()); + report.setErrorInfo(errs); } if (rootE != null) { diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/MetadataEditElement.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/MetadataEditElement.java index 5c41bccef6a..6b76aa1757c 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/MetadataEditElement.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/MetadataEditElement.java @@ -70,7 +70,9 @@ public void removeAndAddElement(CSVBatchEdit batchEdit, ApplicationContext conte if(headerVal.equalsIgnoreCase(Geonet.EditType.MD_PARENT)) rootE = getMdparentElement(context, serContext, batchEdit, values); } catch (BatchEditException e) { - report.getErrorInfo().add(e.getMessage()); + List errs = report.getErrorInfo(); + errs.add(e.getMessage()); + report.setErrorInfo(errs); } if (rootE != null) { diff --git a/core/src/main/java/org/fao/geonet/kernel/batchedit/OnlineResourceEditElement.java b/core/src/main/java/org/fao/geonet/kernel/batchedit/OnlineResourceEditElement.java index 218f1d2e4a6..d144bb1062d 100644 --- a/core/src/main/java/org/fao/geonet/kernel/batchedit/OnlineResourceEditElement.java +++ b/core/src/main/java/org/fao/geonet/kernel/batchedit/OnlineResourceEditElement.java @@ -82,7 +82,9 @@ public void removeAndAddElement(CSVBatchEdit batchEdit, ApplicationContext conte rootE = additionalInformation(name, desc, linkage, protocol, function); } } catch (BatchEditException e) { - report.getErrorInfo().add(e.getMessage()); + List errs = report.getErrorInfo(); + errs.add(e.getMessage()); + report.setErrorInfo(errs); } if(rootE != null){ diff --git a/core/src/main/java/org/fao/geonet/kernel/search/LuceneConfig.java b/core/src/main/java/org/fao/geonet/kernel/search/LuceneConfig.java index a0ac8db2613..cbf6c07f10a 100644 --- a/core/src/main/java/org/fao/geonet/kernel/search/LuceneConfig.java +++ b/core/src/main/java/org/fao/geonet/kernel/search/LuceneConfig.java @@ -314,7 +314,7 @@ private void load(ServletContext servletContext, String luceneConfigXmlFile) { fieldBoost.put(name, Float.parseFloat(boost)); } catch (Exception exc) { // TODO: handle exception - exc.printStackTrace(); + Log.error(Geonet.SEARCH_ENGINE, "LuceneConfig error: " + exc.getMessage(), exc); } } } @@ -481,8 +481,7 @@ private void loadClassParameters(int type, String field, String clazz, List c } catch (ClassNotFoundException e) { Log.warning(Geonet.SEARCH_ENGINE, " Class not found for parameter: " + name - + ", type: " + paramType); - e.printStackTrace(); + + ", type: " + paramType, e); return; } diff --git a/core/src/main/java/org/fao/geonet/kernel/search/LuceneOptimizerJob.java b/core/src/main/java/org/fao/geonet/kernel/search/LuceneOptimizerJob.java index a6c7fec9715..0a7c420a6b7 100644 --- a/core/src/main/java/org/fao/geonet/kernel/search/LuceneOptimizerJob.java +++ b/core/src/main/java/org/fao/geonet/kernel/search/LuceneOptimizerJob.java @@ -52,8 +52,7 @@ public void execute(JobExecutionContext context) indexTracker.optimize(); } catch (Exception e) { Log.error(Geonet.INDEX_ENGINE, - "Optimize task failed: " + e.getMessage()); - e.printStackTrace(); + "Optimize task failed: " + e.getMessage(), e); } } diff --git a/core/src/main/java/org/fao/geonet/kernel/search/LuceneSearcher.java b/core/src/main/java/org/fao/geonet/kernel/search/LuceneSearcher.java index 38eac53227d..cc550a43e74 100644 --- a/core/src/main/java/org/fao/geonet/kernel/search/LuceneSearcher.java +++ b/core/src/main/java/org/fao/geonet/kernel/search/LuceneSearcher.java @@ -450,6 +450,8 @@ private static SortField makeSortField(String sortBy, boolean sortOrder, String sortType = SortField.Type.INT; sortBy = "_" + sortBy; } else if (sortBy.equals(Geonet.SearchResult.SortBy.SCALE_DENOMINATOR)) { + sortType = SortField.Type.INT; + } else if (sortBy.equals(Geonet.SearchResult.SortBy.ECATID)) { sortType = SortField.Type.INT; } else if (sortBy.equals(Geonet.SearchResult.SortBy.DATE) || sortBy.equals(Geonet.SearchResult.SortBy.TITLE)) { @@ -1059,13 +1061,13 @@ public static String analyzeText(String field, String requestStr, PerFieldAnalyz } } catch (Exception e) { // TODO why swallow - e.printStackTrace(); + Log.error(Geonet.SEARCH_ENGINE, "analyzeText error:" + e.getMessage(), e); } finally { if (ts != null) { try { ts.close(); } catch (IOException e) { - e.printStackTrace(); + Log.error(Geonet.SEARCH_ENGINE, "analyzeText error closing TokenStream:" + e.getMessage(), e); } } } @@ -1429,6 +1431,11 @@ private void computeQuery(ServiceContext srvContext, Element request, ServiceCon eCatId.setText(eCatId.getText().replace(",", " or ")); } + Element keyword = request.getChild(Geonet.SearchResult.KEYWORD); + if (keyword != null) { + keyword.setText(keyword.getText() + "*"); + } + _summaryConfig = _luceneConfig.getSummaryTypes().get(resultType); final Element summaryItemsEl = request.getChild(Geonet.SearchResult.SUMMARY_ITEMS); @@ -1654,6 +1661,10 @@ private void computeQuery(ServiceContext srvContext, Element request, ServiceCon sortBy = Geonet.SearchResult.SortBy.TITLE; } + if(sortBy.startsWith(Geonet.SearchResult.SortBy.PUBLICATION_DATE)){ + sortBy = Geonet.SearchResult.SortBy.PUBLICATION_DATE; + } + boolean sortOrder = (Util.getParam(request, Geonet.SearchResult.SORT_ORDER, "").equals("")); if (Log.isDebugEnabled(Geonet.SEARCH_ENGINE)) Log.debug(Geonet.SEARCH_ENGINE, "Sorting by : " + sortBy); diff --git a/core/src/main/java/org/fao/geonet/kernel/search/StopwordFileParser.java b/core/src/main/java/org/fao/geonet/kernel/search/StopwordFileParser.java index 2703f9e6c21..8f2f4c5bd32 100644 --- a/core/src/main/java/org/fao/geonet/kernel/search/StopwordFileParser.java +++ b/core/src/main/java/org/fao/geonet/kernel/search/StopwordFileParser.java @@ -84,8 +84,7 @@ public static Set parse(Path filepath) { Log.warning(Geonet.INDEX_ENGINE, "Invalid stopwords file: " + file.toAbsolutePath()); } } catch (IOException x) { - Log.warning(Geonet.INDEX_ENGINE, x.getMessage() + " (this exception is swallowed)"); - x.printStackTrace(); + Log.warning(Geonet.INDEX_ENGINE, x.getMessage() + " (this exception is swallowed)", x); } if (stopwords != null) { if (Log.isDebugEnabled(Geonet.INDEX_ENGINE)) diff --git a/schemas/iso19115-3/src/main/plugin/iso19115-3/formatter/xsl-view/view.xsl b/schemas/iso19115-3/src/main/plugin/iso19115-3/formatter/xsl-view/view.xsl index 88bec2837c7..50b6969573c 100644 --- a/schemas/iso19115-3/src/main/plugin/iso19115-3/formatter/xsl-view/view.xsl +++ b/schemas/iso19115-3/src/main/plugin/iso19115-3/formatter/xsl-view/view.xsl @@ -18,6 +18,7 @@ xmlns:msr="http://standards.iso.org/iso/19115/-3/msr/1.0" xmlns:mrd="http://standards.iso.org/iso/19115/-3/mrd/1.0" xmlns:mdq="http://standards.iso.org/iso/19157/-2/mdq/1.0" + xmlns:mmi="http://standards.iso.org/iso/19115/-3/mmi/1.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:srv="http://standards.iso.org/iso/19115/-3/srv/2.0" xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0" @@ -69,12 +70,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schemas/iso19115-3/src/main/plugin/iso19115-3/index-fields/common.xsl b/schemas/iso19115-3/src/main/plugin/iso19115-3/index-fields/common.xsl index 2d919cf90cb..3b7c08f3b9d 100644 --- a/schemas/iso19115-3/src/main/plugin/iso19115-3/index-fields/common.xsl +++ b/schemas/iso19115-3/src/main/plugin/iso19115-3/index-fields/common.xsl @@ -261,6 +261,21 @@ + + + + + + + + + + + + + + + @@ -270,6 +285,25 @@ + + + + + + + + + + + + + + + + + + + @@ -404,8 +438,32 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -479,10 +537,10 @@ - - @@ -515,6 +573,12 @@ + + + + + + diff --git a/schemas/iso19115-3/src/main/plugin/iso19115-3/layout/config-view/config-view-source.xml b/schemas/iso19115-3/src/main/plugin/iso19115-3/layout/config-view/config-view-source.xml index 39561ef4371..d14dd0e0b00 100644 --- a/schemas/iso19115-3/src/main/plugin/iso19115-3/layout/config-view/config-view-source.xml +++ b/schemas/iso19115-3/src/main/plugin/iso19115-3/layout/config-view/config-view-source.xml @@ -1,5 +1,5 @@ - - + diff --git a/schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-test.xml b/schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-dataset.xml similarity index 99% rename from schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-test.xml rename to schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-dataset.xml index f20fa9219cf..014df56a42d 100644 --- a/schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-test.xml +++ b/schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-dataset.xml @@ -163,7 +163,7 @@ - Digital Object Identifier + Digital Obejct Identifier @@ -269,22 +269,6 @@ geoscientificInformation - - - - - - - - - - - - - - - - @@ -303,6 +287,18 @@ + + + + + + + + + + + + diff --git a/schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-source.xml b/schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-source.xml index 41607895130..129f5e5669d 100644 --- a/schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-source.xml +++ b/schemas/iso19115-3/src/main/plugin/iso19115-3/templates/ga-19115-3-source.xml @@ -126,22 +126,6 @@ geoscientificInformation - - - - - - - - - - - - - - - - @@ -160,6 +144,18 @@ + + + + + + + + + + + + diff --git a/services/src/main/java/org/fao/geonet/api/records/MetadataDownloadApi.java b/services/src/main/java/org/fao/geonet/api/records/MetadataDownloadApi.java index 460599f0ad1..9bba925c06a 100644 --- a/services/src/main/java/org/fao/geonet/api/records/MetadataDownloadApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/MetadataDownloadApi.java @@ -16,9 +16,9 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -import java.util.concurrent.ForkJoinPool; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; import javax.xml.transform.stream.StreamResult; import org.fao.geonet.api.API; @@ -48,10 +48,6 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.async.DeferredResult; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiParam; @@ -63,10 +59,8 @@ @PreAuthorize("permitAll") @RestController public class MetadataDownloadApi implements ApplicationContextAware { - // private static final String SAMPLE_CSV_FILE = "./sample.csv"; + private ApplicationContext appContext; - boolean isDone = false; - public synchronized void setApplicationContext(ApplicationContext context) { this.appContext = context; @@ -78,7 +72,6 @@ public String downloadCSV( @ApiParam(value = ApiParams.API_PARAM_BUCKET_NAME, required = false) @RequestParam(required = false) String bucket, @RequestParam String[] exportParams, HttpServletRequest request) throws Exception { - isDone = false; ServiceContext context = ApiUtils.createServiceContext(request); Map mapParams = new HashMap(); @@ -89,7 +82,7 @@ public String downloadCSV( // return prepareCsv(context, appContext, bucket, mapParams); Path csvPath = Files.createTempFile(sessionId + "metadatas", ".csv"); Runnable task = () -> { - prepareCsv(context, appContext, bucket, mapParams, csvPath); + prepareCsv(context, appContext, bucket, mapParams, csvPath, request.getSession()); }; // start the thread @@ -100,8 +93,10 @@ public String downloadCSV( } public void prepareCsv(ServiceContext srvContext, ApplicationContext context, String bucket, - Map exportParams, Path csvPath) { + Map exportParams, Path csvPath, HttpSession session) { + boolean isDone = false; + session.setAttribute(Geonet.CSV_DOWNLOAD_STATUS, isDone); /*exportParams.entrySet().iterator().forEachRemaining(ep -> { Log.debug(Geonet.SEARCH_ENGINE, "export params values --> " + ep.getKey() + ": " + ep.getValue()); });*/ @@ -173,13 +168,15 @@ public void prepareCsv(ServiceContext srvContext, ApplicationContext context, St Log.error(Geonet.SCHEMA_MANAGER, " Download csv compilation failed, Error is " + e.getMessage()); } finally { isDone = true; + session.setAttribute(Geonet.CSV_DOWNLOAD_STATUS, isDone); } } @RequestMapping(value = "/download/status", method = RequestMethod.GET) public boolean downloadCSVStatus(HttpServletRequest request) throws Exception { - return isDone; + return (boolean) request.getSession().getAttribute(Geonet.CSV_DOWNLOAD_STATUS); + } @RequestMapping(value = "/download/csv", method = RequestMethod.GET, produces = "text/csv") diff --git a/services/src/main/java/org/fao/geonet/api/records/MetadataSearchApi.java b/services/src/main/java/org/fao/geonet/api/records/MetadataSearchApi.java index c961fb7a310..ffe48ea7c85 100644 --- a/services/src/main/java/org/fao/geonet/api/records/MetadataSearchApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/MetadataSearchApi.java @@ -52,10 +52,9 @@ public class MetadataSearchApi { SAXBuilder sb = new SAXBuilder(); + public static final String IS_SEARCHING = "isSearching"; + public static final String SEARCH_RECORDS = "searchRecords"; - private List eCatIds = new ArrayList<>(); - private boolean isSearching = false; - @ApiOperation(value = "Get records by xpath") @RequestMapping(value = "/search/xpath", consumes = { MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.POST) @@ -64,11 +63,10 @@ public class MetadataSearchApi { public void getMetadataRecordsByXpath(@ApiIgnore HttpServletRequest request, @RequestBody Map allRequestParams) throws Exception { - - isSearching = true; - if(eCatIds != null && eCatIds.size() > 0){ - eCatIds.clear(); - } + List eCatIds = new ArrayList<>(); + request.getSession().setAttribute(IS_SEARCHING, true); + request.getSession().setAttribute(SEARCH_RECORDS, eCatIds); + ServiceContext context = ApiUtils.createServiceContext(request); final MetadataRepository metadataRepository = context.getBean(MetadataRepository.class); @@ -106,7 +104,9 @@ public void getMetadataRecordsByXpath(@ApiIgnore HttpServletRequest request, if (ele != null) { Content eCatId = (Content) _eCatIdPath.selectSingleNode(ele); - eCatIds.add(eCatId.getValue()); + List eList = (List) request.getSession().getAttribute(SEARCH_RECORDS); + eList.add(eCatId.getValue()); + request.getSession().setAttribute(SEARCH_RECORDS, eList); } } catch (JDOMException e) { Log.error(Geonet.SEARCH_ENGINE, "JDOMException: " + e.getMessage()); @@ -117,7 +117,7 @@ public void getMetadataRecordsByXpath(@ApiIgnore HttpServletRequest request, } catch (Exception e) { } finally { - isSearching = false; + request.getSession().setAttribute(IS_SEARCHING, false); } }; // start the thread @@ -138,13 +138,13 @@ public void getMetadataRecordsByXpath(@ApiIgnore HttpServletRequest request, @ResponseStatus(HttpStatus.CREATED) @ResponseBody public boolean getMetadataSearchStatus(@ApiIgnore HttpServletRequest request) throws Exception { - return isSearching; + return (boolean) request.getSession().getAttribute(IS_SEARCHING); } @ApiOperation(value = "Get records by xpath") @RequestMapping(value = "/search/xpath", method = RequestMethod.GET) public @ResponseBody List getMetadataRecords(@ApiIgnore HttpServletRequest request) throws Exception { - return eCatIds; + return (List) request.getSession().getAttribute(SEARCH_RECORDS); } private List query(Map queryFields, HttpServletRequest request) throws JDOMException { diff --git a/services/src/main/java/org/fao/geonet/api/records/editing/BatchEditsApi.java b/services/src/main/java/org/fao/geonet/api/records/editing/BatchEditsApi.java index 7c99ab62733..7daf7439ff8 100644 --- a/services/src/main/java/org/fao/geonet/api/records/editing/BatchEditsApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/editing/BatchEditsApi.java @@ -37,7 +37,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Date; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -47,6 +46,7 @@ import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; @@ -87,7 +87,6 @@ import org.fao.geonet.utils.Xml; import org.jdom.Document; import org.jdom.Element; -import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; import org.jdom.xpath.XPath; import org.springframework.beans.factory.annotation.Autowired; @@ -145,15 +144,11 @@ public class BatchEditsApi implements ApplicationContextAware { @Autowired SchemaManager _schemaManager; + private ApplicationContext context; - // List reports; AmazonS3URI s3uri = new AmazonS3URI(Geonet.BATCHEDIT_BACKUP_BUCKET); - List tempBackupData = new ArrayList<>(); Gson g = new Gson(); - double pct; - SimpleMetadataProcessingReport report = new SimpleMetadataProcessingReport(); - public synchronized void setApplicationContext(ApplicationContext context) { this.context = context; } @@ -174,11 +169,13 @@ public IProcessingReport batchEdit( @ApiParam(value = ApiParams.API_PARAM_BUCKET_NAME, required = false) @RequestParam(required = false) String bucket, @RequestBody BatchEditParameter[] edits, HttpServletRequest request) throws Exception { + List listOfUpdates = Arrays.asList(edits); if (listOfUpdates.size() == 0) { throw new IllegalArgumentException("At least one edit must be defined."); } + ServiceContext serviceContext = ApiUtils.createServiceContext(request); final Set setOfUuidsToEdit; if (uuids == null) { @@ -262,24 +259,21 @@ public IProcessingReport batchEdit( @ResponseStatus(HttpStatus.CREATED) @ResponseBody public void batchUpdateUsingCSV(@RequestParam(value = "file") MultipartFile file, - @RequestParam(value = "mode") String mode, @RequestParam(value = "desc") String desc,@RequestParam(value = "backup") boolean backup , HttpServletRequest request) { - + @RequestParam(value = "mode") String mode, @RequestParam(value = "desc") String desc, + @RequestParam(value = "backup") boolean backup , HttpServletRequest request) { + ServiceContext serviceContext = ApiUtils.createServiceContext(request); - if(tempBackupData != null && tempBackupData.size() > 0){ - tempBackupData.clear(); - } + Log.debug(Geonet.SEARCH_ENGINE, "ECAT, BatchEditsApi mode: " + mode); - // File csvFile = new File(file.getOriginalFilename()); try { - clearReport(report); - // csvFile.createNewFile(); + File csvFile = File.createTempFile(file.getOriginalFilename(), "csv"); FileUtils.copyInputStreamToFile(file.getInputStream(), csvFile); Runnable task = () -> { Log.debug(Geonet.SEARCH_ENGINE, "BatchEditAPI calling... startBackupOperation........"); - processCsv(csvFile, context, serviceContext, mode, desc, backup); + processCsv(csvFile, context, serviceContext, mode, desc, backup, request.getSession()); }; // start the thread @@ -287,11 +281,9 @@ public void batchUpdateUsingCSV(@RequestParam(value = "file") MultipartFile file } catch (Exception e) { Log.error(Geonet.SEARCH_ENGINE, "ECAT, BatchEditsApi (C) Stacktrace is\n" + Util.getStackTrace(e)); - report.addError(e); + } - //return report; - } /** @@ -306,6 +298,7 @@ public void batchUpdateUsingCSV(@RequestParam(value = "file") MultipartFile file @ResponseStatus(HttpStatus.CREATED) @ResponseBody public int batchUpdateReport(HttpServletRequest request) { + SimpleMetadataProcessingReport report = (SimpleMetadataProcessingReport) request.getSession().getAttribute(Geonet.BATCHEDIT_REPORT); return report.getNumberOfRecordsProcessed(); } @@ -407,16 +400,19 @@ public void purgeBatchUpdateHistory(HttpServletRequest request) { * @throws Exception */ @SuppressWarnings("unchecked") - public void processCsv(File csvFile, ApplicationContext context, - ServiceContext serviceContext, String mode, String desc, boolean backup) { + private void processCsv(File csvFile, ApplicationContext context, + ServiceContext serviceContext, String mode, String desc, boolean backup, HttpSession session) { + + List backupData = new ArrayList<>(); + SimpleMetadataProcessingReport report = new SimpleMetadataProcessingReport(); + session.setAttribute(Geonet.BATCHEDIT_REPORT, report); + session.setAttribute(Geonet.BATCHEDIT_BACKUP, backupData); // Create folder in s3 bucket with current date Date datetime = new Date(System.currentTimeMillis()); final String dateTimeStr = Geonet.DATE_FORMAT.format(datetime); - - SAXBuilder sb = new SAXBuilder(); // final CSVBatchEdit cbe = context.getBean(CSVBatchEdit.class); CSVBatchEdit cbe = new CSVBatchEdit(context); @@ -437,7 +433,7 @@ public void processCsv(File csvFile, ApplicationContext context, try { // Parse the csv file parser = CSVParser.parse(csvFile, Charset.defaultCharset(), CSVFormat.EXCEL.withHeader()); - // report.setTotalRecords(parser.getRecords().size()); + } catch (IOException e1) { Log.error(Geonet.SEARCH_ENGINE, e1.getMessage()); } @@ -465,14 +461,12 @@ public void processCsv(File csvFile, ApplicationContext context, record = cbe.getMetadataByLuceneSearch(context, serviceContext, request); } catch (BatchEditException e) { report.addMetadataError(id, new Exception(e.getMessage())); - // report.incrementNullRecords(); continue; } } else {// If there is no valid uuid and ecatId, doesn't // process this record and continue to execute next // record report.addError(new Exception("Unable to process record number " + csvr.getRecordNumber())); - // report.incrementNullRecords(); continue; } @@ -489,12 +483,11 @@ record = metadataRepository.findOneByUuid(csvr.get("uuid")); if (record == null) { report.addError(new Exception( "No metadata found, Unable to process record number " + csvr.getRecordNumber())); - // report.incrementNullRecords(); continue; } - if (backup && !saveToS3Bucket(record)) { + if (backup && !saveToS3Bucket(record, session)) { report.addError(new Exception("Unable to backup record uuid/ecat: " + id)); continue; } @@ -512,18 +505,27 @@ record = metadataRepository.findOneByUuid(csvr.get("uuid")); while (iter.hasNext()) { Map.Entry header = (Map.Entry) iter.next(); Log.debug(Geonet.SEARCH_ENGINE, header.getKey() + " - " + header.getValue()); + + try { + if (xpathExpr.containsKey(header.getKey())) { + XPath _xpath = xpathExpr.get(header.getKey()); + + if (_xpath != null) { + BatchEditReport batchreport = cbe.removeOrAddElements(context, serviceContext, header, + csvr, _xpath, document, listOfUpdates, mode); - XPath _xpath = xpathExpr.get(header.getKey()); - - if (_xpath != null) { - BatchEditReport batchreport = cbe.removeOrAddElements(context, serviceContext, header, csvr, - _xpath, document, listOfUpdates, mode); - batchreport.getErrorInfo().stream().forEach(err -> { - report.addMetadataError(id, new Exception(err)); - }); - batchreport.getProcessInfo().stream().forEach(info -> { - report.addMetadataInfos(id, info); - }); + batchreport.getErrorInfo().stream().forEach(err -> { + report.addMetadataError(id, new Exception(err)); + }); + + batchreport.getProcessInfo().stream().forEach(info -> { + report.addMetadataInfos(id, info); + }); + + } + } + } catch (Exception e) { + Log.error(Geonet.SEARCH_ENGINE, "Exception while getting Batch edit report: " + e.getMessage()); } } @@ -546,15 +548,14 @@ record = metadataRepository.findOneByUuid(csvr.get("uuid")); batchEditParam.getXpath(), propertyValue, true); } - - //if (metadataChanged) { - Log.debug(Geonet.SEARCH_ENGINE, "BatchEditsApi --> updating Metadata: " + record.getId()); - dataMan.updateMetadata(serviceContext, record.getId() + "", metadata, false, false, true, "eng", - null, false); - report.addMetadataInfos(id, "Metadata updated, uuid: " + record.getUuid()); - report.incrementProcessedRecords(); - //} - + + Log.debug(Geonet.SEARCH_ENGINE, "BatchEditsApi --> updating Metadata: " + record.getId()); + dataMan.updateMetadata(serviceContext, record.getId() + "", metadata, false, false, true, "eng", + null, false); + report.addMetadataInfos(id, "Metadata updated, uuid: " + record.getUuid()); + report.incrementProcessedRecords(); + session.setAttribute(Geonet.BATCHEDIT_REPORT, report); + } catch (Exception e) { Log.error(Geonet.SEARCH_ENGINE, "Exception :" + e.getMessage()); } @@ -569,7 +570,7 @@ record = metadataRepository.findOneByUuid(csvr.get("uuid")); if(backup){ Log.debug(Geonet.SEARCH_ENGINE, "BatchEditAPI calling... startBackupOperation........"); - startBackupOperation(s3key); + startBackupOperation(s3key, session); } } @@ -585,9 +586,11 @@ public AmazonS3 getS3Client(){ * @param md * @return */ - private boolean saveToS3Bucket(Metadata md) { + private boolean saveToS3Bucket(Metadata md, HttpSession session) { try { - tempBackupData.add(md); + List backupData = (List) session.getAttribute(Geonet.BATCHEDIT_BACKUP); + backupData.add(md); + session.setAttribute(Geonet.BATCHEDIT_BACKUP, backupData); } catch (Exception e) { return false; } @@ -595,7 +598,9 @@ private boolean saveToS3Bucket(Metadata md) { return true; } - public void startBackupOperation(String s3key){ + private void startBackupOperation(String s3key, HttpSession session){ + + Double pct = 0.0; AmazonS3 s3client = getS3Client(); TransferManager xfer_mgr = TransferManagerBuilder @@ -614,8 +619,8 @@ public void startBackupOperation(String s3key){ } Log.debug(Geonet.SEARCH_ENGINE, "BatchEditAPI, tmpDir for backup xml files --->" + tmpDir); - - List files = tempBackupData.stream().map(md -> { + List backupData = (List) session.getAttribute(Geonet.BATCHEDIT_BACKUP); + List files = backupData.stream().map(md -> { try { Path path = Files.createTempFile(tempPath, md.getUuid(), ".xml"); @@ -643,7 +648,8 @@ public void startBackupOperation(String s3key){ //long so_far = progress.getBytesTransferred(); //long total = progress.getTotalBytesToTransfer(); pct = progress.getPercentTransferred(); - progressBackup(); + session.setAttribute(Geonet.BATCHEDIT_PROGRESS, pct); + } while (xfer.isDone() == false); // print the final state of the transfer. TransferState xfer_state = xfer.getState(); @@ -683,14 +689,28 @@ public void startBackupOperation(String s3key){ @ResponseStatus(HttpStatus.CREATED) @ResponseBody public Double batchEditBackup(HttpServletRequest request) { - return progressBackup(); - } - - public Double progressBackup() - { + Double pct = (Double) request.getSession().getAttribute(Geonet.BATCHEDIT_PROGRESS); Log.debug(Geonet.SEARCH_ENGINE, "Percentage transfer: " + pct); return pct; - } + } + + /** + * The service updates records by uploading the csv file + */ + @ApiOperation(value = "Invalidate batchedit attributes.") + @RequestMapping(value = "/batchediting/clear", method = RequestMethod.GET, produces = { + MediaType.APPLICATION_JSON_VALUE }) + @ApiResponses(value = { @ApiResponse(code = 201, message = "Clear batchedit attributes"), + @ApiResponse(code = 403, message = ApiParams.API_RESPONSE_NOT_ALLOWED_CAN_EDIT) }) + @PreAuthorize("hasRole('Administrator')") + @ResponseStatus(HttpStatus.OK) + @ResponseBody + public void clearBatchEditSession(HttpServletRequest request) { + Log.debug(Geonet.SEARCH_ENGINE, "Remove batchedit attributes..."); + request.getSession().removeAttribute(Geonet.BATCHEDIT_BACKUP); + request.getSession().removeAttribute(Geonet.BATCHEDIT_REPORT); + request.getSession().removeAttribute(Geonet.BATCHEDIT_PROGRESS); + } /** * Add batch update entry into database. Converts CustomReport into JSON and stores as StrigClob @@ -755,22 +775,6 @@ private boolean addEntry(SimpleMetadataProcessingReport report, String s3key, Se return true; } - public void clearReport(SimpleMetadataProcessingReport report){ - try{ - report.getInfos().clear(); - report.getErrors().clear(); - report.getMetadata().clear(); - report.getMetadataErrors().clear(); - report.getMetadataInfos().clear(); - report.setTotalRecords(0); - report.processStart(); - report.setNumberOfRecordsProcessed(0); - }catch(Exception e){ - - } - - } - } class CustomReport { diff --git a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js index 676dc51ebd5..8f5e85f8c9b 100644 --- a/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js +++ b/web-ui/src/main/resources/catalog/components/edit/onlinesrc/OnlineSrcDirective.js @@ -954,8 +954,8 @@ scope.alertMsg = $translate.instant( 'linkToServiceWithoutURLError'); } - - var pidUrl = 'http://pid.geoscience.gov.au/'+md.type[0]+'/ga/'+md.eCatId; + var scopeType = md.type[0] === 'service' ? 'service' : 'dataset'; + var pidUrl = 'http://pid.geoscience.gov.au/'+ scopeType +'/ga/'+md.eCatId; scope.params.url=pidUrl; scope.params.name=md.title; scope.params.code=md.eCatId; @@ -1189,7 +1189,8 @@ if(scope.model.selectedType === scope.selectionType.ECAT_RECORD){ if(scope.metadata){ var md = scope.metadata; - var pidUrl = 'http://pid.geoscience.gov.au/'+md.type[0]+'/ga/'+md.eCatId; + var scopeType = md.type[0] === 'service' ? 'service' : 'dataset'; + var pidUrl = 'http://pid.geoscience.gov.au/'+ scopeType +'/ga/'+md.eCatId; scope.params.url=pidUrl; scope.params._uuid=md.getUuid(); scope.params.protocol='WWW:LINK-1.0-http--link'; diff --git a/web-ui/src/main/resources/catalog/components/metadataactions/MetadataActionService.js b/web-ui/src/main/resources/catalog/components/metadataactions/MetadataActionService.js index 33ab26d60ba..27b28be672d 100644 --- a/web-ui/src/main/resources/catalog/components/metadataactions/MetadataActionService.js +++ b/web-ui/src/main/resources/catalog/components/metadataactions/MetadataActionService.js @@ -503,36 +503,7 @@ }); return defer.promise; }; - - this.getCitation = function(md){ - var citationUrl = ''; - if(angular.isArray(md.author) && md.author.length > 0){ - citationUrl = md.author.join(', ') + ' '; - }else{ - if(md.author){ - citationUrl = md.author + ' '; - } - } - - if(md.publicationDate){ - var date = new Date(md.publicationDate); - citationUrl += date.getFullYear() + '. '; - } - - citationUrl += md.title + '. '; - if(md.issueIdentification){ - citationUrl = citationUrl + 'Record ' + md.issueIdentification + '. '; - } - - citationUrl += 'Geoscience Australia, Canberra. '; - - if(md.DOI){ - citationUrl += md.DOI; - } - - gnUtilityService.getPermalink(md.title || md.defaultTitle, citationUrl); - }; /** * Get html formatter link for the given md * @param {Object} md diff --git a/web-ui/src/main/resources/catalog/components/metadataactions/RelatedDirective.js b/web-ui/src/main/resources/catalog/components/metadataactions/RelatedDirective.js index 735f502a7fc..42e29575b5d 100644 --- a/web-ui/src/main/resources/catalog/components/metadataactions/RelatedDirective.js +++ b/web-ui/src/main/resources/catalog/components/metadataactions/RelatedDirective.js @@ -121,7 +121,7 @@ scope.hasAction = function(mainType) { var fn = gnRelatedResources.map[mainType].action; // If function name ends with ToMap do not display the action - if (fn.name.match(/.*ToMap$/) && + if (fn && fn.name.match(/.*ToMap$/) && gnGlobalSettings.isMapViewerEnabled === false) { return false; } @@ -141,7 +141,10 @@ } scope.display = function(r) { - var dis = !r.url.startsWith('file') || (r.url.startsWith('file') && gnGlobalSettings.isIntranet); + var dis = (!r.url.startsWith('http://rmweb/HPEContentManager') + && !r.url.startsWith('file')) + || (r.url.startsWith('file') && gnGlobalSettings.isIntranet) + || (r.url.startsWith('http://rmweb/HPEContentManager') && gnGlobalSettings.isIntranet); return dis; }; diff --git a/web-ui/src/main/resources/catalog/components/metadataactions/RelatedResourcesService.js b/web-ui/src/main/resources/catalog/components/metadataactions/RelatedResourcesService.js index d2009267402..fea0519d0eb 100644 --- a/web-ui/src/main/resources/catalog/components/metadataactions/RelatedResourcesService.js +++ b/web-ui/src/main/resources/catalog/components/metadataactions/RelatedResourcesService.js @@ -239,7 +239,7 @@ this.map['DEFAULT'].iconClass; }; - this.getLabel = function(mainType, type) { + this.getLabel = function(mainType, type, url) { // Old key before the move to API var oldKey = { hasfeaturecats: 'hasfeaturecat', @@ -248,6 +248,10 @@ fcats: 'fcat', hassources: 'hassource' }; + + if(url.startsWith('http://services.ga.gov.au')){ + return 'Link to Web Services'; + } return this.map[mainType || 'DEFAULT'].label + (oldKey[type] ? oldKey[type] : type); }; diff --git a/web-ui/src/main/resources/catalog/components/metadataactions/partials/related.html b/web-ui/src/main/resources/catalog/components/metadataactions/partials/related.html index c238f8225ab..aef46409f88 100644 --- a/web-ui/src/main/resources/catalog/components/metadataactions/partials/related.html +++ b/web-ui/src/main/resources/catalog/components/metadataactions/partials/related.html @@ -1,10 +1,11 @@