-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CCAP-420] Updating FFL short code configs to be set per flow and not…
… per project (#613) * [CCAP-420] Updating FFL short code configs to be set per flow and not per project * Cleanup from review * Cleanup from review
- Loading branch information
Showing
9 changed files
with
121 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 35 additions & 23 deletions
58
src/main/java/formflow/library/config/submission/ShortCodeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,56 @@ | ||
package formflow.library.config.submission; | ||
|
||
import java.util.Map; | ||
import lombok.Getter; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Getter | ||
@Configuration | ||
@ConfigurationProperties(prefix = "form-flow.short-code") | ||
public class ShortCodeConfig { | ||
|
||
public enum ShortCodeType { | ||
alphanumeric, alpha, numeric; | ||
private Map<String, Config> shortCodeConfigs; | ||
|
||
public Config getConfig(String flowName) { | ||
return shortCodeConfigs != null ? shortCodeConfigs.get(flowName) : null; | ||
} | ||
|
||
public enum ShortCodeCreationPoint { | ||
creation, submission | ||
public void setShortCodeConfigs(Map<String, Config> shortCodeConfigs) { | ||
this.shortCodeConfigs = shortCodeConfigs; | ||
} | ||
|
||
@Value("${form-flow.short-code.length:6}") | ||
private int codeLength; | ||
@Setter | ||
@Getter | ||
public static class Config { | ||
|
||
@Value("${form-flow.short-code.type:alphanumeric}") | ||
private ShortCodeType codeType; | ||
public enum ShortCodeType { | ||
alphanumeric, alpha, numeric; | ||
} | ||
|
||
@Value("${form-flow.short-code.uppercase: true}") | ||
private boolean uppercase; | ||
public enum ShortCodeCreationPoint { | ||
creation, submission | ||
} | ||
|
||
@Value("${form-flow.short-code.creation-point:submission}") | ||
private ShortCodeCreationPoint creationPoint; | ||
private int codeLength = 6; | ||
|
||
@Value("${form-flow.short-code.prefix:#{null}}") | ||
private String prefix; | ||
private ShortCodeType codeType = ShortCodeType.alphanumeric; | ||
|
||
@Value("${form-flow.short-code.suffix:#{null}}") | ||
private String suffix; | ||
private boolean uppercase = true; | ||
|
||
public boolean isCreateShortCodeAtCreation() { | ||
return ShortCodeCreationPoint.creation.equals(creationPoint); | ||
} | ||
private ShortCodeCreationPoint creationPoint = ShortCodeCreationPoint.submission; | ||
|
||
private String prefix = null; | ||
|
||
private String suffix = null; | ||
|
||
public boolean isCreateShortCodeAtCreation() { | ||
return ShortCodeCreationPoint.creation.equals(creationPoint); | ||
} | ||
|
||
public boolean isCreateShortCodeAtSubmission() { | ||
return ShortCodeCreationPoint.submission.equals(creationPoint); | ||
} | ||
|
||
public boolean isCreateShortCodeAtSubmission() { | ||
return ShortCodeCreationPoint.submission.equals(creationPoint); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,12 @@ form-flow: | |
domain: 'mail.forms-starter.cfa-platforms.org' | ||
sender-email: 'Testing <[email protected]>' | ||
short-code: | ||
length: 8 | ||
type: alphanumeric | ||
uppercase: false | ||
prefix: "IL-" | ||
short-code-configs: | ||
testFlow: | ||
length: 8 | ||
type: alphanumeric | ||
uppercase: false | ||
prefix: "IL-" | ||
spring: | ||
main: | ||
allow-bean-definition-overriding: true | ||
|