Interface SchemaExtensionsContext
AccessRule
/AccessRuleForCreate
to restrict access on data;ServicePermissionRule
to restrict access on available services;UserServiceDeclaration
to declare a user service.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the root node of the data model.<S extends EntitySelection,
T extends ActivationContext<S>>
voidregisterUserService
(UserServiceDeclaration<S, T> aNewUserServiceDeclaration) Registers a new user service for the current data model in EBX®.void
registerUserServiceExtension
(UserServiceExtensionDeclaration aUserServiceExtensionDeclaration) Registers a new user service extension for the current data model in EBX®.void
setAccessRuleForCreateOnNode
(Path aPath, AccessRuleForCreate aRule) Sets anAccessRuleForCreate
on a node without specifying a custom description.void
setAccessRuleForCreateOnNode
(Path aPath, AccessRuleForCreate aRule, UserMessage aDescription) Declares that the access to a record node may be restricted by the specified rule while in a record creation context.void
setAccessRuleForCreateOnNodeAndAllDescendants
(Path aSubTreePath, boolean includeRoot, AccessRuleForCreate aRule) Sets anAccessRuleForCreate
on a node subtree without specifying a custom description.void
setAccessRuleForCreateOnNodeAndAllDescendants
(Path aSubTreePath, boolean includeRoot, AccessRuleForCreate aRule, UserMessage aDescription) Declares that the access to an element's subtree may be restricted in a record creation context by the specifiedAccessRuleForCreate
.void
Sets anAccessRule
on a dataset using this schema without specifying a custom description.void
setAccessRuleOnInstance
(AccessRule aRule, UserMessage aDescription) Declares that global access to a dataset may be restricted by the specified rule.void
setAccessRuleOnNode
(Path aPath, AccessRule aRule) Sets anAccessRule
on a node without specifying a custom description.void
setAccessRuleOnNode
(Path aPath, AccessRule aRule, UserMessage aDescription) Declares that the access to an element may be restricted by the specified rule.void
setAccessRuleOnNodeAndAllDescendants
(Path aSubTreePath, boolean includeRoot, AccessRule aRule) Sets anAccessRule
on a node subtree without specifying a custom description.void
setAccessRuleOnNodeAndAllDescendants
(Path aSubTreePath, boolean includeRoot, AccessRule aRule, UserMessage aDescription) Declares that the access to an element's subtree may be restricted by the specified rule.void
setAccessRuleOnOccurrence
(Path aTablePath, AccessRule aRule) Sets anAccessRule
on an table record without specifying a custom description.void
setAccessRuleOnOccurrence
(Path aTablePath, AccessRule aRule, UserMessage aDescription) Declares that global access to a table record in the data model may be restricted by the specified rule.void
setServicePermissionRuleOnNode
(Path aPathInSchema, ServiceKey aServiceKey, ServicePermissionRule<? extends EntitySelection> aRule) Sets aServicePermissionRule
on a node without specifying a custom description.void
setServicePermissionRuleOnNode
(Path aPathInSchema, ServiceKey aServiceKey, ServicePermissionRule<? extends EntitySelection> aRule, UserMessage aDescription) Declares that the display and execution of the specified service is conditioned by the specified rule, when invoked on the element referred by the specified path.void
setServicePermissionRuleOnNodeAndAllDescendants
(Path aSubTreePathInSchema, ServiceKey aServiceKey, ServicePermissionRule<? extends EntitySelection> aRule) Sets aServicePermissionRule
on a node subtree without specifying a custom description.void
setServicePermissionRuleOnNodeAndAllDescendants
(Path aSubTreePathInSchema, ServiceKey aServiceKey, ServicePermissionRule<? extends EntitySelection> aRule, UserMessage aDescription) Declares that the display and execution of the specified service is conditioned by the specified rule, for all elements matching the rule's type ofEntitySelection
under the specified data model element.
-
Method Details
-
getSchemaNode
SchemaNode getSchemaNode()Returns the root node of the data model. -
setAccessRuleOnInstance
Sets anAccessRule
on a dataset using this schema without specifying a custom description. This method is equivalent tosetAccessRuleOnInstance(aRule, null)
. -
setAccessRuleOnInstance
Declares that global access to a dataset may be restricted by the specified rule. Note that theSchemaNode
provided in the rule will always be the root node.Attention: Only one
AccessRule
can be associated with a data model regarding the access to its datasets. Thus, if a rule has previously been set using this method, it will be replaced by the current one.- Parameters:
aRule
- the rule to be setaDescription
- a description for the rule. When null,aRule
's class name is used.- Since:
- 6.1.2
- See Also:
-
setAccessRuleOnNode
Sets anAccessRule
on a node without specifying a custom description. This method is equivalent tosetAccessRuleOnNode(aPath, aRule, null)
. -
setAccessRuleOnNode
Declares that the access to an element may be restricted by the specified rule.Attention: Only one
AccessRule
can be specified for a terminal element. As a consequence:- if an
AccessRule
has previously been set on the element, it will be replaced by the current one; - if the element is not terminal, the rule will be ignored.
When a rule is not defined at a given level, it is considered to be
AccessRule.ALWAYS_READ_WRITE
at that level.At runtime, the effective access permission for an element is the most restrictive permission of the following:
- Resolved user-defined permissions: this is the minimum permission computed from the user-defined rules set at each level (dataspace, dataset, table, record and node);
- AccessRule for the element's dataset:
this is the permission computed by the
AccessRule
attached to the dataset containing the element (seesetAccessRuleOnInstance(AccessRule)
); - AccessRule for the element's record:
(only when in a record context) this is the permission computed by the
AccessRule
attached to the record containing the element, if the element is in a table (seesetAccessRuleOnOccurrence(Path, AccessRule)
). - AccessRule for the element:
this is the permission computed by the
AccessRule
attached to the element, as set by this method; - AccessRuleForCreate for the element:
(only when in a record creation context) this is the permission computed by the
AccessRuleForCreate
attached to the element, as set bysetAccessRuleForCreateOnNode(Path, AccessRuleForCreate)
;
- Parameters:
aPath
- the location of the element on which to set the ruleaRule
- the rule to be setaDescription
- a description for the rule. When null,aRule
's class name is used.- Since:
- 6.1.2
- See Also:
- if an
-
setAccessRuleOnNodeAndAllDescendants
Sets anAccessRule
on a node subtree without specifying a custom description. This method is equivalent tosetAccessRuleOnNodeAndAllDescendants(aSubTreePath, includeRoot, aRule, null)
. -
setAccessRuleOnNodeAndAllDescendants
void setAccessRuleOnNodeAndAllDescendants(Path aSubTreePath, boolean includeRoot, AccessRule aRule, UserMessage aDescription) Declares that the access to an element's subtree may be restricted by the specified rule. Only terminal elements will be affected by the specified rule.Attention: Only one
AccessRule
can be specified for a terminal element. As a consequence, if anAccessRule
has previously been set on any node in the specified sub-tree, it will be replaced by the specified one.- Parameters:
aSubTreePath
- the root of the sub-tree on which to set the ruleincludeRoot
- specifies whether the root is also to have the rule setaRule
- the rule to setaDescription
- a description for the rule. When null,aRule
's class name is used.- Since:
- 6.1.2
- See Also:
-
setAccessRuleForCreateOnNode
Sets anAccessRuleForCreate
on a node without specifying a custom description. This method is equivalent tosetAccessRuleForCreateOnNode(aPath, aRule, null)
.- Since:
- 5.9.0
- See Also:
-
setAccessRuleForCreateOnNode
Declares that the access to a record node may be restricted by the specified rule while in a record creation context.See
setAccessRuleOnNode(Path, AccessRule)
for more information about permission evaluation.Attention: Only one
AccessRuleForCreate
can be specified for a terminal element under a table. As a consequence:- if an
AccessRuleForCreate
has previously been set on the element, it will be replaced by the current one; - if the element is not terminal or not under a table, a compilation error is added.
- Parameters:
aPath
- the location of the element on which to set the ruleaRule
- the rule to be setaDescription
- a description for the rule. When null,aRule
's class name is used.- Since:
- 6.1.2
- See Also:
- if an
-
setAccessRuleForCreateOnNodeAndAllDescendants
void setAccessRuleForCreateOnNodeAndAllDescendants(Path aSubTreePath, boolean includeRoot, AccessRuleForCreate aRule) Sets anAccessRuleForCreate
on a node subtree without specifying a custom description. This method is equivalent tosetAccessRuleOnNodeAndAllDescendants(aSubTreePath, includeRoot, aRule, null)
. -
setAccessRuleForCreateOnNodeAndAllDescendants
void setAccessRuleForCreateOnNodeAndAllDescendants(Path aSubTreePath, boolean includeRoot, AccessRuleForCreate aRule, UserMessage aDescription) Declares that the access to an element's subtree may be restricted in a record creation context by the specifiedAccessRuleForCreate
. Only record terminal nodes will be affected by the specified rule.Attention: Only one
AccessRuleForCreate
can be specified for a terminal element under a table. As a consequence, if anAccessRuleForCreate
has previously been set on any node in the specified sub-tree, it will be replaced by the specified one.- Parameters:
aSubTreePath
- the root of the sub-tree on which to set the ruleincludeRoot
- specifies whether the root is also to have the rule setaRule
- the rule to setaDescription
- a description for the rule. When null,aRule
's class name is used.- Since:
- 6.1.2
- See Also:
-
setAccessRuleOnOccurrence
Sets anAccessRule
on an table record without specifying a custom description. This method is equivalent tosetAccessRuleOnOccurrence(aTablePath, aRule, null)
. -
setAccessRuleOnOccurrence
Declares that global access to a table record in the data model may be restricted by the specified rule.Attention 1: When dealing with large volume, it is highly recommended to use scripting record access rule instead.
Attention 2: Only one rule can be associated with a table at a given path for access to its records. Thus, if a rule has already been set, it will be replaced by the current one.
At runtime, the effective access permission to a table record is the most restrictive permission of the following:
- AccessRule for the table's dataset:
these are the rights that are computed by the
AccessRule
attached to the dataset containing the table (seesetAccessRuleOnInstance(AccessRule)
); - AccessRule for the element's record:
these are the rights that are computed by the
AccessRule
and/or scripting record access rule attached to the record containing the element.
When a rule is not defined at a given level, it is considered to be
AccessRule.ALWAYS_READ_WRITE
at that level.- Parameters:
aTablePath
- location of the table elementaRule
- the rule to setaDescription
- a description for the rule. When null,aRule
's class name is used.- Since:
- 6.1.2
- See Also:
- AccessRule for the table's dataset:
these are the rights that are computed by the
-
setServicePermissionRuleOnNode
void setServicePermissionRuleOnNode(Path aPathInSchema, ServiceKey aServiceKey, ServicePermissionRule<? extends EntitySelection> aRule) Sets aServicePermissionRule
on a node without specifying a custom description. This method is equivalent tosetServicePermissionRuleOnNode(aPathInSchema, aServiceKey, aRule, null)
.- Since:
- 5.8.0
- See Also:
-
setServicePermissionRuleOnNode
void setServicePermissionRuleOnNode(Path aPathInSchema, ServiceKey aServiceKey, ServicePermissionRule<? extends EntitySelection> aRule, UserMessage aDescription) Declares that the display and execution of the specified service is conditioned by the specified rule, when invoked on the element referred by the specified path. The rule can only restrict the service availability.Attention: Only one rule can be associated with a path. Thus, if a rule has previously been set on the element, it will be replaced by the current one.
Possible types of rule by element
When the element specified by the path is a dataset, the specified rule can only be a
ServicePermissionRule<DatasetEntitySelection>
, in which case the rule will be evaluated when the selection is this dataset.When the element specified by the path is a table, the specified rule can either be:
- a
ServicePermissionRule<TableViewEntitySelection>
or aServicePermissionRule<RecordEntitySelection>
, in which case the rule will be evaluated when the selection is:- this table;
- a record selection or single record of this table;
- an association view linking to this table;
- a single record in an association view linking to this table;
- a hierarchy with this table as target table;
- a hierarchy node representing a record of this table.
For a
ServicePermissionRule<RecordEntitySelection>
, the provided context is more limited than the one provided in aServicePermissionRule<TableViewEntitySelection>
, but it is also easier to use when working on a single record base. - a
ServicePermissionRule<HierarchyEntitySelection>
, in which case the rule will only be evaluated when the selection is a hierarchy with this table as target table. - a
ServicePermissionRule<HierarchyNodeEntitySelection>
, in which case the rule will only be evaluated when the selection is a hierarchy node representing a record of this table.
When the element specified by the path is an association, the specified rule can either be:
- a
ServicePermissionRule<AssociationEntitySelection>
, in which case the rule will only be evaluated when the selection is this association. - a
ServicePermissionRule<AssociationRecordEntitySelection>
, in which case the rule will only be evaluated when the selection is a linked record by this association.
Compilation errors
A data model compilation error is added:
- if the element referred by the specified path is not the data model's root, a table, or an association.
- if the permission rule
EntitySelection
parameter does not match the element referred by the specified path (see previous section).
- Parameters:
aPathInSchema
- the location of the element on which to set the ruleaServiceKey
- the key of the service on which the rule will applyaRule
- the rule to be setaDescription
- a description for the rule. When null,aRule
's class name is used.- Throws:
IllegalArgumentException
- if:- specified
Path
isnull
. - specified
ServiceKey
isnull
. - specified
ServicePermissionRule
isnull
.
- specified
- Since:
- 6.1.2
- See Also:
- a
-
setServicePermissionRuleOnNodeAndAllDescendants
void setServicePermissionRuleOnNodeAndAllDescendants(Path aSubTreePathInSchema, ServiceKey aServiceKey, ServicePermissionRule<? extends EntitySelection> aRule) Sets aServicePermissionRule
on a node subtree without specifying a custom description. This method is equivalent tosetServicePermissionRuleOnNodeAndAllDescendants(aSubTreePathInSchema, aServiceKey, aRule, null)
. -
setServicePermissionRuleOnNodeAndAllDescendants
void setServicePermissionRuleOnNodeAndAllDescendants(Path aSubTreePathInSchema, ServiceKey aServiceKey, ServicePermissionRule<? extends EntitySelection> aRule, UserMessage aDescription) Declares that the display and execution of the specified service is conditioned by the specified rule, for all elements matching the rule's type ofEntitySelection
under the specified data model element.Attention: Only one rule can be associated with an element. Thus, if a rule has previously been set for any element in the specified sub-tree, it will be replaced by the specified rule. For this reason, the order in which rules are set is important.
Matching elements by type of rule
The rule will be set on table elements only, when the specified rule is either:
- a
ServicePermissionRule<TableViewEntitySelection>
- a
ServicePermissionRule<RecordEntitySelection>
, - a
ServicePermissionRule<HierarchyEntitySelection>
- a
ServicePermissionRule<HierarchyNodeEntitySelection>
The rule will be set on association elements only, when the specified rule is either:
- a
ServicePermissionRule<AssociationEntitySelection>
- a
ServicePermissionRule<AssociationRecordEntitySelection>
- Parameters:
aSubTreePathInSchema
- the root of the sub-tree on which to set the ruleaServiceKey
- the key of the service on which the rule will applyaRule
- the rule to setaDescription
- a description for the rule. When null,aRule
's class name is used.- Since:
- 6.1.2
- See Also:
- a
-
registerUserService
<S extends EntitySelection,T extends ActivationContext<S>> void registerUserService(UserServiceDeclaration<S, T> aNewUserServiceDeclaration) Registers a new user service for the current data model in EBX®.- Since:
- 5.8.0
-
registerUserServiceExtension
Registers a new user service extension for the current data model in EBX®.Only built-in services and services declared in the current data model can be extended using this method.
- Since:
- 5.8.0
-