Skip to content

Commit

Permalink
feat(geonetwork/web): Add datahub integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
Romuald Caplier authored and Guillaume-d-o committed Feb 17, 2025
1 parent 711f9f2 commit 30d9db8
Show file tree
Hide file tree
Showing 14 changed files with 613 additions and 2 deletions.
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
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

0 comments on commit 30d9db8

Please sign in to comment.