Skip to content

Commit

Permalink
Merge pull request #310 from georchestra/fix-csw-server
Browse files Browse the repository at this point in the history
fix : csw server not ignoring failures
  • Loading branch information
f-necas committed Dec 18, 2024
1 parent ec01b82 commit 13159f4
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,9 @@
import org.fao.geonet.utils.Xml;
import org.geotools.xsd.Configuration;
import org.geotools.xsd.Parser;
import org.jdom.Attribute;
import org.jdom.Content;
import org.jdom.Element;
import org.jdom.Namespace;
import org.opengis.filter.Filter;
import org.opengis.filter.capability.FilterCapabilities;
import org.jdom.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.xml.sax.SAXException;

Expand Down Expand Up @@ -483,17 +480,20 @@ public Element search(ServiceContext context, int startPos, int maxRecords,
AbstractMetadata metadata = metadataUtils.findOne(mdId);

String displayLanguage = context.getLanguage();
Element resultMD = retrieveMetadata(context, metadata.getId() + "",
setName, outSchema, elemNames, typeName, resultType, strategy, displayLanguage);
try {// The query to retrieve GetRecords, filters by portal. No need to re-check again when retrieving each metadata.
Element resultMD = retrieveMetadata(context, metadata.getId() + "",
setName, outSchema, elemNames, typeName, resultType, strategy, displayLanguage);

if (resultMD != null) {
if (resultType == ResultType.RESULTS) {
results.addContent(resultMD);
}
if (resultMD != null) {
if (resultType == ResultType.RESULTS) {
results.addContent(resultMD);
}

counter++;
counter++;
}
} catch (InvalidParameterValueEx e) {
results.addContent(new Comment(e.getMessage()));
}

}

results.setAttribute("numberOfRecordsMatched", Long.toString(numMatches));
Expand Down
112 changes: 112 additions & 0 deletions georchestra-migration/migration-dev-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Geonetwork migration in Georchestra

This document aims to help simplify future migration for geonetwork in Georchestra.

## Upgrade Process

### Simplified guide

This is an ultra-simplified guide to be able to build an upgraded version of georchestra/geonetwork
- Merge gn-core tag into georchestra/gn wanted branch. Resolve coflicts and get georchestra custom implementions (see below).
- Copy folders `config` and `data` from `web/src/main/webapp/WEB-INF/data/` into the repo [geonetwork_minimal_datadir](https://github.com/georchestra/geonetwork_minimal_datadir) and create associated branch with new version name.
- Build geonetwork (war, docker ...)
- Delete wro4j cache if necessary (use ?debug can be sometimes useful)
- Reindex records if necessary

A more detailed guide is available in [upgrade_geonetwork.md](upgrade_geonetwork.md).

## Georchestra custom implementations

All versions in `pom.xml` files must be updated. E.g. for this version `4.4.5-georchestra`.
All italic folder just have the `pom.xml` change.

- .github
- workflows `linux.yml` `mvn-dep-tree.yml` `sonarcloud.yml` `dependabot.yml` are deleted. Only `georchestra-gn4.yml` is used
- *cachingxslt*
- common
- `ZipUtilTest.java` : In `assertExampleZip` method, assertions which are supposed check folders must check with trailing slash too.
- core
- `XslUtil.java`: Implement georchestra header specific code
- `config-spring-geonetwork.xml` : Implement `context:property-placeholder` for georchestra's datadir
- `src/test/resources/config-spring-geonetwork.xml`: Add GeonetworkDataDirectory bean
- `cleanoutdatabase.sql`: Delete from settings-ui at the end of the file
- csw-server
- `CswFilter2Es.java` : Keep `{@}` instead of `%s` until it is fixed upstream (not supporting some CSW request)
- `CswFilter2EsTest.java` : Keep `{@}` instead of `%s`
- `SearchController.java` : Keep `{@}` instead of `%s` with StringUtils.replace, try/catch around Element resultMD, to avoid csw server to crash [issue core-gn 6940](https://github.com/geonetwork/core-geonetwork/issues/6940)
- **docker**
- Mandatory, get everything from geOrchestra
- *docs*
- *doi*
- domain
- `ExternalGroupLink.java` : get file from geOrchestra
- `ExternalUserLink.java` : get file from geOrchestra
- `Group.java` : set column definition to `TEXT` (which is PostGreSQL specific) on `description` and `logo`
- *es*
- *estest*
- *events*
- **georchestra-integration**
- Mandatory, get everything from geOrchestra
- *harvesters*
- *healthmonitor*
- *index*
- *inspire-atom*
- *jmeter*
- *listeners*
- *messaging*
- *oaipmh*
- *release*
- schemas
- `iso19139/layout/config-editor.xml`: xlinks for contacts reenabled
- *schemas-test*
- *sde*
- services
- `config-spring-geonetwork.xml`: Implement `context:property-placeholder` for georchestra's datadir
- `MetadataExtentApiTest.java` : Update image signatures if necessary (tests may fail see [MetadataExtentApiTest-reference](resources%2FMetadataExtentApiTest-reference) for image reference)
- `BatchOpsMetadatReindexerTest.java` : Add PowerMockIgnore
- `pom.xml`: version to update **and to add to gn-services**
- `LogUtils.java`: Keep custom configuration in `refreshLogConfiguration()` method.
- *slave*
- web
- `src/docker`: Mandatory, get everything from geOrchestra
- `main/filters/prod.properties`: Session timeout variable updated
- `main/filters/java/org/fao/geonet/proxy`: Mandatory, get everything from geOrchestra
- `data-db-default.sql` : Some data to retrieve: setting-ui, inspire activated, georchestra name, (backported value) sitemapLinkUrl, xlinkresolver enabled by default
- `UpdateMetadataStatus.java`: Some fixes
- `config-security.xml`: Remove config security add start of file, get end of the file from georchestra.
- `config-geonetwork-georchestra.properties`, `config-georchestra-geonetwork-datadirs.xml`, `DKAN-to-ISO19115-3-2018.xsl`, `GeoIDE-services-OGC.xsl`, `udata-to-ISO19115-3-2018.xsl`
- Get files from georchestra
- `base-variables.xsl` and `base-layout.xsl`
- Get header from georchestra
- `defaultJdbcDataSource.xml`: Implement `context:property-placeholder` for georchestra's db
- `config-spring-geonetwork.xml`
- Implement `context:property-placeholder` for georchestra's datadir
- Don't forget to import config resource and logging bean
- `spring-servlet.xml`: Implement `context:property-placeholder` for georchestra's datadir
- `postgres-postgis.xml` Keep `context:property-placeholder` for georchestra's datadir
- `pom.xml`: Update `dockerGnDatadirScmVersion` variable accordingly and remove `font-awesome/css/` from `packagingExclude`
- `pom.xml`: Keep exclusion of groovy package to avoid two versions of it.
- web-ui
- `pom.xml`: version to update **and to add to gn-web-ui**
- `CatController.js`: Menu bar accessible
- `menu-signin.html`: remove the `authenticated` from the `ng-if` in first ul tag.
- `src/main/resources/catalog/locales/`
- Get `en-georchestra.json` and `fr-georchestra.json` from georchestra
- `src/main/resources/catalog/style/gn-less`: remove position fixed from `.gn-top-bar` to get gn header after georchestra's header.
- `gn_admin_default.less`: Same (header position)
- `gn_navbar_default.less`: Same (header position)
- `src/main/resources/catalog/views/georchestra/`: Get files from georchestra
- *workers*
- *wro4j*
- .gitignore
- add idea and settings to it
- pom.xml
- Add georchestra-integration module, set db-type

## Process used

### 4.2.4 -> 4.2.7

A branch has been created from core-geonetwork 4.2.7 tag and merged into `georchestra-gn4.2.x`.
All conflicts files have been resolved with taking gn changes and not grochestra's one.
Then changes have been reimplemented.

0 comments on commit 13159f4

Please sign in to comment.