Interface CodeGenerationService

  • All Known Implementing Classes:
    DefaultCodeGenerationService

    public interface CodeGenerationService
    Performs operations on a CodeGenerator, such as validation and code generation.
    Author:
    Chad Harchar (charchar)
    • Method Detail

      • initializeCodePrefixAndValidateGenerator

        @Deprecated
        void initializeCodePrefixAndValidateGenerator​(CodeGenerator info,
                                                      com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
        Deprecated.
        since 1.4 initialization has moved to BaseCrudEntityService.create(Object, ContextInfo), and validation has moved to CodeGeneratorValidator and CodeGeneratorPreValidator
        Sets the CodeGenerator's CodeGenerator.codePrefix to be its campaign's code prefix if not present. After this, validates that the codeFormat for the CodeGenerator is large enough to hold the number of codes desired, ensuring that the codes are not easily guessable.
        Parameters:
        info - The CodeGenerator that contains the number of codes to generate and the potential code format.
        contextRequest - The context of the request with which to generate codes.
        Throws:
        com.broadleafcommerce.common.error.validation.ValidationException - if the code generator is invalid
      • initializeCodePrefixAndGenerateCodes

        @Deprecated
        void initializeCodePrefixAndGenerateCodes​(CodeGenerator info,
                                                  com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
        Deprecated.
        since 1.4, initialization has moved to BaseCrudEntityService.create(Object, ContextInfo), and use markInProgressAndGenerateCodes(CodeGenerator, ContextRequest) for generating codes
        Sets the CodeGenerator's CodeGenerator.codePrefix to be its campaign's code prefix if not present. After this, generates the codes for the provided CodeGenerator.
        Parameters:
        info - The CodeGenerator that holds the information needed in order to generate the expected number of codes with the expected format, if desired.
        contextRequest - The context of the request with which to generate codes.
      • startCodeGeneration

        @Deprecated
        void startCodeGeneration​(CodeGenerator info,
                                 com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
        Prepares the CodeGenerator for processing, then triggers the code generation.
        Parameters:
        info - The CodeGenerator that holds the information needed in order to generate the expected number of codes with the expected format, if desired.
        contextRequest - The context of the request with which to generate codes.
      • markInProgressAndGenerateCodes

        default void markInProgressAndGenerateCodes​(CodeGenerator info,
                                                    com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
        Updates the CodeGenerator to have a status of CodeGenerationStatusType.IN_PROCESS, then performs the code generation.
        Parameters:
        info - The CodeGenerator that holds the information needed in order to generate the expected number of codes with the expected format
        contextRequest - The context of the request with which to generate codes
      • markInProgressAndGenerateAndGetCodes

        CodeGenerationResult markInProgressAndGenerateAndGetCodes​(CodeGenerator info,
                                                                  com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest)
        Updates the CodeGenerator to have a status of CodeGenerationStatusType.IN_PROCESS, then performs the code generation.
        Parameters:
        info - The CodeGenerator that holds the information needed in order to generate the expected number of codes with the expected format
        contextRequest - The context of the request with which to generate codes
        Returns:
        the CodeGenerationResult containing the generated CampaignCodes and error message based on the given CodeGenerator