/** * {@inheritDoc} * * Note: If the descriptor with {@code key} does not exist in this set, the call is delegated to the base descriptors. */ @Nullable @Override public Value getValue(@NotNull String key) { Descriptor d = descriptors.get(key); if (d == null) { return base == null ? null : base.getValue(key); } return !d.singleValued ? null : d.values[0]; }
static DescriptorEntry fromKey(String key, Descriptors descriptors) { if (descriptors.isSingleValueDescriptor(key)) { return newSingleValuedEntry(key, descriptors.getValue(key), descriptors.isStandardDescriptor(key)); } else { return newMultiValuedEntry(key, descriptors.getValues(key), descriptors.isStandardDescriptor(key)); } }
/** * {@inheritDoc} * * Note: If the descriptor with {@code key} does not exist in this set, the call is delegated to the base descriptors. */ @CheckForNull @Override public Value getValue(@Nonnull String key) { Descriptor d = descriptors.get(key); if (d == null) { return base == null ? null : base.getValue(key); } return !d.singleValued ? null : d.values[0]; }
@Nullable @Override public Value getValue(@NotNull String key) { for (Iterator<Descriptors> it = getDescriptors().iterator(); it.hasNext();) { Descriptors descriptors = it.next(); Value value = descriptors.getValue(key); if (value!=null) { return value; } } return null; }
@CheckForNull @Override public Value getValue(@Nonnull String key) { for (Iterator<Descriptors> it = getDescriptors().iterator(); it.hasNext();) { Descriptors descriptors = it.next(); Value value = descriptors.getValue(key); if (value!=null) { return value; } } return null; }
String getDescriptor(String key) throws Exception { final Value value = descriptors.getValue(key); if (value == null) { return null; } if (value.getType() != PropertyType.STRING) { return null; } try { return value.getString(); } catch (ValueFormatException vfe) { return null; } }
@Test public void testUserManagementDescriptor() throws RepositoryException { Oak oak = new Oak() .with(new InitialContent()) .with(getSecurityProvider()); ContentRepository contentRepository = oak.createContentRepository(); assertFalse(contentRepository.getDescriptors().getValue(JackrabbitRepository.OPTION_USER_MANAGEMENT_SUPPORTED).getBoolean()); }