Commit 1a3ad998 authored by LAVENIER's avatar LAVENIER
Browse files

Merge branch 'release/1.7.1'

parents af4bd99c c6598041
image: jlrigau/maven-git
stages:
- build
- test
- docs
- prepare
- release
- deploy
build-dev:
extends: .build
only:
- develop
- feature/imagine
except:
- schedules
schedule-build:
extends: .build
artifacts:
paths:
- sumaris-server/target/*.war
only:
- schedules
.build:
stage: build
tags:
- sih_public_runner
script:
- echo "Test dev build in progress"
- mvn -s ./settings.xml clean install -DskipTests -P oracle
environment:
name: test
build_val:
stage: build
tags:
- sih_public_runner
script:
- echo "Test oracle build in progress"
- mvn -s ./settings.xml clean install -DskipTests -Dspring.liquibase.enabled=false -Dsumaris.name=SUMARiS -Dsumaris.persistence.sequence.increment=1 -Dlogging.level.org.hibernate.SQL=debug
environment:
name: test
artifacts:
paths:
- sumaris-server/target/*.war
only:
- develop
- feature/imagine
when: manual
sonarqube:
stage: test
tags:
- sih_public_runner
variables:
SONAR_TOKEN: "e6f816eee72d3d5c03319ec74b468157b9164d12"
SONAR_HOST_URL: "http://visi-common-sonar:9000"
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
script:
- echo "Sonarqube analysis in progress"
- sonar-scanner
-Dsonar.projectKey=imagine-pod
-Dsonar.host.url=$SONAR_HOST_URL
-Dsonar.login=$SONAR_TOKEN
-Dsonar.sourceEncoding=UTF-8
-Dsonar.java.binaries=.
-Dsonar.java.libraries=.
only:
- develop
- feature/imagine
when: manual
pages:
stage: docs
tags:
- sih_public_runner
image: python:3.7-alpine
before_script:
- apk --update --upgrade add gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev
- pip install --upgrade pip
- pip install --upgrade mkdocs
- pip install --upgrade mkdocs-pdf-export-plugin==0.5.5
script:
- mkdocs -v build
- mv site public
artifacts:
paths:
- public
only:
- develop
- feature/imagine
when: manual
package:
stage: prepare
tags:
- sih_public_runner
before_script:
- git checkout -B "$CI_BUILD_REF_NAME"
- git config --global user.email "lbruvryl@ifremer.fr"
- git config --global user.name "Leo BRUVRY-LAGADEC"
- echo "TAG=$RELEASE_VERSION" >> variables.env
script:
- echo "Release in progress"
- mvn release:clean -Dslf4jJclScope=provided
- mvn -s ./settings.xml release:prepare --batch-mode -Dtag=imagine-pod-$RELEASE_VERSION -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion=$NEW_DEV_VERSION -DscmCommentPrefix="[ci skip] to "
- mvn -s ./settings.xml release:perform -Dslf4jJclScope=provided -X -DscmCommentPrefix="[ci skip] to "
artifacts:
paths:
- web-services/target/*.war
reports:
dotenv: variables.env
only:
- develop
- feature/imagine
allow_failure: false
when: manual
release:
stage: release
tags:
- sih_public_runner
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: package
artifacts: true
script:
- echo "running release for imagine-pod-$TAG"
release:
name: "Release imagine-pod-$TAG"
description: "Created using the release-cli $EXTRA_DESCRIPTION"
tag_name: "imagine-pod-$TAG"
ref: "$CI_COMMIT_SHA"
only:
- develop
- feature/imagine
when: manual
deploy:
stage: deploy
tags:
- sih_public_runner
script:
- echo "Deploy in progress"
- mvn -s ./settings.xml deploy:deploy-file -DgroupId=fr.ifremer -DartifactId=imagine-pod -Dversion=$TAG -Dfile=web-services/target/ROOT.war -DrepositoryId=gitlab-maven -Durl=https://gitlab.ifremer.fr/api/v4/projects/1226/packages/maven
only:
- develop
- feature/imagine
when: manual
......@@ -3,7 +3,7 @@
<groupId>net.sumaris</groupId>
<artifactId>sumaris-pod</artifactId>
<version>1.7.0</version>
<version>1.7.1</version>
<packaging>pom</packaging>
<name>SUMARiS</name>
<description>SUMARiS :: Maven parent</description>
......@@ -108,40 +108,41 @@
<commonBeanutilsVersion>1.9.4</commonBeanutilsVersion>
<opencsv.version>2.4.3</opencsv.version>
<hibernate.version>5.4.18.Final</hibernate.version>
<hibernate-tools.version>5.3.11.Final</hibernate-tools.version>
<hibernate-search.version>5.10.4.Final</hibernate-search.version>
<hibernate-spatial.version>5.4.12.Final</hibernate-spatial.version>
<hibernate-validator.version>6.1.0.Final</hibernate-validator.version>
<spring.version>5.1.10.RELEASE</spring.version>
<spring-web.version>5.1.10.RELEASE</spring-web.version>
<spring-data.version>2.1.11.RELEASE</spring-data.version>
<hibernate.version>5.4.27.Final</hibernate.version>
<hibernate-tools.version>5.4.27.Final</hibernate-tools.version>
<hibernate-search.version>5.11.8.Final</hibernate-search.version>
<hibernate-spatial.version>5.4.27.Final</hibernate-spatial.version>
<hibernate-validator.version>6.2.0.Final</hibernate-validator.version>
<spring.version>5.2.12.RELEASE</spring.version>
<spring-web.version>5.2.12.RELEASE</spring-web.version>
<spring-data.version>2.3.6.RELEASE</spring-data.version>
<querydsl.version>4.2.2</querydsl.version>
<aspectj.version>1.8.14</aspectj.version>
<javassist.version>3.25.0-GA</javassist.version>
<aspectj.version>1.9.6</aspectj.version>
<javassist.version>3.27.0-GA</javassist.version>
<cglib.version>3.3.0</cglib.version>
<ehcache.version>2.10.6</ehcache.version>
<ehcache-monitor.version>2.7.11</ehcache-monitor.version>
<lombok.version>1.18.10</lombok.version>
<lombok.version>1.18.16</lombok.version>
<xmlquery.version>1.2</xmlquery.version>
<jdom2.version>2.0.6</jdom2.version>
<jaxen.version>1.2.0</jaxen.version>
<spring-boot.version>2.0.3.RELEASE</spring-boot.version>
<spring-boot-plugin.version>2.0.3.RELEASE</spring-boot-plugin.version>
<spring-boot.version>2.3.8.RELEASE</spring-boot.version>
<spring-boot-plugin.version>2.3.8.RELEASE</spring-boot-plugin.version>
<ozimov-email.version>0.6.3</ozimov-email.version>
<reflections.version>0.9.11</reflections.version>
<rxjava.version>2.2.0</rxjava.version>
<activemq.version>5.15.11</activemq.version>
<reflections.version>0.9.12</reflections.version>
<rxjava.version>2.2.20</rxjava.version>
<activemq.version>5.16.0</activemq.version>
<jnr-ffi.version>2.1.7</jnr-ffi.version>
<jnr-ffi.version>2.2.1</jnr-ffi.version>
<kalium.version>0.5.0_blavenie</kalium.version>
<!--<kalium.version>0.8.1-SNAPSHOT</kalium.version>-->
<scrypt.version>1.4.0</scrypt.version>
<geojson-jackson.version>1.12</geojson-jackson.version>
<geojson-jackson.version>1.14</geojson-jackson.version>
<graphql-java.version>13.0</graphql-java.version>
<graphql-java-tools.version>6.1.0</graphql-java-tools.version>
<graphql-java-servlet.version>9.2.0</graphql-java-servlet.version>
<spqr.version>0.10.0</spqr.version>
<spqr.version>0.10.1</spqr.version>
<kotlin.version>1.3.70</kotlin.version>
<!-- database version management -->
<liquibase.version>3.6.3</liquibase.version>
......@@ -1187,6 +1188,30 @@
</exclusions>
</dependency>
</dependencies>
<executions>
<execution>
<id>fix-resource-eol</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath refid="maven.plugin.classpath" />
</taskdef>
<!-- LP 21/10/2020 Needed if project is built on Windows, will not cause non modified file as modified in Git -->
<if>
<available file="${project.basedir}/src/main/resources/i18n" type="dir"/>
<then>
<echo level="info">Fix line endings on resources files (*.properties)</echo>
<fixcrlf srcdir="${project.basedir}/src/main/resources/i18n" includes="*.properties" eol="lf"/>
</then>
</if>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
| This is the configuration file for Maven. It can be specified at two levels:
|
| 1. User Level. This settings.xml file provides configuration for a single user,
| and is normally provided in ${user.home}/.m2/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -s /path/to/user/settings.xml
|
| 2. Global Level. This settings.xml file provides configuration for all Maven
| users on a machine (assuming they're all using the same Maven
| installation). It's normally provided in
| ${maven.home}/conf/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -gs /path/to/global/settings.xml
|
| The sections in this sample file are intended to give you a running start at
| getting the most out of your Maven installation. Where appropriate, the default
| values (values used when the setting is not specified) are provided.
|
|-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ~/.m2/repository
-->
<localRepository>/root/.m2/repository/</localRepository>
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
-->
<!-- offline
| Determines whether maven should attempt to connect to the network when executing a build.
| This will have an effect on artifact downloads, artifact deployment, and others.
|
| Default: false
<offline>false</offline>
-->
<!-- pluginGroups
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
|-->
<pluginGroups>
<!-- pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
</pluginGroups>
<!-- proxies
| This is a list of proxies which can be used on this machine to connect to the network.
| Unless otherwise specified (by system property or command-line switch), the first proxy
| specification in this list marked as active will be used.
|-->
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
|
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>
<!-- servers
| This is a list of authentication profiles, keyed by the server-id used within the system.
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|-->
<servers>
<!-- server
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the 'id' attribute below).
|
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
| used together.
|
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
-->
<!--
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>gitlab+deploy-token-34</name>
<value>qmqyr4oesz6hHiGYuEFX</value>
</property>
</httpHeaders>
</configuration>
</server>
-->
<server>
<id>gitlab-maven</id>
<username>${env.MAVEN_REPO_USER}</username>
<password>${env.MAVEN_REPO_PASS}</password>
</server>
<server>
<id>gitlab.ifremer.fr</id>
<username>${env.GITLAB_REPO_USER}</username>
<password>${env.GITLAB_REPO_PASS}</password>
</server>
</servers>
<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
</mirrors>
<!-- profiles
| This is a list of profiles which can be activated in a variety of ways, and which can modify
| the build process. Profiles provided in the settings.xml are intended to provide local machine-
| specific paths and repository locations which allow the build to work in the local environment.
|
| For example, if you have an integration testing plugin - like cactus - that needs to know where
| your Tomcat instance is installed, you can provide a variable here such that the variable is
| dereferenced during the build process to configure the cactus plugin.
|
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
| section of this document (settings.xml) - will be discussed later. Another way essentially
| relies on the detection of a system property, either matching a particular value for the property,
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
| Finally, the list of active profiles can be specified directly from the command line.
|
| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
| repositories, plugin repositories, and free-form properties to be used as configuration
| variables for plugins in the POM.
|
|-->
<profiles>
<!-- profile
| Specifies a set of introductions to the build process, to be activated using one or more of the
| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
| or the command line, profiles have to have an ID that is unique.
|
| An encouraged best practice for profile identification is to use a consistent naming convention
| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
| This will make it more intuitive to understand what the set of introduced profiles is attempting
| to accomplish, particularly when you only have a list of profile id's for debug.
|
| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
<profile>
<id>jdk-1.4</id>
<activation>
<jdk>1.4</jdk>
</activation>
<repositories>
<repository>
<id>jdk14</id>
<name>Repository for JDK 1.4 builds</name>
<url>http://www.myhost.com/maven/jdk14</url>
<layout>default</layout>
<snapshotPolicy>always</snapshotPolicy>
</repository>
</repositories>
</profile>
-->
<!--
| Here is another profile, activated by the system property 'target-env' with a value of 'dev',
| which provides a specific path to the Tomcat instance. To use this, your plugin configuration
| might hypothetically look like:
|
| ...
| <plugin>
| <groupId>org.myco.myplugins</groupId>
| <artifactId>myplugin</artifactId>
|
| <configuration>
| <tomcatLocation>${tomcatPath}</tomcatLocation>
| </configuration>
| </plugin>
| ...
|
| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
| anything, you could just leave off the <value/> inside the activation-property.
|
<profile>
<id>env-dev</id>
<activation>
<property>
<name>target-env</name>
<value>dev</value>
</property>
</activation>
<properties>
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
</properties>
</profile>
-->
</profiles>
<!-- activeProfiles
| List of profiles that are active for all builds.
|
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
</activeProfiles>
<activeProfiles>
<activeProfile>staging</activeProfile>
</activeProfiles>-->
</settings>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<groupId>net.sumaris</groupId>
<artifactId>sumaris-pod</artifactId>
<version>1.7.0</version>
<version>1.7.1</version>
</parent>
<artifactId>sumaris-core-extraction</artifactId>
......@@ -152,6 +152,10 @@
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
</plugins>
</build>
......
package net.sumaris.core.extraction.dao.administration;
/*-
* #%L
* SUMARiS:: Core Extraction
* %%
* Copyright (C) 2018 - 2019 SUMARiS Consortium
* %%
* 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 3 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, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.sumaris.core.extraction.dao.ExtractionDao;
import net.sumaris.core.extraction.specification.administration.StratSpecification;
import net.sumaris.core.extraction.vo.ExtractionFilterCriterionVO;
import net.sumaris.core.extraction.vo.ExtractionFilterOperatorEnum;
import net.sumaris.core.extraction.vo.ExtractionFilterVO;
import net.sumaris.core.extraction.vo.administration.ExtractionStrategyContextVO;
import net.sumaris.core.extraction.vo.administration.ExtractionStrategyFilterVO;
import net.sumaris.core.util.Beans;
import net.sumaris.core.util.Dates;
import net.sumaris.core.util.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Benoit Lavenier <benoit.lavenier@e-is.pro>
*/
public interface ExtractionStrategyDao<C extends ExtractionStrategyContextVO, F extends ExtractionFilterVO>
extends ExtractionDao {
<R extends C> R execute(F filter);
void clean(C context);
default ExtractionStrategyFilterVO toStrategyFilterVO(ExtractionFilterVO source){
ExtractionStrategyFilterVO target = new ExtractionStrategyFilterVO();
if (source == null) return target;
Beans.copyProperties(source, target);
target.setPreview(source.isPreview());
Beans.getStream(source.getCriteria()).forEach(criterion -> {
ExtractionFilterOperatorEnum operator = ExtractionFilterOperatorEnum.fromSymbol(criterion.getOperator());
if (StringUtils.isNotBlank(criterion.getValue())) {
switch (criterion.getName().toLowerCase()) {
case StratSpecification.COLUMN_PROJECT:
if (operator == ExtractionFilterOperatorEnum.EQUALS) {
target.setProgramLabel(criterion.getValue());
}
break;
case