Campaign Forms

CampaignForms

This block of classes handles the display and processing of the form used to create/edit a Campaignarrow-up-right entity via the UI. It follows the standard architecture used in timveroOS: Form β†’ FormService β†’ Entity, with full versioning support through HistoryEntityFormService.


βœ… CampaignForm

CampaignForm is a DTO class representing the fields of the campaign creation/edit form. Validation annotations provide basic input checks.

Example fields:

public class CampaignForm {

    @NotEmpty
    private String name;

    @NotNull
    private CampaignExecutionType executionType;

    private boolean restartable;

    private Integer restartableUnit;

    private RestartableUnitType restartableUnitType;

    @Valid
    private ExpressionForm expression;

    @NotEmpty
    private Set<@NotNull String> creditProductCodes;

    private LocalDateTime dateTimeExecution;

    // getters and setters
}

πŸ” CampaignFormMapper

The CampaignFormMapper interface is used to convert between Campaignarrow-up-right and CampaignForm using the MapStruct library. It extends EntityToFormMapper<Campaign, CampaignForm>.

Example:

MapStruct automatically generates the conversion based on matching fields. Additional logic can be added using @AfterMapping if needed.


βš™οΈ CampaignFormService β€” Extends HistoryEntityFormService

CampaignFormService implements the core business logic for editing campaigns via the UI. It extends HistoryEntityFormService<Campaign, CampaignForm, Long>, which means:

  • Versioning is handled automatically β€” saving a campaign creates a new version

  • Previous versions are marked as inactive

  • The version lineage is tracked via lineageId

Example:

Key Method:

Version History Support:

Dependencies Used:

  • CreditProductRepository β€” for retrieving available credit products

  • ScriptManager β€” for showing available scripting engines


βœ… /campaign/list.html

Purpose: Displays a table with the list of all campaigns. It serves as the main campaign overview page.

Key Features:

  • Sortable by id, name, and executionType

  • Displays active/inactive status

  • Shows the last execution date (if available)

Last updated

Was this helpful?