Campaign Forms
CampaignForms
This block of classes handles the display and processing of the form used to create/edit a Campaign 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 Campaign 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
HistoryEntityFormServiceCampaignFormService 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 productsScriptManagerβ for showing available scripting engines
π§© HTML Templates Related to Campaign
β
/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, andexecutionTypeDisplays active/inactive status
Shows the last execution date (if available)
Last updated
Was this helpful?