@Test public void resolveAccessLevelWithUnknownAccess() throws ComponentLookupException { when(this.componentManager.getInstance(AccessLevel.class, UNKNOWN_LABEL)) .thenThrow(new ComponentLookupException("No such component")); Assert.assertSame(this.noAccess, this.component.resolveAccessLevel(UNKNOWN_LABEL)); }
@Nonnull @Override public AccessLevel resolveAccessLevel(@Nullable final String name) { try { if (StringUtils.isNotBlank(name)) { final AccessLevel accessLevel = this.componentManager.get().getInstance(AccessLevel.class, name); return accessLevel == null ? this.noAccess : accessLevel; } } catch (ComponentLookupException ex) { this.logger.warn("Invalid entity access level requested: {}", name); } return this.noAccess; }
DefaultEntityAccessManager implements EntityAccessManager { @Nonnull @Override public AccessLevel resolveAccessLevel(@Nullable final String name) { try { if (StringUtils.isNotBlank(name)) { final AccessLevel accessLevel = this.componentManager.get().getInstance(AccessLevel.class, name); return accessLevel == null ? this.noAccess : accessLevel; } } catch (ComponentLookupException ex) { this.logger.warn("Invalid entity access level requested: {}", name); } return this.noAccess; } }
DefaultEntityAccessManager implements EntityAccessManager { @Nonnull @Override public AccessLevel resolveAccessLevel(@Nullable final String name) { try { if (StringUtils.isNotBlank(name)) { final AccessLevel accessLevel = this.componentManager.get().getInstance(AccessLevel.class, name); return accessLevel == null ? this.noAccess : accessLevel; } } catch (ComponentLookupException ex) { this.logger.warn("Invalid entity access level requested: {}", name); } return this.noAccess; }  }
DefaultEntityAccessManager implements EntityAccessManager { @Nonnull @Override public AccessLevel resolveAccessLevel(@Nullable final String name) { try { if (StringUtils.isNotBlank(name)) { final AccessLevel accessLevel = this.componentManager.get().getInstance(AccessLevel.class, name); return accessLevel == null ? this.noAccess : accessLevel; } } catch (ComponentLookupException ex) { this.logger.warn("Invalid entity access level requested: {}", name); } return this.noAccess; }  @Nonnull @Override Collection<AccessLevel> listAccessLevels(); @Nonnull @Override Collection<AccessLevel> listAllAccessLevels(); @Nonnull @Override AccessLevel resolveAccessLevel(@Nullable final String name); @Nonnull @Override AccessLevel getAccessLevel(@Nullable final PrimaryEntity entity, @Nullable final EntityReference userOrGroup); @Override boolean isAdministrator(@Nullable final PrimaryEntity entity); @Override boolean isAdministrator(@Nullable final PrimaryEntity entity, @Nullable final DocumentReference user); @Nullable @Override Owner getOwner(@Nullable final PrimaryEntity entity); @Override boolean setOwner(@Nullable final PrimaryEntity entity, @Nullable final EntityReference userOrGroup); @Nonnull @Override Collection<Collaborator> getCollaborators(@Nullable final PrimaryEntity entity); @Override boolean setCollaborators(
        @Nullable final PrimaryEntity entity,
        @Nullable final Collection<Collaborator> newCollaborators); @Override boolean addCollaborator(@Nullable final PrimaryEntity entity, @Nullable final Collaborator collaborator); @Override boolean removeCollaborator(@Nullable final PrimaryEntity entity, @Nullable final Collaborator collaborator); }
DefaultEntityAccessManager implements EntityAccessManager { @Nonnull @Override public AccessLevel resolveAccessLevel(@Nullable final String name) { try { if (StringUtils.isNotBlank(name)) { final AccessLevel accessLevel = this.componentManager.get().getInstance(AccessLevel.class, name); return accessLevel == null ? this.noAccess : accessLevel; } } catch (ComponentLookupException ex) { this.logger.warn("Invalid entity access level requested: {}", name); } return this.noAccess; }  @Nonnull @Override Collection<AccessLevel> listAccessLevels(); @Nonnull @Override Collection<AccessLevel> listAllAccessLevels(); @Nonnull @Override AccessLevel resolveAccessLevel(@Nullable final String name); @Nonnull @Override AccessLevel getAccessLevel(@Nullable final PrimaryEntity entity, @Nullable final EntityReference userOrGroup); @Override boolean isAdministrator(@Nullable final PrimaryEntity entity); @Override boolean isAdministrator(@Nullable final PrimaryEntity entity, @Nullable final DocumentReference user); @Nullable @Override Owner getOwner(@Nullable final PrimaryEntity entity); @Override boolean setOwner(@Nullable final PrimaryEntity entity, @Nullable final EntityReference userOrGroup); @Nonnull @Override Collection<Collaborator> getCollaborators(@Nullable final PrimaryEntity entity); @Override boolean setCollaborators(
        @Nullable final PrimaryEntity entity,
        @Nullable final Collection<Collaborator> newCollaborators); @Override boolean addCollaborator(@Nullable final PrimaryEntity entity, @Nullable final Collaborator collaborator); @Override boolean removeCollaborator(@Nullable final PrimaryEntity entity, @Nullable final Collaborator collaborator);  }