Commit 441d947c authored by CLEMENT's avatar CLEMENT
Browse files

Merge remote-tracking branch 'origin/feature/imagine' into feature/imagine

parents b3e87957 a6e09e77
......@@ -74,7 +74,7 @@ variables:
- ${ARTIFACT_CONFIG_FILES}
reports:
dotenv: ${ENV_FILE}
expire_in: 60 minutes
expire_in: 72 hours
build:
extends: .build
......@@ -118,7 +118,7 @@ docker:ci:
artifacts:
paths:
- target/ci/Dockerfile
expire_in: 60 minutes
expire_in: 72 hours
# ---------------------------------------------------------------
# Test jobs
......@@ -254,7 +254,11 @@ gitlab-release:
extends: .docker
stage: docker
script:
# Create the target directory
# Build variables: set default values
- export IMAGE_USERID=${IMAGE_USERID:-20001}
- export IMAGE_GROUPID=${IMAGE_GROUPID:-20001}
- echo "Creating image - userid=${IMAGE_USERID} groupid=${IMAGE_GROUPID}"
# Create the target directory, to build the image
- mkdir -p target/docker/config
- cp -rf ${APP_WAR_MODULE}/src/main/docker/* target/docker/
- cp -f ${ARTIFACT_WAR_FILE} target/docker/app.war
......@@ -262,26 +266,28 @@ gitlab-release:
- ls -l target/docker/config
- cd target/docker
# Build docker image
- docker pull ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} || true
- docker build --cache-from ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} --pull -t ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} .
#- docker build --no-cache -t ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} .
#- docker pull ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} || true
#- docker build --cache-from ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} --pull -t ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} --build-arg="USERID=${IMAGE_USERID}" --build-arg="GROUPID=${IMAGE_GROUPID}" .
- docker build --no-cache -t ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} --build-arg="USERID=${IMAGE_USERID}" --build-arg="GROUPID=${IMAGE_GROUPID}" .
- docker push ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}
artifacts:
paths:
- target/docker
expire_in: 60 minutes
expire_in: 72 hours
docker:develop:
extends: .docker-build
variables:
IMAGE_TAG: develop
IMAGE_TAG: 'develop'
only:
- develop
docker:imagine:
extends: .docker-build
variables:
IMAGE_TAG: imagine
IMAGE_TAG: 'imagine'
IMAGE_USERID: 25484
IMAGE_GROUPID: 10004
only:
- feature/imagine
......@@ -292,6 +298,18 @@ docker:release:
only:
- tags
# /!\ For Ifremer deployment, to isi-val (build using user tomcat:ditiisi)
docker:ifremer-isi-val:
extends: .docker-build
variables:
IMAGE_TAG: 'isi-val'
IMAGE_USERID: 25484
IMAGE_GROUPID: 10004
only:
- tags
- feature/imagine
when: manual
# ---------------------------------------------------------------
# Publish jobs
# ---------------------------------------------------------------
......
......@@ -32,8 +32,12 @@
<!-- other fields -->
<select alias="START_DATE" type="date">APP.START_DATE</select>
<select alias="END_DATE" type="date">APP.END_DATE</select>
<!-- TODO: EFFORT à renommer en ??? -->
<select alias="EXPECTED_EFFORT" type="number">APP.ACQUISITION_NUMBER</select>
<select alias="REALIZED_EFFORT" type="number">count(distinct S.ID)</select>
<!--<select alias="SAMPLE_COUNT" type="number">count(distinct S.ID)</select>-->
<select alias="LANDING_COUNT" type="number">count(distinct L.ID)</select>
<!-- hidden columns -->
......
......@@ -275,34 +275,40 @@ public class StrategyRepositoryImpl
@Override
public String computeNextSampleLabelByStrategy(String strategyLabel, String labelSeparator, int nbDigit) {
Preconditions.checkNotNull(strategyLabel);
final String prefix = (labelSeparator == null) ? strategyLabel : strategyLabel + labelSeparator;
final String prefix = StringUtils.isNotBlank(labelSeparator) ? strategyLabel + labelSeparator : strategyLabel;
CriteriaBuilder builder = getEntityManager().getCriteriaBuilder();
CriteriaQuery<String> query = builder.createQuery(String.class);
Root<Sample> root = query.from(Sample.class);
ParameterExpression<Integer> idParam = builder.parameter(Integer.class);
ParameterExpression<String> valueParam = builder.parameter(String.class);
ParameterExpression<Integer> tagIdPmfmIdParam = builder.parameter(Integer.class);
ParameterExpression<Integer> strategyPmfmIdParam = builder.parameter(Integer.class);
ParameterExpression<String> strategyLabelParam = builder.parameter(String.class);
Join<Sample, Landing> landingInnerJoin = root.join(Sample.Fields.LANDING, JoinType.INNER);
Join<Landing, LandingMeasurement> measurementInnerJoin = landingInnerJoin.joinList(Landing.Fields.MEASUREMENTS, JoinType.INNER);
Join<Landing, LandingMeasurement> strategyMeasurementInnerJoin = landingInnerJoin.joinList(Landing.Fields.MEASUREMENTS, JoinType.INNER);
Join<Landing, LandingMeasurement> tagIdInnerJoin = landingInnerJoin.joinList(Landing.Fields.MEASUREMENTS, JoinType.INNER);
query.select(root.get(Sample.Fields.LABEL))
query.select(tagIdInnerJoin.get(LandingMeasurement.Fields.ALPHANUMERICAL_VALUE))
.distinct(true)
.where(
builder.and(
builder.equal(measurementInnerJoin.get(LandingMeasurement.Fields.PMFM).get(IEntity.Fields.ID), idParam),
builder.equal(measurementInnerJoin.get(LandingMeasurement.Fields.ALPHANUMERICAL_VALUE), valueParam)
// Tag id measurement
builder.equal(tagIdInnerJoin.get(LandingMeasurement.Fields.PMFM).get(IEntity.Fields.ID), tagIdPmfmIdParam),
// Strategy measurement
builder.equal(strategyMeasurementInnerJoin.get(LandingMeasurement.Fields.PMFM).get(IEntity.Fields.ID), strategyPmfmIdParam),
builder.equal(strategyMeasurementInnerJoin.get(LandingMeasurement.Fields.ALPHANUMERICAL_VALUE), strategyLabelParam)
));
String result = getEntityManager()
.createQuery(query)
.setParameter(idParam, PmfmEnum.STRATEGY_LABEL.getId())
.setParameter(valueParam, strategyLabel)
.getResultStream()
.max(String::compareTo)
.map(source -> StringUtils.removeStart(source, prefix))
.orElse("0");
.createQuery(query)
.setParameter(tagIdPmfmIdParam, PmfmEnum.TAG_ID.getId())
.setParameter(strategyPmfmIdParam, PmfmEnum.STRATEGY_LABEL.getId())
.setParameter(strategyLabelParam, strategyLabel)
.getResultStream()
.max(String::compareTo)
.map(source -> StringUtils.removeStart(source, prefix))
.orElse("0");
if (!StringUtils.isNumeric(result)) {
throw new SumarisTechnicalException(String.format("Unable to increment label '%s' on sample", prefix.concat(result)));
......
FROM openjdk:8-jdk
# Build arg
ARG ENTRYPOINT=app.sh
ARG WAR_FILE=app.war
ARG CONFIG_FILES=config/*.properties
ARG USERNAME="spring"
ARG USERID="20001"
ARG GROUPNAME="spring"
ARG GROUPID="20001"
# Install dependencies
RUN apt update && apt -y install libsodium-dev
# Create execution user/group
RUN echo "Creatin group ${GROUPNAME}:${GROUPID}"
RUN groupadd -g ${GROUPID} ${GROUPNAME}
RUN echo "Creatin user ${USERNAME}:${USERID}"
RUN useradd -g ${GROUPNAME} -d /app -u ${USERID} ${USERNAME}
USER ${USERNAME}:${GROUPNAME}
# Copy files
COPY ${ENTRYPOINT} /app/app.sh
RUN chmod +x /app/app.sh
RUN mkdir -p /app/logs
RUN mkdir -p /app/data
COPY ${WAR_FILE} /app/app.war
COPY ${CONFIG_FILES} /app/config/
# Run
ENV PORT=8080 \
TZ=UTC \
PROFILES=default
......
#!/bin/bash
APP_NAME=sumaris
BASEDIR=/app
JAVA_OPTS="-Dsumaris.basedir=${BASEDIR}"
LOG_DIR=/app/logs
JAVA_OPTS="-D${APP_NAME}.basedir=${BASEDIR}"
JAVA_OPTS="${JAVA_OPTS} -Dspring.config.location=file:${BASEDIR}/config/"
JAVA_OPTS="${JAVA_OPTS} -Dsumaris.log.file=${LOG_DIR}/${APP_NAME}-pod.log"
JAVA_OPTS="${JAVA_OPTS} -Doracle.net.tns_admin=/home/tnsnames"
JAVA_OPTS="${JAVA_OPTS} -Doracle.jdbc.timezoneAsRegion=false"
[[ "_${PROFILES}" != "_" ]] && JAVA_OPTS="${JAVA_OPTS} -Dspring.profiles.active=${PROFILES}"
......@@ -12,6 +15,6 @@ ARGS=
# TODO test this
#ARGS=${@:2}
echo "*** Starting Application - args: ${ARGS} - profiles: ${PROFILES} ***"
echo "*** Starting ${APP_NAME}-pod - args: ${ARGS} - profiles: ${PROFILES} ***"
java ${JAVA_OPTS} -server -jar ${BASEDIR}/app.war ${ARGS}
\ No newline at end of file
......@@ -889,7 +889,7 @@
<!-- PARAMBIO / Strategy -->
<PARAMETER ID="350" LABEL="AGE" NAME="Âge" IS_BOOLEAN="0" IS_QUALITATIVE="0" IS_ALPHANUMERIC="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PARAMETER ID="351" LABEL="MATURITY_STAGE_9_VISUAL" NAME="Maturité sexuelle à 4 plus 2 stades" IS_BOOLEAN="0" IS_QUALITATIVE="1" IS_ALPHANUMERIC="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PARAMETER ID="352" LABEL="MORSE_CODE" NAME="Code Morse" IS_QUALITATIVE="0" IS_ALPHANUMERIC="1" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<!--<PARAMETER ID="352" LABEL="MORSE_CODE" NAME="Code Morse" IS_QUALITATIVE="0" IS_ALPHANUMERIC="1" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>-->
<PARAMETER ID="353" LABEL="STRATEGY_LABEL" NAME="Stratégie" IS_QUALITATIVE="0" IS_ALPHANUMERIC="1" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PARAMETER ID="1435" LABEL="SAMPLE_ID" NAME="Code du prélèvement" IS_QUALITATIVE="0" IS_ALPHANUMERIC="1" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
......@@ -1470,7 +1470,7 @@
<PMFM ID="351" PARAMETER_FK="351" LABEL="MATURITY_STAGE_9_VISUAL" MATRIX_FK="2" FRACTION_FK="1" METHOD_FK="2" UNIT_FK="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PMFM ID="356" PARAMETER_FK="91" LABEL="WEIGHT_TOTAL_KG" MATRIX_FK="2" FRACTION_FK="1" METHOD_FK="1" MIN_VALUE="0" MAXIMUM_NUMBER_DECIMALS="2" UNIT_FK="3" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PMFM ID="357" PARAMETER_FK="91" LABEL="WEIGHT_ESTIMATED_TOTAL_KG" MATRIX_FK="2" FRACTION_FK="1" METHOD_FK="3" MIN_VALUE="0" MAXIMUM_NUMBER_DECIMALS="2" UNIT_FK="3" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PMFM ID="358" PARAMETER_FK="352" LABEL="MORSE_CODE" UNIT_FK="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<!--<PMFM ID="358" PARAMETER_FK="352" LABEL="MORSE_CODE" UNIT_FK="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>-->
<PMFM ID="359" PARAMETER_FK="353" LABEL="STRATEGY_LABEL" UNIT_FK="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PMFM ID="1435" PARAMETER_FK="1435" LABEL="SAMPLE_ID" UNIT_FK="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
......
......@@ -40,8 +40,7 @@
<PROGRAM_PROPERTY ID="69" STATUS_FK="1" PROGRAM_FK="40" CREATION_DATE="2020-09-29" LABEL="sumaris.landing.dateTime.enable" NAME="false"/>
<PROGRAM_PROPERTY ID="70" STATUS_FK="1" PROGRAM_FK="40" CREATION_DATE="2020-09-29" LABEL="sumaris.landing.location.enable" NAME="true"/>
<PROGRAM_PROPERTY ID="71" STATUS_FK="1" PROGRAM_FK="40" CREATION_DATE="2020-09-29" LABEL="sumaris.i18nSuffix" NAME="SAMPLING."/>
<PROGRAM_PROPERTY ID="72" STATUS_FK="1" PROGRAM_FK="40" CREATION_DATE="2020-09-29" LABEL="sumaris.landing.oneTab.enable" NAME="true"/>
<PROGRAM_PROPERTY ID="73" STATUS_FK="1" PROGRAM_FK="40" CREATION_DATE="2020-09-29" LABEL="sumaris.landing.samplesCount.enable" NAME="true"/>
<PROGRAM_PROPERTY ID="72" STATUS_FK="1" PROGRAM_FK="40" CREATION_DATE="2020-09-29" LABEL="sumaris.landing.samplesCount.enable" NAME="true"/>
<PROGRAM2PERSON ID="40" PROGRAM_FK="40" PERSON_FK="3" PROGRAM_PRIVILEGE_FK="1" UPDATE_DATE="2020-09-29"/>
<PROGRAM2PERSON ID="41" PROGRAM_FK="40" PERSON_FK="2" PROGRAM_PRIVILEGE_FK="2" UPDATE_DATE="2020-09-29"/>
......@@ -75,7 +74,7 @@
<!-- PmfmStrategy / Observation -->
<PMFM_STRATEGY ID="500" STRATEGY_FK="30" ACQUISITION_LEVEL_FK="11" PMFM_FK="359" RANK_ORDER="1" ACQUISITION_NUMBER="1" IS_MANDATORY="1"/>
<PMFM_STRATEGY ID="501" STRATEGY_FK="30" ACQUISITION_LEVEL_FK="12" PMFM_FK="358" RANK_ORDER="1" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="501" STRATEGY_FK="30" ACQUISITION_LEVEL_FK="12" PMFM_FK="82" RANK_ORDER="1" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="502" STRATEGY_FK="30" ACQUISITION_LEVEL_FK="12" PMFM_FK="80" RANK_ORDER="2" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="503" STRATEGY_FK="30" ACQUISITION_LEVEL_FK="12" PMFM_FK="350" RANK_ORDER="3" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="504" STRATEGY_FK="30" ACQUISITION_LEVEL_FK="12" PMFM_FK="351" RANK_ORDER="4" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
......@@ -87,7 +86,7 @@
<PMFM_STRATEGY ID="510" STRATEGY_FK="30" ACQUISITION_LEVEL_FK="12" FRACTION_FK="13" RANK_ORDER="10" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="530" STRATEGY_FK="31" ACQUISITION_LEVEL_FK="11" PMFM_FK="359" RANK_ORDER="1" ACQUISITION_NUMBER="1" IS_MANDATORY="1"/>
<PMFM_STRATEGY ID="531" STRATEGY_FK="31" ACQUISITION_LEVEL_FK="12" PMFM_FK="358" RANK_ORDER="1" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="531" STRATEGY_FK="31" ACQUISITION_LEVEL_FK="12" PMFM_FK="82" RANK_ORDER="1" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="532" STRATEGY_FK="31" ACQUISITION_LEVEL_FK="12" PMFM_FK="80" RANK_ORDER="2" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="533" STRATEGY_FK="31" ACQUISITION_LEVEL_FK="12" PMFM_FK="350" RANK_ORDER="3" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
<PMFM_STRATEGY ID="534" STRATEGY_FK="31" ACQUISITION_LEVEL_FK="12" PMFM_FK="351" RANK_ORDER="4" ACQUISITION_NUMBER="1" IS_MANDATORY="0"/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment