Skip to content

Commit

Permalink
Merge pull request #239 from netgrif/dev
Browse files Browse the repository at this point in the history
Release 6.3.3
  • Loading branch information
machacjozef authored Jan 19, 2024
2 parents c2e579f + ec80522 commit 3227bcf
Show file tree
Hide file tree
Showing 23 changed files with 616 additions and 108 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ jobs:
java-version: 11
distribution: 'adopt'

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
# - name: Cache SonarCloud packages
# uses: actions/cache@v3
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
uses: actions/cache@v3
Expand All @@ -89,12 +89,17 @@ jobs:

- name: Build
run: mvn clean package install -DskipTests=true

- name: Build, test, and analyze
#
# - name: Build, test, and analyze
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=netgrif_application-engine

- name: Build, test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=netgrif_application-engine
run: mvn -B verify

docs:
name: Generate docs
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ jobs:
java-version: 11
distribution: 'adopt'

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
# - name: Cache SonarCloud packages
# uses: actions/cache@v3
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
uses: actions/cache@v3
Expand All @@ -90,9 +90,17 @@ jobs:
- name: Build
run: mvn clean package install -DskipTests=true

- name: Build, test, and analyze
# Upgrade Java
# - name: Build, test, and analyze
# timeout-minutes: 180
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=netgrif_application-engine

- name: Build, test
timeout-minutes: 180
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=netgrif_application-engine
run: mvn -B test
23 changes: 15 additions & 8 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ jobs:
java-version: 11
distribution: 'adopt'

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
# - name: Cache SonarCloud packages
# uses: actions/cache@v3
# with:
# path: ~/.sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
uses: actions/cache@v3
Expand All @@ -101,11 +101,18 @@ jobs:
- name: Build
run: mvn clean package install -DskipTests=true

- name: Build, test, and analyze
# Upgrade Java
# - name: Build, test, and analyze
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=netgrif_application-engine

- name: Build, test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=netgrif_application-engine
run: mvn -B test

publish-OSSRH:
runs-on: ubuntu-latest
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,21 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Full Changelog: [https://github.com/netgrif/application-engine/commits/v6.3.2](https://github.com/netgrif/application-engine/commits/v6.3.2)

## [6.3.2](https://github.com/netgrif/application-engine/releases/tag/v6.3.1) (2023-11-08)
## [6.3.3](https://github.com/netgrif/application-engine/releases/tag/v6.3.3) (2024-01-19)

### Fixed

- [NAE-1930] Modify Annotation in LdapUser Class for Indexing
- [NAE-1931] Implementation of Index Re-Creation after MongoDB Database Drop
- [NAE-1934] Remove devtools dependency
- [NAE-1938] Slow Indexing of Elastic Tasks

### Added

- [NAE-1932] Enhancement of Redis Connector to Support Authentication


## [6.3.2](https://github.com/netgrif/application-engine/releases/tag/v6.3.2) (2023-11-08)

### Fixed

Expand Down
9 changes: 1 addition & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.netgrif</groupId>
<artifactId>application-engine</artifactId>
<version>6.3.2</version>
<version>6.3.3</version>
<packaging>jar</packaging>

<name>NETGRIF Application Engine</name>
Expand Down Expand Up @@ -413,13 +413,6 @@
<version>2.2.0-rc2</version>
</dependency>

<!-- Dev tools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>

<!-- OpenAPI 3 / Swagger Docs -->
<dependency>
<groupId>org.springdoc</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class Action {
this.transitionIds = transitionIds
}

void setId(ObjectId id) {
this.id = id
}

@Override
String toString() {
return "[$trigger] $definition"
Expand All @@ -123,6 +127,7 @@ class Action {
@Override
Action clone() {
Action clone = new Action()
clone.setId(new ObjectId(this.getId().toString()))
clone.setTrigger(this.trigger)
clone.setDefinition(this.definition)
clone.setImportId(this.importId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Profile
import org.springframework.data.mapping.context.MappingContext
import org.springframework.data.mongodb.core.MongoTemplate
import org.springframework.data.mongodb.core.index.IndexOperations
import org.springframework.data.mongodb.core.index.IndexResolver
import org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver
import org.springframework.data.mongodb.core.mapping.Document
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty
import org.springframework.stereotype.Component

@Component
Expand All @@ -32,6 +39,9 @@ class MongoDbRunner extends AbstractOrderedCommandLineRunner {
@Value('${spring.data.mongodb.drop}')
private boolean dropDatabase

@Value('${spring.data.mongodb.runner-ensure-index}')
private boolean resolveIndexesOnStartup

@Override
void run(String... strings) throws Exception {
if (dropDatabase) {
Expand All @@ -41,5 +51,20 @@ class MongoDbRunner extends AbstractOrderedCommandLineRunner {
log.info("Droppiung Mongo database ${uri}")
mongoTemplate.getDb().drop()
}
if (resolveIndexesOnStartup) {
resolveIndexes()
}
}

void resolveIndexes() {
MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext = mongoTemplate.getConverter().getMappingContext()
IndexResolver resolver = new MongoPersistentEntityIndexResolver(mappingContext)
mappingContext.getPersistentEntities()
.stream()
.filter(it -> it.isAnnotationPresent(Document.class))
.forEach(it -> {
IndexOperations indexOps = mongoTemplate.indexOps(it.getType());
resolver.resolveIndexFor(it.getType()).forEach(indexOps::ensureIndex);
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public IElasticCaseService elasticCaseService() {
@Bean
@Primary
public IElasticTaskService elasticTaskService() {
return new ElasticTaskService(taskRepository, elasticsearchTemplate);
return new ElasticTaskService(elasticsearchTemplate);
}

@Bean
Expand All @@ -71,7 +71,7 @@ public IElasticCaseService reindexingTaskElasticCaseService() {

@Bean
public IElasticTaskService reindexingTaskElasticTaskService() {
return new ElasticTaskService(taskRepository, elasticsearchTemplate);
return new ElasticTaskService(elasticsearchTemplate);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.netgrif.application.engine.configuration;

import com.netgrif.application.engine.configuration.properties.ElasticTaskExecutorProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

@Configuration
public class ElasticTaskExecutorConfiguration {

protected final ElasticTaskExecutorProperties elasticTaskExecutorProperties;

public ElasticTaskExecutorConfiguration(ElasticTaskExecutorProperties elasticTaskExecutorProperties) {
this.elasticTaskExecutorProperties = elasticTaskExecutorProperties;
}

@Bean("elasticTaskExecutor")
public ThreadPoolTaskExecutor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(elasticTaskExecutorProperties.getSize());
executor.setMaxPoolSize(elasticTaskExecutorProperties.getMaxPoolSize());
executor.setAllowCoreThreadTimeOut(elasticTaskExecutorProperties.isAllowCoreThreadTimeOut());
executor.setKeepAliveSeconds(elasticTaskExecutorProperties.getKeepAliveSeconds());
executor.setThreadNamePrefix(elasticTaskExecutorProperties.getThreadNamePrefix());
executor.initialize();
return executor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,22 @@ public class SessionConfiguration {
@Value("${spring.session.redis.port}")
private Integer port;

@Value("${spring.session.redis.username:#{null}}")
private String username;

@Value("${spring.session.redis.password:#{null}}")
private String password;


@Bean
public JedisConnectionFactory jedisConnectionFactory() {
hostName = hostName == null ? "localhost" : hostName;
port = port == null || port == 0 ? 6379 : port;
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(hostName, port);
if(username != null && password !=null && !username.isEmpty() && !password.isEmpty()){
redisStandaloneConfiguration.setUsername(username);
redisStandaloneConfiguration.setPassword(password);
}
return new JedisConnectionFactory(redisStandaloneConfiguration);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.netgrif.application.engine.configuration.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "spring.data.elasticsearch.task.executors")
public class ElasticTaskExecutorProperties {

private int size = 50;
private int maxPoolSize = size*10;
private boolean allowCoreThreadTimeOut = true;
private int keepAliveSeconds = 30;
private String threadNamePrefix = "ElasticTaskExecutor-";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.netgrif.application.engine.elastic.domain;

public enum ElasticJob {
INDEX,
REMOVE,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.netgrif.application.engine.elastic.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ElasticTaskJob {

private ElasticJob jobType;

private ElasticTask task;

public String getTaskId() {
return getTask().getTaskId();
}
}




Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ElasticTaskRepository extends ElasticsearchRepository<ElasticTask, String> {

ElasticTask findByStringId(String stringId);

ElasticTask findByTaskId(String taskId);

void deleteAllByStringId(String taskId);

ElasticTask deleteAllByTaskId(String taskId);

void deleteAllByProcessId(String processId);

List<ElasticTask> findAllByProcessId(String processId);
}
Loading

0 comments on commit 3227bcf

Please # to comment.