CampaignExecution model

CampaignExecution

The CampaignExecution class represents a specific execution of a campaign and contains information about its status, the clients processed, applications created, and any execution errors. This entity is not versioned and extends BaseEntity<Long>.


📌 Inheritance and Relationships

  • BaseEntity<Long> — a base class provided by timveroOS

  • Relationship with Campaign: many-to-one — each CampaignExecution belongs to a single Campaign


📌 Key Fields

  • campaign — the associated Campaign

  • status — the current execution status (CampaignExecutionStatus)

  • clients — clients selected by the script (Set<Client>)

  • applications — applications created as a result (List<Application>)

  • exception — error information if execution failed (ExceptionEntity, nullable)


📌 The exception Field

The exception field is an object of type ExceptionEntity, provided by the platform. If the execution ends with an error, the stack trace and message are stored here. In the UI (campaign-execution/details.html), it is shown as a clickable link:

<a th:href="@{'/exception-entity/' + *{exception.id}}">Script execution error</a>

📌 CampaignExecutionStatus Enum

public enum CampaignExecutionStatus {
    NEW,                // Execution created, waiting to be started
    IN_PROGRESS,        // Currently executing
    FINISHED,           // Successfully completed
    EXCEPTION_OCCURRED, // Finished with an error (exception present)
    STOPPED,            // Manually or forcibly stopped
    DISABLED            // Disabled manually or by Producer logic
}

📌 Model Example

@Entity
@Table(name = "campaign_execution")
public class CampaignExecution extends BaseEntity<Long> implements NamedEntity {

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "campaign_id", nullable = false, updatable = false)
    private Campaign campaign;

    @ManyToMany
    @JoinTable(name = "campaign_execution_clients",
        joinColumns = @JoinColumn(name = "campaign_execution"),
        inverseJoinColumns = @JoinColumn(name = "client"))
    private Set<Client> clients = new HashSet<>();

    @OneToMany(mappedBy = FinomApplication_.CAMPAIGN_EXECUTION)
    private List<Application> applications = new ArrayList<>();

    @Column(nullable = false)
    @Enumerated(EnumType.STRING)
    private CampaignExecutionStatus status = CampaignExecutionStatus.NEW;

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    private ExceptionEntity exception;

    // getters and setters...
}

Last updated

Was this helpful?