private EntityBaseBean allowedOne(
     Relationship r, Method method, GateKeeper gateKeeper, String userId, EntityManager manager)
     throws IllegalAccessException, IllegalArgumentException, InvocationTargetException,
         IcatException {
   EntityBaseBean bean = (EntityBaseBean) method.invoke(this);
   if (bean != null && !gateKeeper.allowed(r)) {
     try {
       gateKeeper.performAuthorisation(userId, bean, AccessType.READ, manager);
     } catch (IcatException e) {
       if (e.getType() == IcatExceptionType.INSUFFICIENT_PRIVILEGES) {
         return null;
       } else {
         throw e;
       }
     }
   }
   return bean;
 }
 @SuppressWarnings("unchecked")
 private List<EntityBaseBean> allowedMany(
     Step step,
     Map<Field, Method> getters,
     GateKeeper gateKeeper,
     String userId,
     EntityManager manager)
     throws IllegalAccessException, IllegalArgumentException, InvocationTargetException,
         IcatException {
   Field field = step.getRelationship().getField();
   List<EntityBaseBean> beans = (List<EntityBaseBean>) getters.get(field).invoke(this);
   if (step.isAllowed()) {
     return beans;
   } else {
     return gateKeeper.getReadable(userId, beans, manager);
   }
 }