Class SubscriptionState

java.lang.Object
com.evolveum.midpoint.repo.common.subscription.SubscriptionState
All Implemented Interfaces:
DebugDumpable, Serializable

public class SubscriptionState extends Object implements DebugDumpable, Serializable
The state of the subscription with regards to the current situation (subscription ID presence, time, system features, and so on). See e.g. - isActive() - isDemo() - isInGracePeriod() - isProductionEnvironment() - ...
See Also:
  • Method Details

    • determine

      @NotNull public static @NotNull SubscriptionState determine(@NotNull @NotNull SubscriptionId subscriptionId, @NotNull @NotNull SystemFeatures systemFeatures)
    • error

      public static SubscriptionState error()
      To be called in rare situations when there is either no information about the subscription and/or we cannot retrieve the system features. This can happen e.g. if the system configuration cannot be completely retrieved because of a schema exception (that should be quite rare, as the "normal" issues of e.g. missing extension schema should be handled gracefully by the repository).
    • getMonthsAfter

      public int getMonthsAfter()
      Returns the # of months after the subscription period ended. Call only with well-formed subscriptions!
    • getDaysToGracePeriodGone

      public int getDaysToGracePeriodGone()
      How many days remains to the end of the grace period (if there's one for this kind of subscription)? For example, if the subscription ends 05/24, then the grace period ends on August 31st, 2024 (assuming 3-months period), and the "no subscription" period starts on September 1st, 2024. So, on September 1st (or later), the returned value is 0; on August 31st, the returned value is 1; and so on. Call only with well-formed subscriptions!
    • isActive

      public boolean isActive()
      Is the subscription active? The subscription ID must be well-formed, and within its time validity period. (The grace period - if available - counts also as the validity.) The expired or malformed subscriptions give `false` here.
    • isInGracePeriod

      public boolean isInGracePeriod()
      Is the (well-formed) subscription in the grace period?
    • isDemo

      public boolean isDemo()
      Is this a demo subscription? Note that the subscription itself may be expired.
    • isInactiveOrDemo

      public boolean isInactiveOrDemo()
      Just a convenience method.
    • isGenericRepoWithoutSubscription

      public boolean isGenericRepoWithoutSubscription()
      Is used generic repo (other than H2) and we detect
    • isProductionEnvironment

      public boolean isProductionEnvironment()
      Do we think we run in a production environment (regardless of the subscription ID present or not)?
    • isClusteringAvailable

      public boolean isClusteringAvailable()
      Should we allow clustering? In production environments ONLY with an active subscription.
    • getSystemFeatures

      @NotNull public @NotNull SystemFeatures getSystemFeatures()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • debugDump

      public String debugDump(int indent)
      Specified by:
      debugDump in interface DebugDumpable