String viewClassName = view.getViewClassName();
if (!component.isDenyAllApplicableToClass(viewClassName, ejbClassName)) {
denyOnAllViews = false;
} else {
EJBViewDescription ejbView = EJBViewDescription.class.cast(view);
MethodInterfaceType type = getMethodInterfaceType(ejbView.getMethodIntf());
EJBMethodPermission p = new EJBMethodPermission(ejbName, null, type.name(), null);
permissions.add(p);
}
if (!component.isPermitAllApplicableToClass(viewClassName, ejbClassName)) {
permitOnAllViews = false;
} else {
EJBViewDescription ejbView = EJBViewDescription.class.cast(view);
MethodInterfaceType type = getMethodInterfaceType(ejbView.getMethodIntf());
EJBMethodPermission p = new EJBMethodPermission(ejbName, null, type.name(), null);
uncheckedPermissions.add(p);
}
Set<String> roles = component.getRolesAllowedForClass(viewClassName, ejbClassName);
for (String role : roles) {
policyConfiguration.addToRole(role, new EJBMethodPermission(ejbName, null, null, null));
}
// check method level
Collection<EJBMethodIdentifier> methods = component.getDenyAllMethodsForView(viewClassName);
for (EJBMethodIdentifier method : methods) {
MethodIdentifier identifier = method.getMethodIdentifier();
EJBViewDescription ejbView = EJBViewDescription.class.cast(view);
MethodInterfaceType type = getMethodInterfaceType(ejbView.getMethodIntf());
EJBMethodPermission p = new EJBMethodPermission(ejbName, identifier.getName(), type.name(),
identifier.getParameterTypes());
policyConfiguration.addToExcludedPolicy(p);
}
methods = component.getPermitAllMethodsForView(viewClassName);
for (EJBMethodIdentifier method : methods) {
MethodIdentifier identifier = method.getMethodIdentifier();
EJBViewDescription ejbView = EJBViewDescription.class.cast(view);
MethodInterfaceType type = getMethodInterfaceType(ejbView.getMethodIntf());
EJBMethodPermission p = new EJBMethodPermission(ejbName, identifier.getName(), type.name(),
identifier.getParameterTypes());
policyConfiguration.addToUncheckedPolicy(p);
}
Map<EJBMethodIdentifier, Set<String>> rolesMap = component.getRolesAllowed(viewClassName);
for (Entry<EJBMethodIdentifier, Set<String>> entry : rolesMap.entrySet()) {
MethodIdentifier identifier = entry.getKey().getMethodIdentifier();
EJBViewDescription ejbView = EJBViewDescription.class.cast(view);
MethodInterfaceType type = getMethodInterfaceType(ejbView.getMethodIntf());
for (String role : entry.getValue()) {
EJBMethodPermission p = new EJBMethodPermission(ejbName, identifier.getName(), type.name(),
identifier.getParameterTypes());
policyConfiguration.addToRole(role, p);
}
}
}