use of io.jmix.ui.screen.UiController in project jmix by jmix-framework.
the class ScreenPolicyExtractor method extractResourcePolicies.
@Override
public Collection<ResourcePolicy> extractResourcePolicies(Method method) {
Set<ResourcePolicy> resourcePolicies = new HashSet<>();
Set<ScreenPolicy> annotations = AnnotatedElementUtils.findMergedRepeatableAnnotations(method, ScreenPolicy.class, ScreenPolicyContainer.class);
for (ScreenPolicy screenPolicyAnnotation : annotations) {
for (String screenId : screenPolicyAnnotation.screenIds()) {
ResourcePolicy resourcePolicy = ResourcePolicy.builder(ResourcePolicyType.SCREEN, screenId).withPolicyGroup(method.getName()).build();
resourcePolicies.add(resourcePolicy);
}
for (Class screenClass : screenPolicyAnnotation.screenClasses()) {
UiController uiControllerAnnotation = (UiController) screenClass.getAnnotation(UiController.class);
String screenId = uiControllerAnnotation.value();
ResourcePolicy resourcePolicy = ResourcePolicy.builder(ResourcePolicyType.SCREEN, screenId).withPolicyGroup(method.getName()).build();
resourcePolicies.add(resourcePolicy);
}
}
return resourcePolicies;
}
Aggregations