Skip to content

Commit

Permalink
Added: Replace hypen in bridgeheads
Browse files Browse the repository at this point in the history
  • Loading branch information
djuarezgf committed Nov 4, 2024
1 parent c8d7fd7 commit 361f612
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Query Code in Explorer URL
- Decode human readable in base 64
- Log bridgeheads at start
- Replace hypen in bridgeheads
1 change: 1 addition & 0 deletions src/main/java/de/samply/app/ProjectManagerConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ public class ProjectManagerConst {
public final static String OIDC_EMAIL_CLAIM = "email";
public final static String CUSTOM_PROJECT_CONFIGURATION = "CUSTOM";
public final static String EMAIL_SERVICE = "EMAIL_SERVICE";
public final static String HYPHEN = "minus";


}
11 changes: 11 additions & 0 deletions src/main/java/de/samply/bridgehead/BridgeheadConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static class BridgeheadConfig {

@PostConstruct
private void initIdBridgeheadMaps() {
replaceHyphenInBridgeheads();
log.info("Registered bridgeheads:");
config.forEach((bridgehead, bridgeheadConfig) -> {
addBridgeheadId(bridgehead, bridgeheadConfig.getExplorerId(), explorerIdBridgeheadMap);
Expand All @@ -44,6 +45,16 @@ private void initIdBridgeheadMaps() {
});
}

private void replaceHyphenInBridgeheads() {
Map<String, BridgeheadConfig> tempConfig = new HashMap<>();
config.forEach(((bridgehead, bridgeheadConfig) -> tempConfig.put(replaceHyphen(bridgehead), bridgeheadConfig)));
config = tempConfig;
}

private String replaceHyphen(String var) {
return var.replace(ProjectManagerConst.HYPHEN, "-");
}

private String fetchBridgehead(String id, Map<String, String> idBridgeheadMap) {
return idBridgeheadMap.get(id);
}
Expand Down

0 comments on commit 361f612

Please sign in to comment.