Package de.xima.fc.mdl
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 aclient
scope. The system scope could also be represented as a value of typeMandant
that is set tonull
, but that has several disadvantages, such as an increased risk ofnull pointer exceptions
in general, and the limited interoperability with newCollection
APIs that disallownull
values. This class provides an abstraction around system and client scopes that does not exposenull
values explicitly.- Since:
- 8.0.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WorkspaceScope
client(Mandant client)
Gets a workspace scope instance for a client.boolean
equals(Object obj)
Optional<Mandant>
getClient()
Gets the client if this scope is a client scope.int
hashCode()
boolean
isClientScope()
Whether this scope represents a client scope.boolean
isSystemScope()
Whether this scope represents the system scope.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.static WorkspaceScope
system()
Gets the workspace scope instance for the system scope.String
toString()
-
-
-
Method Detail
-
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.
-
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.
-
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 ornull
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.
-
-