@Override public boolean apply(NodeState input) { return !input.getBoolean(JCR_SAMENAMESIBLINGS); } };
/** * Depending on the given SNS flag, checks whether the given child node * definition allows same-name-siblings. * * @param sns SNS flag, {@code true} if processing an SNS node * @param definition child node definition */ private boolean snsMatch(boolean sns, @Nonnull NodeState definition) { return !sns || definition.getBoolean(JCR_SAMENAMESIBLINGS); }
/** * Depending on the given SNS flag, checks whether the given child node * definition allows same-name-siblings. * * @param sns SNS flag, {@code true} if processing an SNS node * @param definition child node definition */ private boolean snsMatch(boolean sns, @NotNull NodeState definition) { return !sns || definition.getBoolean(JCR_SAMENAMESIBLINGS); }
/** * Depending on the given SNS flag, checks whether the given child node * definition allows same-name-siblings. * * @param sns SNS flag, {@code true} if processing an SNS node * @param definition child node definition */ private boolean snsMatch(boolean sns, @NotNull NodeState definition) { return !sns || definition.getBoolean(JCR_SAMENAMESIBLINGS); }
@Override public boolean getBoolean(@NotNull String name) { return delegate.getBoolean(name); }
Set<IndexStoreStrategy> getStrategies(NodeState definition) { boolean unique = definition .getBoolean(IndexConstants.UNIQUE_PROPERTY_NAME); return Multiplexers.getStrategies(unique, mountInfoProvider, definition, INDEX_CONTENT_NODE_NAME); }
Set<IndexStoreStrategy> getStrategies(NodeState definition) { boolean unique = definition .getBoolean(IndexConstants.UNIQUE_PROPERTY_NAME); return Multiplexers.getStrategies(unique, mountInfoProvider, definition, INDEX_CONTENT_NODE_NAME); }
Set<IndexStoreStrategy> getStrategies(NodeState definition) { boolean unique = definition .getBoolean(IndexConstants.UNIQUE_PROPERTY_NAME); return Multiplexers.getStrategies(unique, mountInfoProvider, definition, INDEX_CONTENT_NODE_NAME); }
@Override public boolean getBoolean(@NotNull String name) { return head().getCurrentNodeState().getBoolean(checkNotNull(name)); }
public static BundledTypesRegistry from(NodeState configParentState){ Map<String, DocumentBundlor> bundlors = Maps.newHashMap(); for (ChildNodeEntry e : configParentState.getChildNodeEntries()){ NodeState config = e.getNodeState(); if (config.getBoolean(DocumentBundlor.PROP_DISABLED)){ continue; } bundlors.put(e.getName(), DocumentBundlor.from(config)); } return new BundledTypesRegistry(bundlors); }
public static BundledTypesRegistry from(NodeState configParentState){ Map<String, DocumentBundlor> bundlors = Maps.newHashMap(); for (ChildNodeEntry e : configParentState.getChildNodeEntries()){ NodeState config = e.getNodeState(); if (config.getBoolean(DocumentBundlor.PROP_DISABLED)){ continue; } bundlors.put(e.getName(), DocumentBundlor.from(config)); } return new BundledTypesRegistry(bundlors); }
@Test public void nestedBuilderWithNewPropertyFromState() throws Exception { NodeState rootState = store.getRoot(); NodeBuilder rootBuilder = rootState.builder(); rootBuilder.setProperty("newProperty", true, Type.BOOLEAN); NodeState baseState = rootBuilder.getNodeState(); assertTrue(baseState.getBoolean("newProperty")); NodeBuilder builderFromState = baseState.builder(); assertTrue(builderFromState.getBoolean("newProperty")); assertTrue(builderFromState.getNodeState().getBoolean("newProperty")); //assertTrue(builderFromState.getBaseState().getBoolean("newProperty")); // FIXME }
@Test public void regexProperty() throws Exception{ builder.indexRule("nt:base") .property(FulltextIndexConstants.REGEX_ALL_PROPS, true); NodeState state = builder.build(); assertTrue(NodeStateUtils.getNode(state, "indexRules/nt:base/properties/prop") .getBoolean(FulltextIndexConstants.PROP_IS_REGEX)); }
@Test public void regexProperty() throws Exception{ builder.indexRule("nt:base") .property(FulltextIndexConstants.REGEX_ALL_PROPS, true); NodeState state = builder.build(); assertTrue(NodeStateUtils.getNode(state, "indexRules/nt:base/properties/prop") .getBoolean(FulltextIndexConstants.PROP_IS_REGEX)); }
@Test public void nodeTypeIndex() throws Exception{ builder.nodeTypeIndex(); builder.indexRule("nt:file"); NodeState state = builder.build(); assertTrue(state.getChildNode("indexRules").exists()); NodeState ntFileRule = state.getChildNode("indexRules").getChildNode("nt:file"); assertTrue(ntFileRule.exists()); assertTrue(state.getBoolean(FulltextIndexConstants.PROP_INDEX_NODE_TYPE)); assertFalse(ntFileRule.getBoolean(FulltextIndexConstants.PROP_SYNC)); }
@Test public void nodeTypeIndex() throws Exception{ builder.nodeTypeIndex(); builder.indexRule("nt:file"); NodeState state = builder.build(); assertTrue(state.getChildNode("indexRules").exists()); NodeState ntFileRule = state.getChildNode("indexRules").getChildNode("nt:file"); assertTrue(ntFileRule.exists()); assertTrue(state.getBoolean(FulltextIndexConstants.PROP_INDEX_NODE_TYPE)); assertFalse(ntFileRule.getBoolean(FulltextIndexConstants.PROP_SYNC)); }
@Test public void headIndexFilesGetMarkedUnsafe() throws Exception { String indexPath = "/fooIndex"; createFakeIndex(indexPath); IndexPathService indexPathService = MockRegistrar.getIndexPathsService(indexPaths); AsyncIndexInfoService asyncIndexInfoService = MockRegistrar.getAsyncIndexInfoService(newArrayList( new IndexMBeanInfoSupplier("foo-async", () -> STATUS_DONE, () -> 2L) )); ActiveDeletedBlobCollectorMBean bean = getTestBean(indexPathService, asyncIndexInfoService); bean.flagActiveDeletionUnsafeForCurrentState(); NodeState indexFile = getFakeIndexFile(indexPath); assertTrue(indexFile.getBoolean(PROP_UNSAFE_FOR_ACTIVE_DELETION)); }
@Test public void nodeTypeIndexSync() throws Exception{ builder.nodeTypeIndex(); builder.indexRule("nt:file").sync(); NodeState state = builder.build(); assertTrue(state.getChildNode("indexRules").exists()); NodeState ntFileRule = state.getChildNode("indexRules").getChildNode("nt:file"); assertTrue(ntFileRule.exists()); assertTrue(state.getBoolean(FulltextIndexConstants.PROP_INDEX_NODE_TYPE)); assertTrue(ntFileRule.getBoolean(FulltextIndexConstants.PROP_SYNC)); }
@Test public void nodeTypeIndexSync() throws Exception{ builder.nodeTypeIndex(); builder.indexRule("nt:file").sync(); NodeState state = builder.build(); assertTrue(state.getChildNode("indexRules").exists()); NodeState ntFileRule = state.getChildNode("indexRules").getChildNode("nt:file"); assertTrue(ntFileRule.exists()); assertTrue(state.getBoolean(FulltextIndexConstants.PROP_INDEX_NODE_TYPE)); assertTrue(ntFileRule.getBoolean(FulltextIndexConstants.PROP_SYNC)); }
@Test public void reindexAndAsyncFlagChange() throws Exception{ builder.async("async", IndexConstants.INDEXING_MODE_NRT); nodeBuilder = builder.build().builder(); nodeBuilder.setProperty(REINDEX_PROPERTY_NAME, false); NodeState oldState = nodeBuilder.getNodeState(); builder = new IndexDefinitionBuilder(nodeBuilder); builder.async("async", IndexConstants.INDEXING_MODE_SYNC); assertFalse(builder.build().getBoolean(REINDEX_PROPERTY_NAME)); builder = new IndexDefinitionBuilder(oldState.builder()); builder.async("fulltext-async", IndexConstants.INDEXING_MODE_SYNC); assertTrue(builder.build().getBoolean(REINDEX_PROPERTY_NAME)); }