Class Tm1Capabilities

java.lang.Object
io.skipcheck.tm1.client.version.Tm1Capabilities

public final class Tm1Capabilities extends Object
What a connected TM1 server supports, read from its own $metadata: the way OData intends clients to detect features, with no version tables. It works for any TM1, including versions the client has never seen.
// Does the server's $metadata define the cube's tm1.Reserve action?
Tm1Capability reserve = Tm1Capability.boundOperation("tm1.Cube", "tm1.Reserve").since("11.8.34");
return session.capabilities().map(capabilities -> capabilities.supports(reserve));
  • Method Details

    • of

      public static Tm1Capabilities of(CsdlDocument metadata, @Nullable Tm1Version productVersion)
      The capabilities a $metadata document describes.
      Parameters:
      metadata - the server's $metadata, parsed
      productVersion - the server's version (Server.ProductVersion), or null if not known
      Returns:
      the capabilities
    • schemaVersion

      public Optional<String> schemaVersion()
      The REST API schema version the server reports in Core.SchemaVersion, such as 11.8.35. Not the product version: a different number.
      Returns:
      the schema version, or empty if the server doesn't report one
    • productVersion

      public Optional<Tm1Version> productVersion()
      The server's product version, such as 11.8.03500.6.
      Returns:
      the version, or empty if not known
    • metadata

      public CsdlDocument metadata()
      The server's $metadata, for anything the checks here don't cover.
      Returns:
      the parsed document
    • supports

      public boolean supports(Tm1Capability capability)
      Whether the server defines capability.
      Parameters:
      capability - what's needed
      Returns:
      true if the server's $metadata defines it
    • check

      public Optional<Tm1UnsupportedOperationException> check(Tm1Capability capability, String server)
      Checks the server defines capability.
      Parameters:
      capability - what's needed
      server - the server, for the message, such as its service root
      Returns:
      empty if it's defined, otherwise the exception to fail with, saying what's missing and comparing schema versions when the version that added it is known
    • toString

      public String toString()
      Overrides:
      toString in class Object