Annotation Interface UiComponentPolicy


Defines UI component policy in annotated resource role. Multiple UiComponentPolicy annotations may be placed on a single method. UiComponentPolicy annotation may present on multiple methods of the same class. Annotated method may have any name and return type.

This annotation is used to specify policies for UI components within a view. It allows defining actions and effects for specific components identified by their IDs within a view.

Example:

 @ResourceRole(name = "Some role", code = SomeRole.CODE)
 public interface SomeResourceRole {

     @UiComponentPolicy(viewClass = SomeView.class,
         componentIds = "field1",
         action = UiComponentPolicyAction.VISIBLE,
         effect = UiComponentPolicyEffect.DENY)
     @UiComponentPolicy(viewClass = SomeView.class,
         componentIds = {"field2", "button1"},
         action = UiComponentPolicyAction.ENABLED,
         effect = UiComponentPolicyEffect.DENY)
     void test1View();
 }
 

By default, when UI component policies are applied, if a component doesn't have a defined policy, then its visibility and accessibility will not be changed. In most cases the policies with the DENY effect will be defined in roles, and in this case, the UI component will be hidden or disabled.

If multiple roles are assigned to a user and these roles contain conflicting policies for the same component (one policy has the ALLOW effect and another has the DENY effect), then the ALLOW effect will be applied.

See Also: