Class BusinessDomainObject

java.lang.Object
de.seggebaeing.sqlanalyzer.logic.bdo.BusinessDomainObject
Direct Known Subclasses:
GeneratedQuery, LLM, Prompt, PromptType, SampleQuery

public abstract class BusinessDomainObject extends Object
Abstract base class for all business domain objects (BDOs).

Provides a versioning mechanism that updates automatically when bound JavaFX Property values change. Subclasses should call registerProperties(Property[]) at the end of their constructors to ensure version tracking.

Versioning: The version is either set explicitly or refreshed to the current time when properties change.

Since:
1.0
Author:
Felix Seggebäing
  • Constructor Details

    • BusinessDomainObject

      protected BusinessDomainObject(Long version)
      Creates a new BusinessDomainObject.

      Initializes the version to the given value if non-null, otherwise sets it to the current time.

      Parameters:
      version - initial version value, or null to auto-generate
  • Method Details

    • registerProperties

      protected void registerProperties(javafx.beans.property.Property<?>... properties)
      Registers change listeners on the given JavaFX properties.

      Must be called as the last statement in each subclass constructor to ensure that the version is updated only after all initial property values have been set. Once registered, any change to one of the observed properties triggers refreshVersion().

      Parameters:
      properties - the properties to observe for changes
    • setVersion

      protected void setVersion(Long version)
      Sets the version of this object.

      If a non-null value is provided, it is used directly. If null, the version is refreshed to the current time.

      Parameters:
      version - explicit version value, or null to auto-generate
    • getVersion

      public long getVersion()
      Returns the current version of this object.
      Returns:
      the version value
    • refreshVersion

      protected void refreshVersion()
      Refreshes the version value to the current time.

      Sets version to the number of seconds since the Unix epoch.