Skip to content

Commit

Permalink
missing method added
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorsten Marx committed Oct 24, 2024
1 parent 53f2b38 commit 76704fa
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cms-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-api</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public interface SiteProperties {

public Object get (String field);

public <T> T getOrDefault (String field, T defaultValue);

public String theme ();

public String queryIndexMode ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ public interface ThemeProperties {
public List<String> activeModules();

public Object get (String field);

public <T> T getOrDefault (String field, T defaultValue);
}
2 changes: 1 addition & 1 deletion cms-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-auth</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-content/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-content</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-core</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ public Object get (String field) {
return value.isPresent() ? value.get() : null;
}

public Object getOrDefault (String field, Object defaultValue) {
var value = sources.reversed().stream()
.filter(ConfigSource::exists)
.map(config -> config.get(field))
.filter(cv -> cv != null)
.findFirst();
return value.isPresent() ? value.get() : defaultValue;
}

public <T> T getValue (String field, Class<T> typeClass) {
var value = sources.reversed().stream()
.filter(ConfigSource::exists)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,9 @@ public List<String> activeModules() {
public Object get (String field) {
return configuration.get(field);
}

@Override
public <T> T getOrDefault(String field, T defaultValue) {
return (T) configuration.getOrDefault(field, defaultValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,9 @@ public Object get (String field) {
return configuration.get(field);
}

@Override
public <T> T getOrDefault(String field, T defaultValue) {
return (T) configuration.getOrDefault(field, defaultValue);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public Object get(String field) {
return properties.get(field);
}

@Override
public <T> T getOrDefault(String field, T defaultValue) {
return (T) properties.getOrDefault(field, defaultValue);
}

@Override
public String parent() {
return (String) properties.get("parent");
Expand Down
2 changes: 1 addition & 1 deletion cms-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-extensions</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-filesystem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-filesystem</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-git/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-git</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-media/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-media</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-server</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>cms-test</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public String language() {
public Object get(String field) {
return values.get(field);
}

@Override
public <T> T getOrDefault(String field, T defaultValue) {
return (T) values.getOrDefault(field, defaultValue);
}

@Override
public String defaultContentType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public TestThemeProperties(Map<String, Object> values) {
public Object get(String field) {
return values.get(field);
}

@Override
public <T> T getOrDefault(String field, T defaultValue) {
return (T) values.getOrDefault(field, defaultValue);
}

@Override
public String name() {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>integration-tests</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion modules-framework/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms.module.framework</groupId>
<artifactId>module-framework</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>modules-api</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion modules-framework/manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms.module.framework</groupId>
<artifactId>module-framework</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>modules-manager</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion modules-framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<groupId>com.condation.cms.module.framework</groupId>
<artifactId>module-framework</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion modules/example-module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms.modules</groupId>
<artifactId>cms-modules</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<artifactId>example-module</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
</parent>
<groupId>com.condation.cms.modules</groupId>
<artifactId>cms-modules</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.condation.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down

0 comments on commit 76704fa

Please sign in to comment.