Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datahubs per sub-portal #8644

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,7 @@ web/src/main/webapp/data/
web/src/main/webapp/doc/en
web/src/main/webapp/doc/fr
web/src/main/webapp/WEB-INF/data/data/resources/schemapublication

# geonetwork-ui git project
plugins/datahub-integration/src/main/geonetwork-ui/
plugins/datahub-integration/node/
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ public class Settings {

public static final String MICROSERVICES_ENABLED = "microservices/enabled";

public static final String GEONETWORK_UI_DATAHUB_CONFIGURATION = "geonetwork-ui/datahub/configuration";
public static final String GEONETWORK_UI_DATAHUB_ENABLED = "geonetwork-ui/datahub/enabled";

public static class GNSetting {
private String name;
private boolean nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,8 @@ Allows to view metadata history
## Harvesting

*Allow editing on harvested records*: Enables/Disables editing of harvested records in the catalogue. By default, harvested records cannot be edited.

## Geonetwork-ui configuration

*Enable datahub*:
You can adapt your GeoNetwork UI by enabling Datahub. First, download the specific plugin datahub-integration. Then, on the settings page, enable Datahub . you can provide an other specific Datahub configuration than the default one. You can also configure it for each portal. Ensure that Datahub is enabled in the settings to make it work on portals.
Comment on lines +276 to +279
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for documenting your work. IMO this should go in a separate section of the documentation. The things that need to be documented are:

  • what the plugin does (with a link to GeoNetwork-UI project)
  • how to build the plugin
  • how to enable it
  • how to configure the datahub instances (link to the relevant documentation in GN-UI)

We might start a new "plugins" section in the documentation for that, I think that'd be appropriate. @jodygarnett do you have any opinion on how/where to put this? thanks!

27 changes: 27 additions & 0 deletions domain/src/main/java/org/fao/geonet/domain/Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.fao.geonet.domain.converter.BooleanToYNConverter;
import org.fao.geonet.entitylistener.SourceEntityListenerManager;
import org.fao.geonet.repository.LanguageRepository;
import org.hibernate.annotations.Type;

import javax.annotation.Nonnull;
import javax.persistence.*;
Expand Down Expand Up @@ -64,6 +65,9 @@ public class Source extends Localized {
private Integer groupOwner;
private Boolean listableInHeaderSelector = true;

private Boolean datahubEnabled = false;
private String datahubConfiguration = ""; // will use the main conf if empty

/**
* Default constructor. Required by framework.
*/
Expand Down Expand Up @@ -224,6 +228,29 @@ public Source setUiConfig(String uiConfig) {
return this;
}

/**
* Only applies to subportal.
*
* @return
*/
public Boolean getDatahubEnabled() {
return datahubEnabled;
}
public Source setDatahubEnabled(Boolean datahubEnabled) {
this.datahubEnabled = datahubEnabled;
return this;
}

@Lob
@Type(type = "org.hibernate.type.TextType")
public String getDatahubConfiguration() {
return datahubConfiguration;
}
public Source setDatahubConfiguration(String datahubConfiguration) {
this.datahubConfiguration = datahubConfiguration;
return this;
}


/**
* Get the date that the source was created.
Expand Down
201 changes: 201 additions & 0 deletions plugins/datahub-integration/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2001-2023 Food and Agriculture Organization of the
~ United Nations (FAO-UN), United Nations World Food Programme (WFP)
~ and United Nations Environment Programme (UNEP)
~
~ This program is free software; you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation; either version 2 of the License, or (at
~ your option) any later version.
~
~ This program is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
~
~ Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
~ Rome - Italy. email: [email protected]
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>geonetwork</artifactId>
<groupId>org.geonetwork-opensource</groupId>
<version>4.4.7-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>


<groupId>org.geonetwork-opensource.plugins</groupId>
<artifactId>gn-datahub-integration</artifactId>
<name>GeoNetwork Datahub integration</name>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.geonetwork-opensource</groupId>
<artifactId>gn-core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>datahub-integration</id>
<activation>
<property>
<!-- include when making a release -->
<name>release</name>
</property>
</activation>
<modules>
<module>gn-datahub-integration</module>
</modules>
</profile>
</profiles>

<properties>
<geonetwork-ui.git.branch>main</geonetwork-ui.git.branch>
<rootProjectDir>../..</rootProjectDir>
</properties>

<build>
<plugins>
<!-- Git clone geonetwork-ui -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>delete-existing</id>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>rm</executable>
<arguments>
<argument>-rf</argument>
<argument>src/main/geonetwork-ui</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>checkout-geonetwork-ui</id>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>git</executable>
<arguments>
<argument>clone</argument>
<argument>--branch</argument>
<argument>${geonetwork-ui.git.branch}</argument>
<argument>https://github.com/geonetwork/geonetwork-ui.git</argument>
<argument>src/main/geonetwork-ui</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

<!-- Install node & npm -> npm install -> npm run build -->
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.15.0</version>
<executions>
<execution>
<!-- Installing node and npm -->
<id>install-node-and-npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v20.12.2</nodeVersion>
<npmVersion>10.7.0</npmVersion>
</configuration>
</execution>
<!-- Install geonetwork-ui dependencies -->
<execution>
<id>npm-install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>ci --loglevel error</arguments>
<workingDirectory>src/main/geonetwork-ui</workingDirectory>
<installDirectory>${basedir}</installDirectory>
</configuration>
</execution>
<!-- Build datahub app -->
<execution>
<id>npm-build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<environmentVariables>
<NX_DAEMON>false</NX_DAEMON>
</environmentVariables>
<arguments>
run nx -- build datahub --base-href=./
</arguments>
<workingDirectory>src/main/geonetwork-ui</workingDirectory>
<installDirectory>${basedir}</installDirectory>
</configuration>
</execution>
</executions>
</plugin>

<!-- Copy of datahub files -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<encoding>UTF-8</encoding>
<outputDirectory>src/main/resources/datahub</outputDirectory>
<resources>
<resource>
<directory>src/main/geonetwork-ui/dist/apps/datahub</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
Loading
Loading