Skip to content

Commit

Permalink
Add javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
vrajmohan authored and bseeger committed Oct 13, 2023
1 parent 9d8b0fe commit ddcdbef
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/main/java/formflow/library/ValidationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class ValidationService {
* Autoconfigured constructor.
*
* @param validator Validator from Jakarta package.
* @param actionManager the <code>ActionManager</code> that manages the logic to be run at specific points
* @param inputConfigPath the package path where inputs classes are located
*/
public ValidationService(Validator validator, ActionManager actionManager,
@Value("${form-flow.inputs: 'formflow.library.inputs.'}") String inputConfigPath) {
Expand All @@ -60,6 +62,7 @@ public ValidationService(Validator validator, ActionManager actionManager,
* @param currentScreen The screen we are currently validating form data from
* @param flowName The name of the current flow, not null
* @param formSubmission The input data from a form as a map of field name to field value(s), not null
* @param submission The submission that we are cross validating with
* @return a HashMap of field to list of error messages, will be empty if no field violations
*/
public Map<String, List<String>> validate(ScreenNavigationConfiguration currentScreen, String flowName,
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/formflow/library/data/Submission.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public class Submission {
@Column(name = "submitted_at")
private Date submittedAt;

/**
* Creates a new <code>Submission</code> with empty content
*/
public Submission() {
inputData = new HashMap<>();
urlParams = new HashMap<>();
Expand Down Expand Up @@ -120,8 +123,13 @@ public void mergeFormDataWithSubmissionData(FormSubmission formSubmission) {
inputData = formSubmission.getFormData();
}

public void mergeUrlParamsWithData(Map<String, String> passedParams) {
urlParams.putAll(passedParams);
/**
* Merges the passed in query parameters into the Submission's urlParams Map
*
* @param queryParams the Map of query parameters to merge in
*/
public void mergeUrlParamsWithData(Map<String, String> queryParams) {
urlParams.putAll(queryParams);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
* Service providing encryption and decryption of designated fields in a <code>Submission</code> using Google's
* Tink Cryptographic Library
*/
@Service
public class SubmissionEncryptionService {

/**
* Suffix added to the field name for encrypted fields
*/
public final String ENCRYPT_SUFFIX = "_encrypted";
private final Aead encDec;
private final String inputConfigPath;
Expand All @@ -31,6 +38,11 @@ private enum EncryptionDirection {
DECRYPT
}

/**
* Constructs an instance of the <code>SubmissionEncryptionService</code>
* @param key the key used to encrypt the fields
* @param inputConfigPath the package path where inputs classes are located
*/
public SubmissionEncryptionService(
@Value("${form-flow.encryption-key:#{null}}") String key,
@Value("${form-flow.inputs: 'formflow.library.inputs.'}") String inputConfigPath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.springframework.stereotype.Repository;

/**
* Repository interface for the SubmissionRepository.
* Repository interface for UserFile objects
*/
@Repository
public interface UserFileRepository extends JpaRepository<UserFile, UUID> {
Expand Down

0 comments on commit ddcdbef

Please sign in to comment.