LogoLogo
timvero.comMaven Repository
  • timveroOS SDK guide
  • timveroOS how-to
  • timveroOS admin-side setup
  • Campaigns in timveroOS
    • 7.11
      • Business Context
      • Introduction
      • Core Concept
        • Entity Diagram
        • Lifecycle Diagram
        • Expression
      • Design and Development of the Campaign Model
        • Campaign model
        • Campaign repository
        • Campaign forms
        • Campaign сontroller
        • UI elements
        • Campaign actions
      • Design and Development of the CampaignExecution Model
        • CampaignExecution model
        • CampaignExecution repository
        • CampaignExecution controller
        • UI elements
      • Expression
      • Services
        • CampaignService
        • CampaignExecutionService
      • Campaign Processing
        • Producer
        • Consumer
      • Post-processing
        • Checker
Powered by GitBook
On this page

Was this helpful?

  1. Campaigns in timveroOS
  2. 7.11
  3. Design and Development of the CampaignExecution Model

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...
}
PreviousDesign and Development of the CampaignExecution ModelNextCampaignExecution repository

Last updated 18 days ago

Was this helpful?