Class WorkspaceScope

java.lang.Object
de.xima.fc.mdl.WorkspaceScope
All Implemented Interfaces:
Serializable

public final class WorkspaceScope extends Object implements Serializable
A workspace scope in formcycle, either the system scope or a client scope. The system scope could also be represented as a value of type Mandant that is set to null, but that has several disadvantages, such as an increased risk of null pointer exceptions in general, and the limited interoperability with new Collection APIs that disallow null values. This class provides an abstraction around system and client scopes that does not expose null values explicitly.
Since:
8.0.0
Author:
XIMA MEDIA GmbH
See Also:
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getClient

      public Optional<Mandant> getClient()
      Gets the client if this scope is a client scope.
      Returns:
      The client if this scope represents a client scope, empty otherwise.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isClientScope

      public boolean isClientScope()
      Whether this scope represents a client scope.
      Returns:
      true if this scope represents a client scope, false otherwise.
    • isSystemScope

      public boolean isSystemScope()
      Whether this scope represents the system scope.
      Returns:
      true if this scope represents the system scope, false otherwise.
    • toString

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

      public static WorkspaceScope client(Mandant client)
      Gets a workspace scope instance for a client.
      Parameters:
      client - Client scope.
      Returns:
      A new workspace scope for the given client.
    • of

      public static WorkspaceScope of(Mandant scope)
      Gets a workspace scope instance for the given scope, either a client scope when the given client is non-null, or the system scope otherwise.
      Parameters:
      scope - A client scope or null for the system scope.
      Returns:
      The system workspace scope.
    • system

      public static WorkspaceScope system()
      Gets the workspace scope instance for the system scope.
      Returns:
      The system workspace scope.