Skip to content

Commit d666578

Browse files
Merge pull request #411 from adessoAG/teams-frontend-roles
Proper handling of roles in the UI and many performance improvements.
2 parents 4dad941 + cd884e3 commit d666578

File tree

451 files changed

+3910
-3211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

451 files changed

+3910
-3211
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM openjdk:11.0.8-jre-buster
22
ARG JAR_FILE=coderadar-app/build/**/*.jar
3-
COPY ${JAR_FILE} coderadar-app-0.5.0.local.jar
4-
ENTRYPOINT ["java","-jar","/coderadar-app-0.5.0.local.jar"]
3+
COPY ${JAR_FILE} coderadar-app-1.0.0.local.jar
4+
ENTRYPOINT ["java","-jar","/coderadar-app-1.0.0.local.jar"]

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ apply plugin: "java"
2020
apply plugin: "org.sonarqube"
2121

2222
ext {
23-
majorVersion = '0'
24-
minorVersion = '5'
23+
majorVersion = '1'
24+
minorVersion = '0'
2525
patchVersion = '0'
2626
baseVersion = "${majorVersion}.${minorVersion}.${patchVersion}"
2727
}

coderadar-app/src/main/java/io/reflectoring/coderadar/app/CoderadarApplication.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.springframework.boot.autoconfigure.SpringBootApplication;
66
import org.springframework.boot.autoconfigure.domain.EntityScan;
77
import org.springframework.boot.context.properties.EnableConfigurationProperties;
8+
import org.springframework.boot.web.servlet.error.ErrorController;
89
import org.springframework.scheduling.annotation.EnableAsync;
910
import org.springframework.scheduling.annotation.EnableScheduling;
1011
import org.springframework.stereotype.Controller;
@@ -18,15 +19,23 @@
1819
@EntityScan(basePackages = "io.reflectoring.coderadar")
1920
@SpringBootApplication(scanBasePackages = "io.reflectoring.coderadar")
2021
@Controller
21-
public class CoderadarApplication {
22+
public class CoderadarApplication implements ErrorController {
2223

2324
public static void main(String[] args) {
2425
Locale.setDefault(Locale.US);
2526
SpringApplication.run(CoderadarApplication.class, args);
2627
}
2728

28-
@GetMapping(value = "/**/{path:[^.]*}")
29-
public String redirect() {
29+
private static final String ERROR = "/error";
30+
31+
/** @return forwards to index.html (angular app) */
32+
@GetMapping(value = ERROR)
33+
public String error() {
3034
return "forward:/index.html";
3135
}
36+
37+
@Override
38+
public String getErrorPath() {
39+
return ERROR;
40+
}
3241
}

coderadar-app/src/main/resources/application.properties.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ coderadar.authentication.accessToken.durationInMinutes=15
88
coderadar.authentication.refreshToken.durationInMinutes=86400
99
coderadar.authentication.enabled=true
1010
coderadar.cors.enabled=true
11+
coderadar.gitPasswordsEncryptionKey=test-key
1112

1213
logging.level.io.reflectoring.coderadar=DEBUG
1314
logging.level.org.reflections=ERROR

coderadar-core/src/main/java/io/reflectoring/coderadar/CoderadarConfigurationProperties.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.reflectoring.coderadar;
22

3+
import io.reflectoring.coderadar.useradministration.service.security.PasswordUtil;
34
import java.io.IOException;
45
import java.nio.file.Files;
56
import java.nio.file.Path;
@@ -30,6 +31,8 @@ public class CoderadarConfigurationProperties {
3031

3132
@NotNull private Integer scanIntervalInSeconds = 30;
3233

34+
@NotNull private String gitPasswordsEncryptionKey;
35+
3336
@NotNull private Locale dateLocale = Locale.ENGLISH;
3437

3538
private Authentication authentication = new Authentication();
@@ -69,6 +72,11 @@ public void validateWorkdirIsWritable() {
6972
}
7073
}
7174

75+
@PostConstruct
76+
public void setGitPasswordEncryptionKey() {
77+
PasswordUtil.setKey(gitPasswordsEncryptionKey);
78+
}
79+
7280
@Data
7381
public static class Authentication {
7482

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package io.reflectoring.coderadar;
2+
3+
public class CoderadarConstants {
4+
5+
private CoderadarConstants() {}
6+
7+
public static final int COMMIT_HASH_LENGTH = 16;
8+
9+
public static final String ZERO_HASH = "0000000000000000";
10+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package io.reflectoring.coderadar;
2+
3+
import io.reflectoring.coderadar.analyzer.service.AnalyzingService;
4+
import io.reflectoring.coderadar.projectadministration.service.ProcessProjectService;
5+
import io.reflectoring.coderadar.projectadministration.service.project.ScanProjectScheduler;
6+
import io.reflectoring.coderadar.useradministration.service.security.TokenService;
7+
import lombok.RequiredArgsConstructor;
8+
import org.springframework.context.ConfigurableApplicationContext;
9+
import org.springframework.stereotype.Service;
10+
11+
@Service
12+
@RequiredArgsConstructor
13+
public class ShutdownService implements ShutdownUseCase {
14+
15+
private final ProcessProjectService processProjectService;
16+
private final ScanProjectScheduler scanProjectScheduler;
17+
private final AnalyzingService analyzingService;
18+
private final ConfigurableApplicationContext applicationContext;
19+
private final TokenService tokenService;
20+
21+
@Override
22+
public void shutdown() throws InterruptedException {
23+
tokenService.setShuttingDown(true);
24+
analyzingService.onShutdown();
25+
scanProjectScheduler.onShutdown();
26+
processProjectService.onShutdown();
27+
applicationContext.close();
28+
}
29+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.reflectoring.coderadar;
2+
3+
public interface ShutdownUseCase {
4+
void shutdown() throws InterruptedException;
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.reflectoring.coderadar;
2+
3+
public class ValidationUtils {
4+
5+
private ValidationUtils() {}
6+
7+
public static String validateAndTrimCommitHash(String commitHash) {
8+
if (commitHash.length() < CoderadarConstants.COMMIT_HASH_LENGTH) {
9+
throw new IllegalArgumentException(
10+
String.format(
11+
"The length of the commit hash must be at least %d",
12+
CoderadarConstants.COMMIT_HASH_LENGTH));
13+
}
14+
return commitHash.substring(0, CoderadarConstants.COMMIT_HASH_LENGTH);
15+
}
16+
}

coderadar-core/src/main/java/io/reflectoring/coderadar/analyzer/domain/AnalyzerConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ public class AnalyzerConfiguration {
1111
private String analyzerName;
1212
private boolean enabled;
1313

14-
private AnalyzerConfigurationFile analyzerConfigurationFile;
15-
1614
public AnalyzerConfiguration(long id, String analyzerName, boolean enabled) {
1715
this.id = id;
1816
this.analyzerName = analyzerName;

0 commit comments

Comments
 (0)