Merge branch 'RED-7404' into 'master'

RED-7404 - Migrate to gradle

Closes RED-7404

See merge request redactmanager/persistence-service!231
This commit is contained in:
Andrei Isvoran 2023-12-04 12:31:47 +01:00
commit 391365b2fb
83 changed files with 888 additions and 1585 deletions

8
.gitignore vendored
View File

@ -26,3 +26,11 @@
**/.DS_Store
**/classpath-data.json
**/dependencies-and-licenses-overview.txt
gradle.properties
gradlew
gradlew.bat
gradle/
**/.gradle
**/build

View File

@ -1,6 +1,27 @@
variables:
SONAR_PROJECT_KEY: 'RED_persistence-service'
SONAR_PROJECT_KEY: 'RED_redaction-report-service'
include:
- project: 'gitlab/gitlab'
ref: 'main'
file: 'ci-templates/maven_java.yml'
file: 'ci-templates/gradle_java.yml'
deploy:
stage: deploy
tags:
- dind
variables:
DOCKER_AUTH_CONFIG: $CI_NEXUS_DOCKER_CONFIG_JSON
DOCKER_HOST: "tcp://docker:2375"
DOCKER_TLS_CERTDIR: ""
script:
- echo "Building with gradle version ${BUILDVERSION}"
- gradle -Pversion=${BUILDVERSION} publish
- gradle bootBuildImage --cleanCache --publishImage -PbuildbootDockerHostNetwork=true -Pversion=${BUILDVERSION}
- echo "BUILDVERSION=$BUILDVERSION" >> version.env
artifacts:
reports:
dotenv: version.env
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH =~ /^release/
- if: $CI_COMMIT_TAG

View File

@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}
repositories {
gradlePluginPortal()
}

View File

@ -0,0 +1,56 @@
plugins {
`java-library`
`maven-publish`
pmd
checkstyle
jacoco
}
repositories {
mavenLocal()
mavenCentral()
maven {
url = uri("https://nexus.knecon.com/repository/gindev/");
credentials {
username = providers.gradleProperty("mavenUser").getOrNull();
password = providers.gradleProperty("mavenPassword").getOrNull();
}
}
}
group = "com.iqser.red.service"
java.sourceCompatibility = JavaVersion.VERSION_17
java.targetCompatibility = JavaVersion.VERSION_17
tasks.pmdMain {
pmd.ruleSetFiles = files("${rootDir}/config/pmd/pmd.xml")
}
tasks.pmdTest {
pmd.ruleSetFiles = files("${rootDir}/config/pmd/test_pmd.xml")
}
tasks.named<Test>("test") {
useJUnitPlatform()
reports {
junitXml.outputLocation.set(layout.buildDirectory.dir("reports/junit"))
}
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
xml.required.set(true)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml"))
}
}
java {
withJavadocJar()
}

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property
name="severity"
value="error"/>
<module name="TreeWalker">
<module name="SuppressWarningsHolder"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
<module name="AnnotationLocation"/>
<module name="JavadocStyle"/>
<module name="NonEmptyAtclauseDescription"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="RedundantModifier"/>
<module name="EmptyBlock"/>
<module name="DefaultComesLast"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="ExplicitInitialization"/>
<module name="IllegalInstantiation"/>
<module name="ModifiedControlVariable"/>
<module name="MultipleVariableDeclarations"/>
<module name="PackageDeclaration"/>
<module name="ParameterAssignment"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="OneStatementPerLine"/>
<module name="FinalClass"/>
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
<module name="OuterTypeFilename"/>
</module>
<module name="FileTabCharacter"/>
<module name="SuppressWarningsFilter"/>
</module>

21
config/pmd/pmd.xml Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
Knecon ruleset checks the code for bad stuff
</description>
<rule ref="category/java/errorprone.xml">
<exclude name="DataflowAnomalyAnalysis"/>
<exclude name="MissingSerialVersionUID"/>
<exclude name="NullAssignment"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AssignmentInOperand"/>
</rule>
</ruleset>

24
config/pmd/test_pmd.xml Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
Knecon test ruleset checks the code for bad stuff
</description>
<rule ref="category/java/errorprone.xml">
<exclude name="DataflowAnomalyAnalysis"/>
<exclude name="MissingSerialVersionUID"/>
<exclude name="NullAssignment"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="AvoidDuplicateLiterals"/>
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AssignmentInOperand"/>
<exclude name="TestClassWithoutTestCases"/>
</rule>
</ruleset>

1
gradle.properties.kts Normal file
View File

@ -0,0 +1 @@
version = 4.0-SNAPSHOT

View File

@ -1,96 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.knecon.fforesight</groupId>
<artifactId>platform-docker-dependency</artifactId>
<version>0.1.0</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-image-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<service.server>persistence-service-server-v1</service.server>
<platform.jar>${service.server}.jar</platform.jar>
<docker.skip.push>false</docker.skip.push>
<docker.image.name>${docker.image.prefix}/${service.server}</docker.image.name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>download-platform-jar</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${service.server}</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<destFileName>${platform.jar}</destFileName>
</dependency>
</artifactItems>
<outputDirectory>${docker.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${docker.image.name}</name>
<build>
<dockerFileDir>${docker.build.directory}</dockerFileDir>
<args>
<PLATFORM_JAR>${platform.jar}</PLATFORM_JAR>
</args>
<tags>
<tag>${docker.image.version}</tag>
</tags>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -1,9 +0,0 @@
FROM red/base-image:2.0.2
ARG PLATFORM_JAR
ENV PLATFORM_JAR ${PLATFORM_JAR}
ENV USES_ELASTICSEARCH false
COPY ["${PLATFORM_JAR}", "/"]

View File

@ -0,0 +1,12 @@
plugins {
id("com.iqser.red.service.java-conventions")
id("io.spring.dependency-management") version "1.1.3"
id("org.sonarqube") version "4.4.1.3373"
id("io.freefair.lombok") version "8.4"
}
dependencies {
api(project(":persistence-service-processor-v1"))
}
description = "persistence-service-external-api-impl-v1"

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-external-api-impl-v1</artifactId>
<properties>
<slf4j.version>1.7.30</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-processor-v1</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -8,6 +8,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@ -243,7 +244,7 @@ public class DossierTemplateController implements DossierTemplateResource {
if (originalFileName == null || originalFileName.isEmpty()) {
throw new BadRequestException("Could not upload file, no filename provided.");
}
var extension = originalFileName.substring(originalFileName.lastIndexOf(".") + 1).toLowerCase();
var extension = originalFileName.substring(originalFileName.lastIndexOf(".") + 1).toLowerCase(Locale.ROOT);
if ("zip".equalsIgnoreCase(extension)) {
if (StringUtils.isEmpty(dossierTemplateId) && updateExistingDossierTemplate) {
throw new BadRequestException("Could not update with dossier template empty");

View File

@ -52,10 +52,11 @@ public class HighlightsController implements HighlightsResource {
fileStatusService.getStatus(fileId);
if (storageService.objectExists(TenantContext.getTenantId(), getStorageId(dossierId, fileId, FileType.TEXT_HIGHLIGHTS))) {
InputStream stream = fileManagementStorageService.getObject(TenantContext.getTenantId(), getStorageId(dossierId, fileId, FileType.TEXT_HIGHLIGHTS));
Highlights highlights = objectMapper.readValue(stream, Highlights.class);
stream.close();
return highlights;
try(InputStream stream = fileManagementStorageService.getObject(TenantContext.getTenantId(), getStorageId(dossierId, fileId, FileType.TEXT_HIGHLIGHTS))) {
Highlights highlights = objectMapper.readValue(stream, Highlights.class);
stream.close();
return highlights;
}
}
return new Highlights();

View File

@ -59,6 +59,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@RequiredArgsConstructor
@SuppressWarnings("PMD")
public class ReportTemplateController implements ReportTemplateResource {
private final ReportTemplatePlaceholderClient reportTemplatePlaceholderClient;

View File

@ -8,6 +8,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@ -44,6 +45,7 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequiredArgsConstructor
@Slf4j
@SuppressWarnings("PMD")
public class UploadController implements UploadResource {
private static final int THRESHOLD_ENTRIES = 10000;
@ -119,7 +121,7 @@ public class UploadController implements UploadResource {
private String getExtension(String fileName) {
return fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
return fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(Locale.ROOT);
}

View File

@ -0,0 +1,12 @@
plugins {
id("com.iqser.red.service.java-conventions")
id("io.freefair.lombok") version "8.4"
}
dependencies {
api(project(":persistence-service-processor-v1"))
api(project(":persistence-service-external-api-v2"))
api(project(":persistence-service-external-api-impl-v1"))
}
description = "persistence-service-external-api-impl-v2"

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-external-api-impl-v2</artifactId>
<properties>
<slf4j.version>1.7.30</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-processor-v1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-v2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-impl-v1</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -9,6 +9,7 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Locale;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
@ -207,7 +208,7 @@ public class DossierTemplateControllerV2 implements DossierTemplateResource {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.TEXT_PLAIN);
httpHeaders.add("Content-Disposition", "attachment" + "; filename*=utf-8''" + StringEncodingUtils.urlEncode(ruleFileType.name().toLowerCase() + RULES_DOWNLOAD_FILE_NAME_SUFFIX));
httpHeaders.add("Content-Disposition", "attachment" + "; filename*=utf-8''" + StringEncodingUtils.urlEncode(ruleFileType.name().toLowerCase(Locale.ROOT) + RULES_DOWNLOAD_FILE_NAME_SUFFIX));
InputStream is = new ByteArrayInputStream(data);

View File

@ -0,0 +1,25 @@
plugins {
id("com.iqser.red.service.java-conventions")
}
dependencies {
api(project(":persistence-service-internal-api-v1"))
api("com.iqser.red.service:pdftron-redaction-service-api-v1:4.38.0")
api("com.iqser.red.service:redaction-service-api-v1:4.177.0")
api("com.iqser.red.service:redaction-report-service-api-v1:4.36.0")
api("com.iqser.red.service:search-service-api-v1:2.71.0")
api("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.4")
api("com.google.guava:guava:31.1-jre")
api("org.springframework.boot:spring-boot-starter-security:3.1.3")
api("org.springframework.boot:spring-boot-starter-validation:3.1.3")
api("com.iqser.red.commons:jackson-commons:2.1.0")
api(project(":persistence-service-shared-api-v1"))
testImplementation("com.iqser.red.commons:test-commons:2.1.0")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.4")
compileOnly("org.springdoc:springdoc-openapi-ui:1.6.13")
api("io.github.openfeign:feign-core:12.2")
compileOnly("org.springframework:spring-web:6.0.6")
}
description = "persistence-service-external-api-v1"

View File

@ -1,141 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-external-api-v1</artifactId>
<dependencies>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-v1</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-report-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>search-service-api-v1</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.13.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- spring -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>jackson-commons</artifactId>
</dependency>
<!-- test -->
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>test-commons</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-shared-api-v1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,26 @@
plugins {
id("com.iqser.red.service.java-conventions")
id("io.freefair.lombok") version "8.4"
}
dependencies {
api(project(":persistence-service-external-api-v1"))
api(project(":persistence-service-internal-api-v1"))
api("com.iqser.red.service:pdftron-redaction-service-api-v1:4.38.0")
api("com.iqser.red.service:redaction-service-api-v1:4.177.0")
api("com.iqser.red.service:redaction-report-service-api-v1:4.36.0")
api("com.iqser.red.service:search-service-api-v1:2.71.0")
api("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.16.0")
api("com.google.guava:guava:31.1-jre")
api("org.springframework.boot:spring-boot-starter-security:3.1.3")
api("org.springframework.boot:spring-boot-starter-validation:3.1.3")
api("com.iqser.red.commons:jackson-commons:2.1.0")
api(project(":persistence-service-shared-api-v1"))
testImplementation("com.iqser.red.commons:test-commons:2.1.0")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.4")
compileOnly("org.springdoc:springdoc-openapi-ui:1.6.13")
api("io.github.openfeign:feign-core:12.2")
compileOnly("org.springframework:spring-web:6.0.6")
}
description = "persistence-service-external-api-v2"

View File

@ -1,147 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-external-api-v2</artifactId>
<dependencies>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-v1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-v1</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-report-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>search-service-api-v1</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.13.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- spring -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>jackson-commons</artifactId>
</dependency>
<!-- test -->
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>test-commons</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-shared-api-v1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,12 @@
plugins {
id("com.iqser.red.service.java-conventions")
id("io.freefair.lombok") version "8.4"
}
dependencies {
api(project(":persistence-service-processor-v1"))
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.4")
}
description = "persistence-service-internal-api-impl-v1"

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-internal-api-impl-v1</artifactId>
<properties>
<slf4j.version>1.7.30</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-processor-v1</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,16 @@
plugins {
id("com.iqser.red.service.java-conventions")
}
dependencies {
api("io.github.openfeign:feign-core:12.2")
api("org.springframework.boot:spring-boot-starter-web:3.1.3")
api("org.springframework.boot:spring-boot-starter-validation:3.1.3")
api("com.iqser.red.commons:jackson-commons:2.1.0")
api(project(":persistence-service-shared-api-v1"))
compileOnly("org.springdoc:springdoc-openapi-ui:1.6.13")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.4")
}
description = "persistence-service-internal-api-v1"

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-internal-api-v1</artifactId>
<dependencies>
<dependency>
<!-- This dependency contains annotations that are used in specifying REST endpoints. -->
<!-- It is optional since not all users of this API might use Feign. -->
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
<!-- spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<scope>compile</scope>
</dependency>
<!-- test -->
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>jackson-commons</artifactId>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-shared-api-v1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,52 @@
plugins {
id("com.iqser.red.service.java-conventions")
id("io.freefair.lombok") version "8.4"
}
val springBootStarterVersion = "3.1.3"
dependencies {
api(project(":persistence-service-external-api-v1"))
api(project(":persistence-service-internal-api-v1"))
api("com.knecon.fforesight:jobs-commons:0.10.0")
api("com.knecon.fforesight:database-tenant-commons:0.16.0")
api("com.knecon.fforesight:keycloak-commons:0.18.0")
api("com.knecon.fforesight:swagger-commons:0.5.0")
api("com.iqser.red.service:pdftron-redaction-service-api-v1:4.38.0")
api("com.iqser.red.service:redaction-service-api-v1:4.177.0")
api("com.iqser.red.service:redaction-report-service-api-v1:4.36.0")
api("com.knecon.fforesight:layoutparser-service-internal-api:0.74.0")
api("com.iqser.red.service:search-service-api-v1:2.71.0")
api("com.giffing.bucket4j.spring.boot.starter:bucket4j-spring-boot-starter:0.4.0")
api("com.iqser.red.service:ocr-service-api-v1:3.10.0")
api("org.springframework.security:spring-security-acl:6.0.2")
api("org.springframework.boot:spring-boot-starter-mail:${springBootStarterVersion}")
api("org.springframework.boot:spring-boot-starter-data-jpa:${springBootStarterVersion}")
api("org.springframework.boot:spring-boot-starter-data-redis:${springBootStarterVersion}")
api("org.springframework.boot:spring-boot-starter-amqp:${springBootStarterVersion}")
api("com.iqser.red.commons:spring-commons:2.1.0")
api("com.iqser.red.commons:jackson-commons:2.1.0")
api("org.apache.commons:commons-compress:1.21")
api("com.iqser.red.commons:storage-commons:2.45.0")
api("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2")
api("org.postgresql:postgresql:42.2.23")
api("org.apache.commons:commons-lang3:3.12.0")
api("org.springframework.boot:spring-boot-starter-web:3.1.3")
api("com.iqser.red.commons:spring-boot-starter-web-custom-commons:2.1.0")
api("com.iqser.red.commons:metric-commons:2.1.0")
api("com.opencsv:opencsv:5.4")
api("org.springframework.cloud:spring-cloud-starter-openfeign:4.0.4")
api("commons-validator:commons-validator:1.7")
api("com.iqser.red.service:persistence-service-shared-api-v1:+")
testImplementation("org.springframework.amqp:spring-rabbit-test:3.0.2")
testImplementation("org.testcontainers:postgresql:1.17.1")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.4")
testImplementation("com.yannbriancon:spring-hibernate-query-utils:2.0.0")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.4")
}
description = "persistence-service-processor-v1"
java {
withJavadocJar()
}

View File

@ -1,308 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-processor-v1</artifactId>
<properties>
<bucket4j.version>6.4.1</bucket4j.version>
<bucket4j.spring.version>0.4.0</bucket4j.spring.version>
<swagger-commons.version>0.5.0</swagger-commons.version>
<keycloak-commons.version>0.18.0</keycloak-commons.version>
<jobs-commons.version>0.10.0</jobs-commons.version>
<database-tenant-commons.version>0.16.0</database-tenant-commons.version>
</properties>
<dependencies>
<dependency>
<groupId>com.knecon.fforesight</groupId>
<artifactId>jobs-commons</artifactId>
<version>${jobs-commons.version}</version>
</dependency>
<dependency>
<groupId>com.knecon.fforesight</groupId>
<artifactId>database-tenant-commons</artifactId>
<version>${database-tenant-commons.version}</version>
</dependency>
<dependency>
<groupId>com.knecon.fforesight</groupId>
<artifactId>keycloak-commons</artifactId>
<version>${keycloak-commons.version}</version>
</dependency>
<dependency>
<groupId>com.knecon.fforesight</groupId>
<artifactId>swagger-commons</artifactId>
<version>${swagger-commons.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-report-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.knecon.fforesight</groupId>
<artifactId>layoutparser-service-internal-api</artifactId>
<version>0.74.0</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>search-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Rate Limiting -->
<dependency>
<groupId>com.giffing.bucket4j.spring.boot.starter</groupId>
<artifactId>bucket4j-spring-boot-starter</artifactId>
<version>${bucket4j.spring.version}</version>
<exclusions>
<exclusion>
<groupId>com.github.vladimir-bukhtoyarov</groupId>
<artifactId>bucket4j-jcache</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.vladimir-bukhtoyarov</groupId>
<artifactId>bucket4j-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-v1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>ocr-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-v1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>search-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- commons -->
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>spring-commons</artifactId>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>jackson-commons</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>storage-commons</artifactId>
<version>${storage.commons.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.23</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>spring-boot-starter-web-custom-commons</artifactId>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>metric-commons</artifactId>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.4</version>
</dependency>
<!-- spring -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!-- test -->
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.17.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.yannbriancon</groupId>
<artifactId>spring-hibernate-query-utils</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-shared-api-v1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessors>
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,5 +1,7 @@
package com.iqser.red.service.persistence.management.v1.processor.entity.configuration;
import java.util.Locale;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
@ -78,7 +80,7 @@ public class ColorsEntity {
if (color == null) {
return null;
}
return color.toLowerCase();
return color.toLowerCase(Locale.ROOT);
}

View File

@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@Service
@RequiredArgsConstructor
@SuppressWarnings("PMD")
public class MigrationStarterService {
private final List<Migration> migrations;

View File

@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@Setter
@Service
@SuppressWarnings("PMD")
public class ReduceTextFileSizeMigration10 extends Migration {
private static final String NAME = "Reduce TEXT filesize migration";

View File

@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
@ -113,7 +114,7 @@ public class DictionaryManagementService {
StringBuilder strbf = new StringBuilder();
Matcher match = Pattern.compile("([a-z])([a-z]*)", Pattern.CASE_INSENSITIVE).matcher(str);
while (match.find()) {
match.appendReplacement(strbf, match.group(1).toUpperCase() + match.group(2));
match.appendReplacement(strbf, match.group(1).toUpperCase(Locale.ROOT) + match.group(2));
}
return match.appendTail(strbf).toString();

View File

@ -8,7 +8,6 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.iqser.red.service.persistence.management.v1.processor.configuration.MessagingConfiguration;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.DossierEntity;

View File

@ -11,6 +11,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
@ -106,7 +107,7 @@ public class FileAttributesManagementService {
}
// TODO this is a primitive solution we need smart name matching
if (!fileStatusMappingColumn.toLowerCase().endsWith(".pdf")) {
if (!fileStatusMappingColumn.toLowerCase(Locale.ROOT).endsWith(".pdf")) {
fileStatusMappingColumn = fileStatusMappingColumn + ".pdf";
}

View File

@ -31,6 +31,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@Service
@RequiredArgsConstructor
@SuppressWarnings("PMD")
public class FileManagementStorageService {
private final StorageService storageService;

View File

@ -6,17 +6,18 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.CommentEntity;
public interface CommentRepository extends JpaRepository<CommentEntity, Long> {
@Query("select e from CommentEntity e where e.fileId = :fileId and e.annotationId = :annotationId and (:includeDeletions = true or e.softDeletedTime is null)")
List<CommentEntity> findByFileIdAndAnnotationId(String fileId, String annotationId, boolean includeDeletions);
List<CommentEntity> findByFileIdAndAnnotationId(@Param("fileId") String fileId, @Param("annotationId") String annotationId, @Param("includeDeletions") boolean includeDeletions);
@Query("select e from CommentEntity e where e.fileId = :fileId and (:includeDeletions = true or e.softDeletedTime is null)")
List<CommentEntity> findByFileId(String fileId, boolean includeDeletions);
List<CommentEntity> findByFileId(@Param("fileId") String fileId, @Param("includeDeletions") boolean includeDeletions);
boolean existsByFileIdAndSoftDeletedTimeIsNull(String fileId);
@ -24,10 +25,10 @@ public interface CommentRepository extends JpaRepository<CommentEntity, Long> {
@Modifying
@Query("update CommentEntity c set c.softDeletedTime = :softDeleteTime where c.id = :id")
int updateSoftDelete(long id, OffsetDateTime softDeleteTime);
int updateSoftDelete(@Param("id") long id, @Param("softDeleteTime") OffsetDateTime softDeleteTime);
@Modifying
@Query("update CommentEntity c set c.annotationId = :newAnnotationId where c.annotationId = :oldAnnotationId and c.fileId = :fileId")
int saasMigrationUpdateAnnotationIds(String fileId, String oldAnnotationId, String newAnnotationId);
int saasMigrationUpdateAnnotationIds(@Param("fileId") String fileId, @Param("oldAnnotationId") String oldAnnotationId, @Param("newAnnotationId") String newAnnotationId);
}

View File

@ -3,6 +3,7 @@ package com.iqser.red.service.persistence.management.v1.processor.service.persis
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.DigitalSignatureEntity;
@ -10,6 +11,10 @@ public interface DigitalSignatureRepository extends JpaRepository<DigitalSignatu
@Modifying
@Query("update DigitalSignatureEntity e set e.reason = :reason, e.location = :location, e.contactInfo = :contactInfo, e.certificateName= :certificateName " + "where e.id = :id")
int updateDigitalSignature(String id, String reason, String location, String contactInfo, String certificateName);
int updateDigitalSignature(@Param("id") String id,
@Param("reason") String reason,
@Param("location") String location,
@Param("contactInfo") String contactInfo,
@Param("certificateName") String certificateName);
}

View File

@ -5,6 +5,7 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.DossierAttributeConfigEntity;
@ -14,6 +15,6 @@ public interface DossierAttributeConfigRepository extends JpaRepository<DossierA
@Query("select da from DossierAttributeConfigEntity da where da.dossierTemplate.id = :dossierTemplateId and (da.id = :dossierAttributeId or da.label = :label)")
Optional<DossierAttributeConfigEntity> findAttributeByIdOrDossierTemplateIdAndLabel(String dossierTemplateId, String dossierAttributeId, String label);
Optional<DossierAttributeConfigEntity> findAttributeByIdOrDossierTemplateIdAndLabel(@Param("dossierTemplateId") String dossierTemplateId, @Param("dossierAttributeId") String dossierAttributeId, @Param("label") String label);
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.DossierAttributeEntity;
@ -15,16 +16,16 @@ public interface DossierAttributeRepository extends JpaRepository<DossierAttribu
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query("DELETE FROM DossierAttributeEntity e WHERE e.id.dossierId = :dossierId")
void deleteByDossierId(String dossierId);
void deleteByDossierId(@Param("dossierId") String dossierId);
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query("DELETE FROM DossierAttributeEntity e WHERE e.id.dossierAttributeConfigId = :id")
void deleteByDossierAttributeConfigId(String id);
void deleteByDossierAttributeConfigId(@Param("id") String id);
@Modifying
@Query("update DossierAttributeEntity dae set dae.value = :dossierAttributeValue where dae.id = :dossierAttributeId")
void updateDossierAttribute(DossierAttributeEntity.DossierAttributeEntityId dossierAttributeId, String dossierAttributeValue);
void updateDossierAttribute(@Param("dossierAttributeId") DossierAttributeEntity.DossierAttributeEntityId dossierAttributeId, @Param("dossierAttributeValue") String dossierAttributeValue);
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.DossierEntity;
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.DossierCountByStatusProjection;
@ -13,69 +14,73 @@ import com.iqser.red.service.persistence.management.v1.processor.service.persist
public interface DossierRepository extends JpaRepository<DossierEntity, String> {
@Query("select d.id from DossierEntity d where d.lastUpdated > :since")
List<String> findDossierChangeByLastUpdatedIsAfter(OffsetDateTime since);
List<String> findDossierChangeByLastUpdatedIsAfter(@Param("since") OffsetDateTime since);
@Modifying
@Query("update DossierEntity d set d.softDeletedTime = null, d.lastUpdated = :lastUpdated where d.id = :dossierId" + " and d.hardDeletedTime is null")
int undelete(String dossierId, OffsetDateTime lastUpdated);
int undelete(@Param("dossierId") String dossierId, @Param("lastUpdated") OffsetDateTime lastUpdated);
@Modifying
@Query("update DossierEntity d set d.softDeletedTime = :softDeletedTime, d.lastUpdated = :lastUpdated where d.id = :dossierId")
void markDossierAsDeleted(String dossierId, OffsetDateTime softDeletedTime, OffsetDateTime lastUpdated);
void markDossierAsDeleted(@Param("dossierId") String dossierId,
@Param("softDeletedTime") OffsetDateTime softDeletedTime,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Modifying
@Query("update DossierEntity d set d.hardDeletedTime = :hardDeletedTime, d.lastUpdated = :lastUpdated, " + "d.softDeletedTime = " + "case " + "when d.softDeletedTime is null then :hardDeletedTime " + "else d.softDeletedTime " + "end " + "where d.id = :dossierId")
void hardDelete(String dossierId, OffsetDateTime hardDeletedTime, OffsetDateTime lastUpdated);
void hardDelete(@Param("dossierId") String dossierId,
@Param("hardDeletedTime") OffsetDateTime hardDeletedTime,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Modifying
@Query("update DossierEntity d set d.archivedTime = :archiveTime, d.lastUpdated = :archiveTime where d.id = :dossierId ")
void archiveDossier(String dossierId, OffsetDateTime archiveTime);
void archiveDossier(@Param("dossierId") String dossierId, @Param("archiveTime") OffsetDateTime archiveTime);
@Modifying
@Query("update DossierEntity d set d.lastUpdated = :lastUpdated, d.archivedTime = null where d.id = :dossierId")
int unarchiveDossier(String dossierId, OffsetDateTime lastUpdated);
int unarchiveDossier(@Param("dossierId") String dossierId, @Param("lastUpdated") OffsetDateTime lastUpdated);
@Query("select count(d) from DossierEntity d where d.archivedTime is not null and d.softDeletedTime is null and d.hardDeletedTime is null and d.dossierTemplateId = :dossierTemplateId")
int countArchived(String dossierTemplateId);
int countArchived(@Param("dossierTemplateId") String dossierTemplateId);
@Query("select count(d) from DossierEntity d where d.hardDeletedTime is null and d.softDeletedTime is not null and d.dossierTemplateId = :dossierTemplateId")
int countSofDeleted(String dossierTemplateId);
int countSofDeleted(@Param("dossierTemplateId") String dossierTemplateId);
@Query("select count(d) from DossierEntity d where d.archivedTime is null and d.softDeletedTime is null and d.hardDeletedTime is null and d.dossierTemplateId = :dossierTemplateId")
int countActive(String dossierTemplateId);
int countActive(@Param("dossierTemplateId") String dossierTemplateId);
@Query("select d.dossierStatusId as dossierStatusId, count(d) as count from DossierEntity d where d.archivedTime is null and d.softDeletedTime is null and d.hardDeletedTime is null and d.dossierTemplateId = :dossierTemplateId group by d.dossierStatusId")
List<DossierCountByStatusProjection> countByDossierStatus(String dossierTemplateId);
List<DossierCountByStatusProjection> countByDossierStatus(@Param("dossierTemplateId") String dossierTemplateId);
@Query("select d.id from DossierEntity d where d.dossierTemplateId = :dossierTemplateId and d.archivedTime is null and d.softDeletedTime is null and d.hardDeletedTime is null")
List<String> findActiveDossierIdsForTemplate(String dossierTemplateId);
List<String> findActiveDossierIdsForTemplate(@Param("dossierTemplateId") String dossierTemplateId);
@Query("select d from DossierEntity d where d.dossierTemplateId = :dossierTemplateId")
List<DossierEntity> findByDossierTemplateId(String dossierTemplateId);
List<DossierEntity> findByDossierTemplateId(@Param("dossierTemplateId") String dossierTemplateId);
@Modifying
@Query("update DossierEntity d set d.watermarkId = null where d.watermarkId = :watermarkId")
int countDeleteWatermark(long watermarkId);
int countDeleteWatermark(@Param("watermarkId") long watermarkId);
@Modifying
@Query("update DossierEntity d set d.previewWatermarkId = null where d.previewWatermarkId = :previewWatermarkId")
int countDeletePreviewWatermark(long previewWatermarkId);
int countDeletePreviewWatermark(@Param("previewWatermarkId") long previewWatermarkId);
@Query("select count(d) from DossierEntity d where d.watermarkId = :watermarkId or d.previewWatermarkId = :watermarkId")
int countDossiersWithWatermarkInUse(long watermarkId);
int countDossiersWithWatermarkInUse(@Param("watermarkId") long watermarkId);
}

View File

@ -1,5 +1,6 @@
package com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Optional;
@ -12,25 +13,20 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemp
public interface DossierStatusRepository extends JpaRepository<DossierStatusEntity, String> {
@Query("select new com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.DossierStatusInfo(s.id, s.name," + "s.description, s.dossierTemplateId, s.color, s.rank, count(d)) from DossierStatusEntity s " + "left outer join s.dossiers d where s.dossierTemplateId in (:dossierTemplateIds) group by s order by s.rank ASC")
List<DossierStatusInfo> getAllDossierStatusForDossierTemplate(List<String> dossierTemplateIds);
@Query("select new com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.DossierStatusInfo(s.id, s.name," + "s.description, s.color, s.dossierTemplateId, s.rank, count(d)) from DossierStatusEntity s left outer join s.dossiers d where s.id = :dossierStatusId group by s")
Optional<DossierStatusInfo> findProjectionById(String dossierStatusId);
@Query("select new com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.DossierStatusInfo(s.id, s.name, s.description, s.dossierTemplateId, s.color, s.rank, count(d)) from DossierStatusEntity s left outer join s.dossiers d where s.dossierTemplateId in (:dossierTemplateIds) group by s order by s.rank ASC")
List<DossierStatusInfo> getAllDossierStatusForDossierTemplate(@Param("dossierTemplateIds") List<String> dossierTemplateIds);
@Query("select new com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.DossierStatusInfo(s.id, s.name, s.description, s.color, s.dossierTemplateId, s.rank, count(d)) from DossierStatusEntity s left outer join s.dossiers d where s.id = :dossierStatusId group by s")
Optional<DossierStatusInfo> findProjectionById(@Param("dossierStatusId") String dossierStatusId);
@Modifying
@Query("update DossierStatusEntity d set d.rank = :newRank where d.id = :dossierStatusId")
void updateRank(String dossierStatusId, int newRank);
void updateRank(@Param("dossierStatusId") String dossierStatusId, @Param("newRank") int newRank);
@Modifying
@Query("update DossierStatusEntity d set d.rank = d.rank + 1 where d.dossierTemplateId = :dossierTemplateId and d.rank >= :rank")
void adjustRanksForDossierTemplate(String dossierTemplateId, int rank);
void adjustRanksForDossierTemplate(@Param("dossierTemplateId") String dossierTemplateId, @Param("rank") int rank);
@Query("select count(d) from DossierStatusEntity d where d.dossierTemplateId = :dossierTemplateId and d.rank = :rankToCheck")
int getDuplicateRanks(String dossierTemplateId, int rankToCheck);
int getDuplicateRanks(@Param("dossierTemplateId") String dossierTemplateId, @Param("rankToCheck") int rankToCheck);
}

View File

@ -5,6 +5,7 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.DossierTemplateEntity;
@ -15,7 +16,7 @@ public interface DossierTemplateRepository extends JpaRepository<DossierTemplate
@Query("select d from DossierTemplateEntity d where d.id = :dossierTemplateId and d.softDeleteTime is null")
Optional<DossierTemplateEntity> findByIdAndNotDeleted(String dossierTemplateId);
Optional<DossierTemplateEntity> findByIdAndNotDeleted(@Param("dossierTemplateId") String dossierTemplateId);
boolean existsByName(String name);

View File

@ -1,13 +1,15 @@
package com.iqser.red.service.persistence.management.v1.processor.service.persistence.repository;
import com.iqser.red.service.persistence.management.v1.processor.entity.download.DownloadRedactionFileStatusEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.download.DownloadRedactionFileStatusEntity;
public interface DownloadRedactionFileStatusRepository extends JpaRepository<DownloadRedactionFileStatusEntity, String> {
List<DownloadRedactionFileStatusEntity> findAllByDownloadStorageId(String storageId);
@ -17,7 +19,7 @@ public interface DownloadRedactionFileStatusRepository extends JpaRepository<Dow
@Modifying
@Query("update DownloadRedactionFileStatusEntity e set e.processingErrorCounter = :processingErrorCounter where e.downloadStorageId = :downloadStorageId and e.fileId = :fileId")
void updateStatusErrorInfo(String downloadStorageId, String fileId, Integer processingErrorCounter);
void updateStatusErrorInfo(@Param("downloadStorageId") String downloadStorageId, @Param("fileId") String fileId, @Param("processingErrorCounter") Integer processingErrorCounter);
@Modifying
Integer deleteIfPresentByDownloadStorageId(String downloadStorageId);

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.download.DownloadStatusEntity;
import com.iqser.red.service.persistence.service.v1.api.shared.model.download.DownloadStatusValue;
@ -14,14 +15,11 @@ public interface DownloadStatusRepository extends JpaRepository<DownloadStatusEn
List<DownloadStatusEntity> findAllByUserId(String userId);
@Modifying
@Query("update DownloadStatusEntity ds set ds.status = :status where ds.storageId = :storageId")
void updateStatus(String storageId, DownloadStatusValue status);
void updateStatus(@Param("storageId") String storageId, @Param("status") DownloadStatusValue status);
@Modifying
@Query("update DownloadStatusEntity ds set ds.lastDownload = :lastDownload where ds.storageId = :storageId")
void updateLastDownload(String storageId, OffsetDateTime lastDownload);
void updateLastDownload(@Param("storageId") String storageId, @Param("lastDownload") OffsetDateTime lastDownload);
}

View File

@ -6,6 +6,7 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileAttributeConfigEntity;
@ -16,15 +17,15 @@ public interface FileAttributeConfigRepository extends JpaRepository<FileAttribu
@Modifying
@Query("update FileAttributeConfigEntity e set e.primaryAttribute = false where e.dossierTemplate.id = :dossierTemplateId")
void updateAllPrimaryAttributeValuesToFalse(String dossierTemplateId);
void updateAllPrimaryAttributeValuesToFalse(@Param("dossierTemplateId") String dossierTemplateId);
@Modifying
@Query("update FileAttributeConfigEntity e set e.primaryAttribute = true where e.id = :fileAttributeId")
void updatePrimaryAttributeValueToTrue(String fileAttributeId);
void updatePrimaryAttributeValueToTrue(@Param("fileAttributeId") String fileAttributeId);
@Query("select fa from FileAttributeConfigEntity fa where fa.dossierTemplate.id = :dossierTemplateId and (fa.id = :fileAttributeId or fa.label = :label)")
Optional<FileAttributeConfigEntity> findByIdOrDossierTemplateIdAndLabel(String dossierTemplateId, String fileAttributeId, String label);
Optional<FileAttributeConfigEntity> findByIdOrDossierTemplateIdAndLabel(@Param("dossierTemplateId") String dossierTemplateId, @Param("fileAttributeId") String fileAttributeId, @Param("label") String label);
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileAttributeEntity;
@ -12,15 +13,15 @@ public interface FileAttributesRepository extends JpaRepository<FileAttributeEnt
@Modifying(flushAutomatically = true, clearAutomatically = true)
@Query("DELETE FROM FileAttributeEntity f where f.fileAttributeId.fileAttributeConfigId = :fileAttributeConfigId")
void deleteByFileAttributeConfigId(String fileAttributeConfigId);
void deleteByFileAttributeConfigId(@Param("fileAttributeConfigId") String fileAttributeConfigId);
@Modifying(flushAutomatically = true, clearAutomatically = true)
@Query("DELETE FROM FileAttributeEntity f where f.fileAttributeId.fileId = :fileId")
void deleteByFileId(String fileId);
void deleteByFileId(@Param("fileId") String fileId);
@Query("SELECT f FROM FileAttributeEntity f where f.fileAttributeId.fileId = :fileId")
List<FileAttributeEntity> findByFileId(String fileId);
List<FileAttributeEntity> findByFileId(@Param("fileId") String fileId);
}

View File

@ -7,6 +7,7 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileEntity;
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FilePageCountsProjection;
@ -29,206 +30,336 @@ public interface FileRepository extends JpaRepository<FileEntity, String> {
@Modifying
@Query("update FileEntity e set e.hasRedactions = :hasRedactions ," + " e.hasHints = :hasHints, e.hasSuggestions = :hasSuggestions," + " e.hasImages = :hasImages, e.hasUpdates = :hasUpdates, e.hasAnnotationComments = :hasComments, " + " e.lastUpdated = :lastUpdated " + " where e.id =:fileId")
void updateFlags(String fileId,
OffsetDateTime lastUpdated,
boolean hasRedactions,
boolean hasHints,
boolean hasImages,
boolean hasSuggestions,
boolean hasComments,
boolean hasUpdates);
@Query("update FileEntity e set e.hasRedactions = :hasRedactions ," +
" e.hasHints = :hasHints, e.hasSuggestions = :hasSuggestions," +
" e.hasImages = :hasImages, e.hasUpdates = :hasUpdates, e.hasAnnotationComments = :hasComments, " +
" e.lastUpdated = :lastUpdated " +
" where e.id =:fileId")
void updateFlags(@Param("fileId") String fileId,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("hasRedactions") boolean hasRedactions,
@Param("hasHints") boolean hasHints,
@Param("hasImages") boolean hasImages,
@Param("hasSuggestions") boolean hasSuggestions,
@Param("hasComments") boolean hasComments,
@Param("hasUpdates") boolean hasUpdates);
@Modifying
@Query("update FileEntity f set f.numberOfPages = :numberOfPages, f.processingStatus = :processingStatus, " + "f.dictionaryVersion = :dictionaryVersion, f.rulesVersion = :rulesVersion, f.componentRulesVersion = :componentRulesVersion, f.legalBasisVersion = :legalBasisVersion, " + "f.analysisDuration = :analysisDuration, f.dossierDictionaryVersion = :dossierDictionaryVersion, " + "f.analysisVersion = :analysisVersion, f.numberOfAnalyses = :analysisNumber, f.lastUpdated = :lastUpdated, " + "f.lastProcessed = :lastProcessed, f.processingErrorCounter = :processingErrorCounter " + "where f.id = :fileId")
void updateProcessingStatus(String fileId,
int numberOfPages,
ProcessingStatus processingStatus,
long dictionaryVersion,
long rulesVersion,
long componentRulesVersion,
long legalBasisVersion,
long analysisDuration,
long dossierDictionaryVersion,
int analysisVersion,
OffsetDateTime lastUpdated,
OffsetDateTime lastProcessed,
int analysisNumber,
int processingErrorCounter);
@Query("update FileEntity f set f.numberOfPages = :numberOfPages, f.processingStatus = :processingStatus, " +
"f.dictionaryVersion = :dictionaryVersion, f.rulesVersion = :rulesVersion, f.componentRulesVersion = :componentRulesVersion, f.legalBasisVersion = :legalBasisVersion, " +
"f.analysisDuration = :analysisDuration, f.dossierDictionaryVersion = :dossierDictionaryVersion, " +
"f.analysisVersion = :analysisVersion, f.numberOfAnalyses = :analysisNumber, f.lastUpdated = :lastUpdated, " +
"f.lastProcessed = :lastProcessed, f.processingErrorCounter = :processingErrorCounter " +
"where f.id = :fileId")
void updateProcessingStatus(@Param("fileId") String fileId,
@Param("numberOfPages") int numberOfPages,
@Param("processingStatus") ProcessingStatus processingStatus,
@Param("dictionaryVersion") long dictionaryVersion,
@Param("rulesVersion") long rulesVersion,
@Param("componentRulesVersion") long componentRulesVersion,
@Param("legalBasisVersion") long legalBasisVersion,
@Param("analysisDuration") long analysisDuration,
@Param("dossierDictionaryVersion") long dossierDictionaryVersion,
@Param("analysisVersion") int analysisVersion,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("lastProcessed") OffsetDateTime lastProcessed,
@Param("analysisNumber") int analysisNumber,
@Param("processingErrorCounter") int processingErrorCounter);
@Modifying
@Query("update FileEntity f set f.workflowStatus = :workflowStatus, f.lastUpdated = :lastUpdated, f.approvalDate = :approvalDate," + " f.excludedFromAutomaticAnalysis = :excludedFromAutomaticAnalysis where f.id = :fileId")
void updateWorkflowStatus(String fileId, WorkflowStatus workflowStatus, OffsetDateTime lastUpdated, OffsetDateTime approvalDate, boolean excludedFromAutomaticAnalysis);
@Query("update FileEntity f set f.workflowStatus = :workflowStatus, f.lastUpdated = :lastUpdated, f.approvalDate = :approvalDate," +
" f.excludedFromAutomaticAnalysis = :excludedFromAutomaticAnalysis where f.id = :fileId")
void updateWorkflowStatus(@Param("fileId") String fileId,
@Param("workflowStatus") WorkflowStatus workflowStatus,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("approvalDate") OffsetDateTime approvalDate,
@Param("excludedFromAutomaticAnalysis") boolean excludedFromAutomaticAnalysis);
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query("update FileEntity f set f.workflowStatus = :workflowStatus, f.lastUpdated = :lastUpdated, f.approvalDate = :approvalDate " + " where f.id = :fileId")
void updateWorkflowStatus(String fileId, WorkflowStatus workflowStatus, OffsetDateTime lastUpdated, OffsetDateTime approvalDate);
@Query("update FileEntity f set f.workflowStatus = :workflowStatus, f.lastUpdated = :lastUpdated, f.approvalDate = :approvalDate " +
" where f.id = :fileId")
void updateWorkflowStatus(@Param("fileId") String fileId,
@Param("workflowStatus") WorkflowStatus workflowStatus,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("approvalDate") OffsetDateTime approvalDate);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.fileSize = :fileSize where f.id = :fileId")
void updateFileSize(String fileId, long fileSize);
void updateFileSize(@Param("fileId") String fileId, @Param("fileSize") long fileSize);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated," + " f.hasHighlights = :hasHighlights, f.processingErrorCounter = :processingErrorCounter " + " where f.id = :fileId")
void updateProcessingStatus(String fileId, ProcessingStatus processingStatus, OffsetDateTime lastUpdated, boolean hasHighlights, int processingErrorCounter);
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated," +
" f.hasHighlights = :hasHighlights, f.processingErrorCounter = :processingErrorCounter " +
" where f.id = :fileId")
void updateProcessingStatus(@Param("fileId") String fileId,
@Param("processingStatus") ProcessingStatus processingStatus,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("hasHighlights") boolean hasHighlights,
@Param("processingErrorCounter") int processingErrorCounter);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated, f.processingErrorCounter = :processingErrorCounter " + "where f.id = :fileId")
void updateProcessingStatus(String fileId, ProcessingStatus processingStatus, OffsetDateTime lastUpdated, int processingErrorCounter);
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated, f.processingErrorCounter = :processingErrorCounter " +
"where f.id = :fileId")
void updateProcessingStatus(@Param("fileId") String fileId,
@Param("processingStatus") ProcessingStatus processingStatus,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("processingErrorCounter") int processingErrorCounter);
@Modifying
@Query("update FileEntity f set f.errorCause = :cause, f.errorQueue = :queue, f.errorService = :service, f.errorTimestamp = :timestamp where f.id = :fileId")
void updateStatusErrorInfo(String fileId, String cause, String queue, String service, OffsetDateTime timestamp);
@Query("update FileEntity f set f.errorCause = :cause, f.errorQueue = :queue, f.errorService = :service, f.errorTimestamp = :timestamp " +
"where f.id = :fileId")
void updateStatusErrorInfo(@Param("fileId") String fileId,
@Param("cause") String cause,
@Param("queue") String queue,
@Param("service") String service,
@Param("timestamp") OffsetDateTime timestamp);
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated, f.lastProcessed = :lastProcessed, f.processingErrorCounter = :processingErrorCounter " + "where f.id = :fileId")
void updateProcessingStatus(String fileId, ProcessingStatus processingStatus, OffsetDateTime lastUpdated, OffsetDateTime lastProcessed, int processingErrorCounter);
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated, f.lastProcessed = :lastProcessed, f.processingErrorCounter = :processingErrorCounter " +
"where f.id = :fileId")
void updateProcessingStatus(@Param("fileId") String fileId,
@Param("processingStatus") ProcessingStatus processingStatus,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("lastProcessed") OffsetDateTime lastProcessed,
@Param("processingErrorCounter") int processingErrorCounter);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated," + "f.lastIndexed = :lastIndexed, f.processingErrorCounter = :processingErrorCounter where f.id = :fileId")
void setUpdateStatusIndexingSuccessful(String fileId, ProcessingStatus processingStatus, OffsetDateTime lastUpdated, OffsetDateTime lastIndexed, int processingErrorCounter);
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated," +
"f.lastIndexed = :lastIndexed, f.processingErrorCounter = :processingErrorCounter where f.id = :fileId")
void setUpdateStatusIndexingSuccessful(@Param("fileId") String fileId,
@Param("processingStatus") ProcessingStatus processingStatus,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("lastIndexed") OffsetDateTime lastIndexed,
@Param("processingErrorCounter") int processingErrorCounter);
@Modifying
@Query("update FileEntity f set f.lastUpdated = :lastUpdated, f.ocrStartTime = :ocrStartTime where f.id = :fileId")
void updateOCRStartTime(String fileId, OffsetDateTime lastUpdated, OffsetDateTime ocrStartTime);
void updateOCRStartTime(@Param("fileId") String fileId,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("ocrStartTime") OffsetDateTime ocrStartTime);
@Modifying
@Query("update FileEntity f set f.fileManipulationDate = :fileManipulationDate where f.id = :fileId")
void updateFileModificationDate(String fileId, OffsetDateTime fileManipulationDate);
void updateFileModificationDate(@Param("fileId") String fileId,
@Param("fileManipulationDate") OffsetDateTime fileManipulationDate);
@Modifying
@Query("update FileEntity f set f.hasHighlights = :hasHighlights where f.id = :fileId")
void updateHasHighlights(String fileId, boolean hasHighlights);
void updateHasHighlights(@Param("fileId") String fileId,
@Param("hasHighlights") boolean hasHighlights);
@Modifying
@Query("update FileEntity f set f.lastUpdated = :lastUpdated, f.hasAnnotationComments = :hasAnnotationComments where f.id = :fileId")
void updateHasComments(String fileId, OffsetDateTime lastUpdated, boolean hasAnnotationComments);
void updateHasComments(@Param("fileId") String fileId,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("hasAnnotationComments") boolean hasAnnotationComments);
@Modifying
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated, " + "f.deleted = :softDeletedTime where f.id = :fileId")
int setSoftDelete(String fileId, ProcessingStatus processingStatus, OffsetDateTime lastUpdated, OffsetDateTime softDeletedTime);
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated, " +
"f.deleted = :softDeletedTime where f.id = :fileId")
int setSoftDelete(@Param("fileId") String fileId,
@Param("processingStatus") ProcessingStatus processingStatus,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("softDeletedTime") OffsetDateTime softDeletedTime);
@Modifying
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated," + " f.hardDeletedTime = :hardDeletedTime, " + " f.deleted = case " + " when f.deleted is null then :deleted " + " when f.deleted is not null then f.deleted " + " end " + " where f.id = :fileId")
int setHardDelete(String fileId, ProcessingStatus processingStatus, OffsetDateTime lastUpdated, OffsetDateTime hardDeletedTime, OffsetDateTime deleted);
@Query("update FileEntity f set f.processingStatus = :processingStatus, f.lastUpdated = :lastUpdated," +
"f.hardDeletedTime = :hardDeletedTime, " +
"f.deleted = case " +
" when f.deleted is null then :deleted " +
" when f.deleted is not null then f.deleted " +
"end " +
"where f.id = :fileId")
int setHardDelete(@Param("fileId") String fileId,
@Param("processingStatus") ProcessingStatus processingStatus,
@Param("lastUpdated") OffsetDateTime lastUpdated,
@Param("hardDeletedTime") OffsetDateTime hardDeletedTime,
@Param("deleted") OffsetDateTime deleted);
@Modifying
@Query("update FileEntity f set f.assignee = :assignee, f.lastReviewer = :lastReviewer, f.lastApprover = :lastApprover, " + "f.lastUpdated = :lastUpdated where f.id = :fileId")
int setAssignee(String fileId, String assignee, String lastReviewer, String lastApprover, OffsetDateTime lastUpdated);
@Query("update FileEntity f set f.assignee = :assignee, f.lastReviewer = :lastReviewer, f.lastApprover = :lastApprover, " +
"f.lastUpdated = :lastUpdated where f.id = :fileId")
int setAssignee(@Param("fileId") String fileId,
@Param("assignee") String assignee,
@Param("lastReviewer") String lastReviewer,
@Param("lastApprover") String lastApprover,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.excluded = :excluded, f.lastUpdated = :lastUpdated where f.id = :fileId")
int toggleExclusion(String fileId, boolean excluded, OffsetDateTime lastUpdated);
int toggleExclusion(@Param("fileId") String fileId,
@Param("excluded") boolean excluded,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.excludedFromAutomaticAnalysis = :excludedFromAutomaticAnalysis, f.lastUpdated = :lastUpdated where f.id = :fileId")
int toggleAutomaticAnalysis(String fileId, boolean excludedFromAutomaticAnalysis, OffsetDateTime lastUpdated);
int toggleAutomaticAnalysis(@Param("fileId") String fileId,
@Param("excludedFromAutomaticAnalysis") boolean excludedFromAutomaticAnalysis,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.filename = :filename, f.uploader = :uploader, f.processingStatus = :processingStatus, " + "f.workflowStatus = :workflowStatus, f.lastUploaded = :lastUploaded, f.lastUpdated = :lastUpdated, f.fileManipulationDate = :lastUploaded, " + "f.ocrEndTime = null, f.ocrStartTime = null, f.numberOfPagesToOCR = null, f.numberOfOCRedPages = null, f.excluded = false, f.lastProcessed = null, f.lastReviewer = null, f.lastApprover = null, " + "f.assignee = null, f.approvalDate = null, f.numberOfAnalyses = 0, f.lastManualChangeDate = null, f.redactionModificationDate = null, " + "f.dictionaryVersion = 0, f.dossierDictionaryVersion = 0, f.rulesVersion = 0, f.hasImages = false, " + "f.hasHints = false, f.hasRedactions = false, f.hasSuggestions = false, f.hasUpdates = false, " + "f.deleted = null, f.hardDeletedTime = null, f.hasHighlights = false, f.excludedFromAutomaticAnalysis = false, f.processingErrorCounter = 0, f.errorCause = null, f.errorQueue = null, f.errorService = null, f.errorTimestamp = null where f.id = :fileId")
int overwriteFile(String fileId,
String filename,
String uploader,
ProcessingStatus processingStatus,
WorkflowStatus workflowStatus,
OffsetDateTime lastUploaded,
OffsetDateTime lastUpdated);
@Query("update FileEntity f set f.filename = :filename, f.uploader = :uploader, f.processingStatus = :processingStatus, " +
"f.workflowStatus = :workflowStatus, f.lastUploaded = :lastUploaded, f.lastUpdated = :lastUpdated, " +
"f.fileManipulationDate = :lastUploaded, " +
"f.ocrEndTime = null, f.ocrStartTime = null, f.numberOfPagesToOCR = null, f.numberOfOCRedPages = null, " +
"f.excluded = false, f.lastProcessed = null, f.lastReviewer = null, f.lastApprover = null, " +
"f.assignee = null, f.approvalDate = null, f.numberOfAnalyses = 0, f.lastManualChangeDate = null, " +
"f.redactionModificationDate = null, " +
"f.dictionaryVersion = 0, f.dossierDictionaryVersion = 0, f.rulesVersion = 0, f.hasImages = false, " +
"f.hasHints = false, f.hasRedactions = false, f.hasSuggestions = false, f.hasUpdates = false, " +
"f.deleted = null, f.hardDeletedTime = null, f.hasHighlights = false, f.excludedFromAutomaticAnalysis = false, " +
"f.processingErrorCounter = 0, f.errorCause = null, f.errorQueue = null, f.errorService = null, " +
"f.errorTimestamp = null where f.id = :fileId")
int overwriteFile(@Param("fileId") String fileId,
@Param("filename") String filename,
@Param("uploader") String uploader,
@Param("processingStatus") ProcessingStatus processingStatus,
@Param("workflowStatus") WorkflowStatus workflowStatus,
@Param("lastUploaded") OffsetDateTime lastUploaded,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.filename = :filename, f.uploader = :uploader, f.processingStatus = :processingStatus, " + "f.lastUploaded = :lastUploaded, f.lastUpdated = :lastUpdated, f.fileManipulationDate = :lastUploaded, " + "f.lastProcessed = null," + "f.approvalDate = null, f.numberOfAnalyses = 0, f.lastManualChangeDate = null, f.redactionModificationDate = null, " + "f.dictionaryVersion = 0, f.dossierDictionaryVersion = 0, f.rulesVersion = 0, f.hasImages = false, " + "f.hasHints = false, f.hasRedactions = false, f.hasSuggestions = false, f.hasUpdates = false, " + "f.deleted = null, f.hardDeletedTime = null, f.hasHighlights = false, f.processingErrorCounter = 0, f.ocrStartTime = null, f.ocrEndTime = null, f.numberOfPagesToOCR = null, f.numberOfOCRedPages = null, f.errorCause = null, f.errorQueue = null, f.errorService = null, f.errorTimestamp = null where f.id = :fileId")
int overwriteFileAndKeepManualRedactions(String fileId,
String filename,
String uploader,
ProcessingStatus processingStatus,
OffsetDateTime lastUploaded,
OffsetDateTime lastUpdated);
@Query("update FileEntity f set f.filename = :filename, f.uploader = :uploader, f.processingStatus = :processingStatus, " +
"f.lastUploaded = :lastUploaded, f.lastUpdated = :lastUpdated, f.fileManipulationDate = :lastUploaded, " +
"f.lastProcessed = null," +
"f.approvalDate = null, f.numberOfAnalyses = 0, f.lastManualChangeDate = null, f.redactionModificationDate = null, " +
"f.dictionaryVersion = 0, f.dossierDictionaryVersion = 0, f.rulesVersion = 0, f.hasImages = false, " +
"f.hasHints = false, f.hasRedactions = false, f.hasSuggestions = false, f.hasUpdates = false, " +
"f.deleted = null, f.hardDeletedTime = null, f.hasHighlights = false, f.processingErrorCounter = 0, " +
"f.ocrStartTime = null, f.ocrEndTime = null, f.numberOfPagesToOCR = null, f.numberOfOCRedPages = null, " +
"f.errorCause = null, f.errorQueue = null, f.errorService = null, f.errorTimestamp = null " +
"where f.id = :fileId")
int overwriteFileAndKeepManualRedactions(@Param("fileId") String fileId,
@Param("filename") String filename,
@Param("uploader") String uploader,
@Param("processingStatus") ProcessingStatus processingStatus,
@Param("lastUploaded") OffsetDateTime lastUploaded,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Query("select count(f) from FileEntity f inner join DossierEntity d on d.id = f.dossierId where d.dossierTemplateId = :dossierTemplateId" + " and ((f.deleted is not null and f.hardDeletedTime is null) or " + " (d.softDeletedTime is not null and d.hardDeletedTime is null)) and d.archivedTime is null")
int countSoftDeletedFilesPerDossierTemplateId(String dossierTemplateId);
@Query("select count(f) from FileEntity f inner join DossierEntity d on d.id = f.dossierId " +
"where d.dossierTemplateId = :dossierTemplateId" +
" and ((f.deleted is not null and f.hardDeletedTime is null) or " +
" (d.softDeletedTime is not null and d.hardDeletedTime is null)) and d.archivedTime is null")
int countSoftDeletedFilesPerDossierTemplateId(@Param("dossierTemplateId") String dossierTemplateId);
@Query("select count(f) from FileEntity f inner join DossierEntity d on d.id = f.dossierId where d.id = :dossierId" + " and ((f.deleted is not null and f.hardDeletedTime is null) or " + " (d.softDeletedTime is not null and d.hardDeletedTime is null))")
int countSoftDeletedFilesPerDossierId(String dossierId);
@Query("select count(f) from FileEntity f inner join DossierEntity d on d.id = f.dossierId " +
"where d.id = :dossierId" +
" and ((f.deleted is not null and f.hardDeletedTime is null) or " +
" (d.softDeletedTime is not null and d.hardDeletedTime is null))")
int countSoftDeletedFilesPerDossierId(@Param("dossierId") String dossierId);
@Query("select distinct f.dossierId from FileEntity f where f.lastUpdated > :since")
List<String> findDossierChangeByLastUpdatedIsAfter(OffsetDateTime since);
List<String> findDossierChangeByLastUpdatedIsAfter(@Param("since") OffsetDateTime since);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.redactionModificationDate = :redactionModificationDate, f.lastUpdated = :lastUpdated where f.id = :fileId")
void setLastRedactionModificationDateForFile(String fileId, OffsetDateTime redactionModificationDate, OffsetDateTime lastUpdated);
void setLastRedactionModificationDateForFile(@Param("fileId") String fileId,
@Param("redactionModificationDate") OffsetDateTime redactionModificationDate,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.lastManualChangeDate = :lastManualChangeDate, f.lastUpdated = :lastUpdated where f.id = :fileId")
void setLastManualChangeDate(String fileId, OffsetDateTime lastManualChangeDate, OffsetDateTime lastUpdated);
void setLastManualChangeDate(@Param("fileId") String fileId,
@Param("lastManualChangeDate") OffsetDateTime lastManualChangeDate,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Query("select f from FileEntity f join DossierEntity d on d.id = f.dossierId where f.excluded = false and f.workflowStatus <> 'APPROVED' and f.excludedFromAutomaticAnalysis = false " + " and ( f.processingStatus = 'PROCESSED' or f.processingStatus = 'ERROR' )" + " and d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null " + " and f.deleted is null and f.hardDeletedTime is null and f.processingErrorCounter <= :maxRetries")
List<FileEntity> getAllRelevantStatusesForReanalysisScheduler(int maxRetries);
@Query("select f from FileEntity f join DossierEntity d on d.id = f.dossierId " +
"where f.excluded = false and f.workflowStatus <> 'APPROVED' and f.excludedFromAutomaticAnalysis = false " +
" and ( f.processingStatus = 'PROCESSED' or f.processingStatus = 'ERROR' )" +
" and d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null " +
" and f.deleted is null and f.hardDeletedTime is null and f.processingErrorCounter <= :maxRetries")
List<FileEntity> getAllRelevantStatusesForReanalysisScheduler(@Param("maxRetries") int maxRetries);
@Modifying
@Query("update FileEntity f set f.lastFileAttributeChange = :date, f.lastUpdated = :date where f.id = :fileId")
void updateLastAttributeChangeDate(String fileId, OffsetDateTime date);
void updateLastAttributeChangeDate(@Param("fileId") String fileId,
@Param("date") OffsetDateTime date);
@Query("select f from FileEntity f where f.deleted is not null and f.hardDeletedTime is null and f.dossierId in :dossierIds")
List<FileEntity> getSoftDeletedFiles(List<String> dossierIds);
List<FileEntity> getSoftDeletedFiles(@Param("dossierIds") List<String> dossierIds);
@Query("select f.processingStatus as processingStatus, count(f) as count from FileEntity f " + "inner join DossierEntity d on d.id = f.dossierId " + "where f.deleted is null and f.hardDeletedTime is null " + "and d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null " + "and d.dossierTemplateId = :dossierTemplateId " + "group by f.processingStatus ")
List<FileProcessingStatusProjection> countFilesByProcessingStatus(String dossierTemplateId);
@Query("select f.processingStatus as processingStatus, count(f) as count from FileEntity f " +
"inner join DossierEntity d on d.id = f.dossierId " +
"where f.deleted is null and f.hardDeletedTime is null " +
"and d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null " +
"and d.dossierTemplateId = :dossierTemplateId " +
"group by f.processingStatus ")
List<FileProcessingStatusProjection> countFilesByProcessingStatus(@Param("dossierTemplateId") String dossierTemplateId);
@Query("select f.workflowStatus as workflowStatus, count(f) as count from FileEntity f " + "inner join DossierEntity d on d.id = f.dossierId " + "where f.deleted is null and f.hardDeletedTime is null " + "and d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null " + "and d.dossierTemplateId = :dossierTemplateId " + "group by f.workflowStatus ")
List<FileWorkflowStatusProjection> countFilesByWorkflowStatus(String dossierTemplateId);
@Query("select f.workflowStatus as workflowStatus, count(f) as count from FileEntity f " +
"inner join DossierEntity d on d.id = f.dossierId " +
"where f.deleted is null and f.hardDeletedTime is null " +
"and d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null " +
"and d.dossierTemplateId = :dossierTemplateId " +
"group by f.workflowStatus ")
List<FileWorkflowStatusProjection> countFilesByWorkflowStatus(@Param("dossierTemplateId") String dossierTemplateId);
@Query(value = "select COALESCE(sum(number_of_pages),0) as numberOfAnalyzedPages, COALESCE(sum(json_array_length(cast(excluded_pages AS json))),0) as numberOfExcludedPages " + " from file join dossier on file.dossier_id = dossier.id where file.deleted is null and file.hard_deleted_time is null " + " and dossier.archived_time is null and dossier.soft_deleted_time is null and dossier.hard_deleted_time is null" + " and dossier.dossier_template_id = :dossierTemplateId", nativeQuery = true)
FilePageCountsProjection countPages(String dossierTemplateId);
@Query(value = "select COALESCE(sum(number_of_pages),0) as numberOfAnalyzedPages, " +
"COALESCE(sum(json_array_length(cast(excluded_pages AS json))),0) as numberOfExcludedPages " +
"from file join dossier on file.dossier_id = dossier.id " +
"where file.deleted is null and file.hard_deleted_time is null " +
"and dossier.archived_time is null and dossier.soft_deleted_time is null and dossier.hard_deleted_time is null" +
" and dossier.dossier_template_id = :dossierTemplateId", nativeQuery = true)
FilePageCountsProjection countPages(@Param("dossierTemplateId") String dossierTemplateId);
@Query("select count(f) from FileEntity f inner join DossierEntity d on d.id = f.dossierId where " + "f.hardDeletedTime is null and f.deleted is null and " + "d.dossierTemplateId = :dossierTemplateId and " + "d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null")
int countActiveFiles(String dossierTemplateId);
@Query("select count(f) from FileEntity f inner join DossierEntity d on d.id = f.dossierId where " +
"f.hardDeletedTime is null and f.deleted is null and " +
"d.dossierTemplateId = :dossierTemplateId and " +
"d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null")
int countActiveFiles(@Param("dossierTemplateId") String dossierTemplateId);
@Transactional
@Modifying(clearAutomatically = true)
@Query(value = "update FileEntity f set f.numberOfOCRedPages = :numberOfOCRedPages, f.numberOfPagesToOCR = :numberOfPagesToOCR, f.ocrEndTime = :ocrEndTime, " + " f.lastUpdated = :lastUpdated where f.id = :fileId")
void updateOCRStatus(String fileId, int numberOfPagesToOCR, int numberOfOCRedPages, OffsetDateTime ocrEndTime, OffsetDateTime lastUpdated);
@Query(value = "update FileEntity f set f.numberOfOCRedPages = :numberOfOCRedPages, " +
"f.numberOfPagesToOCR = :numberOfPagesToOCR, f.ocrEndTime = :ocrEndTime, " +
"f.lastUpdated = :lastUpdated where f.id = :fileId")
void updateOCRStatus(@Param("fileId") String fileId,
@Param("numberOfPagesToOCR") int numberOfPagesToOCR,
@Param("numberOfOCRedPages") int numberOfOCRedPages,
@Param("ocrEndTime") OffsetDateTime ocrEndTime,
@Param("lastUpdated") OffsetDateTime lastUpdated);
@Transactional
@Modifying(clearAutomatically = true)
@Query(value = "update FileEntity f set f.lastLayoutProcessed = :offsetDateTime where f.id = :fileId")
void updateLayoutProcessedTime(String fileId, OffsetDateTime offsetDateTime);
void updateLayoutProcessedTime(@Param("fileId") String fileId,
@Param("offsetDateTime") OffsetDateTime offsetDateTime);
@Query("select f.filename from FileEntity f where f.id = :fileId")
Optional<String> getFilenameById(String fileId);
Optional<String> getFilenameById(@Param("fileId") String fileId);
}

View File

@ -6,13 +6,14 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.notification.NotificationEntity;
public interface NotificationRepository extends JpaRepository<NotificationEntity, Long> {
@Query("select count(n) from NotificationEntity n where " + " (exists (select e from NotificationPreferencesEntity e where e.userId = :userId) and n.notificationType in ( select apn from NotificationPreferencesEntity p join p.inAppNotifications apn where p.userId = :userId and p.inAppNotificationsEnabled = true )) " + " and n.softDeleted is null and n.userId = :userId and n.creationDate > :since")
int hasInAppNotificationForUser(String userId, OffsetDateTime since);
int hasInAppNotificationForUser(@Param("userId") String userId, @Param("since") OffsetDateTime since);
@Query("""
@ -20,7 +21,7 @@ public interface NotificationRepository extends JpaRepository<NotificationEntity
(exists (select e from NotificationPreferencesEntity e where e.userId = :userId) and n.notificationType in
(select apn from NotificationPreferencesEntity p join p.inAppNotifications apn where p.userId = :userId and p.inAppNotificationsEnabled = true))
and n.softDeleted is null and n.userId = :userId order by n.creationDate desc""")
List<NotificationEntity> findAppNotificationsForUser(String userId);
List<NotificationEntity> findAppNotificationsForUser(@Param("userId") String userId);
@Query("""
@ -28,35 +29,35 @@ public interface NotificationRepository extends JpaRepository<NotificationEntity
(exists (select e from NotificationPreferencesEntity e where e.userId = :userId) and n.notificationType in
(select apn from NotificationPreferencesEntity p join p.inAppNotifications apn where p.userId = :userId and p.inAppNotificationsEnabled = true))
and n.seenDate is null and n.softDeleted is null and n.userId = :userId order by n.creationDate desc""")
List<NotificationEntity> findUnseenNotificationsForUser(String userId);
List<NotificationEntity> findUnseenNotificationsForUser(@Param("userId") String userId);
@Modifying
@Query("update NotificationEntity n set n.seenDate = :seenDate where n.id = :notificationId and n.userId = :userId")
int setSeenDate(String userId, long notificationId, OffsetDateTime seenDate);
int setSeenDate(@Param("userId") String userId, @Param("notificationId") long notificationId, @Param("seenDate") OffsetDateTime seenDate);
@Modifying
@Query("update NotificationEntity n set n.readDate = :readDate where n.id = :notificationId and n.userId = :userId")
int setReadDate(String userId, long notificationId, OffsetDateTime readDate);
int setReadDate(@Param("userId") String userId ,@Param("notificationId") long notificationId, @Param("readDate") OffsetDateTime readDate);
@Modifying
@Query("update NotificationEntity n set n.softDeleted = :softDeleted where n.id = :notificationId and n.userId = :userId")
int softDelete(String userId, long notificationId, OffsetDateTime softDeleted);
int softDelete(@Param("userId") String userId, @Param("notificationId") long notificationId, @Param("softDeleted") OffsetDateTime softDeleted);
@Modifying
@Query("update NotificationEntity n set n.softDeleted = :softDeleted where n.userId = :userId")
void deleteAllByUserId(String userId, OffsetDateTime softDeleted);
void deleteAllByUserId(@Param("userId") String userId, @Param("softDeleted") OffsetDateTime softDeleted);
@Modifying
@Query("update NotificationEntity n set n.softDeleted = :softDeleted where n.userId = :userId and n.notificationType in :removedNotificationTypes")
void deleteAllByUserIdAndNotificationTypeIn(String userId, List<String> removedNotificationTypes, OffsetDateTime softDeleted);
void deleteAllByUserIdAndNotificationTypeIn(@Param("userId") String userId, @Param("removedNotificationTypes") List<String> removedNotificationTypes, @Param("softDeleted") OffsetDateTime softDeleted);
@Query("select n from NotificationEntity n where " + " (exists (select e from NotificationPreferencesEntity e where e.userId = :userId) and n.notificationType in ( select apn from NotificationPreferencesEntity p join p.emailNotifications apn where p.userId = :userId and p.emailNotificationsEnabled = true )) " + " and n.userId = :userId and n.creationDate >= :from and n.creationDate <= :to order by n.creationDate desc")
List<NotificationEntity> findEmailNotificationsForUserId(String userId, OffsetDateTime from, OffsetDateTime to);
List<NotificationEntity> findEmailNotificationsForUserId(@Param("userId") String userId, @Param("from") OffsetDateTime from, @Param("to") OffsetDateTime to);
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.ReportTemplateEntity;
@ -15,6 +16,6 @@ public interface ReportTemplateRepository extends JpaRepository<ReportTemplateEn
@Modifying
@Query("update ReportTemplateEntity r set r.fileName = :fileName, r.multiFileReport = :multiFileReport, r.activeByDefault = :activeByDefault " + "where r.templateId = :templateId and r.dossierTemplateId = :dossierTemplateId")
int updateReportTemplate(String dossierTemplateId, String templateId, String fileName, boolean multiFileReport, boolean activeByDefault);
int updateReportTemplate(@Param("dossierTemplateId") String dossierTemplateId, @Param("templateId") String templateId, @Param("fileName") String fileName, @Param("multiFileReport") boolean multiFileReport, @Param("activeByDefault") boolean activeByDefault);
}

View File

@ -5,6 +5,7 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.RuleSetEntity;
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.RuleSetEntityKey;
@ -13,13 +14,13 @@ public interface RuleSetRepository extends JpaRepository<RuleSetEntity, RuleSetE
@Modifying
@Query("update RuleSetEntity r set r.timeoutDetected = true where r.dossierTemplateId = :dossierTemplateId and r.ruleFileType = :ruleFileType")
void updateTimeoutDetected(String dossierTemplateId, String ruleFileType);
void updateTimeoutDetected(@Param("dossierTemplateId") String dossierTemplateId, @Param("ruleFileType") String ruleFileType);
Optional<RuleSetEntity> findByDossierTemplateIdAndRuleFileType(String dossierTemplateId, String ruleFileType);
@Query("select r.version from RuleSetEntity r where r.dossierTemplateId = :dossierTemplateId and r.ruleFileType = :ruleFileType")
Optional<Long> findVersionByDossierTemplateIdAndRuleFileType(String dossierTemplateId, String ruleFileType);
Optional<Long> findVersionByDossierTemplateIdAndRuleFileType(@Param("dossierTemplateId") String dossierTemplateId, @Param("ruleFileType") String ruleFileType);
}

View File

@ -5,6 +5,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemp
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
@ -14,18 +15,19 @@ public interface SaasMigrationStatusRepository extends JpaRepository<SaasMigrati
@Modifying
@Query("update SaasMigrationStatusEntity e set e.status = :status where e.fileId = :fileId")
void updateStatus(String fileId, SaasMigrationStatus status);
void updateStatus(@Param("fileId") String fileId, @Param("status") SaasMigrationStatus status);
@Modifying
@Query("update SaasMigrationStatusEntity e set e.status = :status, e.errorCause = :errorCause where e.fileId = :fileId")
void updateErrorStatus(String fileId, SaasMigrationStatus status, String errorCause);
void updateErrorStatus(@Param("fileId") String fileId, @Param("status") SaasMigrationStatus status, @Param("errorCause") String errorCause);
@Modifying
@Query("update SaasMigrationStatusEntity e set e.processingErrorCounter = :processingErrorCounter, e.errorCause = :errorCause where e.fileId = :fileId")
void updateErrorCounter(String fileId, Integer processingErrorCounter, String errorCause);
void updateErrorCounter(@Param("fileId") String fileId, @Param("processingErrorCounter") Integer processingErrorCounter, @Param("errorCause") String errorCause);
@Query("select count(*) from SaasMigrationStatusEntity e where e.status = :status")
int countByStatus(SaasMigrationStatus status);
int countByStatus(@Param("status") SaasMigrationStatus status);
@Query("select count(*) from SaasMigrationStatusEntity")
int countAll();

View File

@ -7,6 +7,7 @@ import java.util.Set;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.TypeEntity;
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.DictionarySummaryResponse;
@ -14,59 +15,53 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemp
public interface TypeRepository extends JpaRepository<TypeEntity, String> {
@Query("select t from TypeEntity t where t.dossierTemplateId = :dossierTemplate and t.dossierId = :dossier and t.rank = :rank and t.softDeletedTime is null")
Optional<TypeEntity> findOneByDossierTemplateIdAndDossierIdAndRank(String dossierTemplate, String dossier, int rank);
Optional<TypeEntity> findOneByDossierTemplateIdAndDossierIdAndRank(@Param("dossierTemplate") String dossierTemplate, @Param("dossier") String dossier, @Param("rank") int rank);
List<TypeEntity> findByDossierId(String dossierId);
@Query("select t from TypeEntity t where t.id = :typeId and t.softDeletedTime is null")
Optional<TypeEntity> findByIdAndNotDeleted(String typeId);
Optional<TypeEntity> findByIdAndNotDeleted(@Param("typeId") String typeId);
@Modifying
@Query("update TypeEntity t set t.version = t.version +1 where t.id = :typeId")
void updateByIdSetIncrementVersionByOne(String typeId);
@Query("update TypeEntity t set t.version = t.version + 1 where t.id = :typeId")
void updateByIdSetIncrementVersionByOne(@Param("typeId") String typeId);
@Query("select t from TypeEntity t where t.dossierTemplateId = :dossierTemplateId and t.type = :type and t.dossierId is not null")
List<TypeEntity> getAllDossierTypesForDossierTemplateAndType(String dossierTemplateId, String type);
List<TypeEntity> getAllDossierTypesForDossierTemplateAndType(@Param("dossierTemplateId") String dossierTemplateId, @Param("type") String type);
@Query("select t from TypeEntity t where t.dossierTemplateId = :dossierTemplateId and t.dossierId is null")
List<TypeEntity> getAllTypesForDossierTemplate(String dossierTemplateId);
List<TypeEntity> getAllTypesForDossierTemplate(@Param("dossierTemplateId") String dossierTemplateId);
@Query("select t from TypeEntity t where t.dossierTemplateId = :dossierTemplateId or t.dossierId = :dossierId")
List<TypeEntity> findAllTypesByDossierTemplateIdOrDossierId(String dossierTemplateId, String dossierId);
List<TypeEntity> findAllTypesByDossierTemplateIdOrDossierId(@Param("dossierTemplateId") String dossierTemplateId, @Param("dossierId") String dossierId);
List<TypeEntity> findAllByDossierTemplateIdAndDossierId(String dossierTemplateId, String dossierId);
@Query("select coalesce(sum(t.version),0) from TypeEntity t where t.dossierId = :dossierId")
long getVersionForDossierId(String dossierId);
@Query("select coalesce(sum(t.version),0) from TypeEntity t where t.dossierTemplateId = :dossierTemplateId and t.dossierId is null")
long getVersionForDossierTemplateId(String dossierTemplateId);
@Query("select coalesce(sum(t.version), 0) from TypeEntity t where t.dossierId = :dossierId")
long getVersionForDossierId(@Param("dossierId") String dossierId);
@Query("select coalesce(sum(t.version), 0) from TypeEntity t where t.dossierTemplateId = :dossierTemplateId and t.dossierId is null")
long getVersionForDossierTemplateId(@Param("dossierTemplateId") String dossierTemplateId);
@Query("""
select new com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.DictionarySummaryResponse(dt.id, t.id, t.type, t.label, count(e))
from DossierTemplateEntity dt
left join TypeEntity t on t.dossierTemplateId = dt.id
left join DictionaryEntryEntity e on e.typeId = t.id
where t.softDeletedTime is null and dt.id in :dossierTemplateIds and t.dossierId is null and (e.entryId is null or e.deleted = false)
group by dt.id, t.id, t.type, t.label""")
List<DictionarySummaryResponse> findDictionarySummaryList(Set<String> dossierTemplateIds);
select new com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.type.DictionarySummaryResponse(dt.id, t.id, t.type, t.label, count(e))
from DossierTemplateEntity dt
left join TypeEntity t on t.dossierTemplateId = dt.id
left join DictionaryEntryEntity e on e.typeId = t.id
where t.softDeletedTime is null and dt.id in :dossierTemplateIds and t.dossierId is null and (e.entryId is null or e.deleted = false)
group by dt.id, t.id, t.type, t.label""")
List<DictionarySummaryResponse> findDictionarySummaryList(@Param("dossierTemplateIds") Set<String> dossierTemplateIds);
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query("Update TypeEntity t set t.softDeletedTime = offset_datetime where t.id = :typeId")
void softDeleteTypeById(String typeId);
void softDeleteTypeById(@Param("typeId") String typeId);
@Modifying
@Query("Update TypeEntity t set t.softDeletedTime = null where t.id = :typeId and t.softDeletedTime is not null")
int unSoftDeleteTypeById(String typeId);
int unSoftDeleteTypeById(@Param("typeId") String typeId);
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ViewedPageEntity;
@ -18,6 +19,6 @@ public interface ViewedPagesRepository extends JpaRepository<ViewedPageEntity, V
@Modifying
@Query("DELETE FROM ViewedPageEntity e where e.id.fileId = :fileId and e.id.userId = :currentReviewer and e.id.page in :viewedPagesToReset")
void deleteSeenPages(String fileId, String currentReviewer, List<Integer> viewedPagesToReset);
void deleteSeenPages(@Param("fileId") String fileId, @Param("currentReviewer") String currentReviewer, @Param("viewedPagesToReset") List<Integer> viewedPagesToReset);
}

View File

@ -7,6 +7,7 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.AnnotationEntityId;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ManualForceRedactionEntity;
@ -15,29 +16,24 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
public interface ForceRedactionRepository extends JpaRepository<ManualForceRedactionEntity, AnnotationEntityId>, AnnotationEntityRepository {
@Modifying(clearAutomatically = true)
@Query("update ManualForceRedactionEntity mfr set mfr.status = :annotationStatus " + "where mfr.id = :annotationEntityId")
void updateStatus(AnnotationEntityId annotationEntityId, AnnotationStatus annotationStatus);
@Query("update ManualForceRedactionEntity mfr set mfr.status = :annotationStatus where mfr.id = :annotationEntityId")
void updateStatus(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("annotationStatus") AnnotationStatus annotationStatus);
@Modifying
@Query("update ManualForceRedactionEntity mfr set mfr.softDeletedTime = :softDeletedTime " + "where mfr.id = :annotationEntityId")
void updateSoftDelete(AnnotationEntityId annotationEntityId, OffsetDateTime softDeletedTime);
@Query("update ManualForceRedactionEntity mfr set mfr.softDeletedTime = :softDeletedTime where mfr.id = :annotationEntityId")
void updateSoftDelete(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("softDeletedTime") OffsetDateTime softDeletedTime);
@Query("select mfr from ManualForceRedactionEntity mfr where mfr.id = :annotationEntityId and mfr.softDeletedTime is null")
Optional<ManualForceRedactionEntity> findByIdAndNotSoftDeleted(AnnotationEntityId annotationEntityId);
Optional<ManualForceRedactionEntity> findByIdAndNotSoftDeleted(@Param("annotationEntityId") AnnotationEntityId annotationEntityId);
@Query("select mfr from ManualForceRedactionEntity mfr where mfr.id.fileId = :fileId and (:includeDeletions = true or mfr.softDeletedTime is null)")
List<ManualForceRedactionEntity> findByFileIdIncludeDeletions(String fileId, boolean includeDeletions);
List<ManualForceRedactionEntity> findByFileIdIncludeDeletions(@Param("fileId") String fileId, @Param("includeDeletions") boolean includeDeletions);
@Query("select mfr from ManualForceRedactionEntity mfr where mfr.id.fileId = :fileId and mfr.processedDate is null")
List<ManualForceRedactionEntity> findByFileIdAndUnprocessed(String fileId);
List<ManualForceRedactionEntity> findByFileIdAndUnprocessed(@Param("fileId") String fileId);
@Modifying
@Query("update ManualForceRedactionEntity mfr set mfr.processedDate = :processedDate where mfr.id = :annotationEntityId")
void markAsProcessed(AnnotationEntityId annotationEntityId, OffsetDateTime processedDate);
void markAsProcessed(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("processedDate") OffsetDateTime processedDate);
}

View File

@ -7,6 +7,7 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.AnnotationEntityId;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ManualLegalBasisChangeEntity;
@ -15,29 +16,24 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
public interface LegalBasisChangeRepository extends JpaRepository<ManualLegalBasisChangeEntity, AnnotationEntityId>, AnnotationEntityRepository {
@Modifying(clearAutomatically = true)
@Query("update ManualLegalBasisChangeEntity mlbc set mlbc.status = :annotationStatus, mlbc.processedDate = :processedDate " + "where mlbc.id = :annotationEntityId")
void updateStatus(AnnotationEntityId annotationEntityId, AnnotationStatus annotationStatus, OffsetDateTime processedDate);
@Query("update ManualLegalBasisChangeEntity mlbc set mlbc.status = :annotationStatus, mlbc.processedDate = :processedDate where mlbc.id = :annotationEntityId")
void updateStatus(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("annotationStatus") AnnotationStatus annotationStatus, @Param("processedDate") OffsetDateTime processedDate);
@Modifying
@Query("update ManualLegalBasisChangeEntity mlbc set mlbc.softDeletedTime = :softDeletedTime " + "where mlbc.id = :annotationEntityId")
void updateSoftDelete(AnnotationEntityId annotationEntityId, OffsetDateTime softDeletedTime);
@Query("update ManualLegalBasisChangeEntity mlbc set mlbc.softDeletedTime = :softDeletedTime where mlbc.id = :annotationEntityId")
void updateSoftDelete(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("softDeletedTime") OffsetDateTime softDeletedTime);
@Query("select mlbc from ManualLegalBasisChangeEntity mlbc where mlbc.id = :annotationEntityId and mlbc.softDeletedTime is null")
Optional<ManualLegalBasisChangeEntity> findByIdAndNotSoftDeleted(AnnotationEntityId annotationEntityId);
Optional<ManualLegalBasisChangeEntity> findByIdAndNotSoftDeleted(@Param("annotationEntityId") AnnotationEntityId annotationEntityId);
@Query("select mlbc from ManualLegalBasisChangeEntity mlbc where mlbc.id.fileId = :fileId and (:includeDeletions = true or mlbc.softDeletedTime is null)")
List<ManualLegalBasisChangeEntity> findByFileIdIncludeDeletions(String fileId, boolean includeDeletions);
List<ManualLegalBasisChangeEntity> findByFileIdIncludeDeletions(@Param("fileId") String fileId, @Param("includeDeletions") boolean includeDeletions);
@Query("select mlbc from ManualLegalBasisChangeEntity mlbc where mlbc.id.fileId = :fileId and mlbc.processedDate is null")
List<ManualLegalBasisChangeEntity> findUnprocessedByFileId(String fileId);
List<ManualLegalBasisChangeEntity> findUnprocessedByFileId(@Param("fileId") String fileId);
@Modifying
@Query("update ManualLegalBasisChangeEntity mlbc set mlbc.processedDate = :processedDate where mlbc.id = :annotationEntityId")
void markAsProcessed(AnnotationEntityId annotationEntityId, OffsetDateTime processedDate);
void markAsProcessed(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("processedDate") OffsetDateTime processedDate);
}

View File

@ -8,6 +8,7 @@ import java.util.Set;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.AnnotationEntityId;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ManualRedactionEntryEntity;
@ -17,38 +18,31 @@ public interface ManualRedactionRepository extends JpaRepository<ManualRedaction
@Modifying
@Query("update ManualRedactionEntryEntity m set m.softDeletedTime = :softDeleteTime where m.id = :id")
void updateSoftDelete(AnnotationEntityId id, OffsetDateTime softDeleteTime);
void updateSoftDelete(@Param("id") AnnotationEntityId id, @Param("softDeleteTime") OffsetDateTime softDeleteTime);
@Modifying(clearAutomatically = true)
@Query("update ManualRedactionEntryEntity m set m.status = :annotationStatus, m.processedDate = :processedDate where m.id = :id")
void updateStatus(AnnotationEntityId id, AnnotationStatus annotationStatus, OffsetDateTime processedDate);
void updateStatus(@Param("id") AnnotationEntityId id, @Param("annotationStatus") AnnotationStatus annotationStatus, @Param("processedDate") OffsetDateTime processedDate);
@Modifying
@Query("update ManualRedactionEntryEntity m set m.status = :annotationStatus, m.addToDictionary = :isAddOrRemoveFromDictionary, m.addToDossierDictionary = :isAddOrRemoveFromDossierDictionary where m.id = :id")
void updateStatus(AnnotationEntityId id, AnnotationStatus annotationStatus, boolean isAddOrRemoveFromDictionary, boolean isAddOrRemoveFromDossierDictionary);
void updateStatus(@Param("id") AnnotationEntityId id, @Param("annotationStatus") AnnotationStatus annotationStatus, @Param("isAddOrRemoveFromDictionary") boolean isAddOrRemoveFromDictionary, @Param("isAddOrRemoveFromDossierDictionary") boolean isAddOrRemoveFromDossierDictionary);
@Query("select m from ManualRedactionEntryEntity m where m.id = :id and m.softDeletedTime is null")
Optional<ManualRedactionEntryEntity> findAddRedaction(AnnotationEntityId id);
Optional<ManualRedactionEntryEntity> findAddRedaction(@Param("id") AnnotationEntityId id);
@Query("select m from ManualRedactionEntryEntity m where m.id.fileId = :fileId and (:includeDeletions = true or m.softDeletedTime is null)")
List<ManualRedactionEntryEntity> findByFileIdIncludeDeletions(String fileId, boolean includeDeletions);
List<ManualRedactionEntryEntity> findByFileIdIncludeDeletions(@Param("fileId") String fileId, @Param("includeDeletions") boolean includeDeletions);
@Query("select m from ManualRedactionEntryEntity m where m.id.fileId = :fileId and m.processedDate is null")
List<ManualRedactionEntryEntity> findByFileIdAndUnprocessed(String fileId);
List<ManualRedactionEntryEntity> findByFileIdAndUnprocessed(@Param("fileId") String fileId);
@Modifying
@Query("update ManualRedactionEntryEntity m set m.status = :newStatus, m.processedDate = :processedDate where m.id.fileId in :fileIds and m.value = :filterValue and m.addToDictionary = true and m.status = :filterStatus ")
void updateStatus(Set<String> fileIds, String filterValue, AnnotationStatus filterStatus, AnnotationStatus newStatus, OffsetDateTime processedDate);
@Query("update ManualRedactionEntryEntity m set m.status = :newStatus, m.processedDate = :processedDate where m.id.fileId in :fileIds and m.value = :filterValue and m.addToDictionary = true and m.status = :filterStatus")
void updateStatus(@Param("fileIds") Set<String> fileIds, @Param("filterValue") String filterValue, @Param("filterStatus") AnnotationStatus filterStatus, @Param("newStatus") AnnotationStatus newStatus, @Param("processedDate") OffsetDateTime processedDate);
@Modifying
@Query("update ManualRedactionEntryEntity m set m.processedDate = :processedDate where m.id = :annotationEntityId")
void markAsProcessed(AnnotationEntityId annotationEntityId, OffsetDateTime processedDate);
void markAsProcessed(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("processedDate") OffsetDateTime processedDate);
}

View File

@ -7,6 +7,7 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.AnnotationEntityId;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ManualRecategorizationEntity;
@ -15,28 +16,24 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
public interface RecategorizationRepository extends JpaRepository<ManualRecategorizationEntity, AnnotationEntityId>, AnnotationEntityRepository {
@Modifying(clearAutomatically = true)
@Query("update ManualRecategorizationEntity mir set mir.status = :annotationStatus " + "where mir.id = :annotationEntityId")
void updateStatus(AnnotationEntityId annotationEntityId, AnnotationStatus annotationStatus);
@Query("update ManualRecategorizationEntity mir set mir.status = :annotationStatus where mir.id = :annotationEntityId")
void updateStatus(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("annotationStatus") AnnotationStatus annotationStatus);
@Modifying
@Query("update ManualRecategorizationEntity mir set mir.softDeletedTime = :softDeletedTime " + "where mir.id = :annotationEntityId")
void updateSoftDelete(AnnotationEntityId annotationEntityId, OffsetDateTime softDeletedTime);
@Query("update ManualRecategorizationEntity mir set mir.softDeletedTime = :softDeletedTime where mir.id = :annotationEntityId")
void updateSoftDelete(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("softDeletedTime") OffsetDateTime softDeletedTime);
@Query("select mir from ManualRecategorizationEntity mir where mir.id = :annotationEntityId and mir.softDeletedTime is null")
Optional<ManualRecategorizationEntity> findByIdAndNotSoftDeleted(AnnotationEntityId annotationEntityId);
Optional<ManualRecategorizationEntity> findByIdAndNotSoftDeleted(@Param("annotationEntityId") AnnotationEntityId annotationEntityId);
@Query("select mir from ManualRecategorizationEntity mir where mir.id.fileId = :fileId and (:includeDeletions = true or mir.softDeletedTime is null)")
List<ManualRecategorizationEntity> findByFileIdIncludeDeletions(String fileId, boolean includeDeletions);
List<ManualRecategorizationEntity> findByFileIdIncludeDeletions(@Param("fileId") String fileId, @Param("includeDeletions") boolean includeDeletions);
@Query("select mir from ManualRecategorizationEntity mir where mir.id.fileId = :fileId and mir.processedDate is null")
List<ManualRecategorizationEntity> findUnprocessedByFileId(String fileId);
List<ManualRecategorizationEntity> findUnprocessedByFileId(@Param("fileId") String fileId);
@Modifying
@Query("update ManualRecategorizationEntity mir set mir.processedDate = :processedDate where mir.id = :annotationEntityId")
void markAsProcessed(AnnotationEntityId annotationEntityId, OffsetDateTime processedDate);
void markAsProcessed(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("processedDate") OffsetDateTime processedDate);
}

View File

@ -7,36 +7,34 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.AnnotationEntityId;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.IdRemovalEntity;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ManualRedactionEntryEntity;
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;
public interface RemoveRedactionRepository extends JpaRepository<IdRemovalEntity, AnnotationEntityId>, AnnotationEntityRepository {
@Modifying
@Query("update IdRemovalEntity idr set idr.softDeletedTime = :softDeletedTime where idr.id = :annotationEntityId")
void updateSoftDelete(AnnotationEntityId annotationEntityId, OffsetDateTime softDeletedTime);
void updateSoftDelete(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("softDeletedTime") OffsetDateTime softDeletedTime);
@Modifying(clearAutomatically = true)
@Query("update IdRemovalEntity idr set idr.status = :annotationStatus where idr.id = :annotationEntityId")
void updateStatus(AnnotationEntityId annotationEntityId, AnnotationStatus annotationStatus);
void updateStatus(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("annotationStatus") AnnotationStatus annotationStatus);
@Query("select idr from IdRemovalEntity idr where idr.id = :annotationEntityId and idr.softDeletedTime is null")
Optional<IdRemovalEntity> findByIdAndNotSoftDeleted(AnnotationEntityId annotationEntityId);
Optional<IdRemovalEntity> findByIdAndNotSoftDeleted(@Param("annotationEntityId") AnnotationEntityId annotationEntityId);
@Query("select idr from IdRemovalEntity idr where idr.id.fileId = :fileId and (:includeDeletions = true or idr.softDeletedTime is null)")
List<IdRemovalEntity> findByFileIdIncludeDeletions(String fileId, boolean includeDeletions);
List<IdRemovalEntity> findByFileIdIncludeDeletions(@Param("fileId") String fileId, @Param("includeDeletions") boolean includeDeletions);
@Query("select idr from IdRemovalEntity idr where idr.id.fileId = :fileId and idr.processedDate is null")
List<IdRemovalEntity> findByFileIdAndUnprocessed(String fileId);
List<IdRemovalEntity> findByFileIdAndUnprocessed(@Param("fileId") String fileId);
@Modifying
@Query("update IdRemovalEntity idr set idr.processedDate = :processedDate where idr.id = :annotationEntityId")
void markAsProcessed(AnnotationEntityId annotationEntityId, OffsetDateTime processedDate);
void markAsProcessed(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("processedDate") OffsetDateTime processedDate);
}

View File

@ -7,6 +7,7 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.AnnotationEntityId;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.ManualResizeRedactionEntity;
@ -15,37 +16,30 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations
public interface ResizeRedactionRepository extends JpaRepository<ManualResizeRedactionEntity, AnnotationEntityId>, AnnotationEntityRepository {
@Modifying(clearAutomatically = true)
@Query("update ManualResizeRedactionEntity mrd set mrd.status = :annotationStatus, mrd.processedDate = :processedDate " + "where mrd.id = :annotationEntityId")
void updateStatus(AnnotationEntityId annotationEntityId, AnnotationStatus annotationStatus, OffsetDateTime processedDate);
@Query("update ManualResizeRedactionEntity mrd set mrd.status = :annotationStatus, mrd.processedDate = :processedDate where mrd.id = :annotationEntityId")
void updateStatus(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("annotationStatus") AnnotationStatus annotationStatus, @Param("processedDate") OffsetDateTime processedDate);
@Modifying
@Query("update ManualResizeRedactionEntity mrd set mrd.softDeletedTime = :softDeletedTime " + "where mrd.id = :annotationEntityId")
void updateSoftDelete(AnnotationEntityId annotationEntityId, OffsetDateTime softDeletedTime);
@Query("update ManualResizeRedactionEntity mrd set mrd.softDeletedTime = :softDeletedTime where mrd.id = :annotationEntityId")
void updateSoftDelete(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("softDeletedTime") OffsetDateTime softDeletedTime);
@Query("select mrd from ManualResizeRedactionEntity mrd where mrd.id = :annotationEntityId and mrd.softDeletedTime is null")
Optional<ManualResizeRedactionEntity> findByIdAndNotSoftDeleted(AnnotationEntityId annotationEntityId);
Optional<ManualResizeRedactionEntity> findByIdAndNotSoftDeleted(@Param("annotationEntityId") AnnotationEntityId annotationEntityId);
@Query("select mrd from ManualResizeRedactionEntity mrd where mrd.id.fileId = :fileId and (:includeDeletions = true or mrd.softDeletedTime is null)")
List<ManualResizeRedactionEntity> findByFileIdIncludeDeletions(String fileId, boolean includeDeletions);
List<ManualResizeRedactionEntity> findByFileIdIncludeDeletions(@Param("fileId") String fileId, @Param("includeDeletions") boolean includeDeletions);
@Query("select mrd from ManualResizeRedactionEntity mrd where mrd.id.fileId = :fileId and mrd.processedDate is null")
List<ManualResizeRedactionEntity> findUnprocessedByFileId(String fileId);
List<ManualResizeRedactionEntity> findUnprocessedByFileId(@Param("fileId") String fileId);
@Modifying
@Query("update ManualResizeRedactionEntity m set m.textBefore = :textBefore, m.textAfter = :textAfter where m.id = :id")
void updateSurroundingText(AnnotationEntityId id, String textBefore, String textAfter);
List<ManualResizeRedactionEntity> findByStatusAndValue(AnnotationStatus status, String value);
void updateSurroundingText(@Param("id") AnnotationEntityId id, @Param("textBefore") String textBefore, @Param("textAfter") String textAfter);
List<ManualResizeRedactionEntity> findByStatusAndValue(@Param("status") AnnotationStatus status, @Param("value") String value);
@Modifying
@Query("update ManualResizeRedactionEntity mir set mir.processedDate = :processedDate where mir.id = :annotationEntityId")
void markAsProcessed(AnnotationEntityId annotationEntityId, OffsetDateTime processedDate);
void markAsProcessed(@Param("annotationEntityId") AnnotationEntityId annotationEntityId, @Param("processedDate") OffsetDateTime processedDate);
}

View File

@ -7,36 +7,34 @@ import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iqser.red.service.persistence.management.v1.processor.entity.configuration.DictionaryEntryEntity;
public interface EntryRepository extends EntryRepositoryCustom, JpaRepository<DictionaryEntryEntity, Long> {
@Modifying
@Query("update DictionaryEntryEntity e set e.version = :version where e.typeId = :typeId and e.deleted = false")
void updateVersionWhereTypeId(long version, String typeId);
@Query("update DictionaryEntryEntity e set e.version = :version where e.typeId = :typeId and e.deleted = false")
void updateVersionWhereTypeId(@Param("version") long version, @Param("typeId") String typeId);
@Modifying
@Query("update DictionaryEntryEntity e set e.typeId = :newTypeId, e.version = e.version + 1 where e.typeId =:typeId and e.deleted = false")
void updateTypeIdAndIncrementVersionByOne(String typeId, String newTypeId);
List<DictionaryEntryEntity> findByTypeIdAndVersionGreaterThan(String typeId, long version);
List<DictionaryEntryEntity> findByTypeIdContainsAndValue(String typeId, String value);
@Query("update DictionaryEntryEntity e set e.typeId = :newTypeId, e.version = e.version + 1 where e.typeId = :typeId and e.deleted = false")
void updateTypeIdAndIncrementVersionByOne(@Param("typeId") String typeId, @Param("newTypeId") String newTypeId);
@Modifying(flushAutomatically = true, clearAutomatically = true)
@Transactional
@Query("update DictionaryEntryEntity e set e.deleted = true, e.version = :version where e.typeId = :typeId")
void deleteAllEntriesForTypeId(String typeId, long version);
void deleteAllEntriesForTypeId(@Param("typeId") String typeId, @Param("version") long version);
@Modifying(flushAutomatically = true, clearAutomatically = true)
@Transactional
@Query(value = "insert into dictionary_entry (value, version, deleted, type_id) " + " select value, 1, false, :newTypeId from dictionary_entry where type_id = :originalTypeId and deleted = false", nativeQuery = true)
void cloneEntries(String originalTypeId, String newTypeId);
@Query(value = "insert into dictionary_entry (value, version, deleted, type_id) " +
" select value, 1, false, :newTypeId from dictionary_entry where type_id = :originalTypeId and deleted = false", nativeQuery = true)
void cloneEntries(@Param("originalTypeId") String originalTypeId, @Param("newTypeId") String newTypeId);
List<DictionaryEntryEntity> findByTypeIdAndVersionGreaterThan(String typeId, long version);
List<DictionaryEntryEntity> findByTypeIdContainsAndValue(String typeId, String value);
}

View File

@ -5,6 +5,7 @@ import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
@ -12,7 +13,7 @@ public interface FalsePositiveEntryRepository extends FalsePositiveEntryReposito
@Modifying
@Query("update DictionaryFalsePositiveEntryEntity e set e.version = :version where e.typeId = :typeId and e.deleted = false")
void updateVersionWhereTypeId(long version, String typeId);
void updateVersionWhereTypeId(@Param("version") long version, @Param("typeId") String typeId);
List<DictionaryFalsePositiveEntryEntity> findByTypeIdAndVersionGreaterThan(String typeId, long version);
@ -21,13 +22,13 @@ public interface FalsePositiveEntryRepository extends FalsePositiveEntryReposito
@Modifying
@Transactional
@Query("update DictionaryFalsePositiveEntryEntity e set e.deleted = true, e.version = :version where e.typeId = :typeId")
void deleteAllEntriesForTypeId(String typeId, long version);
void deleteAllEntriesForTypeId(@Param("typeId") String typeId, @Param("version") long version);
@Modifying(flushAutomatically = true, clearAutomatically = true)
@Transactional
@Query(value = "insert into dictionary_false_positive_entry (value, version, deleted, type_id) " + " select value, 1, false, :newTypeId from dictionary_false_positive_entry where type_id = :originalTypeId and deleted = false", nativeQuery = true)
void cloneEntries(String originalTypeId, String newTypeId);
void cloneEntries(@Param("originalTypeId") String originalTypeId, @Param("newTypeId") String newTypeId);
List<DictionaryFalsePositiveEntryEntity> findByTypeIdContainsAndValue(String typeId, String value);

View File

@ -5,6 +5,7 @@ import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
@ -12,7 +13,7 @@ public interface FalseRecommendationEntryRepository extends FalseRecommendationE
@Modifying
@Query("update DictionaryFalseRecommendationEntryEntity e set e.version = :version where e.typeId = :typeId and e.deleted = false")
void updateVersionWhereTypeId(long version, String typeId);
void updateVersionWhereTypeId(@Param("version") long version, @Param("typeId") String typeId);
List<DictionaryFalseRecommendationEntryEntity> findByTypeIdAndVersionGreaterThan(String typeId, long version);
@ -21,13 +22,13 @@ public interface FalseRecommendationEntryRepository extends FalseRecommendationE
@Modifying
@Transactional
@Query("update DictionaryFalseRecommendationEntryEntity e set e.deleted = true, e.version = :version where e.typeId = :typeId")
void deleteAllEntriesForTypeId(String typeId, long version);
void deleteAllEntriesForTypeId(@Param("typeId") String typeId, @Param("version") long version);
@Modifying(flushAutomatically = true, clearAutomatically = true)
@Transactional
@Query(value = "insert into dictionary_false_recommendation_entry (value, version, deleted, type_id) " + " select value, 1, false, :newTypeId from dictionary_false_recommendation_entry where type_id = :originalTypeId and deleted = false", nativeQuery = true)
void cloneEntries(String originalTypeId, String newTypeId);
void cloneEntries(@Param("originalTypeId") String originalTypeId, @Param("newTypeId") String newTypeId);
List<DictionaryFalseRecommendationEntryEntity> findByTypeIdContainsAndValue(String typeId, String value);

View File

@ -11,6 +11,7 @@ import java.util.stream.Collectors;
import lombok.experimental.UtilityClass;
@UtilityClass
@SuppressWarnings("PMD")
public class ResourceLoader {
public Set<String> load(String classpathPath) {

View File

@ -0,0 +1,57 @@
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
plugins {
application
id("com.iqser.red.service.java-conventions")
id("org.springframework.boot") version "3.1.3"
id("io.spring.dependency-management") version "1.1.3"
id("org.sonarqube") version "4.4.1.3373"
id("io.freefair.lombok") version "8.4"
}
configurations {
all {
exclude(group = "org.springframework.boot", module = "spring-boot-starter-logging")
}
}
dependencies {
api(project(":persistence-service-processor-v1"))
api("com.iqser.red.commons:storage-commons:2.45.0")
api("junit:junit:4.13.2")
api(project(":persistence-service-external-api-impl-v1"))
api(project(":persistence-service-external-api-impl-v2"))
api(project(":persistence-service-internal-api-impl-v1"))
testImplementation("org.springframework.amqp:spring-rabbit-test:3.0.2")
testImplementation("org.springframework.security:spring-security-test:6.0.2")
testImplementation("org.testcontainers:postgresql:1.17.1")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.4")
testImplementation("org.apache.logging.log4j:log4j-slf4j-impl:2.19.0")
testImplementation("com.yannbriancon:spring-hibernate-query-utils:2.0.0")
}
description = "persistence-service-server-v1"
tasks.named<BootBuildImage>("bootBuildImage") {
environment.put("BPE_DELIM_JAVA_TOOL_OPTIONS", " ")
environment.put("BPE_APPEND_JAVA_TOOL_OPTIONS", "-Dfile.encoding=UTF-8")
imageName.set("nexus.knecon.com:5001/red/${project.name}:${project.version}")
if (project.hasProperty("buildbootDockerHostNetwork")) {
network.set("host")
}
docker {
if (project.hasProperty("buildbootDockerHostNetwork")) {
bindHostToBuilder.set(true)
}
verboseLogging.set(true)
publishRegistry {
username.set(providers.gradleProperty("mavenUser").getOrNull())
password.set(providers.gradleProperty("mavenPassword").getOrNull())
email.set(providers.gradleProperty("mavenEmail").getOrNull())
url.set("https://nexus.knecon.com:5001/")
}
}
}

View File

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-server-v1</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-processor-v1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>storage-commons</artifactId>
<version>${storage.commons.version}</version>
</dependency>
<!-- test -->
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.17.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.yannbriancon</groupId>
<artifactId>spring-hibernate-query-utils</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-impl-v1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-impl-v2</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-impl-v1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessors>
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
<plugin>
<!-- generate git.properties for exposure in /info -->
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<gitDescribe>
<tags>true</tags>
</gitDescribe>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- repackages the generated jar into a runnable fat-jar and makes it
executable -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<executable>true</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -55,6 +55,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@SuppressWarnings("PMD")
public class DossierTemplateTest extends AbstractPersistenceServerServiceTest {
@Autowired

View File

@ -90,6 +90,7 @@ public class DossierTest extends AbstractPersistenceServerServiceTest {
dossierTesterAndProvider.provideTestDossier(dossierTemplate, "sameNameDossier");
} catch (Exception e) {
// conflict exception is expected
log.debug("conflict exception is expected");
}
});
var allDossiers = dossierClient.getDossiers(true, true);

View File

@ -3,7 +3,7 @@ package com.iqser.red.service.peristence.v1.server.integration.utils;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.utility.DockerImageName;
public class KneconRedisTestContainer extends GenericContainer<KneconRedisTestContainer> {
public final class KneconRedisTestContainer extends GenericContainer<KneconRedisTestContainer> {
private static final String IMAGE_VERSION = "nexus.knecon.com:5001/bitnami/redis:7.0.5-debian-11-r7";
private static KneconRedisTestContainer container;

View File

@ -10,6 +10,7 @@ import org.testcontainers.containers.JdbcDatabaseContainer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import org.testcontainers.utility.DockerImageName;
@SuppressWarnings("PMD")
public class KneconSpringPostgreSQLTestContainer extends JdbcDatabaseContainer<KneconSpringPostgreSQLTestContainer> {
private static final String IMAGE_VERSION = "nexus.knecon.com:5001/bitnami/postgresql:14.5.0-debian-11-r31";

View File

@ -3,7 +3,7 @@ package com.iqser.red.service.peristence.v1.server.integration.utils;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.utility.DockerImageName;
public class RedisTestContainer extends GenericContainer<RedisTestContainer> {
public final class RedisTestContainer extends GenericContainer<RedisTestContainer> {
private static final String IMAGE_VERSION = "redis:6.2.6";
private static RedisTestContainer container;

View File

@ -2,7 +2,7 @@ package com.iqser.red.service.peristence.v1.server.integration.utils;
import org.testcontainers.containers.PostgreSQLContainer;
public class SpringPostgreSQLTestContainer extends PostgreSQLContainer<SpringPostgreSQLTestContainer> {
public final class SpringPostgreSQLTestContainer extends PostgreSQLContainer<SpringPostgreSQLTestContainer> {
private static final String IMAGE_VERSION = "postgres:15.2";
private static SpringPostgreSQLTestContainer container;

View File

@ -14,6 +14,7 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@Service
@SuppressWarnings("checkstyle:all")
public class MetricsPrinterService {
@Value("${server.port}")

View File

@ -16,6 +16,7 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@SuppressWarnings("PMD")
public class FileSystemBackedArchiverTest {
private final static byte[] dummyFileContent = new byte[]{1, 2};

View File

@ -0,0 +1,19 @@
plugins {
id("com.iqser.red.service.java-conventions")
id("io.freefair.lombok") version "8.4"
}
dependencies {
api("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.16.0")
api("com.google.guava:guava:31.1-jre")
api("org.springframework.boot:spring-boot-starter-validation:3.1.3")
api("com.iqser.red.commons:jackson-commons:2.1.0")
api("com.iqser.red.commons:dictionary-merge-commons:1.3.0")
testImplementation("com.iqser.red.commons:test-commons:2.1.0")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.4")
compileOnly("org.springdoc:springdoc-openapi-ui:1.7.0")
compileOnly("io.github.openfeign:feign-core:12.2")
compileOnly("org.springframework:spring-web:6.0.6")
}
description = "persistence-service-shared-api-v1"

View File

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-shared-api-v1</artifactId>
<dependencies>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.13.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- spring -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>jackson-commons</artifactId>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>dictionary-merge-commons</artifactId>
<version>1.3.0</version>
</dependency>
<!-- test -->
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>test-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,146 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.iqser.red</groupId>
<artifactId>platform-dependency</artifactId>
<version>2.20.0</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-v1</artifactId>
<version>2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>persistence-service-shared-api-v1</module>
<module>persistence-service-internal-api-v1</module>
<module>persistence-service-external-api-v1</module>
<module>persistence-service-external-api-v2</module>
<module>persistence-service-processor-v1</module>
<module>persistence-service-server-v1</module>
<module>persistence-service-external-api-impl-v1</module>
<module>persistence-service-external-api-impl-v2</module>
<module>persistence-service-internal-api-impl-v1</module>
</modules>
<properties>
<findbugs.skip>true</findbugs.skip>
<spotbugs.skip>true</spotbugs.skip>
<redaction-service.version>4.177.0</redaction-service.version>
<search-service.version>2.71.0</search-service.version>
<pdftron-redaction-service.version>4.38.0</pdftron-redaction-service.version>
<redaction-report-service.version>4.36.0</redaction-report-service.version>
<ocr-service.version>3.10.0</ocr-service.version>
<storage.commons.version>2.45.0</storage.commons.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.iqser.red</groupId>
<artifactId>platform-commons-dependency</artifactId>
<version>2.9.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.13</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
<version>${redaction-service.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>ocr-service-api-v1</artifactId>
<version>${ocr-service.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>search-service-api-v1</artifactId>
<version>${search-service.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-report-service-api-v1</artifactId>
<version>${redaction-report-service.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
<version>${pdftron-redaction-service.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.0.2155</version>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>6.3.1</version>
<configuration>
<format>ALL</format>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report-aggregate</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

20
pom.xml
View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>persistence-service-v1</module>
<module>persistence-service-image-v1</module>
</modules>
</project>

View File

@ -1,27 +0,0 @@
#!/bin/bash
# This script compiles the project, builds a docker image with the tag <BranchName>-<CommitHash> and pushes it to our nexus.
# Set the Nexus repository URL
NEXUS_REPO="nexus.knecon.com:5001"
# Set the image name
IMAGE_NAME="red/persistence-service-server-v1"
# path to image repo
IMAGE_REPO="persistence-service-image-v1"
echo "Running build"
mvn clean install -Pquickbuild
# Get the current Git branch
GIT_BRANCH=$(git symbolic-ref --short HEAD)
# Get the first 5 characters of the commit hash
GIT_COMMIT_HASH=$(git rev-parse --short=5 HEAD)
# Create the image tag by combining branch and commit hash
IMAGE_TAG="${GIT_BRANCH}-${GIT_COMMIT_HASH}"
IMAGE_NAME="$NEXUS_REPO/$IMAGE_NAME:$IMAGE_TAG"
echo "Building docker image: {$IMAGE_NAME}"
# Build the Docker image with the specified name and tag and push to nexus
mvn -f $IMAGE_REPO docker:build docker:push -Ddocker.image.version=$IMAGE_TAG
echo "Docker image '$IMAGE_NAME' has been built and pushed to Nexus."

15
publish-custom-image.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
dir=${PWD##*/}
gradle assemble
# Get the current Git branch
branch=$(git rev-parse --abbrev-ref HEAD)
# Get the short commit hash (first 5 characters)
commit_hash=$(git rev-parse --short=5 HEAD)
# Combine branch and commit hash
buildName="${USER}-${branch}-${commit_hash}"
gradle bootBuildImage --cleanCache --publishImage -PbuildbootDockerHostNetwork=true -Pversion=$buildName
echo "nexus.knecon.com:5001/red/${dir}-server-v1:$buildName"

19
settings.gradle.kts Normal file
View File

@ -0,0 +1,19 @@
rootProject.name = "persistence-service"
include(":persistence-service-processor-v1")
include(":persistence-service-shared-api-v1")
include(":persistence-service-external-api-impl-v1")
include(":persistence-service-server-v1")
include(":persistence-service-external-api-v1")
include(":persistence-service-internal-api-impl-v1")
include(":persistence-service-external-api-v2")
include(":persistence-service-external-api-impl-v2")
include(":persistence-service-internal-api-v1")
project(":persistence-service-processor-v1").projectDir = file("persistence-service-v1/persistence-service-processor-v1")
project(":persistence-service-shared-api-v1").projectDir = file("persistence-service-v1/persistence-service-shared-api-v1")
project(":persistence-service-external-api-impl-v1").projectDir = file("persistence-service-v1/persistence-service-external-api-impl-v1")
project(":persistence-service-server-v1").projectDir = file("persistence-service-v1/persistence-service-server-v1")
project(":persistence-service-external-api-v1").projectDir = file("persistence-service-v1/persistence-service-external-api-v1")
project(":persistence-service-internal-api-impl-v1").projectDir = file("persistence-service-v1/persistence-service-internal-api-impl-v1")
project(":persistence-service-external-api-v2").projectDir = file("persistence-service-v1/persistence-service-external-api-v2")
project(":persistence-service-external-api-impl-v2").projectDir = file("persistence-service-v1/persistence-service-external-api-impl-v2")
project(":persistence-service-internal-api-v1").projectDir = file("persistence-service-v1/persistence-service-internal-api-v1")