/
SqlRepositoryConfiguration.java
69 lines (55 loc) · 2.18 KB
/
SqlRepositoryConfiguration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package org.javers.repository.sql;
import java.util.Optional;
import org.javers.common.validation.Validate;
/**
* @author bartosz.walacik
*/
public class SqlRepositoryConfiguration {
private final boolean globalIdCacheDisabled;
private final String schemaName;
private final boolean schemaManagementEnabled;
private final String globalIdTableName;
private final String commitTableName;
private final String snapshotTableName;
private final String commitPropertyTableName;
SqlRepositoryConfiguration(boolean globalIdCacheDisabled, String schemaName,
boolean schemaManagementEnabled, String globalIdTableName,
String commitTableName,
String snapshotTableName, String commitPropertyTableName) {
Validate.argumentCheck(schemaName == null || !schemaName.isEmpty(),"schemaName should be null or non-empty");
this.globalIdCacheDisabled = globalIdCacheDisabled;
this.schemaName = schemaName;
this.schemaManagementEnabled = schemaManagementEnabled;
this.globalIdTableName = globalIdTableName;
this.commitTableName = commitTableName;
this.snapshotTableName = snapshotTableName;
this.commitPropertyTableName = commitPropertyTableName;
}
public boolean isGlobalIdCacheDisabled() {
return globalIdCacheDisabled;
}
/**
* null or non-empty
*/
public String getSchemaName() {
return schemaName;
}
public Optional<String> getSchemaNameAsOptional() {
return Optional.ofNullable(schemaName);
}
public boolean isSchemaManagementEnabled() {
return schemaManagementEnabled;
}
public Optional<String> getGlobalIdTableName() {
return Optional.ofNullable(globalIdTableName);
}
public Optional<String> getCommitTableName() {
return Optional.ofNullable(commitTableName);
}
public Optional<String> getSnapshotTableName() {
return Optional.ofNullable(snapshotTableName);
}
public Optional<String> getCommitPropertyTableName() {
return Optional.ofNullable(commitPropertyTableName);
}
}