private boolean requiresWebSudo() { final Method m = abstractMethod.getMethod(); if (null != m && m.getAnnotation(WebSudoRequired.class) != null) { return true; } if (null != m && m.getAnnotation(WebSudoNotRequired.class) != null) { return false; } final AbstractResource resource = abstractMethod.getResource(); if (resource.isAnnotationPresent(WebSudoRequired.class)) { return true; } if (resource.isAnnotationPresent(WebSudoNotRequired.class)) { return false; } final Package p = abstractMethod.getResource().getResourceClass().getPackage(); if (p.getAnnotation(WebSudoRequired.class) != null) { return true; } if (p.getAnnotation(WebSudoNotRequired.class) != null) { return false; } return false; } }
private static boolean annotationIsPresent(AbstractMethod method, Class<? extends Annotation> annotationType) { return method.isAnnotationPresent(annotationType) || method.getResource().isAnnotationPresent(annotationType) || packageHasAnnotation(annotationType, method.getResource().getResourceClass().getPackage()); }
private boolean isSessionBean(AbstractResource ar) { return ar.isAnnotationPresent(Stateless.class) || ar.isAnnotationPresent(Stateful.class); } }
private boolean isSessionBean(AbstractResource ar) { return ar.isAnnotationPresent(Stateless.class) || ar.isAnnotationPresent(Stateful.class); } }
private boolean isSessionBean(AbstractResource ar) { return ar.isAnnotationPresent(Stateless.class) || ar.isAnnotationPresent(Stateful.class); } }
/** * Check if the {@link AdminRequired} annotation is present for this {@link AbstractMethod} * * @return {@code true} if the {@link AdminRequired} annotation is present on the method or resource */ private boolean isAdminRequired() { return ((abstractMethod != null) && (abstractMethod.isAnnotationPresent(AdminRequired.class) || abstractMethod.getResource().isAnnotationPresent(AdminRequired.class))); }
/** * Check if the {@link AdminRequired} annotation is present for this {@link AbstractMethod} * * @return {@code true} if the {@link AdminRequired} annotation is present on the method or resource */ private boolean isAdminRequired() { return ((abstractMethod != null) && (abstractMethod.isAnnotationPresent(AdminRequired.class) || abstractMethod.getResource().isAnnotationPresent(AdminRequired.class))); }
@Override public RequestDispatcher create(AbstractResourceMethod method) { RequestDispatcher dispatcher = provider.create(method); if (dispatcher == null) { return null; } // Chain dispatchers required by resource declared associations // Highest priority last (it will be executed first) // Checks for methods or classes that requires authorization if (method.getMethod().isAnnotationPresent(Authorized.class) || method.getDeclaringResource().getResourceClass().isAnnotationPresent(Authorized.class)) { Authorized annotation; if (method.isAnnotationPresent(Authorized.class)) { annotation = method.getAnnotation(Authorized.class); } else { annotation = method.getDeclaringResource().getResourceClass().getAnnotation(Authorized.class); } dispatcher = new CheckAuthorizationMethodDispatcher(method, annotation, dispatcher); } // Checks for methods or classes that requires a valid tenant. if (method.getMethod().isAnnotationPresent(ExistingTenant.class) || method.getDeclaringResource().isAnnotationPresent(ExistingTenant.class)) { dispatcher = new CheckValidTenantRequestDispatcher(dispatcher); } return dispatcher; } }