diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000000000000000000000000000000000000..ae746ef2a07233516cf0ecb98e54a2a05cf9b2cd --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,18 @@ +<component name="ProjectCodeStyleConfiguration"> + <code_scheme name="Project" version="173"> + <JSCodeStyleSettings version="0"> + <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" /> + <option name="SPACES_WITHIN_IMPORTS" value="true" /> + </JSCodeStyleSettings> + <TypeScriptCodeStyleSettings version="0"> + <option name="FORCE_SEMICOLON_STYLE" value="true" /> + <option name="USE_DOUBLE_QUOTES" value="false" /> + <option name="FORCE_QUOTE_STYlE" value="true" /> + <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" /> + <option name="SPACES_WITHIN_IMPORTS" value="true" /> + </TypeScriptCodeStyleSettings> + <codeStyleSettings language="TypeScript"> + <option name="RIGHT_MARGIN" value="140" /> + </codeStyleSettings> + </code_scheme> +</component> \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e6eec114839ebf81e5be9d3c4224340855c483f --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,6 @@ +<component name="ProjectCodeStyleConfiguration"> + <state> + <option name="USE_PER_PROJECT_SETTINGS" value="true" /> + <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" /> + </state> +</component> \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 677323ac411a2e2cd554d850bdc5b9e1462eb456..0000000000000000000000000000000000000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="CompilerConfiguration"> - <bytecodeTargetLevel> - <module name="faidare.backend.main" target="1.8" /> - <module name="faidare.backend.test" target="1.8" /> - </bytecodeTargetLevel> - </component> -</project> \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000000000000000000000000000000000..a291eb1567eef251a1b031a858dea3a3c929d3a0 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ +<component name="InspectionProjectProfileManager"> + <profile version="1.0"> + <option name="myName" value="Project Default" /> + <inspection_tool class="TsLint" enabled="true" level="ERROR" enabled_by_default="true" /> + </profile> +</component> diff --git a/.idea/jsLinters/tslint.xml b/.idea/jsLinters/tslint.xml new file mode 100644 index 0000000000000000000000000000000000000000..3b034c36900b3dc1dfa7dc4f9dc6529f820c1589 --- /dev/null +++ b/.idea/jsLinters/tslint.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="TsLintConfiguration" use-custom-config-file="true" custom-config-file-path="$PROJECT_DIR$/frontend/src/tslint.json" /> +</project> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index e208459b8afde5f7980720efd6bbb97f7ae24541..5f1dbd4242a4207850da89c88503bb8e8f6dee55 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> - <output url="file://$PROJECT_DIR$/out" /> + <component name="ExternalStorageConfigurationManager" enabled="true" /> + <component name="JavaScriptSettings"> + <option name="languageLevel" value="ES6" /> </component> + <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK" /> </project> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 3b2a562bc3214c46382cc1761196d85196a94d66..0000000000000000000000000000000000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="ProjectModuleManager"> - <modules> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/faidare.iml" filepath="$PROJECT_DIR$/.idea/modules/faidare.iml" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/backend/faidare.backend.iml" filepath="$PROJECT_DIR$/.idea/modules/backend/faidare.backend.iml" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/backend/faidare.backend.main.iml" filepath="$PROJECT_DIR$/.idea/modules/backend/faidare.backend.main.iml" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/backend/faidare.backend.test.iml" filepath="$PROJECT_DIR$/.idea/modules/backend/faidare.backend.test.iml" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/frontend/faidare.frontend.iml" filepath="$PROJECT_DIR$/.idea/modules/frontend/faidare.frontend.iml" /> - <module fileurl="file://$PROJECT_DIR$/backend/src/main/main.iml" filepath="$PROJECT_DIR$/backend/src/main/main.iml" /> - <module fileurl="file://$PROJECT_DIR$/backend/src/test/test.iml" filepath="$PROJECT_DIR$/backend/src/test/test.iml" /> - </modules> - </component> -</project> \ No newline at end of file diff --git a/.idea/modules/backend/faidare.backend.iml b/.idea/modules/backend/faidare.backend.iml deleted file mode 100644 index 74f8369848300b050359ea316a2870777c7eb9c2..0000000000000000000000000000000000000000 --- a/.idea/modules/backend/faidare.backend.iml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id=":backend" external.linked.project.path="$MODULE_DIR$/../../../backend" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="faidare" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$/../../../backend"> - <excludeFolder url="file://$MODULE_DIR$/../../../backend/.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/../../../backend/build" /> - <excludeFolder url="file://$MODULE_DIR$/../../../backend/out" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> \ No newline at end of file diff --git a/.idea/modules/backend/faidare.backend.main.iml b/.idea/modules/backend/faidare.backend.main.iml deleted file mode 100644 index 75e783763dcf6e65ede52044b384993913215d40..0000000000000000000000000000000000000000 --- a/.idea/modules/backend/faidare.backend.main.iml +++ /dev/null @@ -1,147 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id=":backend:main" external.linked.project.path="$MODULE_DIR$/../../../backend" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="faidare" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> - <component name="FacetManager"> - <facet type="Spring" name="Spring"> - <configuration /> - </facet> - <facet type="web" name="Web"> - <configuration> - <webroots /> - </configuration> - </facet> - </component> - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> - <output url="file://$MODULE_DIR$/../../../backend/out/production/classes" /> - <exclude-output /> - <content url="file://$MODULE_DIR$/../../../backend/src/main"> - <sourceFolder url="file://$MODULE_DIR$/../../../backend/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/../../../backend/src/main/resources" type="java-resource" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-web:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" scope="PROVIDED" name="Gradle: org.springframework.boot:spring-boot-configuration-processor:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-actuator:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-security:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-starter-config:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.client:elasticsearch-rest-high-level-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-swagger2:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-swagger-common:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.swagger:swagger-models:1.5.20" level="project" /> - <orderEntry type="library" name="Gradle: io.swagger:swagger-annotations:1.5.21" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-swagger-ui:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-spring-web:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-schema:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-spi:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-core:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: com.google.guava:guava:27.0.1-jre" level="project" /> - <orderEntry type="library" name="Gradle: com.opencsv:opencsv:4.4" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-json:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-starter:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-tomcat:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.hibernate.validator:hibernate-validator:6.0.14.Final" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-webmvc:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-web:5.1.3.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-config-client:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-web:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-actuator-autoconfigure:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: io.micrometer:micrometer-core:1.1.2" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-config:5.1.3.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-autoconfigure:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-actuator:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-core:5.1.3.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-context:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-aop:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch-x-content:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch-cli:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch-core:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch-secure-sm:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-core:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-analyzers-common:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-backward-codecs:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-grouping:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-highlighter:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-join:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-memory:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-misc:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-queries:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-queryparser:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-sandbox:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-spatial:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-spatial-extras:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-spatial3d:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-suggest:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: com.carrotsearch:hppc:0.7.1" level="project" /> - <orderEntry type="library" name="Gradle: joda-time:joda-time:2.10.1" level="project" /> - <orderEntry type="library" name="Gradle: com.tdunning:t-digest:3.2" level="project" /> - <orderEntry type="library" name="Gradle: org.hdrhistogram:HdrHistogram:2.1.9" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-logging:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-to-slf4j:2.11.1" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-api:2.11.1" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:jna:4.5.1" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.client:elasticsearch-rest-client:6.4.3" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.plugin:parent-join-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.plugin:aggs-matrix-stats-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.plugin:rank-eval-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.plugin:lang-mustache-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml:classmate:1.4.0" level="project" /> - <orderEntry type="library" name="Gradle: ch.qos.logback:logback-classic:1.2.3" level="project" /> - <orderEntry type="library" name="Gradle: org.slf4j:jul-to-slf4j:1.7.25" level="project" /> - <orderEntry type="library" name="Gradle: org.slf4j:slf4j-api:1.7.25" level="project" /> - <orderEntry type="library" name="Gradle: org.mapstruct:mapstruct:1.2.0.Final" level="project" /> - <orderEntry type="library" name="Gradle: com.google.guava:failureaccess:1.0.1" level="project" /> - <orderEntry type="library" name="Gradle: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" /> - <orderEntry type="library" name="Gradle: com.google.code.findbugs:jsr305:3.0.2" level="project" /> - <orderEntry type="library" name="Gradle: org.checkerframework:checker-qual:2.5.2" level="project" /> - <orderEntry type="library" name="Gradle: com.google.errorprone:error_prone_annotations:2.2.0" level="project" /> - <orderEntry type="library" name="Gradle: com.google.j2objc:j2objc-annotations:1.1" level="project" /> - <orderEntry type="library" name="Gradle: org.codehaus.mojo:animal-sniffer-annotations:1.17" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.commons:commons-text:1.3" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.commons:commons-lang3:3.8.1" level="project" /> - <orderEntry type="library" name="Gradle: commons-beanutils:commons-beanutils:1.9.3" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.commons:commons-collections4:4.2" level="project" /> - <orderEntry type="library" name="Gradle: javax.annotation:javax.annotation-api:1.3.2" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-beans:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-expression:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-core:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.14" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-core:9.0.14" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-el:9.0.14" level="project" /> - <orderEntry type="library" name="Gradle: javax.validation:validation-api:2.0.1.Final" level="project" /> - <orderEntry type="library" name="Gradle: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" /> - <orderEntry type="library" name="Gradle: org.latencyutils:LatencyUtils:2.0.3" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-context:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-commons:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-rsa:1.0.5.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: org.yaml:snakeyaml:1.23" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: net.sf.jopt-simple:jopt-simple:5.0.2" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:4.5.6" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.4.10" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpasyncclient:4.1.4" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore-nio:4.4.10" level="project" /> - <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.11" level="project" /> - <orderEntry type="library" name="Gradle: commons-logging:commons-logging:1.2" level="project" /> - <orderEntry type="library" name="Gradle: com.github.spullara.mustache.java:compiler:0.9.3" level="project" /> - <orderEntry type="library" name="Gradle: commons-collections:commons-collections:3.2.2" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-jcl:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-crypto:5.1.3.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.bouncycastle:bcpkix-jdk15on:1.56" level="project" /> - <orderEntry type="library" name="Gradle: net.bytebuddy:byte-buddy:1.9.7" level="project" /> - <orderEntry type="library" name="Gradle: ch.qos.logback:logback-core:1.2.3" level="project" /> - <orderEntry type="library" name="Gradle: org.bouncycastle:bcprov-jdk15on:1.56" level="project" /> - </component> -</module> \ No newline at end of file diff --git a/.idea/modules/backend/faidare.backend.test.iml b/.idea/modules/backend/faidare.backend.test.iml deleted file mode 100644 index 32d8f78f15bb094a60be248e2e9f89065edbf356..0000000000000000000000000000000000000000 --- a/.idea/modules/backend/faidare.backend.test.iml +++ /dev/null @@ -1,176 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id=":backend:test" external.linked.project.path="$MODULE_DIR$/../../../backend" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="faidare" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> - <component name="FacetManager"> - <facet type="Spring" name="Spring"> - <configuration /> - </facet> - <facet type="web" name="Web"> - <configuration> - <webroots /> - <sourceRoots /> - </configuration> - </facet> - </component> - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> - <output-test url="file://$MODULE_DIR$/../../../backend/out/test/classes" /> - <exclude-output /> - <content url="file://$MODULE_DIR$/../../../backend/src/test"> - <sourceFolder url="file://$MODULE_DIR$/../../../backend/src/test/java" isTestSource="true" /> - <sourceFolder url="file://$MODULE_DIR$/../../../backend/src/test/resources" type="java-test-resource" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="faidare.backend.main" /> - <orderEntry type="library" scope="PROVIDED" name="Gradle: org.springframework.boot:spring-boot-configuration-processor:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-web:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-actuator:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-security:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-starter-config:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.client:elasticsearch-rest-high-level-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-swagger2:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-swagger-common:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.swagger:swagger-models:1.5.20" level="project" /> - <orderEntry type="library" name="Gradle: io.swagger:swagger-annotations:1.5.21" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-swagger-ui:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-spring-web:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-schema:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-spi:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: io.springfox:springfox-core:2.9.2" level="project" /> - <orderEntry type="library" name="Gradle: com.google.guava:guava:27.0.1-jre" level="project" /> - <orderEntry type="library" name="Gradle: com.opencsv:opencsv:4.4" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-test:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.junit.jupiter:junit-jupiter-params:5.3.2" level="project" /> - <orderEntry type="library" name="Gradle: org.junit-pioneer:junit-pioneer:0.3.0" level="project" /> - <orderEntry type="library" name="Gradle: org.junit.jupiter:junit-jupiter-api:5.3.2" level="project" /> - <orderEntry type="library" name="Gradle: org.mockito:mockito-junit-jupiter:2.23.0" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-json:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Gradle: org.junit.jupiter:junit-jupiter-engine:5.3.2" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-starter:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-tomcat:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.hibernate.validator:hibernate-validator:6.0.14.Final" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-webmvc:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-web:5.1.3.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-config-client:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-web:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-actuator-autoconfigure:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: io.micrometer:micrometer-core:1.1.2" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-config:5.1.3.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-test-autoconfigure:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-test:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-autoconfigure:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-actuator:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-core:5.1.3.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-context:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-aop:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch-x-content:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch-cli:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch-core:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:elasticsearch-secure-sm:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-core:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-analyzers-common:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-backward-codecs:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-grouping:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-highlighter:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-join:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-memory:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-misc:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-queries:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-queryparser:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-sandbox:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-spatial:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-spatial-extras:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-spatial3d:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.lucene:lucene-suggest:7.5.0" level="project" /> - <orderEntry type="library" name="Gradle: com.carrotsearch:hppc:0.7.1" level="project" /> - <orderEntry type="library" name="Gradle: joda-time:joda-time:2.10.1" level="project" /> - <orderEntry type="library" name="Gradle: com.tdunning:t-digest:3.2" level="project" /> - <orderEntry type="library" name="Gradle: org.hdrhistogram:HdrHistogram:2.1.9" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.boot:spring-boot-starter-logging:2.1.2.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-to-slf4j:2.11.1" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.logging.log4j:log4j-api:2.11.1" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch:jna:4.5.1" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.client:elasticsearch-rest-client:6.4.3" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.plugin:parent-join-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.plugin:aggs-matrix-stats-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.plugin:rank-eval-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: org.elasticsearch.plugin:lang-mustache-client:6.5.4" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml:classmate:1.4.0" level="project" /> - <orderEntry type="library" name="Gradle: com.jayway.jsonpath:json-path:2.4.0" level="project" /> - <orderEntry type="library" name="Gradle: ch.qos.logback:logback-classic:1.2.3" level="project" /> - <orderEntry type="library" name="Gradle: org.slf4j:jul-to-slf4j:1.7.25" level="project" /> - <orderEntry type="library" name="Gradle: org.slf4j:slf4j-api:1.7.25" level="project" /> - <orderEntry type="library" name="Gradle: org.mapstruct:mapstruct:1.2.0.Final" level="project" /> - <orderEntry type="library" name="Gradle: com.google.guava:failureaccess:1.0.1" level="project" /> - <orderEntry type="library" name="Gradle: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" /> - <orderEntry type="library" name="Gradle: com.google.code.findbugs:jsr305:3.0.2" level="project" /> - <orderEntry type="library" name="Gradle: org.checkerframework:checker-qual:2.5.2" level="project" /> - <orderEntry type="library" name="Gradle: com.google.errorprone:error_prone_annotations:2.2.0" level="project" /> - <orderEntry type="library" name="Gradle: com.google.j2objc:j2objc-annotations:1.1" level="project" /> - <orderEntry type="library" name="Gradle: org.codehaus.mojo:animal-sniffer-annotations:1.17" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.commons:commons-text:1.3" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.commons:commons-lang3:3.8.1" level="project" /> - <orderEntry type="library" name="Gradle: commons-beanutils:commons-beanutils:1.9.3" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.commons:commons-collections4:4.2" level="project" /> - <orderEntry type="library" name="Gradle: org.assertj:assertj-core:3.11.1" level="project" /> - <orderEntry type="library" name="Gradle: org.mockito:mockito-core:2.23.4" level="project" /> - <orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-library:1.3" level="project" /> - <orderEntry type="library" name="Gradle: org.hamcrest:hamcrest-core:1.3" level="project" /> - <orderEntry type="library" name="Gradle: org.skyscreamer:jsonassert:1.5.0" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-test:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-expression:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-beans:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-core:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.xmlunit:xmlunit-core:2.6.2" level="project" /> - <orderEntry type="library" name="Gradle: org.junit.platform:junit-platform-commons:1.3.2" level="project" /> - <orderEntry type="library" name="Gradle: org.apiguardian:apiguardian-api:1.0.0" level="project" /> - <orderEntry type="library" name="Gradle: org.opentest4j:opentest4j:1.1.1" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Gradle: org.junit.platform:junit-platform-engine:1.3.2" level="project" /> - <orderEntry type="library" name="Gradle: javax.annotation:javax.annotation-api:1.3.2" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.14" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-core:9.0.14" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.tomcat.embed:tomcat-embed-el:9.0.14" level="project" /> - <orderEntry type="library" name="Gradle: javax.validation:validation-api:2.0.1.Final" level="project" /> - <orderEntry type="library" name="Gradle: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" /> - <orderEntry type="library" name="Gradle: org.latencyutils:LatencyUtils:2.0.3" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-context:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.cloud:spring-cloud-commons:2.0.1.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-rsa:1.0.5.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: org.yaml:snakeyaml:1.23" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.9.8" level="project" /> - <orderEntry type="library" name="Gradle: net.sf.jopt-simple:jopt-simple:5.0.2" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpclient:4.5.6" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore:4.4.10" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpasyncclient:4.1.4" level="project" /> - <orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore-nio:4.4.10" level="project" /> - <orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.11" level="project" /> - <orderEntry type="library" name="Gradle: commons-logging:commons-logging:1.2" level="project" /> - <orderEntry type="library" name="Gradle: com.github.spullara.mustache.java:compiler:0.9.3" level="project" /> - <orderEntry type="library" name="Gradle: commons-collections:commons-collections:3.2.2" level="project" /> - <orderEntry type="library" name="Gradle: net.minidev:json-smart:2.3" level="project" /> - <orderEntry type="library" name="Gradle: net.bytebuddy:byte-buddy:1.9.7" level="project" /> - <orderEntry type="library" name="Gradle: net.bytebuddy:byte-buddy-agent:1.9.7" level="project" /> - <orderEntry type="library" name="Gradle: org.objenesis:objenesis:2.6" level="project" /> - <orderEntry type="library" name="Gradle: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework:spring-jcl:5.1.4.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.springframework.security:spring-security-crypto:5.1.3.RELEASE" level="project" /> - <orderEntry type="library" name="Gradle: org.bouncycastle:bcpkix-jdk15on:1.56" level="project" /> - <orderEntry type="library" name="Gradle: net.minidev:accessors-smart:1.2" level="project" /> - <orderEntry type="library" name="Gradle: ch.qos.logback:logback-core:1.2.3" level="project" /> - <orderEntry type="library" name="Gradle: org.bouncycastle:bcprov-jdk15on:1.56" level="project" /> - <orderEntry type="library" name="Gradle: org.ow2.asm:asm:5.0.4" level="project" /> - </component> - <component name="TestModuleProperties" production-module="faidare.backend.main" /> -</module> \ No newline at end of file diff --git a/.idea/modules/faidare.iml b/.idea/modules/faidare.iml deleted file mode 100644 index eb653de9b2e3688282b997abbeaa1cdf75d5b92a..0000000000000000000000000000000000000000 --- a/.idea/modules/faidare.iml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id="faidare" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$/../.."> - <excludeFolder url="file://$MODULE_DIR$/../../.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/../../build" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> \ No newline at end of file diff --git a/.idea/modules/frontend/faidare.frontend.iml b/.idea/modules/frontend/faidare.frontend.iml deleted file mode 100644 index 5b6e33b621c517f2f9cbefcb509bb0e5d446a7ad..0000000000000000000000000000000000000000 --- a/.idea/modules/frontend/faidare.frontend.iml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id=":frontend" external.linked.project.path="$MODULE_DIR$/../../../frontend" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="faidare" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$/../../../frontend"> - <excludeFolder url="file://$MODULE_DIR$/../../../frontend/.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/../../../frontend/build" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7f4cb416c083d265558da75d457237d671..35eb1ddfbbc029bcab630581847471d7f238ec53 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$" vcs="Git" /> + <mapping directory="" vcs="Git" /> </component> </project> \ No newline at end of file diff --git a/README.md b/README.md index 2543f94e1f637a83f6744aca23dd53cd317e7ebf..7101534bc8f28c1c2e0f3392f8c38b86dd00a6b5 100644 --- a/README.md +++ b/README.md @@ -118,3 +118,22 @@ to check what has to be changed. If you want to use a Spring Cloud configuration server, please refer to https://spring.io/guides/gs/centralized-configuration/ + +## Faidare data indexation in elasticsearch + +To index your data use the command line : + +```sh +curl -X GET "http://{host:port}/{environement}/faidare/v1/index?bulkDirectory={pathToTheDataDirectory}" +``` + +* {host} and {port} are the server name and port where the application is deployed and waiting for connections. +* {environment} is the name of the application you are working +* {pathToTheDataDirectory} is the absolute path of the directory where the data to index is. Note that only the compressed file ending with "json.gz" will be indexed and the application will index recursively all matching files. + +> Example :<br/> curl -X GET "http://localhost:8380/faidare-dev/v1/index?bulkDirectory=/tmp/json-bulk_dir" + + +:exclamation: **Warning :** The launcher index you data with an index per type. +The new data indexed will overwrite the previous for all sources. +The files you index must contain data from all sources. diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index c15af8dabbc9f5942c4635a08ef1e0f976dc625c..73bc9f3884c9f7fdd3198bdcd436e412d7cbdc6d 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -39,7 +39,7 @@ tasks { } getByName<Copy>("processResources") { - inputs.property("app", "gnpis") + inputs.property("app", "faidare") filesMatching("bootstrap.yml") {} } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/api/HarvestResult.java b/backend/src/main/java/fr/inra/urgi/faidare/api/HarvestResult.java new file mode 100644 index 0000000000000000000000000000000000000000..6e25d03e49a54507b54ce0c6d04da91700742fec --- /dev/null +++ b/backend/src/main/java/fr/inra/urgi/faidare/api/HarvestResult.java @@ -0,0 +1,120 @@ +package fr.inra.urgi.faidare.api; + +import org.elasticsearch.rest.RestStatus; + +import java.util.ArrayList; +import java.util.List; + +public class HarvestResult { + + private final Long startInstant; + public int nbDocInIndex; + public static int indexingSuccess; + public int indexingFailed; + public String globalError; + private List<Item> docIndexationInfo; + + + public HarvestResult(Long startInstant) { + this.startInstant = startInstant; + nbDocInIndex = 0; + indexingSuccess = 0; + indexingFailed = 0; + docIndexationInfo = new ArrayList<>(); + } + + public long getStartInstant() { + return startInstant; + } + + public int getNbDocInIndex() { + return nbDocInIndex; + } + + public void setNbDocInIndex(int nbDocInIndex) { + this.nbDocInIndex = nbDocInIndex; + } + + public static int getIndexingSuccess() { return indexingSuccess; } + + public void setIndexingSuccess(int indexingSuccess) { + this.indexingSuccess = indexingSuccess; + } + + public int getIndexingFailed() { return indexingFailed; } + + public void setIndexingFailed(int indexingFailed) { + this.indexingFailed = indexingFailed; + } + + public String getGlobalError() { return globalError; } + + public void setGlobalError(String globalError) { + this.globalError = globalError; + } + + public List<Item> getDocIndexationInfo() { + return docIndexationInfo; + } + + public void addDocIndexationInfo(Item docIndexationInfo) { + this.docIndexationInfo.add(docIndexationInfo); + } + + + public static class Item { + + public String fileName; + public String source; + public String index; + public int nbDocuments; + public String docIdFailed; + public RestStatus status; + public String errorMessage; + + public Item() { + nbDocuments = 0; + docIdFailed = null; + status = null; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public void setSource(String source) { this.source = source; } + + public String getIndex() { + return index; + } + + public void setIndex(String index) { + this.index = index; + } + + public int getNbDocuments() { + return nbDocuments; + } + + public void setNbDocuments(int nbDocuments) { + this.nbDocuments = nbDocuments; + } + + public void setDocIdFailed(String docIdFailed) { + this.docIdFailed = docIdFailed; + } + + public RestStatus getStatus() { + return status; + } + + public void setStatus(RestStatus status) { + this.status = status; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + } +} diff --git a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/DataDiscoveryController.java b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/DataDiscoveryController.java similarity index 94% rename from backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/DataDiscoveryController.java rename to backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/DataDiscoveryController.java index 36e0782a887a5be2470da0432b4236431e9c02ea..550b5efc1471ddf0f7cc3618111688a7b0aea59b 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/DataDiscoveryController.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/DataDiscoveryController.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.faidare.api.gnpis.v1; +package fr.inra.urgi.faidare.api.faidare.v1; import fr.inra.urgi.faidare.config.FaidareProperties; import fr.inra.urgi.faidare.domain.brapi.v1.response.BrapiListResponse; @@ -21,9 +21,9 @@ import java.util.List; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; -@Api(tags = {"GnpIS API"}, description = "Extended GnpIS API") +@Api(tags = {"FAIDARE API"}, description = "FAIDARE API") @RestController -@RequestMapping(value = "/gnpis/v1/datadiscovery") +@RequestMapping(value = "/faidare/v1/datadiscovery") public class DataDiscoveryController { private final DataDiscoveryRepository dataDiscoveryRepository; diff --git a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISExceptionHandler.java b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareExceptionHandler.java similarity index 92% rename from backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISExceptionHandler.java rename to backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareExceptionHandler.java index 96ee0096d79adb11411da9a7423c852cdfa3b95d..0088fa86d29a025ecf581d91498b95487139256f 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISExceptionHandler.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareExceptionHandler.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.faidare.api.gnpis.v1; +package fr.inra.urgi.faidare.api.faidare.v1; import fr.inra.urgi.faidare.api.BadRequestException; import fr.inra.urgi.faidare.api.NotFoundException; @@ -14,12 +14,12 @@ import org.springframework.web.bind.annotation.ExceptionHandler; /** - * GnpIS API exception handling + * FAIDARE API exception handling * * @author gcornut */ -@ControllerAdvice(basePackages = "fr.inra.urgi.faidare.api.gnpis.v1") -public class GnpISExceptionHandler { +@ControllerAdvice(basePackages = "fr.inra.urgi.faidare.api.faidare.v1") +public class FaidareExceptionHandler { /** * Return a simple HTTP response with a HTTP code corresponding to the error and the Exception message in the body diff --git a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISGermplasmController.java b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareGermplasmController.java similarity index 92% rename from backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISGermplasmController.java rename to backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareGermplasmController.java index 5b32adbbc07cb46ef6bfffc9db29dba362e6458d..f9b8f99fc0ad9511504fbd57c343c262f24525bb 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISGermplasmController.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareGermplasmController.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.faidare.api.gnpis.v1; +package fr.inra.urgi.faidare.api.faidare.v1; import com.google.common.base.Strings; import fr.inra.urgi.faidare.api.BadRequestException; @@ -23,15 +23,15 @@ import java.util.Collections; import static org.springframework.web.bind.annotation.RequestMethod.GET; -@Api(tags = {"GnpIS API"}, description = "Extended GnpIS API") +@Api(tags = {"FAIDARE API"}, description = "FAIDARE API") @RestController -@RequestMapping(value = "/gnpis/v1/germplasm") -public class GnpISGermplasmController { +@RequestMapping(value = "/faidare/v1/germplasm") +public class FaidareGermplasmController { private final GermplasmService germplasmService; @Autowired - public GnpISGermplasmController(GermplasmService germplasmService) { + public FaidareGermplasmController(GermplasmService germplasmService) { this.germplasmService = germplasmService; } @@ -93,7 +93,7 @@ public class GnpISGermplasmController { public FileSystemResource export(GermplasmPOSTSearchCriteria criteria, HttpServletResponse response) { try { File exportFile = germplasmService.exportCSV(criteria); - response.setHeader("Content-Disposition", "attachment; filename=germplasm.gnpis.csv"); + response.setHeader("Content-Disposition", "attachment; filename=germplasm.faidare.csv"); return new FileSystemResource(exportFile); } catch (Exception e) { e.printStackTrace(); diff --git a/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareIndexController.java b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareIndexController.java new file mode 100644 index 0000000000000000000000000000000000000000..0c178899d48303e635456634d6c432311fe1a64f --- /dev/null +++ b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareIndexController.java @@ -0,0 +1,52 @@ +package fr.inra.urgi.faidare.api.faidare.v1; + + +import com.google.common.base.Strings; +import fr.inra.urgi.faidare.api.BadRequestException; +import fr.inra.urgi.faidare.api.NotFoundException; +import fr.inra.urgi.faidare.service.es.IndexerService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.io.File; +import java.io.IOException; + +@Api(tags = {"FAIDARE API"}, description = "FAIDARE API") +@ApiIgnore +@RestController +@RequestMapping(value = "/faidare/v1/") +public class FaidareIndexController { + + private final IndexerService indexerService; + + @Autowired + public FaidareIndexController(IndexerService indexerService) { + this.indexerService = indexerService; + } + + @ApiOperation("Launch data indexation") + @GetMapping("/index") + public void index(@RequestParam(required = false) String bulkDirectory) throws IOException { + + boolean hasBulkDir = !Strings.isNullOrEmpty(bulkDirectory); + + if (!hasBulkDir) { + System.out.println("You must provide bulk directory in the query params."); + throw new BadRequestException("You must provide bulk directory in the query params."); + } else { + File bulkDir = new File(bulkDirectory); + if (!bulkDir.exists()) { + System.out.println("The file or directory (" + bulkDir + ") does not exist."); + throw new NotFoundException("The file or directory ( " + bulkDir + " ) does not exist."); + } else { + this.indexerService.index(bulkDir); + } + } + } +} diff --git a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISJSONViewHandler.java b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareJSONViewHandler.java similarity index 68% rename from backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISJSONViewHandler.java rename to backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareJSONViewHandler.java index b7836a4b24c03952c3ccf9929a736f2886381268..a24e407b9c9a2c2728a36b47f592c481aaa3601d 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISJSONViewHandler.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareJSONViewHandler.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.faidare.api.gnpis.v1; +package fr.inra.urgi.faidare.api.faidare.v1; import fr.inra.urgi.faidare.domain.JSONView; import org.springframework.core.MethodParameter; @@ -12,8 +12,8 @@ import org.springframework.web.servlet.mvc.method.annotation.AbstractMappingJack /** * @author gcornut */ -@ControllerAdvice(basePackages = "fr.inra.urgi.faidare.api.gnpis.v1") -public class GnpISJSONViewHandler extends AbstractMappingJacksonResponseBodyAdvice { +@ControllerAdvice(basePackages = "fr.inra.urgi.faidare.api.faidare.v1") +public class FaidareJSONViewHandler extends AbstractMappingJacksonResponseBodyAdvice { @Override protected void beforeBodyWriteInternal( @@ -23,7 +23,7 @@ public class GnpISJSONViewHandler extends AbstractMappingJacksonResponseBodyAdvi ServerHttpRequest req, ServerHttpResponse response ) { - // Default: display only GnpIS API Fields (BrAPI + GnpIS fileds) - bodyContainer.setSerializationView(JSONView.GnpISAPI.class); + // Default: display only FAIDARE API Fields (BrAPI + FAIDARE fields) + bodyContainer.setSerializationView(JSONView.FaidareAPI.class); } } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/XRefDocumentController.java b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/XRefDocumentController.java similarity index 89% rename from backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/XRefDocumentController.java rename to backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/XRefDocumentController.java index 95bdc960eb7c284d6ca782f5fa994fa13ee4a9a8..34851dfa256c218082d46aceb12f2acd487b4470 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/api/gnpis/v1/XRefDocumentController.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/api/faidare/v1/XRefDocumentController.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.faidare.api.gnpis.v1; +package fr.inra.urgi.faidare.api.faidare.v1; import fr.inra.urgi.faidare.domain.response.PaginatedList; import fr.inra.urgi.faidare.domain.xref.XRefDocumentSearchCriteria; @@ -17,7 +17,7 @@ import java.util.List; /** * Imported and adapted from unified-interface legacy */ -@Api(tags = {"GnpIS API"}, description = "Extended GnpIS API") +@Api(tags = {"FAIDARE API"}, description = "FAIDARE API") @RestController public class XRefDocumentController { @@ -29,7 +29,7 @@ public class XRefDocumentController { } @ApiOperation("Find xref documents") - @GetMapping(value = "/gnpis/v1/xref/documentbyfulltextid") + @GetMapping(value = "/faidare/v1/xref/documentbyfulltextid") public PaginatedList<XRefDocumentVO> documentByFullTextId( @RequestParam(required = false, value = "entry_type") String entryType, @RequestParam(required = false) List<String> linkedRessourcesID diff --git a/backend/src/main/java/fr/inra/urgi/faidare/config/FaidareProperties.java b/backend/src/main/java/fr/inra/urgi/faidare/config/FaidareProperties.java index 6d58afe20c3b72c97bea56ab88db02cd53239404..799599a0593554005066c856b27f76bd11ffa17b 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/config/FaidareProperties.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/config/FaidareProperties.java @@ -1,5 +1,6 @@ package fr.inra.urgi.faidare.config; +import fr.inra.urgi.faidare.domain.datadiscovery.data.DataSource; import fr.inra.urgi.faidare.domain.datadiscovery.data.DataSourceImpl; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -16,7 +17,7 @@ import java.util.List; public class FaidareProperties { @NotBlank - private String elasticsearchAliasTemplate; + private String elasticsearchIndexingTemplate; @NotBlank private String elasticsearchXrefIndexName; @@ -32,12 +33,12 @@ public class FaidareProperties { private List<DataSourceImpl> dataSources = new ArrayList<>(); - public String getElasticsearchAliasTemplate() { - return elasticsearchAliasTemplate; + public String getElasticsearchIndexingTemplate() { + return elasticsearchIndexingTemplate; } - public void setElasticsearchAliasTemplate(String elasticsearchAliasTemplate) { - this.elasticsearchAliasTemplate = elasticsearchAliasTemplate; + public void setElasticsearchIndexingTemplate(String elasticsearchIndexingTemplate) { + this.elasticsearchIndexingTemplate = elasticsearchIndexingTemplate; } public String getElasticsearchXrefIndexName() { @@ -88,14 +89,34 @@ public class FaidareProperties { this.dataSources = dataSources; } + public DataSource getByUri (String uri) { + for (DataSourceImpl dataSource : getDataSources()) { + if (dataSource.getUri().equals(uri)) { + return dataSource; + } + } + return null; + } + + /** + * Get ElasticSearch alias name using the template property, the document type and the group id + */ + public String getAliasName(String documentType, long groupId) { + return getBaseIndexName(documentType) + "-group" + groupId; + } + /** - * Get ElasticSearch index name using the template property, the document type and the group id + * Get ElasticSearch index name using the template property, the document type and the index creation timestamp */ - public String getIndexName(String source, String documentType, long groupId) { - return elasticsearchAliasTemplate - .replace("{source}", source.toLowerCase()) - .replace("{documentType}", documentType.toLowerCase()) - .replace("{groupId}", String.valueOf(groupId)); + public String getIndexName( String documentType, long startInstant) { + return getBaseIndexName(documentType) + "-d" + startInstant; + } + + public String getBaseIndexName(String documentType) { + return elasticsearchIndexingTemplate + .replace("{documentType}", documentType.toLowerCase()); } + + } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/config/MimeMappingServletCustomizer.java b/backend/src/main/java/fr/inra/urgi/faidare/config/MimeMappingServletCustomizer.java index 184cc1e9597ed814782b8d81e1a890cf21e54729..0913cd03dfacf10450d81eb81b005de4fd5ab44b 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/config/MimeMappingServletCustomizer.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/config/MimeMappingServletCustomizer.java @@ -7,6 +7,7 @@ import org.springframework.context.annotation.Configuration; /** * MimeMappings configuration. Ensure that markdown files are correctly returned with the good MimeType + * * @author R. Flores */ @Configuration diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/JSONView.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/JSONView.java index 37a643806a2e094a31e265c2d0231ff1f30196b8..05ae1392102006a500bfed380a0f5a86a256717c 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/JSONView.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/JSONView.java @@ -17,9 +17,9 @@ public interface JSONView { } /** - * JSON View for GnpIS fields that can be exposed + * JSON View for FAIDARE fields that can be exposed */ - interface GnpISFields { + interface FaidareFields { } /** @@ -29,22 +29,22 @@ public interface JSONView { } /** - * JSON view for GnpIS public API (combine fields from BrAPI and GnpIS) + * JSON view for FAIDARE public API (combine fields from BrAPI and FAIDARE) */ interface BrapiWithJSONLD extends BrapiFields, JSONLDFields { } /** - * JSON view for GnpIS public API (combine fields from BrAPI and GnpIS) + * JSON view for FAIDARE public API (combine fields from BrAPI and FAIDARE) */ - interface GnpISAPI extends JSONLDFields, GnpISFields, BrapiFields { + interface FaidareAPI extends JSONLDFields, FaidareFields, BrapiFields { } /** * Jackson json view used for internal properties that should not be exposed. * Used in {@link ESResponseParser} to deserialize internal properties from Elasticsearch. */ - interface Internal extends GnpISAPI { + interface Internal extends FaidareAPI { } } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/LocationVO.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/LocationVO.java index f8dea56d760b22a1da8f701eda6b91b8be562b5f..801a4974b9276643f323a6c1a1b535780b089194 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/LocationVO.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/LocationVO.java @@ -38,7 +38,7 @@ public class LocationVO implements GnpISInternal, BrapiLocation, HasURI, HasURL, private BrapiAdditionalInfo additionalInfo; - // GnpIS specific fields + // FAIDARE specific fields private List<Long> speciesGroup; private Long groupId; diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/ProgramVO.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/ProgramVO.java index 07584931139e3f87e52379b05365392ce7bef048..2384803a335d72ebf1e5123e3873e2bb514afb8b 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/ProgramVO.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/ProgramVO.java @@ -33,7 +33,7 @@ public class ProgramVO implements GnpISInternal, BrapiProgram, HasURI, HasURL, I @JsonSetter(nulls = Nulls.AS_EMPTY) private String objective = ""; - // GnpIS specific fields + // FAIDARE specific fields private Long groupId; private List<Long> speciesGroup; diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/TrialVO.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/TrialVO.java index 71a150e390d569f3e840a47f878c24ebb8e7f32d..421e86b8f1141c383a977f3b95ff878dcb37c519 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/TrialVO.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/TrialVO.java @@ -43,7 +43,7 @@ public class TrialVO implements GnpISInternal, BrapiTrial, HasURI, HasURL, Inclu private BrapiAdditionalInfo additionalInfo; - // GnpIS specific fields + // FAIDARE specific fields private List<Long> speciesGroup; private Long groupId; diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/CollPop.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/CollPop.java index b9ab3e1b8f3ce3973eb74607a5d8869f9bcbfc63..58240d09beb002fce2067c89bbf305bd8860a081 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/CollPop.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/CollPop.java @@ -7,18 +7,18 @@ import fr.inra.urgi.faidare.domain.JSONView; * @author gcornut */ public interface CollPop { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Long getId(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getName(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getType(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) PuiNameValue getGermplasmRef(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Integer getGermplasmCount(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/ExtendedDonor.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/ExtendedDonor.java index fd5164d5d6c2a789170707b2a5c492d851c567f4..035af0494746fcacd8a130ff99b68b54c4c31748 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/ExtendedDonor.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/ExtendedDonor.java @@ -11,9 +11,9 @@ import fr.inra.urgi.faidare.domain.brapi.v1.data.BrapiGermplasmDonor; */ public interface ExtendedDonor extends BrapiGermplasmDonor { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Institute getDonorInstitute(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Integer getDonationDate(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/ExtendedGermplasm.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/ExtendedGermplasm.java index 4f2c156569e5653fa89831f85fda619d2ee4f641..97d8185f6ab6d606cb5bb1cca9f15fc47aab1232 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/ExtendedGermplasm.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/ExtendedGermplasm.java @@ -14,66 +14,66 @@ import java.util.List; */ public interface ExtendedGermplasm extends BrapiGermplasm, GnpISInternal { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<String> getTaxonSynonyms(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<String> getTaxonCommonNames(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getTaxonComment(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getGeneticNature(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getComment(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Photo getPhoto(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Institute getHoldingInstitute(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Institute getHoldingGenbank(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getPresenceStatus(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Genealogy getGenealogy(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<? extends Genealogy> getChildren(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<? extends PuiNameValue> getDescriptors(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Site getOriginSite(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Site getCollectingSite(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<? extends Site> getEvaluationSites(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) GermplasmInstitute getCollector(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) GermplasmInstitute getBreeder(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<? extends GermplasmInstitute> getDistributors(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<? extends CollPop> getPanel(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<? extends CollPop> getCollection(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<? extends CollPop> getPopulation(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Genealogy.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Genealogy.java index e9837d90c3e0e3cda986a162fb6f8fafd738c181..6ee3bf731fa7312084a5b633e62ce7df5a43003a 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Genealogy.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Genealogy.java @@ -9,33 +9,33 @@ import java.util.List; * @author gcornut */ public interface Genealogy { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getCrossingPlan(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getCrossingYear(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getFamilyCode(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getFirstParentName(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getFirstParentPUI(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getFirstParentType(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getSecondParentName(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getSecondParentPUI(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getSecondParentType(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<SimpleVO> getSibblings(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/GermplasmInstitute.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/GermplasmInstitute.java index 692f62f7b58dd83e84ec830d7523da173490dfab..ae79dfac4575dbd321478ccb37a21cfd4c83318c 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/GermplasmInstitute.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/GermplasmInstitute.java @@ -7,30 +7,30 @@ import fr.inra.urgi.faidare.domain.JSONView; * @author gcornut */ public interface GermplasmInstitute { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Institute getInstitute(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getGermplasmPUI(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getAccessionNumber(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Integer getAccessionCreationDate(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getMaterialType(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getCollectors(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Integer getRegistrationYear(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Integer getDeregistrationYear(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getDistributionStatus(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Institute.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Institute.java index 918211210a890847ec8c1e5f0e6cea7e1949b5f9..653fe2f0a394d7b63a37c29049335702e514c023 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Institute.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Institute.java @@ -7,27 +7,27 @@ import fr.inra.urgi.faidare.domain.JSONView; * @author gcornut */ public interface Institute { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getInstituteName(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getInstituteCode(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getAcronym(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getOrganisation(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getInstituteType(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getWebSite(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getAddress(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getLogo(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Photo.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Photo.java index 928719b7f2704575a5e1944c63e26ff37b383398..5f1381b27bf0fe87e1350fcd768b9b0bb89a7105 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Photo.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Photo.java @@ -7,18 +7,18 @@ import fr.inra.urgi.faidare.domain.JSONView; * @author gcornut */ public interface Photo { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getFile(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getThumbnailFile(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getPhotoName(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getDescription(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getCopyright(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/PuiNameValue.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/PuiNameValue.java index 21611a08c3bddd1e53ff6d13a449e688b2e70ed7..912dae7b43afeb45aa093e2d4e1d37020e060bc2 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/PuiNameValue.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/PuiNameValue.java @@ -7,12 +7,12 @@ import fr.inra.urgi.faidare.domain.JSONView; * @author gcornut */ public interface PuiNameValue { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getPui(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getName(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getValue(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Site.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Site.java index 72479946d41e9a27c1ed62e2b8422edf5ad48f1b..c5b1636bd609ab86073e1a102631701c7d1cb53b 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Site.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/germplasm/Site.java @@ -7,18 +7,18 @@ import fr.inra.urgi.faidare.domain.JSONView; * @author gcornut */ public interface Site { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Long getSiteId(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getSiteName(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Float getLatitude(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Float getLongitude(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getSiteType(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/study/StudyDetailVO.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/study/StudyDetailVO.java index e34075b172ef63d98727970267e3af56864e8eba..0b1e77c1f2684c86a8bc2b0bd920ff6b88f43b43 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/study/StudyDetailVO.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/study/StudyDetailVO.java @@ -59,7 +59,7 @@ public class StudyDetailVO implements GnpISInternal, BrapiStudyDetail, HasURI, H @JsonDeserialize(contentAs = StudyDataLinkVO.class) private List<BrapiStudyDataLink> dataLinks; - // GnpIS specific fields + // FAIDARE specific fields private List<Long> speciesGroup; private Long groupId; diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/study/StudySummaryVO.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/study/StudySummaryVO.java index d27d745dcd37d8fb05169e930d48d7c15b6f3010..7e80913fbaf7ae627c45a9701f94b03dbb9e863a 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/data/study/StudySummaryVO.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/data/study/StudySummaryVO.java @@ -55,7 +55,7 @@ public class StudySummaryVO implements GnpISInternal, BrapiStudySummary, HasURI, @JsonIgnore private List<String> germplasmDbIds; - // GnpIS specific fields + // FAIDARE specific fields private List<Long> speciesGroup; private Long groupId; diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/DataDiscovery.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/DataDiscovery.java index 146a1a5c38444db265f17546531a4a564ce2d21e..12261cb7361db819daf2867f30ae979fb7e62c00 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/DataDiscovery.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/DataDiscovery.java @@ -16,31 +16,31 @@ import java.util.List; public interface DataDiscovery extends Dataset { @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getIdentifier(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getUri(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getName(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getSourceUri(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<String> getType(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getDescription(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getUrl(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/DataSource.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/DataSource.java index 2c23f5db92f5507ac7e23c065504670a78c84a93..1acf4b845ade91587b4b45635976bd2b38edb0da 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/DataSource.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/DataSource.java @@ -14,27 +14,28 @@ import java.util.List; public interface DataSource extends DataCatalog { @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getUri(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getIdentifier(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getName(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<String> getType(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getUrl(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getImage(); + } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/Facet.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/Facet.java index 90635032fd27023bc778f280e730b41d28ebbd52..e851b9271d2a6bfa81a03644e69f2964016655a4 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/Facet.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/Facet.java @@ -10,10 +10,10 @@ import java.util.List; */ public interface Facet { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getField(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<? extends FacetTerm> getTerms(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/FacetTerm.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/FacetTerm.java index 84c7fa56dff66d5d54ea1233f463d28f406a0f21..18c6e41bb71e17332048c4d96e2891cf4a00906f 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/FacetTerm.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/data/FacetTerm.java @@ -8,10 +8,10 @@ import fr.inra.urgi.faidare.domain.JSONView; */ public interface FacetTerm { - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) String getTerm(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) Long getCount(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/response/DataDiscoveryResponse.java b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/response/DataDiscoveryResponse.java index 2e92bea47dd53dd934e762c5349c3b8175f5fcf0..8e70a1612652e6cd986d06e41cff30af063135a4 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/response/DataDiscoveryResponse.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/domain/datadiscovery/response/DataDiscoveryResponse.java @@ -16,14 +16,14 @@ import java.util.List; public interface DataDiscoveryResponse extends BrapiListResponse<DataDiscoveryDocument> { @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) BrapiMetadata getMetadata(); @Override - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) BrapiData<DataDiscoveryDocument> getResult(); - @JsonView(JSONView.GnpISFields.class) + @JsonView(JSONView.FaidareFields.class) List<? extends Facet> getFacets(); } diff --git a/backend/src/main/java/fr/inra/urgi/faidare/elasticsearch/ESRequestFactory.java b/backend/src/main/java/fr/inra/urgi/faidare/elasticsearch/ESRequestFactory.java index 5017cacaafd65d5ec812471bc549eae251cfb1cd..302aa42cbfddfe42b543949f546edab17797f0c7 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/elasticsearch/ESRequestFactory.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/elasticsearch/ESRequestFactory.java @@ -114,7 +114,7 @@ public class ESRequestFactory { List<String> aliases = new ArrayList<>(); for (Integer groupId : groupIds) { for (String sourceId : sourceIds) { - aliases.add(properties.getIndexName(sourceId, documentType, groupId)); + aliases.add(properties.getAliasName(documentType, groupId)); } } return aliases; diff --git a/backend/src/main/java/fr/inra/urgi/faidare/elasticsearch/ESResponseParser.java b/backend/src/main/java/fr/inra/urgi/faidare/elasticsearch/ESResponseParser.java index 092892399f62f7820670f3c057665c55d11c7857..0d7c2b28322ec31021b8d27772e8a8cca1d89d73 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/elasticsearch/ESResponseParser.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/elasticsearch/ESResponseParser.java @@ -125,7 +125,7 @@ public class ESResponseParser { /** * Find aggregation result in search response using the aggregation path and its type */ - private <T> T findAggregation( + public <T> T findAggregation( SearchResponse response, List<String> aggregationPath, Class<T> aggregationType ) { Aggregations aggregations = response.getAggregations(); diff --git a/backend/src/main/java/fr/inra/urgi/faidare/filter/AngularRouteFilter.java b/backend/src/main/java/fr/inra/urgi/faidare/filter/AngularRouteFilter.java index b3c2fa7f2e15a25a8a9a5ee1b9256e0056248868..81978e5f3bfaca602e70eff0f109477d55e1466a 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/filter/AngularRouteFilter.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/filter/AngularRouteFilter.java @@ -34,7 +34,7 @@ import java.util.Arrays; public class AngularRouteFilter implements Filter { private static final String[] API_PREFIXES = { - "/brapi/v1", "/gnpis/v1", "/actuator", "/v2/api-docs", "/swagger-resources" + "/brapi/v1", "/faidare/v1", "/actuator", "/v2/api-docs", "/swagger-resources" }; private static final String[] STATIC_SUFFIXES = { diff --git a/backend/src/main/java/fr/inra/urgi/faidare/repository/es/DataDiscoveryRepositoryImpl.java b/backend/src/main/java/fr/inra/urgi/faidare/repository/es/DataDiscoveryRepositoryImpl.java index 08d6a6d7b7d5e58144b8e4655e08714c864bb8d7..73662c5d9787b70d4f57705fc994e6f4a572749f 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/repository/es/DataDiscoveryRepositoryImpl.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/repository/es/DataDiscoveryRepositoryImpl.java @@ -1,6 +1,6 @@ package fr.inra.urgi.faidare.repository.es; -import fr.inra.urgi.faidare.api.gnpis.v1.DataDiscoveryController; +import fr.inra.urgi.faidare.api.faidare.v1.DataDiscoveryController; import fr.inra.urgi.faidare.domain.datadiscovery.criteria.DataDiscoveryCriteria; import fr.inra.urgi.faidare.domain.datadiscovery.criteria.DataDiscoveryCriteriaImpl; import fr.inra.urgi.faidare.domain.datadiscovery.data.DataDiscoveryDocument; diff --git a/backend/src/main/java/fr/inra/urgi/faidare/service/es/GermplasmServiceImpl.java b/backend/src/main/java/fr/inra/urgi/faidare/service/es/GermplasmServiceImpl.java index 2c851d636da5bff0c04491bf2e02bb61efc84e6a..7ae55bac732429fb0b9c8ee657105e8c1ba53621 100644 --- a/backend/src/main/java/fr/inra/urgi/faidare/service/es/GermplasmServiceImpl.java +++ b/backend/src/main/java/fr/inra/urgi/faidare/service/es/GermplasmServiceImpl.java @@ -1,7 +1,7 @@ package fr.inra.urgi.faidare.service.es; import com.opencsv.CSVWriter; -import fr.inra.urgi.faidare.api.gnpis.v1.GnpISGermplasmController; +import fr.inra.urgi.faidare.api.faidare.v1.FaidareGermplasmController; import fr.inra.urgi.faidare.domain.criteria.GermplasmSearchCriteria; import fr.inra.urgi.faidare.domain.data.germplasm.GermplasmVO; import fr.inra.urgi.faidare.domain.data.germplasm.PedigreeVO; @@ -25,7 +25,7 @@ import java.util.Iterator; @Service("germplasmService") public class GermplasmServiceImpl implements GermplasmService { - private final static Logger LOGGER = LoggerFactory.getLogger(GnpISGermplasmController.class); + private final static Logger LOGGER = LoggerFactory.getLogger(FaidareGermplasmController.class); @Resource GermplasmRepository germplasmRepository; diff --git a/backend/src/main/java/fr/inra/urgi/faidare/service/es/IndexerService.java b/backend/src/main/java/fr/inra/urgi/faidare/service/es/IndexerService.java new file mode 100644 index 0000000000000000000000000000000000000000..95e9f12ed9cf649be8e04665ee54fbc0eb048e66 --- /dev/null +++ b/backend/src/main/java/fr/inra/urgi/faidare/service/es/IndexerService.java @@ -0,0 +1,539 @@ +package fr.inra.urgi.faidare.service.es; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import fr.inra.urgi.faidare.api.HarvestResult; +import fr.inra.urgi.faidare.config.FaidareProperties; +import fr.inra.urgi.faidare.domain.datadiscovery.data.DataSource; +import fr.inra.urgi.faidare.elasticsearch.ESRequestFactory; +import fr.inra.urgi.faidare.elasticsearch.ESResponseParser; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; +import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; +import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; +import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; +import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; +import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; +import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; +import org.elasticsearch.action.admin.indices.get.GetIndexRequest; +import org.elasticsearch.action.admin.indices.get.GetIndexResponse; +import org.elasticsearch.action.bulk.BulkItemResponse; +import org.elasticsearch.action.bulk.BulkRequest; +import org.elasticsearch.action.bulk.BulkResponse; +import org.elasticsearch.action.index.IndexRequest; +import org.elasticsearch.action.search.SearchRequest; +import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; +import org.elasticsearch.client.GetAliasesResponse; +import org.elasticsearch.client.RequestOptions; +import org.elasticsearch.client.RestHighLevelClient; +import org.elasticsearch.cluster.health.ClusterHealthStatus; +import org.elasticsearch.common.xcontent.XContentType; +import org.elasticsearch.index.query.QueryBuilder; +import org.elasticsearch.rest.RestStatus; +import org.elasticsearch.search.aggregations.bucket.terms.Terms; +import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; +import org.elasticsearch.search.builder.SearchSourceBuilder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.*; +import java.util.*; +import java.util.stream.Collectors; +import java.util.zip.GZIPInputStream; + +import static org.elasticsearch.index.query.QueryBuilders.*; +import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; + +@Service +public class IndexerService { + + private final RestHighLevelClient client; + private final ObjectMapper objectMapper; + private final FaidareProperties properties; + private final ESResponseParser esResponseParser; + + @Autowired + public IndexerService( + RestHighLevelClient restHighLevelClient, + ObjectMapper objectMapper, + FaidareProperties faidareProperties, + ESResponseParser esResponseParser + ) { + this.client = restHighLevelClient; + this.objectMapper = objectMapper; + this.properties = faidareProperties; + this.esResponseParser = esResponseParser; + } + + + private void checkClusterHealthNotRed() { + ClusterHealthRequest request = new ClusterHealthRequest(); + ClusterHealthResponse health; + try { + health = this.client.cluster().health(request, RequestOptions.DEFAULT); + } catch (IOException e) { + throw new RuntimeException(e); + } + if (health.getStatus() == ClusterHealthStatus.RED) { + throw new RuntimeException("Cluster health status is red. Indexing aborted !"); + } + } + + + /** + * Manage the different indexing steps + * (Create and index data, Create aliases, Switch link aliases between indices, Delete old indices) + * @param bulkDirectory the directory that contain the files to index. + */ + public void index(File bulkDirectory) { + + long startInstant = System.currentTimeMillis() / 1000; + IndexerInfo indexerInfo = new IndexerInfo(startInstant); + HarvestResult harvestResult = new HarvestResult(startInstant); + + try { + checkClusterHealthNotRed(); + + System.out.println("Launch indexer..."); + indexer(bulkDirectory, indexerInfo, harvestResult); + System.out.println("Indexing done"); + + + /*System.out.println(indexerInfo.dataSource.getName()); + System.out.println(indexerInfo.documentTypes);*/ + + if (harvestResult.getGlobalError() == null) { + System.out.println(harvestResult.getDocIndexationInfo().size() + + " file(s) has been indexed with " + + HarvestResult.getIndexingSuccess() + " document(s)"); + createAliases(indexerInfo); + deleteOldIndices(indexerInfo); + + } + } catch (Exception e) { + e.printStackTrace(); + + // If the indexing failed delete the indices that have been created during this indexing + indexerInfo.getNewIndices() + .forEach(indexToDelete -> deleteIndex(indexToDelete)); + harvestResult.setGlobalError(e.getMessage()); + } + + try { + ObjectMapper objectMapper = new ObjectMapper(); + String harvestResultToIndex = objectMapper.writeValueAsString(harvestResult); + + String documentType = "indexationInfo"; + String indexName = properties.getIndexName(documentType, indexerInfo.startInstant); + + + BulkRequest bulkRequest = new BulkRequest(); + String documentId = "info:" + UUID.randomUUID().toString(); + try { + createIndex(indexName, documentType); + indexerInfo.addDocumentType(documentType); + } catch (IOException e) { + throw new RuntimeException("Could not create the index for the HarvestResult document" + e); + } + + IndexRequest indexRequest = new IndexRequest(indexName, documentType, documentId); + indexRequest.source(harvestResultToIndex, XContentType.JSON); + bulkRequest.add(indexRequest); + + BulkResponse response = client.bulk(bulkRequest, RequestOptions.DEFAULT); + System.out.println("Information indexed in : " + indexName); + + if (response.hasFailures()) { + throw new RuntimeException("Could not index the HarvestResult document" + response.buildFailureMessage()); + } + + deleteOldIndices(indexerInfo); + + } catch (IOException e) { + + e.printStackTrace(); + } + + } + + /** + * Launch indexing of all the files to index in the directory given. + * + * @param bulkDir The file to index or the directory which contains the files to index + * @param indexerInfo The object where all the data needed for indexation (Timestamp, Data source, Document type...) + * @param harvestResult The object which keep a track of the indexing. + * @throws IOException Throw a exception which will be catch by the parent method if the indexing failed. + */ + private void indexer(File bulkDir, IndexerInfo indexerInfo, HarvestResult harvestResult) throws IOException { + + File[] bulkFiles = bulkDir.listFiles(); + assert bulkFiles != null; + for (File bulkFile : bulkFiles) { + // Check if it is a directory + // and if this directory do not have the suffix "failed" (suffix for directory where Extract and Transform have failed) + if (bulkFile.isDirectory() && !bulkFile.getName().endsWith("failed")) { + indexer(bulkFile, indexerInfo, harvestResult); + } else if (bulkFile.getName().endsWith(".json.gz")) { + indexBulkFile(bulkFile, indexerInfo, harvestResult); + } + } + + } + + /* + Indexer using jav.nio + */ + /*public void indexer(Path bulkFile, IndexerInfo indexerInfo, HarvestResult indexingResult) throws Exception{ + + BasicFileAttributes attrs = Files.readAttributes(bulkFile, BasicFileAttributes.class); + + if (attrs.isDirectory() && bulkFile.getFileName().toString().endsWith("failed")) { + DirectoryStream<Path> paths = Files.newDirectoryStream(bulkFile); + System.out.println(bulkFile.getFileName().toString() + " " + bulkFile.getFileName().toString().endsWith("t")); + for (Path deepPaths: paths){ + indexer(deepPaths, indexerInfo, indexingResult); + } + } else if (bulkFile.getFileName().toString().endsWith(".json.gz")) { + indexBulkFile(bulkFile, indexerInfo, indexingResult); + } + }*/ + + private void deleteIndex(String indexToDelete) { + + System.out.println("Deleting index: " + indexToDelete); + DeleteIndexRequest deleteRequest = new DeleteIndexRequest(); + deleteRequest.indices(indexToDelete); + + checkClusterHealthNotRed(); + AcknowledgedResponse deleteResponse = null; + try { + deleteResponse = client.indices().delete(deleteRequest, RequestOptions.DEFAULT); + } catch (IOException e) { + throw new RuntimeException(e); + } + if (!deleteResponse.isAcknowledged()) { + throw new RuntimeException( + "Could not delete old indices: " + indexToDelete + ); + } + + } + + + private void deleteOldIndices(IndexerInfo indexerInfo) throws IOException { + + GetIndexRequest request = new GetIndexRequest(); + String[] indexPatterns = indexerInfo.documentTypes.stream() + .map(documentType -> properties.getBaseIndexName(documentType) + '*') + .toArray(String[]::new); + request.indices(indexPatterns); + + GetIndexResponse response = client.indices().get(request, RequestOptions.DEFAULT); + + Set<String> oldIndices = new HashSet<>(); + oldIndices.addAll(Arrays.asList(response.getIndices())); + + Map<String, List<String>> indexByType = oldIndices.stream() + .collect(Collectors.groupingBy(index -> index.split("_")[1])); + + for (String type : indexByType.keySet()) { + indexByType.get(type).stream() + .sorted(Comparator.reverseOrder()) + .skip(2) + .forEach(indexToDelete -> { + deleteIndex(indexToDelete); + }); + } + } + + private void createAliases(IndexerInfo indexerInfo) throws IOException { + + String dataSource = indexerInfo.getDataSourceName(); + IndicesAliasesRequest request = new IndicesAliasesRequest(); + + for (String documentType : indexerInfo.documentTypes) { + String indexName = properties.getIndexName(documentType, indexerInfo.startInstant); + Set<Long> groupIds = getGroupIds(indexName); + + for (Long groupId : groupIds) { + request.getAliasActions().addAll( + createAliasActions(indexName, documentType, groupId)); + } + } + + if (!request.getAliasActions().isEmpty()) { + + checkClusterHealthNotRed(); + System.out.println("Creating aliases..."); + AcknowledgedResponse indicesAliasesResponse = client.indices().updateAliases(request, RequestOptions.DEFAULT); + + if (!indicesAliasesResponse.isAcknowledged()) { + throw new RuntimeException("Could not update aliases"); + } + System.out.println("Creation of aliases done"); + + } + } + + private Set<Long> getGroupIds(String indexName) throws IOException { + String aggName = "groupIdAgg"; + TermsAggregationBuilder termAgg = terms(aggName) + .field("groupId") + .size(ESRequestFactory.MAX_TERM_AGG_SIZE); + + SearchRequest searchRequest = new SearchRequest(indexName); + SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); + searchSourceBuilder.aggregation(termAgg); + searchRequest.source(searchSourceBuilder); + + SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT); + + Terms terms = esResponseParser.findAggregation(searchResponse, Collections.singletonList(aggName), Terms.class); + + Set<Long> groupIds = terms.getBuckets().stream() + .map(bucket -> bucket.getKeyAsNumber().longValue()) + .collect(Collectors.toSet()); + groupIds.add(0L); + return groupIds; + } + + + private Set<AliasActions> createAliasActions(String indexName, String documentType, long groupId) throws IOException { + Set<AliasActions> actions = new HashSet<>(); + String aliasName = properties.getAliasName(documentType, groupId); + + // Check existing alias and remove old indices from alias + GetAliasesRequest request = new GetAliasesRequest(aliasName); + GetAliasesResponse response = client.indices().getAlias(request, RequestOptions.DEFAULT); + if (response.status() == RestStatus.OK) { + Set<String> oldIndices = response.getAliases().keySet(); + for (String oldIndex : oldIndices) { + AliasActions removeAction = + new AliasActions(AliasActions.Type.REMOVE) + .index(oldIndex) + .alias(aliasName); + actions.add(removeAction); + } + } + + QueryBuilder filter = termQuery("groupId", groupId); + if (groupId == 0) { + filter = boolQuery() + // GroupId = 0 + .should(filter) + // OR groupId field is null or not exists + .should( + boolQuery().mustNot(existsQuery("groupId"))); + } + + // Add new index to filtered alias + AliasActions addIndexAction = + new AliasActions(AliasActions.Type.ADD) + .indices(indexName) + .alias(aliasName) + .filter(filter); + actions.add(addIndexAction); + + return actions; + } + + + private void indexBulkFile(File bulkFile, IndexerInfo indexerInfo, HarvestResult harvestResult) throws IOException { + try (GZIPInputStream gzipInputStream = new GZIPInputStream(new FileInputStream(bulkFile.getAbsolutePath()))) { + + BufferedReader reader = new BufferedReader(new InputStreamReader(gzipInputStream)); + + BulkRequest bulkRequest = new BulkRequest(); + + String documentType = null; + String indexName = null; + + String header; + + while ((header = reader.readLine()) != null) { + + String documentId; + JsonNode headerNode; + try { + headerNode = this.objectMapper.readTree(header); + documentId = headerNode.get("index").get("_id").asText(); + } catch (IOException e) { + HarvestResult.Item item = new HarvestResult.Item(); + item.setFileName(bulkFile.getName()); + item.setStatus(RestStatus.EXPECTATION_FAILED); + item.setErrorMessage(e.toString()); + harvestResult.addDocIndexationInfo(item); + throw new IOException("In header : " + e); + } + + + JsonNode documentNode; + String document; + try { + document = reader.readLine(); + documentNode = this.objectMapper.readTree(document); + } catch (IOException e) { + + HarvestResult.Item item = new HarvestResult.Item(); + item.setFileName(bulkFile.getName()); + item.setDocIdFailed(documentId); + item.setStatus(RestStatus.EXPECTATION_FAILED); + item.setErrorMessage(e.toString()); + harvestResult.addDocIndexationInfo(item); + throw new IOException("In document : " + documentId + e); + } + + + String sourceUri; + // TODO remove the check for empty "schema:includedInDataCatalog" when the new ET will fill this field. + if (documentNode.hasNonNull("schema:includedInDataCatalog")) { + sourceUri = documentNode.get("schema:includedInDataCatalog").asText(); + } else { + sourceUri = "https://urgi.versailles.inra.fr"; + } + + DataSource dataSource = properties.getByUri(sourceUri); + if (dataSource == null) { + throw new RuntimeException("Source URI '" + sourceUri + "' unknown"); + } + + if (indexName == null) { + documentType = headerNode.get("index").get("_type").asText(); + indexerInfo.setDataSource(dataSource); + indexerInfo.addDocumentType(documentType); + indexName = properties.getIndexName(documentType, indexerInfo.getStartInstant()); + createIndex(indexName, documentType); + indexerInfo.addNewIndices(indexName); + } + IndexRequest indexRequest = new IndexRequest(indexName, documentType, documentId); + indexRequest.source(document, XContentType.JSON); + bulkRequest.add(indexRequest); + } + System.out.println("Bulk indexing : " + bulkFile.getName() + "..."); + checkClusterHealthNotRed(); + + BulkResponse response; + try { + response = client.bulk(bulkRequest, RequestOptions.DEFAULT); + // harvestResult.setNbDocInIndex(harvestResult.getNbDocInIndex() += ); + } catch (IOException e) { + StringWriter s = new StringWriter(); + e.printStackTrace(new PrintWriter(s)); + + HarvestResult.Item item = new HarvestResult.Item(); + item.setFileName(bulkFile.getName()); + item.setSource(indexerInfo.getDataSourceName()); + item.setIndex(indexName); + item.setErrorMessage(s.toString()); + harvestResult.addDocIndexationInfo(item); + throw e; + } + + HarvestResult.Item item = new HarvestResult.Item(); + item.setFileName(bulkFile.getName()); + item.setSource(indexerInfo.getDataSourceName()); + item.setIndex(indexName); + for (BulkItemResponse responseItem : response.getItems()) { + + if (responseItem.status() == RestStatus.CREATED || responseItem.status() == RestStatus.OK) { + item.setNbDocuments(item.getNbDocuments() + 1); + harvestResult.setIndexingSuccess(harvestResult.getIndexingSuccess() + 1); + } else { + item.setDocIdFailed(responseItem.getId()); + item.setStatus(RestStatus.EXPECTATION_FAILED); + item.setErrorMessage(responseItem.getFailureMessage()); + harvestResult.setIndexingFailed(harvestResult.getIndexingFailed() + 1); + } + } + if (item.getStatus() == null) { + item.setStatus(RestStatus.CREATED); + } + harvestResult.addDocIndexationInfo(item); + + if (response.hasFailures()) { + throw new RuntimeException(response.buildFailureMessage()); + } + } + } + + private void createIndex(String indexName, String documentType) throws IOException { + GetIndexRequest request = new GetIndexRequest(); + request.indices(indexName); + boolean exists = this.client.indices().exists(request, RequestOptions.DEFAULT); + if (!exists) { + // Create index + CreateIndexRequest createIndex = new CreateIndexRequest(indexName); + + if (!documentType.equals("indexationInfo")) { + // with settings + String settings = readResource("/fr/inra/urgi/faidare/repository/es/setup/index/settings.json"); + createIndex.settings(settings, XContentType.JSON); + + // with document mappings + String mapping = readResource("/fr/inra/urgi/faidare/repository/es/setup/index/" + documentType + "_mapping.json"); + createIndex.mapping(documentType, mapping, XContentType.JSON); + } + + System.out.println("Creating index " + indexName + "..."); + CreateIndexResponse createResponse = client.indices().create(createIndex, RequestOptions.DEFAULT); + if (!createResponse.isAcknowledged()) { + throw new RuntimeException("Could not create index '" + indexName + "': " + createResponse.toString()); + } + } + } + + private String readResource(String path) { + + Scanner scanner = new Scanner(getClass().getResourceAsStream(path), "UTF-8").useDelimiter("\\A"); + return scanner.next(); + } + + static class IndexerInfo { + private final Long startInstant; + private DataSource dataSource; + private String dataSourceName; + private Set<String> newIndices; + + private Set<String> documentTypes; + + IndexerInfo(long startInstant) { + this.startInstant = startInstant; + documentTypes = new HashSet<>(); + newIndices = new HashSet<>(); + } + + private long getStartInstant() { + return startInstant; + } + + public DataSource getDataSource() { + return dataSource; + } + + private void setDataSource(DataSource dataSource) { + this.dataSource = dataSource; + this.dataSourceName = dataSource.getName().replace(" ", "_"); + } + + private String getDataSourceName() { + return dataSourceName; + } + + private Set<String> getNewIndices() { + return newIndices; + } + + private void addNewIndices(String newIndices) { + this.newIndices.add(newIndices); + } + + public Set<String> getDocumentTypes() { + return documentTypes; + } + + private void addDocumentType(String documentType) { + this.documentTypes.add(documentType); + } + } +} diff --git a/backend/src/main/main.iml b/backend/src/main/main.iml deleted file mode 100644 index 908ad4f521a27722a24664f5a0adb595bf81f4e7..0000000000000000000000000000000000000000 --- a/backend/src/main/main.iml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> \ No newline at end of file diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index 5d82866ca801d6cb941187487730cdd65f6ff650..d979b4c6b3331bd275b541b91b2198910df6c484 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -20,8 +20,8 @@ logging.level: fr.inra: DEBUG faidare: - elasticsearch-alias-template: - gnpis_{source}_{documentType}_5432_krusty-group{groupId} + elasticsearch-indexing-template: + faidare_{documentType}_dev elasticsearch-xref-index-name: urgi_xref_dev @@ -37,13 +37,13 @@ faidare: # Warning! URIs should match with FAIDARE datadiscovery 'schema:includedInDataCatalog' field value data-sources: # URGI GnpIS - - uri: https://urgi.versailles.inra.fr + - uri: https://urgi.versailles.inra.fr/gnpis url: https://urgi.versailles.inra.fr/gnpis name: URGI GnpIS image: https://urgi.versailles.inra.fr/files/faidare/logo/GnpIS.png # WUR EU-SOL BreeDB - - uri: https://www.eu-sol.wur.nl/ - url: https://www.eu-sol.wur.nl/ + - uri: https://www.eu-sol.wur.nl + url: https://www.eu-sol.wur.nl name: WUR EU-SOL BreeDB image: https://urgi.versailles.inra.fr/files/faidare/logo/EU-SOL.png # VIB PIPPA @@ -57,15 +57,27 @@ faidare: name: IBET BioData image: https://urgi.versailles.inra.fr/files/faidare/logo/biodata.png # NIB PISA - - uri: http://nib.si + - uri: http://www.pisa.nib.si url: http://www.pisa.nib.si name: NIB PISA image: https://urgi.versailles.inra.fr/files/faidare/logo/NIB.png # CIRAD TropGENE - - uri: http://brapi.tropgenedb.cirad.fr:8888/ + - uri: http://tropgenedb.cirad.fr url: http://tropgenedb.cirad.fr name: CIRAD TropGENE image: https://urgi.versailles.inra.fr/files/faidare/logo/CIRAD.jpg + # ENA + - uri: https://www.ebi.ac.uk/eva + url: https://www.ebi.ac.uk/eva + name: EBI European Nucleotide Archive + image: https://urgi.versailles.inra.fr/files/faidare/logo/EVA.png + # TERRA-REF + - uri: https://terraref.org + url: https://terraref.org + name: TERRA-REF + image: https://urgi.versailles.inra.fr/files/faidare/logo/TERRAREF.png + + server: compression: diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/README.md b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/README.md similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/README.md rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/README.md diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/datadiscovery_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/datadiscovery_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/datadiscovery_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/datadiscovery_mapping.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmAttribute_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmAttribute_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmAttribute_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmAttribute_mapping.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmPedigree_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmPedigree_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmPedigree_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmPedigree_mapping.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmProgeny_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmProgeny_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmProgeny_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasmProgeny_mapping.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasm_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasm_mapping.json similarity index 99% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasm_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasm_mapping.json index 8f7ca21e102dbd820789c9504fb769ddb006e770..ac833ca398650af29ec32e6b24aaab0b38fb0950 100644 --- a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasm_mapping.json +++ b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/germplasm_mapping.json @@ -533,6 +533,9 @@ "type": "integer" } } + }, + "schema:includedInDataCatalog": { + "type": "keyword" } } } diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/location_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/location_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/location_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/location_mapping.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/observationUnit_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/observationUnit_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/observationUnit_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/observationUnit_mapping.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/program_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/program_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/program_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/program_mapping.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/settings.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/settings.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/settings.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/settings.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/study_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/study_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/study_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/study_mapping.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/transplant_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/transplant_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/transplant_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/transplant_mapping.json diff --git a/backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/trial_mapping.json b/backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/trial_mapping.json similarity index 100% rename from backend/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/index/trial_mapping.json rename to backend/src/main/resources/fr/inra/urgi/faidare/repository/es/setup/index/trial_mapping.json diff --git a/backend/src/test/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISGermplasmControllerTest.java b/backend/src/test/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareGermplasmControllerTest.java similarity index 94% rename from backend/src/test/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISGermplasmControllerTest.java rename to backend/src/test/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareGermplasmControllerTest.java index 521f6af3273b56dfb0d6fa1ef0c4efb0bfd41e68..4e469524f9657877dcd2119f616dc446c269ee76 100644 --- a/backend/src/test/java/fr/inra/urgi/faidare/api/gnpis/v1/GnpISGermplasmControllerTest.java +++ b/backend/src/test/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareGermplasmControllerTest.java @@ -1,4 +1,4 @@ -package fr.inra.urgi.faidare.api.gnpis.v1; +package fr.inra.urgi.faidare.api.faidare.v1; import fr.inra.urgi.faidare.domain.criteria.GermplasmGETSearchCriteria; import fr.inra.urgi.faidare.domain.criteria.GermplasmSearchCriteria; @@ -33,8 +33,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. * @author C. Michotey, E. Kimmel, gcornut */ @ExtendWith(SpringExtension.class) -@WebMvcTest(controllers = GnpISGermplasmController.class) -class GnpISGermplasmControllerTest { +@WebMvcTest(controllers = FaidareGermplasmController.class) +class FaidareGermplasmControllerTest { @Autowired private MockMvc mockMvc; @@ -71,7 +71,7 @@ class GnpISGermplasmControllerTest { when(service.find(criteriaCaptor.capture())).thenReturn(germplasmPage); String pui = "doi:10.15454/1.4921786234137117E12"; - mockMvc.perform(get("/gnpis/v1/germplasm?pui=" + pui) + mockMvc.perform(get("/faidare/v1/germplasm?pui=" + pui) .contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); @@ -85,7 +85,7 @@ class GnpISGermplasmControllerTest { @Test void should_Return_Bad_Request_With_No_Param() throws Exception { - mockMvc.perform(get("/gnpis/v1/germplasm") + mockMvc.perform(get("/faidare/v1/germplasm") .contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(status().isBadRequest()); } @@ -114,7 +114,7 @@ class GnpISGermplasmControllerTest { when(service.find(any(GermplasmSearchCriteria.class))).thenReturn(germplasmPage); - mockMvc.perform(get("/gnpis/v1/germplasm?pui=foo") + mockMvc.perform(get("/faidare/v1/germplasm?pui=foo") .contentType(MediaType.APPLICATION_JSON_UTF8)) // Should not have private fields diff --git a/backend/src/test/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareIndexControllerTest.java b/backend/src/test/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareIndexControllerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..596689a64d3701d1ac5fae6f4dd5b164b579d767 --- /dev/null +++ b/backend/src/test/java/fr/inra/urgi/faidare/api/faidare/v1/FaidareIndexControllerTest.java @@ -0,0 +1,66 @@ +package fr.inra.urgi.faidare.api.faidare.v1; + + +import fr.inra.urgi.faidare.service.es.IndexerService; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.web.servlet.MockMvc; + +import java.io.File; + +import static org.mockito.Mockito.atMost; +import static org.mockito.Mockito.verify; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@ExtendWith(SpringExtension.class) +@WebMvcTest(controllers = FaidareIndexController.class) +public class FaidareIndexControllerTest { + + @Autowired + private MockMvc mockMvc; + + @MockBean + private IndexerService service; + + final String dir = System.getProperty("user.dir"); + + @Test + void should_Return_BadRequest_When_No_BulkFile_Given() throws Exception { + + mockMvc.perform(get("/faidare/v1/index?bulkDirectory=") + .contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + + @Test + void should_Return_Not_Found_When_No_Valid_BulkFile_Given() throws Exception { + + String bulkDirPath = dir + "/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/No_fixture"; + + mockMvc.perform(get("/faidare/v1/index?bulkDirectory=" + bulkDirPath) + .contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(status().isNotFound()); + } + + @Test + void should_Launch_Indexation() throws Exception { + + + + String bulkDirPath = dir + "/src/test/resources/fr/inra/urgi/faidare/repository/es/setup/fixture"; + File bulkDir = new File(bulkDirPath); + + mockMvc.perform(get("/faidare/v1/index?bulkDirectory=" + bulkDirPath) + .contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + + verify(service, atMost(1)).index(bulkDir); + + } +} diff --git a/backend/src/test/java/fr/inra/urgi/faidare/elasticsearch/ESRequestFactoryTest.java b/backend/src/test/java/fr/inra/urgi/faidare/elasticsearch/ESRequestFactoryTest.java index d7399f732cf054257135f5ac56156b29749656b0..c2a38963a303c057289d3f96084300f202c876c2 100644 --- a/backend/src/test/java/fr/inra/urgi/faidare/elasticsearch/ESRequestFactoryTest.java +++ b/backend/src/test/java/fr/inra/urgi/faidare/elasticsearch/ESRequestFactoryTest.java @@ -37,7 +37,7 @@ class ESRequestFactoryTest { List<Integer> groups = Collections.singletonList(0); String index0 = "index_group0"; - when(properties.getIndexName("*", documentType, 0)).thenReturn(index0); + when(properties.getAliasName(documentType, 0)).thenReturn(index0); when(userGroupsResourceClient.getUserGroups()).thenReturn(groups); @@ -46,35 +46,24 @@ class ESRequestFactoryTest { } @Test - void should_Generate_Aliases_Multiple_Groups_Multiple_Sources() { + void should_Generate_Aliases_Multiple_Groups() { String documentType = "doc1"; - List<Integer> groups = Arrays.asList(0, 1, 2); - List<String> sources = Arrays.asList("a", "b", "c"); + List<Integer> groups = Arrays.asList(0, 1, 2,3); String[] indices = { - "index_sourcea_group1", - "index_sourcea_group2", - "index_sourcea_group0", - "index_sourceb_group0", - "index_sourceb_group1", - "index_sourceb_group2", - "index_sourcec_group0", - "index_sourcec_group1", - "index_sourcec_group2", + "index_group1", + "index_group2", + "index_group0", + "index_group3" }; - when(properties.getIndexName("a", documentType, 1)).thenReturn(indices[0]); - when(properties.getIndexName("a", documentType, 2)).thenReturn(indices[1]); - when(properties.getIndexName("a", documentType, 0)).thenReturn(indices[2]); - when(properties.getIndexName("b", documentType, 0)).thenReturn(indices[3]); - when(properties.getIndexName("b", documentType, 1)).thenReturn(indices[4]); - when(properties.getIndexName("b", documentType, 2)).thenReturn(indices[5]); - when(properties.getIndexName("c", documentType, 0)).thenReturn(indices[6]); - when(properties.getIndexName("c", documentType, 1)).thenReturn(indices[7]); - when(properties.getIndexName("c", documentType, 2)).thenReturn(indices[8]); + when(properties.getAliasName(documentType, 1)).thenReturn(indices[0]); + when(properties.getAliasName(documentType, 2)).thenReturn(indices[1]); + when(properties.getAliasName(documentType, 0)).thenReturn(indices[2]); + when(properties.getAliasName(documentType, 3)).thenReturn(indices[3]); when(userGroupsResourceClient.getUserGroups()).thenReturn(groups); - String[] aliases = requestFactory.getAliases(documentType, sources); + String[] aliases = requestFactory.getAliases(documentType); assertThat(aliases).containsOnlyElementsOf(new ArrayIterator<>(indices)); } diff --git a/backend/src/test/java/fr/inra/urgi/faidare/filter/AngularRouteFilterTest.java b/backend/src/test/java/fr/inra/urgi/faidare/filter/AngularRouteFilterTest.java index 4042699284a9e2b28568572b0f5692bedb6481ca..b71e9e39509201d931b6e469ff747524f7a4ddd4 100644 --- a/backend/src/test/java/fr/inra/urgi/faidare/filter/AngularRouteFilterTest.java +++ b/backend/src/test/java/fr/inra/urgi/faidare/filter/AngularRouteFilterTest.java @@ -69,7 +69,7 @@ class AngularRouteFilterTest { "/font.ttf", // APIs "/brapi/v1/studies", - "/gnpis/v1/datadiscovery/suggest", + "/faidare/v1/datadiscovery/suggest", "/actuator/info", }) void shouldNotForward(String url) throws Exception { diff --git a/backend/src/test/java/fr/inra/urgi/faidare/repository/es/setup/ESSetUp.java b/backend/src/test/java/fr/inra/urgi/faidare/repository/es/setup/ESSetUp.java index d5f40e75b9e32918f37875946b6f993d790182d7..d26190cd8b7227edab3bcfb87fd31f5114e45204 100644 --- a/backend/src/test/java/fr/inra/urgi/faidare/repository/es/setup/ESSetUp.java +++ b/backend/src/test/java/fr/inra/urgi/faidare/repository/es/setup/ESSetUp.java @@ -114,7 +114,7 @@ public class ESSetUp { String documentType = DocumentAnnotationUtil.getDocumentObjectMetadata(documentClass).getDocumentType(); try { for (long groupId : groupIds) { - String indexName = properties.getIndexName("fixture", documentType, groupId); + String indexName = properties.getAliasName(documentType, groupId); // Delete fixture index if exists deleteIndex(indexName); @@ -137,15 +137,15 @@ public class ESSetUp { String documentType = DocumentAnnotationUtil.getDocumentObjectMetadata(documentClass).getDocumentType(); try { String baseIndex = properties.getElasticsearchXrefIndexName(); - String[] indexNames = XRefDocumentRepositoryImpl.getGroupAliases(baseIndex, Arrays.asList(groupIds)); - for (String indexName : indexNames) { + String[] aliasNames = XRefDocumentRepositoryImpl.getGroupAliases(baseIndex, Arrays.asList(groupIds)); + for (String aliasName : aliasNames) { // Delete fixture index if exists - deleteIndex(indexName); + deleteIndex(aliasName); // Add fixture index (with data) - String jsonPath = "./fixture/" + indexName + ".json"; - addIndex(indexName, jsonPath, documentType); + String jsonPath = "./fixture/" + aliasName + ".json"; + addIndex(aliasName, jsonPath, documentType); } refreshIndex(); } catch (IOException e) { diff --git a/backend/src/test/resources/test.properties b/backend/src/test/resources/test.properties index a82442ba931e528774043a0ed48bbb38de4efa70..c6dee26bec23826226e2c56e7c690a6b6c6c474e 100644 --- a/backend/src/test/resources/test.properties +++ b/backend/src/test/resources/test.properties @@ -1,5 +1,5 @@ spring.data.elasticsearch.host=localhost spring.data.elasticsearch.port=9200 -faidare.elasticsearch-alias-template=gnpis_{source}_{documentType}-group{groupId} +faidare.elasticsearch-indexing-template=faidare_{documentType}_test-group0 faidare.elasticsearch-xref-index-name=urgi_xref_test diff --git a/backend/src/test/test.iml b/backend/src/test/test.iml deleted file mode 100644 index 5ebc6f48ecbe7e78271fcbb44057f6682d802638..0000000000000000000000000000000000000000 --- a/backend/src/test/test.iml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="main" /> - </component> -</module> \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index cac41bac4fd751bac98d6e7127805d3b2beea63f..eebcf0f19fbd0c1e7558997d10b1881ff9333c64 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.3' services: elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:6.5.4 + image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0 container_name: elasticsearch environment: - discovery.type=single-node @@ -9,8 +9,7 @@ services: - 9200:9200 kibana: - image: docker.elastic.co/kibana/kibana:6.5.4 - container_name: kibana + image: docker.elastic.co/kibana/kibana:6.6.0 environment: - "ELASTICSEARCH_URL=http://elasticsearch:9200" depends_on: diff --git a/frontend/proxy.conf.js b/frontend/proxy.conf.js index 68d1cb39ba00c6fb09cec8e61616f97cd7c6b774..771e4ce755ca18e4dae8e8dcf203a664435ce047 100644 --- a/frontend/proxy.conf.js +++ b/frontend/proxy.conf.js @@ -2,7 +2,7 @@ const PROXY_CONFIG = [ { context: [ "/faidare-dev/brapi", - "/faidare-dev/gnpis", + "/faidare-dev/faidare", ], target: "http://localhost:8380", secure: false diff --git a/frontend/src/app/brapi.service.spec.ts b/frontend/src/app/brapi.service.spec.ts index 1b980d136c3a7227ba7c354ed48a312ef1eee9b0..e3741b143b77b0b0fc24fa85f5a6ba838718ba85 100644 --- a/frontend/src/app/brapi.service.spec.ts +++ b/frontend/src/app/brapi.service.spec.ts @@ -16,7 +16,7 @@ import { } from './models/brapi.model'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { Donor, Germplasm, GermplasmInstitute, GermplasmSet, Institute, Site } from './models/gnpis.model'; +import { Donor, Germplasm, GermplasmInstitute, GermplasmSet, Institute, Site } from './models/faidare.model'; describe('BrapiService', () => { diff --git a/frontend/src/app/card-generic-document/card-generic-document.component.spec.ts b/frontend/src/app/card-generic-document/card-generic-document.component.spec.ts index ce782db6f635e8ac0c450d8529c4c1b76062dd06..fec1c090e0e989d150318b8580d015ce0e5399a1 100644 --- a/frontend/src/app/card-generic-document/card-generic-document.component.spec.ts +++ b/frontend/src/app/card-generic-document/card-generic-document.component.spec.ts @@ -4,8 +4,8 @@ import { CardGenericDocumentComponent } from './card-generic-document.component' import { ComponentTester, speculoosMatchers } from 'ngx-speculoos'; import { DataDiscoverySource } from '../models/data-discovery.model'; import { CardRowComponent } from '../card-row/card-row.component'; -import { GnpisService } from '../gnpis.service'; import { of } from 'rxjs/internal/observable/of'; +import { FaidareService } from '../faidare.service'; class CardGenericDocumentComponentTester extends ComponentTester<CardGenericDocumentComponent> { @@ -38,17 +38,17 @@ describe('CardGenericDocumentComponent', () => { }; beforeEach(async () => { - const gnpisService = jasmine.createSpyObj( + const faidareService = jasmine.createSpyObj( 'GnpisService', [ 'getSource' ] ); - gnpisService.getSource.and.returnValue(of(dataSource)); + faidareService.getSource.and.returnValue(of(dataSource)); await TestBed.configureTestingModule({ declarations: [CardRowComponent, CardGenericDocumentComponent], providers: [ - { provide: GnpisService, useValue: gnpisService } + { provide: FaidareService, useValue: faidareService } ] }).compileComponents(); }); diff --git a/frontend/src/app/card-generic-document/card-generic-document.component.ts b/frontend/src/app/card-generic-document/card-generic-document.component.ts index b123303735c01e620c0ce2dd9964929b42b88f68..691bface13141097dc746b66a2af11add97f1c6e 100644 --- a/frontend/src/app/card-generic-document/card-generic-document.component.ts +++ b/frontend/src/app/card-generic-document/card-generic-document.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import * as schema from '../models/schema.org.model'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; @Component({ selector: 'faidare-card-generic-document', @@ -13,7 +13,7 @@ export class CardGenericDocumentComponent implements OnInit { dataSource: schema.DataCatalog; - constructor(private gnpisService: GnpisService) { + constructor(private faidareService: FaidareService) { } ngOnInit() { @@ -21,10 +21,10 @@ export class CardGenericDocumentComponent implements OnInit { // TODO: Make sure this never happen in ETL (always fill this field) if (typeof sourceURI !== 'string') { - sourceURI = GnpisService.URGI_SOURCE_URI; + sourceURI = FaidareService.URGI_SOURCE_URI; } - this.gnpisService.getSource(sourceURI).subscribe(dataSource => { + this.faidareService.getSource(sourceURI).subscribe(dataSource => { this.dataSource = dataSource; }); } diff --git a/frontend/src/app/gnpis.service.spec.ts b/frontend/src/app/faidare.service.spec.ts similarity index 92% rename from frontend/src/app/gnpis.service.spec.ts rename to frontend/src/app/faidare.service.spec.ts index 6032743909d25675bdeb69c29754bea427aa1101..450893a357fdb24c82ba1053f9d6077c591bef4f 100644 --- a/frontend/src/app/gnpis.service.spec.ts +++ b/frontend/src/app/faidare.service.spec.ts @@ -1,11 +1,11 @@ -import { BASE_URL, GnpisService } from './gnpis.service'; +import { BASE_URL, FaidareService } from './faidare.service'; import { BrapiMetaData, BrapiResults } from './models/brapi.model'; import { DataDiscoveryCriteria, DataDiscoverySource } from './models/data-discovery.model'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { Donor, Germplasm, GermplasmInstitute, GermplasmSet, Institute, Site } from './models/gnpis.model'; +import { Donor, Germplasm, GermplasmInstitute, GermplasmSet, Institute, Site } from './models/faidare.model'; -describe('GnpisService', () => { +describe('FaidareService', () => { const source1: DataDiscoverySource = { '@id': 'id1', @@ -22,6 +22,7 @@ describe('GnpisService', () => { 'schema:image': 'image2', }; + const site: Site = { latitude: null, longitude: null, @@ -115,14 +116,14 @@ describe('GnpisService', () => { population: [germplasmSet] }; - let gnpisService: GnpisService; + let faidareService: FaidareService; let http: HttpTestingController; beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule], providers: [HttpClientTestingModule] }); - gnpisService = TestBed.get(GnpisService); + faidareService = TestBed.get(FaidareService); http = TestBed.get(HttpTestingController); const sources: BrapiResults<DataDiscoverySource> = { @@ -150,7 +151,7 @@ describe('GnpisService', () => { const criteria = { crops: ['d'] } as DataDiscoveryCriteria; const fetchSize = 3; - gnpisService.suggest(field, fetchSize, text, criteria).subscribe(suggestions => { + faidareService.suggest(field, fetchSize, text, criteria).subscribe(suggestions => { expect(suggestions.length).toBe(3); expect(suggestions).toBe(expectedSuggestions); }); @@ -169,7 +170,7 @@ describe('GnpisService', () => { it('should fetch the germplasm', () => { let fetchedGermplasm: Germplasm; const germplasmDbId: string = germplasmTest.germplasmDbId; - gnpisService.getGermplasm({ id: germplasmDbId }).subscribe(response => { + faidareService.getGermplasm({ id: germplasmDbId }).subscribe(response => { fetchedGermplasm = response; }); http.expectOne(`${BASE_URL}/germplasm?id=${germplasmDbId}`) @@ -205,7 +206,7 @@ describe('GnpisService', () => { const criteria = { crops: ['d'] } as DataDiscoveryCriteria; - gnpisService.search(criteria).subscribe(result => { + faidareService.search(criteria).subscribe(result => { expect(result.result.data.length).toBe(2); expect(result.result.data[0]['schema:includedInDataCatalog']).toEqual(source1); expect(result.result.data[1]['schema:includedInDataCatalog']).toEqual(source2); @@ -221,7 +222,7 @@ describe('GnpisService', () => { }); it('should fetch sources', () => { - gnpisService.sourceByURI$.subscribe(sourceByURI => { + faidareService.sourceByURI$.subscribe(sourceByURI => { expect(sourceByURI).toEqual({ 'id1': source1, 'id2': source2 diff --git a/frontend/src/app/gnpis.service.ts b/frontend/src/app/faidare.service.ts similarity index 97% rename from frontend/src/app/gnpis.service.ts rename to frontend/src/app/faidare.service.ts index 0e91070da26793423bbd3146b2fb4674a3ab4522..a3cc44559eb50ec7e0921a64026a49d52885fd0b 100644 --- a/frontend/src/app/gnpis.service.ts +++ b/frontend/src/app/faidare.service.ts @@ -4,17 +4,17 @@ import { HttpClient } from '@angular/common/http'; import { DataDiscoveryCriteria, DataDiscoveryFacet, DataDiscoveryResults, DataDiscoverySource } from './models/data-discovery.model'; import { BrapiResults } from './models/brapi.model'; import { map } from 'rxjs/operators'; -import { Germplasm } from './models/gnpis.model'; +import { Germplasm } from './models/faidare.model'; import { XrefResponse } from './models/xref.model'; import { removeNullUndefined } from './utils'; -export const BASE_URL = 'gnpis/v1'; +export const BASE_URL = 'faidare/v1'; @Injectable({ providedIn: 'root' }) -export class GnpisService { +export class FaidareService { static URGI_SOURCE_URI = 'https://urgi.versailles.inra.fr'; sourceByURI$ = new ReplaySubject<Record<string, DataDiscoverySource>>(1); diff --git a/frontend/src/app/form/suggestion-field/suggestion-field.component.spec.ts b/frontend/src/app/form/suggestion-field/suggestion-field.component.spec.ts index f20bd4547fa0d6b7c56f1514aee1768fecf7ec16..b86ccb777d1f6e99c2df689920dabe0c7a8e1baa 100644 --- a/frontend/src/app/form/suggestion-field/suggestion-field.component.spec.ts +++ b/frontend/src/app/form/suggestion-field/suggestion-field.component.spec.ts @@ -3,7 +3,7 @@ import { async, TestBed } from '@angular/core/testing'; import { SuggestionFieldComponent } from './suggestion-field.component'; import { ReactiveFormsModule } from '@angular/forms'; import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; -import { GnpisService } from '../../gnpis.service'; +import { FaidareService } from '../../faidare.service'; import { BehaviorSubject, of } from 'rxjs'; import { DataDiscoveryCriteriaUtils } from '../../models/data-discovery.model'; import { ComponentTester } from 'ngx-speculoos'; @@ -45,7 +45,7 @@ describe('SuggestionFieldComponent', () => { component.criteriaField = 'crops'; const expectedSuggestions = ['a', 'b', 'c']; - const service = TestBed.get(GnpisService) as GnpisService; + const service = TestBed.get(FaidareService) as FaidareService; spyOn(service, 'suggest').and.returnValue(of(expectedSuggestions)); tester.detectChanges(); @@ -85,7 +85,7 @@ describe('SuggestionFieldComponent', () => { component.criteria$ = new BehaviorSubject(criteria); const allSuggestions = ['Zea', 'Wheat', 'Vitis', 'Grapevine']; - const service = TestBed.get(GnpisService) as GnpisService; + const service = TestBed.get(FaidareService) as FaidareService; spyOn(service, 'suggest').and.returnValue(of(allSuggestions)); const expectedSuggestions = allSuggestions.filter(s => selectedCrops.indexOf(s) < 0); diff --git a/frontend/src/app/form/suggestion-field/suggestion-field.component.ts b/frontend/src/app/form/suggestion-field/suggestion-field.component.ts index bbac52ab39b25cac5ee8dd7c59afcc839606187b..ad399c79fd4af43a342e5f64f30b7ec33be2d5ab 100644 --- a/frontend/src/app/form/suggestion-field/suggestion-field.component.ts +++ b/frontend/src/app/form/suggestion-field/suggestion-field.component.ts @@ -2,7 +2,7 @@ import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; import { BehaviorSubject, merge, Observable, of, Subject } from 'rxjs'; import { FormControl } from '@angular/forms'; import { NgbTypeahead, NgbTypeaheadSelectItemEvent } from '@ng-bootstrap/ng-bootstrap'; -import { GnpisService } from '../../gnpis.service'; +import { FaidareService } from '../../faidare.service'; import { debounceTime, filter, map, switchMap } from 'rxjs/operators'; import { DataDiscoveryCriteria } from '../../models/data-discovery.model'; @@ -30,7 +30,7 @@ export class SuggestionFieldComponent implements OnInit { private localCriteria: DataDiscoveryCriteria = null; - constructor(private gnpisService: GnpisService) { + constructor(private faidareService: FaidareService) { } ngOnInit(): void { @@ -84,7 +84,7 @@ export class SuggestionFieldComponent implements OnInit { */ private fetchSuggestion(term: string): Observable<string[]> { // Fetch suggestions - const suggestions$ = this.gnpisService.suggest( + const suggestions$ = this.faidareService.suggest( this.criteriaField, 10, term, this.localCriteria ); diff --git a/frontend/src/app/form/trait-ontology-widget/trait-ontology-widget.component.spec.ts b/frontend/src/app/form/trait-ontology-widget/trait-ontology-widget.component.spec.ts index 120bf39fde756f87f0e51fec772d9885b1ade3b1..6254a2d2ee9c7358eac36f2372de9c39c06cd4e0 100644 --- a/frontend/src/app/form/trait-ontology-widget/trait-ontology-widget.component.spec.ts +++ b/frontend/src/app/form/trait-ontology-widget/trait-ontology-widget.component.spec.ts @@ -1,7 +1,7 @@ import { TestBed } from '@angular/core/testing'; import { CropOntologyWidgetFactory, TraitOntologyWidgetComponent } from './trait-ontology-widget.component'; -import { GnpisService } from '../../gnpis.service'; +import { FaidareService } from '../../faidare.service'; import { BehaviorSubject, of } from 'rxjs'; import { DataDiscoveryCriteriaUtils } from '../../models/data-discovery.model'; import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap'; @@ -57,7 +57,7 @@ describe('TraitOntologyWidgetComponent', () => { const component = fixture.componentInstance; component.criteria$ = new BehaviorSubject(DataDiscoveryCriteriaUtils.emptyCriteria()); - const service = TestBed.get(GnpisService) as GnpisService; + const service = TestBed.get(FaidareService) as FaidareService; spyOn(service, 'suggest').and.returnValue(of(['var1', 'var2'])); fixture.detectChanges(); @@ -76,7 +76,7 @@ describe('TraitOntologyWidgetComponent', () => { component.criteria$ = new BehaviorSubject(criteria); - const service = TestBed.get(GnpisService) as GnpisService; + const service = TestBed.get(FaidareService) as FaidareService; spyOn(service, 'suggest').and.returnValue(of(['var1', 'var2'])); fixture.detectChanges(); diff --git a/frontend/src/app/form/trait-ontology-widget/trait-ontology-widget.component.ts b/frontend/src/app/form/trait-ontology-widget/trait-ontology-widget.component.ts index 42b943b9bc2b255aa7b366e5279c7c491139c0ec..93c8000d7697691e71d197f2d52ac9d5c4b377a6 100644 --- a/frontend/src/app/form/trait-ontology-widget/trait-ontology-widget.component.ts +++ b/frontend/src/app/form/trait-ontology-widget/trait-ontology-widget.component.ts @@ -2,7 +2,7 @@ import { Component, EventEmitter, Injectable, Input, OnInit, Output, ViewEncapsu import { CropOntologyWidget } from 'trait-ontology-widget/dist/module/cropOntologyWidget.module'; import { DataDiscoveryCriteria } from '../../models/data-discovery.model'; import { BehaviorSubject } from 'rxjs'; -import { GnpisService } from '../../gnpis.service'; +import { FaidareService } from '../../faidare.service'; import { filter } from 'rxjs/operators'; @Injectable({ @@ -35,7 +35,7 @@ export class TraitOntologyWidgetComponent implements OnInit { private widget: CropOntologyWidget; - constructor(private gnpisService: GnpisService, + constructor(private faidareService: FaidareService, private widgetFactory: CropOntologyWidgetFactory) { } @@ -69,7 +69,7 @@ export class TraitOntologyWidgetComponent implements OnInit { const field = 'observationVariableIds'; - this.gnpisService.suggest(field, null, '', this.localCriteria) + this.faidareService.suggest(field, null, '', this.localCriteria) .subscribe(ids => { this.variablesList = ids; this.widget.showOnly(ids); diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.html b/frontend/src/app/germplasm-card/germplasm-card.component.html index 2cd6008f1072c6bb434cdceef5255a57b756b944..21abee8e5c7499116c5d066e505db859832a7355 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.html +++ b/frontend/src/app/germplasm-card/germplasm-card.component.html @@ -324,7 +324,7 @@ <faidare-card-row label="Stock center name" - [test]="germplasmGnpis.holdingGenbank.instituteName && germplasmGnpis.holdingGenbank.webSite"> + [test]="germplasmGnpis.holdingGenbank && germplasmGnpis.holdingGenbank.instituteName && germplasmGnpis.holdingGenbank.webSite"> <ng-template> <a [href]="germplasmGnpis.holdingGenbank.webSite" target="_blank"> {{ germplasmGnpis.holdingGenbank.instituteName }} @@ -334,7 +334,7 @@ <faidare-card-row label="Stock center name" - [test]="germplasmGnpis.holdingGenbank.instituteName && !germplasmGnpis.holdingGenbank.webSite"> + [test]="germplasmGnpis.holdingGenbank && germplasmGnpis.holdingGenbank.instituteName && !germplasmGnpis.holdingGenbank.webSite"> <ng-template> {{ germplasmGnpis.holdingGenbank.instituteName }} </ng-template> diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts index 04735dd58837edcf96893a5e715e28fa7161b3fe..ae6686a1b6d3381df32006e12798ecb8251f1c50 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.spec.ts @@ -1,7 +1,7 @@ import { async, TestBed } from '@angular/core/testing'; import { GermplasmCardComponent } from './germplasm-card.component'; import { ComponentTester, speculoosMatchers } from 'ngx-speculoos'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; import { BrapiService } from '../brapi.service'; import { ActivatedRoute, convertToParamMap } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; @@ -15,7 +15,7 @@ import { CardRowComponent } from '../card-row/card-row.component'; import { CardTableComponent } from '../card-table/card-table.component'; import { MapComponent } from '../map/map.component'; import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiResult, BrapiSibling } from '../models/brapi.model'; -import { Donor, Germplasm, GermplasmInstitute, GermplasmSet, Institute, Site } from '../models/gnpis.model'; +import { Donor, Germplasm, GermplasmInstitute, GermplasmSet, Institute, Site } from '../models/faidare.model'; import { DataDiscoverySource } from '../models/data-discovery.model'; import { MockComponent } from 'ng-mocks'; import { XrefsComponent } from '../xrefs/xrefs.component'; @@ -189,14 +189,14 @@ describe('GermplasmCardComponent', () => { 'schema:includedInDataCatalog': source }; - const gnpisService = jasmine.createSpyObj( + const faidareService = jasmine.createSpyObj( 'GnpisService', [ 'getGermplasm', 'getSource' ] ); - gnpisService.getGermplasm.and.returnValue(of(germplasmTest)); - gnpisService.getSource.and.returnValue(of(source)); + faidareService.getGermplasm.and.returnValue(of(germplasmTest)); + faidareService.getSource.and.returnValue(of(source)); const brapiService = jasmine.createSpyObj( 'BrapiService', [ @@ -205,9 +205,6 @@ describe('GermplasmCardComponent', () => { 'germplasmAttributes' ] ); - // brapiService.germplasmProgeny.and.returnValue(of(brapiGermplasmProgeny)); - brapiService.germplasmPedigree.and.returnValue(of(brapiGermplasmPedigree)); - brapiService.germplasmAttributes.and.returnValue(of(brapiGermplasmAttributes)); const activatedRouteParams = { @@ -231,12 +228,16 @@ describe('GermplasmCardComponent', () => { ], providers: [ { provide: BrapiService, useValue: brapiService }, - { provide: GnpisService, useValue: gnpisService }, + { provide: FaidareService, useValue: faidareService }, { provide: ActivatedRoute, useValue: activatedRouteParams }, ] }); })); + /*brapiService.germplasmProgeny.and.returnValue(of(brapiGermplasmProgeny));*/ + brapiService.germplasmPedigree.and.returnValue(of(brapiGermplasmPedigree)); + brapiService.germplasmAttributes.and.returnValue(of(brapiGermplasmAttributes)); + it('should fetch germplasm information', async(() => { const tester = new GermplasmCardComponentTester(); const component = tester.componentInstance; @@ -255,7 +256,5 @@ describe('GermplasmCardComponent', () => { expect(tester.cardHeader[6]).toContainText('Evaluation Data'); }); })); - -}) -; +}); diff --git a/frontend/src/app/germplasm-card/germplasm-card.component.ts b/frontend/src/app/germplasm-card/germplasm-card.component.ts index 7705cce230a4c64f2747b95dbf6b9d6e96304141..87b7f6a4c22e1583cd6c3f8b070771e277c93b2f 100644 --- a/frontend/src/app/germplasm-card/germplasm-card.component.ts +++ b/frontend/src/app/germplasm-card/germplasm-card.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { BrapiService } from '../brapi.service'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; import { BrapiAttributeData, BrapiGermplasmPedigree, BrapiLocation, BrapiTaxonIds } from '../models/brapi.model'; import { Children, Germplasm, Site } from '../models/gnpis.model'; import { environment } from '../../environments/environment'; @@ -14,10 +14,8 @@ import { environment } from '../../environments/environment'; export class GermplasmCardComponent implements OnInit { - alreadyInitialize = false; - constructor(private brapiService: BrapiService, - private gnpisService: GnpisService, + private faidareService: FaidareService, private route: ActivatedRoute) { } @@ -38,7 +36,7 @@ export class GermplasmCardComponent implements OnInit { this.route.queryParams.subscribe(() => { const { id, pui } = this.route.snapshot.queryParams; - this.loaded = this.gnpisService.getGermplasm({ id, pui }).toPromise() + this.loaded = this.faidareService.getGermplasm({ id, pui }).toPromise() .then(germplasm => { const germplasmId = id || germplasm.germplasmDbId; this.germplasmGnpis = germplasm; @@ -67,7 +65,6 @@ export class GermplasmCardComponent implements OnInit { }); this.loading = false; - this.alreadyInitialize = true; }); }); diff --git a/frontend/src/app/markdown-page/markdown-page.component.spec.ts b/frontend/src/app/markdown-page/markdown-page.component.spec.ts index 891bf14f06bc977057729dc1d6a9b486a5cd93e6..470fa8ce900c0a8ac1b0be3f6d84f86f8f09d3de 100644 --- a/frontend/src/app/markdown-page/markdown-page.component.spec.ts +++ b/frontend/src/app/markdown-page/markdown-page.component.spec.ts @@ -13,7 +13,7 @@ describe('MarkdownPageComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ MarkdownPageComponent ], + declarations: [MarkdownPageComponent], providers: [{ provide: ActivatedRoute, useValue: route }], schemas: [NO_ERRORS_SCHEMA] }) diff --git a/frontend/src/app/models/faidare.model.ts b/frontend/src/app/models/faidare.model.ts new file mode 100644 index 0000000000000000000000000000000000000000..edee6ddf7211609bc3009ecf1f15df4f404590da --- /dev/null +++ b/frontend/src/app/models/faidare.model.ts @@ -0,0 +1,93 @@ +import { BrapiDonor, BrapiGermplasm } from './brapi.model'; + +export interface Germplasm extends BrapiGermplasm { + genusSpecies: string; + genusSpeciesSubtaxa: string; + taxonSynonyms: string[]; + taxonCommonNames: string[]; + taxonComment: string; + geneticNature: string; + comment: string; + photo: Photo; + holdingInstitute: Institute; + holdingGenbank: Institute; + presenceStatus: string; + children: Children[]; + originSite: Site; + collectingSite: Site; + evaluationSites: Site[]; + collector: GermplasmInstitute; + breeder: GermplasmInstitute; + donors: Donor[]; + distributors: GermplasmInstitute[]; + panel: GermplasmSet[]; + collection: GermplasmSet[]; + population: GermplasmSet[]; +} + +export interface Site { + latitude: number; + longitude: number; + siteId: string; + siteName: string; + siteType: string; +} + +export interface Institute { + instituteName: string; + instituteCode: string; + acronym: string; + organisation: string; + instituteType: string; + webSite: string; + address: string; + logo: string; +} + +export interface GermplasmInstitute extends Institute { + institute: Institute; + accessionNumber: string; + accessionCreationDate: string; + materialType: string; + collectors: string; + registrationYear: string; + deregistrationYear: string; + distributionStatus?: string; +} + +export interface Photo { + copyright: string; + description: string; + file: string; + photoName: string; + thumbnailFile: string; + +} + +export interface Children { + firstParentName: string; + firstParentPUI: string; + secondParentName: string; + secondParentPUI: string; + sibblings: { + name: string; + pui: string; + }[]; + +} + +export interface Donor extends BrapiDonor { + donorInstitute: Institute; +} + + +export interface GermplasmSet { + id: number; + name: string; + type: string; + germplasmCount: number; + germplasmRef: { + pui: string; + name: string; + }; +} diff --git a/frontend/src/app/navbar/navbar.component.html b/frontend/src/app/navbar/navbar.component.html index 01465fc3472e0a2b325acb008b50edd4b00d1b20..1e684cf8814c09d4a56e1d41bc64a97f3c918517 100644 --- a/frontend/src/app/navbar/navbar.component.html +++ b/frontend/src/app/navbar/navbar.component.html @@ -46,7 +46,8 @@ <!-- Join us link --> <a class="dropdown-item" routerLink="/join" routerLinkActive="true" title="Join us">Join us</a> <!-- Legal mentions link --> - <a class="dropdown-item" routerLink="/legal" routerLinkActive="true" title="Legal mentions" >Legal mentions</a> + <a class="dropdown-item" routerLink="/legal" routerLinkActive="true" title="Legal mentions">Legal + mentions</a> <!-- Help link --> <a class="dropdown-item" routerLink="/help" routerLinkActive="true" title="Help">Help</a> </div> @@ -56,7 +57,8 @@ </div> <a class="navbar-brand d-flex align-items-center" [href]="navbar.contributor.url" target="_blank"> - <img src="{{ navbar.contributor.logo }}" alt="{{ navbar.contributor.name }} logo" title="{{ navbar.contributor.name }}" height="60px"/> + <img src="{{ navbar.contributor.logo }}" alt="{{ navbar.contributor.name }} logo" + title="{{ navbar.contributor.name }}" height="60px"/> </a> <div> <!--<a *ngIf="displayBackButton" diff --git a/frontend/src/app/navbar/navbar.component.spec.ts b/frontend/src/app/navbar/navbar.component.spec.ts index 3a52062b227d1232c61d5d24dc941ffa9d7c9838..34469ec2570fd6f8edc63c346609cad409bc9ebd 100644 --- a/frontend/src/app/navbar/navbar.component.spec.ts +++ b/frontend/src/app/navbar/navbar.component.spec.ts @@ -1,10 +1,10 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { async, TestBed } from '@angular/core/testing'; import { NavbarComponent } from './navbar.component'; import { ComponentTester } from 'ngx-speculoos'; import { DataDiscoverySource } from '../models/data-discovery.model'; import { of } from 'rxjs'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; class NavbarComponentTester extends ComponentTester<NavbarComponent> { constructor() { @@ -54,23 +54,23 @@ describe('NavbarComponent', () => { 'schema:image': 'http://example2.com/logo.png' }; - let gnpisService; + let faidareService; beforeEach(() => { - gnpisService = jasmine.createSpyObj( + faidareService = jasmine.createSpyObj( 'GnpisService', [ 'getSource', 'suggest' ] ); - gnpisService.suggest.and.returnValue(of([dataSource1['@id'], dataSource2['@id']])); - gnpisService.getSource.withArgs(dataSource1['@id']).and.returnValue(of(dataSource1)); - gnpisService.getSource.withArgs(dataSource2['@id']).and.returnValue(of(dataSource2)); + faidareService.suggest.and.returnValue(of([dataSource1['@id'], dataSource2['@id']])); + faidareService.getSource.withArgs(dataSource1['@id']).and.returnValue(of(dataSource1)); + faidareService.getSource.withArgs(dataSource2['@id']).and.returnValue(of(dataSource2)); TestBed.configureTestingModule({ declarations: [NavbarComponent], providers: [ - { provide: GnpisService, useValue: gnpisService } + { provide: FaidareService, useValue: faidareService } ] }).compileComponents(); }); @@ -105,8 +105,8 @@ describe('NavbarComponent', () => { }; tester.detectChanges(); - expect(gnpisService.suggest).toHaveBeenCalledTimes(1); - expect(gnpisService.getSource).toHaveBeenCalledTimes(2); + expect(faidareService.suggest).toHaveBeenCalledTimes(1); + expect(faidareService.getSource).toHaveBeenCalledTimes(2); expect(tester.logos.length).toBe(2); expect(tester.logos.shift().attr('title')).toBe('FAIR Data-finder for Agronomic REsearch'); diff --git a/frontend/src/app/navbar/navbar.component.ts b/frontend/src/app/navbar/navbar.component.ts index 6674354dea1c8237a2c29010ac0d6ef206dc199c..1f9d5fa650a55cf7ae1fc81634d7e1ab4ec89d1f 100644 --- a/frontend/src/app/navbar/navbar.component.ts +++ b/frontend/src/app/navbar/navbar.component.ts @@ -1,14 +1,15 @@ import { Component, OnInit } from '@angular/core'; import { environment } from '../../environments/environment'; -import { GnpisService } from '../gnpis.service'; import { flatMap } from 'rxjs/operators'; import { of } from 'rxjs/internal/observable/of'; +import { FaidareService } from '../faidare.service'; interface Link { label: string; url: string; subMenu?: Link[]; } + interface Contributor { name: string; url: string; @@ -30,25 +31,25 @@ interface NavBar { }) export class NavbarComponent implements OnInit { - /*displayBackButton = false; - previousQueryParam: Params; + /*displayBackButton = false; + previousQueryParam: Params; - constructor(private router: Router, private route: ActivatedRoute - ) { + constructor(private router: Router, private route: ActivatedRoute + ) { - this.router.events.subscribe(event => { - if (event instanceof RoutesRecognized) { - if (this.checkIsFormPage(event.url)) { - this.displayBackButton = false; - this.route.queryParams.subscribe(queryParam => { - this.previousQueryParam = queryParam; - }); - } else { - this.displayBackButton = true; - } - } - }); - }*/ + this.router.events.subscribe(event => { + if (event instanceof RoutesRecognized) { + if (this.checkIsFormPage(event.url)) { + this.displayBackButton = false; + this.route.queryParams.subscribe(queryParam => { + this.previousQueryParam = queryParam; + }); + } else { + this.displayBackButton = true; + } + } + }); + }*/ navbar: NavBar = environment.navbar; navbarCollapsed = true; @@ -59,17 +60,17 @@ export class NavbarComponent implements OnInit { subMenu: [] }; - constructor(private gnpisService: GnpisService) { + constructor(private faidareService: FaidareService) { } ngOnInit() { // Fetch source URIs for with we have data - this.gnpisService.suggest('sources') + this.faidareService.suggest('sources') .pipe( // Flatten observable of array of string into observable of string flatMap(dataSourceURIs => of(...dataSourceURIs)), // For each source URI get actual source description - flatMap(dataSourceURI => this.gnpisService.getSource(dataSourceURI)), + flatMap(dataSourceURI => this.faidareService.getSource(dataSourceURI)), ) .subscribe(dataSource => { // Add each data source to the nav bar, under 'Data providers' diff --git a/frontend/src/app/result-page/document/document.component.ts b/frontend/src/app/result-page/document/document.component.ts index 7e5e5d556ca64bb631fdbb7231e20275c0f1371b..060f53b9de9cfa2d34f0b76518ce64f68cc1a61e 100644 --- a/frontend/src/app/result-page/document/document.component.ts +++ b/frontend/src/app/result-page/document/document.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { DataDiscoveryDocument, DataDiscoverySource, DataDiscoveryType } from '../../models/data-discovery.model'; -import { GnpisService } from '../../gnpis.service'; +import { FaidareService } from '../../faidare.service'; @Component({ selector: 'faidare-document', @@ -33,7 +33,7 @@ export class DocumentComponent implements OnInit { getRouterLink() { // TODO: index URGI schema:identifier like the partners - const urgiStudy = this.dataSource['schema:url'] === GnpisService.URGI_SOURCE_URI; + const urgiStudy = this.dataSource['schema:url'] === FaidareService.URGI_SOURCE_URI; for (const type of this.document['@type']) { const cardUrl = DocumentComponent.CARD_TYPE[type]; if (cardUrl === 'studies') { @@ -53,9 +53,14 @@ export class DocumentComponent implements OnInit { getQueryParam() { if (this.document['schema:identifier']) { - return { - id: this.document['schema:identifier'] - }; + const id: string = this.document['schema:identifier']; + // TODO: remove condition when GnpIS schema:identifier will store an encoded + // value (manage the same way as partners data + if (id.includes('doi.org') || id.includes('gnpis_pui')) { + return { id: btoa(id) }; + } else { + return { id: id }; + } } else { return { pui: this.document['@id'] @@ -63,6 +68,7 @@ export class DocumentComponent implements OnInit { } } + getBadgeType(type: DataDiscoveryType) { return DocumentComponent.BADGE_TYPE[type]; } diff --git a/frontend/src/app/result-page/result-page.component.spec.ts b/frontend/src/app/result-page/result-page.component.spec.ts index 145bb866c1bc67992ce1fee493b1e3a948cacd1a..bd59ae0d2e235044602c318f8ebb0d299d0d89a9 100644 --- a/frontend/src/app/result-page/result-page.component.spec.ts +++ b/frontend/src/app/result-page/result-page.component.spec.ts @@ -13,7 +13,7 @@ import { DataDiscoveryDocument, DataDiscoverySource } from '../models/data-discovery.model'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; import { BrapiResults } from '../models/brapi.model'; @@ -28,7 +28,7 @@ class ResultPageComponentTester extends ComponentTester<ResultPageComponent> { describe('ResultPageComponent', () => { const service = jasmine.createSpyObj( - 'GnpisService', ['search'] + 'FaidareService', ['search'] ); const params = { crops: 'Genus', @@ -71,7 +71,7 @@ describe('ResultPageComponent', () => { ], declarations: [ResultPageComponent, DocumentComponent], providers: [ - { provide: GnpisService, useValue: service }, + { provide: FaidareService, useValue: service }, { provide: ActivatedRoute, useValue: activatedRoute } ], schemas: [NO_ERRORS_SCHEMA], diff --git a/frontend/src/app/result-page/result-page.component.ts b/frontend/src/app/result-page/result-page.component.ts index 9a200f719d7d33ce3e80d3a0059623f02159a4f5..896222aa500654d3fa7fafea3f8fb937298f02b8 100644 --- a/frontend/src/app/result-page/result-page.component.ts +++ b/frontend/src/app/result-page/result-page.component.ts @@ -9,7 +9,7 @@ import { MAX_RESULTS } from '../models/data-discovery.model'; import { BehaviorSubject } from 'rxjs'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; import { filter } from 'rxjs/operators'; import { FormComponent } from '../form/form.component'; @@ -41,14 +41,14 @@ export class ResultPageComponent implements OnInit { constructor(private route: ActivatedRoute, private router: Router, - private gnpisService: GnpisService, + private faidareService: FaidareService, ) { } fetchDocumentsAndFacets() { this.loading = true; const criteria = this.criteria$.value; - this.gnpisService.search(criteria) + this.faidareService.search(criteria) .subscribe(({ metadata, result, facets }) => { this.loading = false; this.documents = result.data; diff --git a/frontend/src/app/site-card/site-card.component.spec.ts b/frontend/src/app/site-card/site-card.component.spec.ts index fdf9e83bf745d6280c59cb2cfaa5228923f54746..2e9fa6ecdea6c2769be5e40e0144b164a8078d31 100644 --- a/frontend/src/app/site-card/site-card.component.spec.ts +++ b/frontend/src/app/site-card/site-card.component.spec.ts @@ -11,7 +11,7 @@ import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.comp import { CardTableComponent } from '../card-table/card-table.component'; import { CardSectionComponent } from '../card-section/card-section.component'; import { DataDiscoverySource } from '../models/data-discovery.model'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; import { MockComponent } from 'ng-mocks'; import { XrefsComponent } from '../xrefs/xrefs.component'; import { CoordinatesPipe, CoordinatesService } from 'angular-coordinates'; @@ -22,8 +22,8 @@ describe('SiteCardComponent', () => { const brapiService = jasmine.createSpyObj( 'BrapiService', ['location'] ); - const gnpisService = jasmine.createSpyObj( - 'GnpisService', ['getSource'] + const faidareService = jasmine.createSpyObj( + 'FaidareService', ['getSource'] ); const coordinatesService = jasmine.createSpyObj( 'CoordinatesService', ['transform'] @@ -75,8 +75,8 @@ describe('SiteCardComponent', () => { ], providers: [ { provide: BrapiService, useValue: brapiService }, - { provide: GnpisService, useValue: gnpisService }, { provide: CoordinatesService, useValue: coordinatesService }, + { provide: FaidareService, useValue: faidareService }, { provide: ActivatedRoute, useValue: { @@ -96,7 +96,7 @@ describe('SiteCardComponent', () => { it('should display site', () => { const fixture = TestBed.createComponent(SiteCardComponent); brapiService.location.and.returnValues(of(response)); - gnpisService.getSource.and.returnValue(of(source)); + faidareService.getSource.and.returnValue(of(source)); fixture.detectChanges(); const element = fixture.nativeElement; expect(element.querySelector('h3').textContent).toBe(' Site: site1 '); diff --git a/frontend/src/app/site-card/site-card.component.ts b/frontend/src/app/site-card/site-card.component.ts index 2d8227bb10e3233c61aaaad5b4ba783c614e82fb..22897207d344c26b41a7217716c57fe620e622ef 100644 --- a/frontend/src/app/site-card/site-card.component.ts +++ b/frontend/src/app/site-card/site-card.component.ts @@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router'; import { BrapiLocation } from '../models/brapi.model'; import { KeyValueObject, toKeyValueObjects } from '../utils'; import { DataDiscoverySource } from '../models/data-discovery.model'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; import { Direction, TransformationType } from 'angular-coordinates'; @Component({ @@ -21,7 +21,7 @@ export class SiteCardComponent implements OnInit { type = TransformationType; loading = true; - constructor(private brapiService: BrapiService, private gnpisService: GnpisService, private route: ActivatedRoute) { + constructor(private brapiService: BrapiService, private faidareService: FaidareService, private route: ActivatedRoute) { } ngOnInit() { diff --git a/frontend/src/app/study-card/study-card.component.html b/frontend/src/app/study-card/study-card.component.html index 81078b1404914ef65e48d43d24cca1134f3ec8cd..e296892bf850dbce0a2c74b058ba2c885aff410c 100644 --- a/frontend/src/app/study-card/study-card.component.html +++ b/frontend/src/app/study-card/study-card.component.html @@ -24,7 +24,7 @@ [value]="study.studyDbId"> </faidare-card-row> - <!-- Display generic document details (PUI, data source links, etc.) --> + <!-- Display generic document details (PUI, data source links, etc.) --> <faidare-card-generic-document [document]="study" documentType="study"> @@ -104,20 +104,20 @@ 'Name', 'Taxon' ]" - [rows]="studyGermplasms"> - <ng-template let-row> - <tr> - <td> - <a [routerLink]="'/germplasm'" [queryParams]="{id:row.germplasmDbId}"> - {{ row.accessionNumber }} - </a> - </td> - <td>{{ row.germplasmName }}</td> - <td>{{ row.genus }} {{ row.species }} {{ row.subtaxa }}</td> - </tr> - </ng-template> - </faidare-card-table> - </div> + [rows]="studyGermplasms"> + <ng-template let-row> + <tr> + <td> + <a [routerLink]="'/germplasm'" [queryParams]="{id:row.germplasmDbId}"> + {{ row.accessionNumber }} + </a> + </td> + <td>{{ row.germplasmName }}</td> + <td>{{ row.genus }} {{ row.species }} {{ row.subtaxa }}</td> + </tr> + </ng-template> + </faidare-card-table> + </div> </ng-template> </faidare-card-section> @@ -135,23 +135,23 @@ 'Ontology name', 'Trait description' ]" - [rows]="studyObservationVariables"> - <ng-template let-row> - <tr> - <td> - <ng-template #name>{{ row.observationVariableDbId }}</ng-template> - <ng-template #link> - <a target="_blank" [href]=row.documentationURL>{{ row.observationVariableDbId }}</a> - </ng-template> - <ng-container *ngIf="row.documentationURL; then link else name"></ng-container> - </td> - <td>{{ row.name }}</td> - <td>{{ row.synonyms[0] }}</td> - <td>{{ row.ontologyName }}</td> - <td>{{ row.trait.description }}</td> - </tr> - </ng-template> - </faidare-card-table> + [rows]="studyObservationVariables"> + <ng-template let-row> + <tr> + <td> + <ng-template #name>{{ row.observationVariableDbId }}</ng-template> + <ng-template #link> + <a target="_blank" [href]=row.documentationURL>{{ row.observationVariableDbId }}</a> + </ng-template> + <ng-container *ngIf="row.documentationURL; then link else name"></ng-container> + </td> + <td>{{ row.name }}</td> + <td>{{ row.synonyms[0] }}</td> + <td>{{ row.ontologyName }}</td> + <td>{{ row.trait.description }}</td> + </tr> + </ng-template> + </faidare-card-table> </div> </ng-template> </faidare-card-section> @@ -167,28 +167,28 @@ 'Type', 'Linked studies identifiers' ]" - [rows]="studyDataset"> - <ng-template let-row> - <tr> - <td> - <ng-template #name>{{ row.trialName }}</ng-template> - <ng-template #link> - <a target="_blank" [href]=row.documentationURL>{{ row.trialName }}</a> - </ng-template> - <ng-container *ngIf="row.documentationURL; then link else name"></ng-container> - </td> - <td>{{ row.trialType }}</td> - <td width="60%"> - <ng-container *ngFor="let trialStudy of row.studies"> - <a - [routerLink]="['/studies', trialStudy.studyDbId]"> - {{ trialStudy.studyName.trim() }} - </a>; - </ng-container> - </td> - </tr> - </ng-template> - </faidare-card-table> + [rows]="studyDataset"> + <ng-template let-row> + <tr> + <td> + <ng-template #name>{{ row.trialName }}</ng-template> + <ng-template #link> + <a target="_blank" [href]=row.documentationURL>{{ row.trialName }}</a> + </ng-template> + <ng-container *ngIf="row.documentationURL; then link else name"></ng-container> + </td> + <td>{{ row.trialType }}</td> + <td width="60%"> + <ng-container *ngFor="let trialStudy of row.studies"> + <a + [routerLink]="['/studies', trialStudy.studyDbId]"> + {{ trialStudy.studyName.trim() }} + </a>; + </ng-container> + </td> + </tr> + </ng-template> + </faidare-card-table> </div> </ng-template> </faidare-card-section> @@ -204,16 +204,17 @@ 'Name', 'Email', 'Institution' - ]"> - <ng-template let-row> - <tr> - <td>{{ row.type }}</td> - <td>{{ row.name }}</td> - <td>{{ row.email }}</td> - <td>{{ row.institutionName }}</td> - </tr> - </ng-template> - </faidare-card-table> + ]" + [rows]="study.contacts"> + <ng-template let-row> + <tr> + <td>{{ row.type }}</td> + <td>{{ row.name }}</td> + <td>{{ row.email }}</td> + <td>{{ row.institutionName }}</td> + </tr> + </ng-template> + </faidare-card-table> </div> </ng-template> </faidare-card-section> @@ -224,13 +225,13 @@ <ng-template> <div class="table-responsive scroll-table table-card-body"> <faidare-card-table - [rows]="additionalInfos"> - <ng-template let-row> - <tr> - <td width="50%">{{ row.key }}</td> - <td>{{ row.value }}</td> - </tr> - </ng-template> + [rows]="additionalInfos"> + <ng-template let-row> + <tr> + <td width="50%">{{ row.key }}</td> + <td>{{ row.value }}</td> + </tr> + </ng-template> </faidare-card-table> </div> </ng-template> diff --git a/frontend/src/app/study-card/study-card.component.spec.ts b/frontend/src/app/study-card/study-card.component.spec.ts index 95a434af2828917b6a8affc15bc16b5a1c639171..8e3bfa92b0ed4f2a9504b2f4aac49b53425b1bee 100644 --- a/frontend/src/app/study-card/study-card.component.spec.ts +++ b/frontend/src/app/study-card/study-card.component.spec.ts @@ -15,6 +15,7 @@ import { BrapiTrial } from '../models/brapi.model'; import { BrapiService } from '../brapi.service'; +import { FaidareService } from '../faidare.service'; import { DataDiscoverySource } from '../models/data-discovery.model'; import { MapComponent } from '../map/map.component'; import { RouterTestingModule } from '@angular/router/testing'; diff --git a/frontend/src/app/study-card/study-card.component.ts b/frontend/src/app/study-card/study-card.component.ts index f01bf13622daac97e2042df454b1894322cb7b2b..f22230071b94db92953e9bb3421679e954cf8b94 100644 --- a/frontend/src/app/study-card/study-card.component.ts +++ b/frontend/src/app/study-card/study-card.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { BrapiService } from '../brapi.service'; import { ActivatedRoute } from '@angular/router'; import { BrapiGermplasm, BrapiObservationVariable, BrapiStudy, BrapiTrial } from '../models/brapi.model'; + import { KeyValueObject, toKeyValueObjects } from '../utils'; @Component({ diff --git a/frontend/src/app/xrefs/xrefs.component.spec.ts b/frontend/src/app/xrefs/xrefs.component.spec.ts index e4ce15e8bed6be6c84f9946697065913fca87155..911f7899a5ca57eac8ba681ab54715edba22d61a 100644 --- a/frontend/src/app/xrefs/xrefs.component.spec.ts +++ b/frontend/src/app/xrefs/xrefs.component.spec.ts @@ -4,7 +4,7 @@ import { XrefsComponent } from './xrefs.component'; import { ComponentTester, speculoosMatchers } from 'ngx-speculoos'; import { XrefModel } from '../models/xref.model'; import { of } from 'rxjs'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; import { CardSectionComponent } from '../card-section/card-section.component'; import { CardTableComponent } from '../card-table/card-table.component'; @@ -25,8 +25,8 @@ describe('XrefsComponent', () => { } } - const gnpisService = jasmine.createSpyObj( - 'GnpisService', [ + const faidareService = jasmine.createSpyObj( + 'FaidareService', [ 'xref' ] ); @@ -50,13 +50,13 @@ describe('XrefsComponent', () => { XrefsComponent, CardSectionComponent, CardTableComponent ], providers: [ - { provide: GnpisService, useValue: gnpisService }, + { provide: FaidareService, useValue: faidareService }, ] }); })); it('should fetch the xref information', async(() => { - gnpisService.xref.and.returnValue(of(xref)); + faidareService.xref.and.returnValue(of(xref)); const tester = new XrefsComponentTester(); tester.detectChanges(); @@ -71,7 +71,7 @@ describe('XrefsComponent', () => { it('should not display cross references', async(() => { - gnpisService.xref.and.returnValue(of(xrefBlank)); + faidareService.xref.and.returnValue(of(xrefBlank)); const tester = new XrefsComponentTester(); tester.detectChanges(); diff --git a/frontend/src/app/xrefs/xrefs.component.ts b/frontend/src/app/xrefs/xrefs.component.ts index d63a97f361706e7cee5e8c03994ffaf932b4b686..ba80757ea5a635c74a98f980f5c785d5ea4c7a4d 100644 --- a/frontend/src/app/xrefs/xrefs.component.ts +++ b/frontend/src/app/xrefs/xrefs.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; -import { GnpisService } from '../gnpis.service'; +import { FaidareService } from '../faidare.service'; import { XrefModel } from '../models/xref.model'; @Component({ @@ -12,11 +12,11 @@ export class XrefsComponent implements OnInit { xrefs: Array<XrefModel> = new Array<XrefModel>(); @Input() xrefId: string; - constructor(private gnpisService: GnpisService) { + constructor(private faidareService: FaidareService) { } ngOnInit() { - this.gnpisService.xref(this.xrefId).subscribe( + this.faidareService.xref(this.xrefId).subscribe( xrefs => { this.xrefs = xrefs; } diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index a86efa94111eb75fb5fb8f8beaa1e2dcb28b1a0d..5caef0af93f24fd54a48f86405f22e305e58c302 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -68,14 +68,14 @@ $fa-font-path: '~font-awesome/fonts'; margin-top: 75px; } -h1{ +h1 { border-bottom: solid; font-weight: bold; color: #0f6191; margin-bottom: 20px; } -h2{ +h2 { border-bottom: solid; color: #0f6191; margin-bottom: 16px; @@ -86,7 +86,7 @@ h3 { color: #0f6191; } -blockquote{ +blockquote { border-left-style: solid; border-left-width: 3px; color: grey;