本文整理汇总了Java中org.apache.jackrabbit.JcrConstants.NT_BASE属性的典型用法代码示例。如果您正苦于以下问题:Java JcrConstants.NT_BASE属性的具体用法?Java JcrConstants.NT_BASE怎么用?Java JcrConstants.NT_BASE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.jackrabbit.JcrConstants
的用法示例。
在下文中一共展示了JcrConstants.NT_BASE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRequiredPrimaryTypes
@Override
public NodeType[] getRequiredPrimaryTypes() {
String[] oakNames = getNames(JcrConstants.JCR_REQUIREDPRIMARYTYPES);
if (oakNames == null) {
oakNames = new String[] { JcrConstants.NT_BASE };
}
NodeType[] types = new NodeType[oakNames.length];
Tree root = definition.getParent();
while (!JCR_NODE_TYPES.equals(root.getName())) {
root = root.getParent();
}
for (int i = 0; i < oakNames.length; i++) {
Tree type = root.getChild(oakNames[i]);
checkState(type.exists());
types[i] = new NodeTypeImpl(type, mapper);
}
return types;
}
示例2: getRequiredPrimaryTypeNames
@Override
public String[] getRequiredPrimaryTypeNames() {
String[] names = getNames(JcrConstants.JCR_REQUIREDPRIMARYTYPES);
if (names == null) {
names = new String[] { JcrConstants.NT_BASE };
}
for (int i = 0; i < names.length; i++) {
names[i] = mapper.getJcrName(names[i]);
}
return names;
}
示例3: planOrderByNonIndexedProperty
@Test
public void planOrderByNonIndexedProperty() throws IllegalArgumentException,
RepositoryException, CommitFailedException {
NodeBuilder root = EmptyNodeState.EMPTY_NODE.builder();
IndexUtils.createIndexDefinition(root.child(IndexConstants.INDEX_DEFINITIONS_NAME),
TEST_INDEX_NAME, false, ImmutableList.of(ORDERED_PROPERTY), null, OrderedIndex.TYPE,
ImmutableMap.<String, String> of());
NodeState before = root.getNodeState();
final OrderDirection direction = OrderDirection.ASC;
final QueryIndex.OrderEntry.Order order = OrderDirection.ASC.equals(direction) ? QueryIndex.OrderEntry.Order.ASCENDING
: QueryIndex.OrderEntry.Order.DESCENDING;
List<String> values = generateOrderedValues(NUMBER_OF_NODES, direction);
addChildNodes(values, root, Type.STRING);
NodeState after = root.getNodeState();
NodeState indexed = HOOK.processCommit(before, after, CommitInfo.EMPTY);
final OrderedPropertyIndex index = new OrderedPropertyIndex();
final String nodeTypeName = JcrConstants.NT_BASE;
Filter filter = createFilter(indexed, nodeTypeName);
List<QueryIndex.OrderEntry> sortOrder = ImmutableList.of(createOrderEntry(
"somethingnotindexed", order));
List<IndexPlan> plans = index.getPlans(filter, sortOrder, indexed);
assertNotNull(plans);
assertEquals(0, plans.size());
}
示例4: planOrderAndWhereMixed
/**
* tests the output of a plan where the query is asked with where conditions that are not indexed
* but the ORDER BY are on the indexed property
*
* eg: SELECT * FROM [nt:base] WHERE pinned=1 ORDER BY lastModified
*
* @throws RepositoryException
* @throws IllegalArgumentException
* @throws CommitFailedException
*/
@Test
public void planOrderAndWhereMixed() throws IllegalArgumentException, RepositoryException, CommitFailedException {
NodeBuilder root = EmptyNodeState.EMPTY_NODE.builder();
IndexUtils.createIndexDefinition(root.child(IndexConstants.INDEX_DEFINITIONS_NAME),
TEST_INDEX_NAME, false, ImmutableList.of(ORDERED_PROPERTY), null, OrderedIndex.TYPE,
ImmutableMap.<String, String> of());
NodeState before = root.getNodeState();
final OrderDirection direction = OrderDirection.ASC;
final QueryIndex.OrderEntry.Order order = OrderDirection.ASC.equals(direction) ? QueryIndex.OrderEntry.Order.ASCENDING
: QueryIndex.OrderEntry.Order.DESCENDING;
List<String> values = generateOrderedValues(NUMBER_OF_NODES, direction);
addChildNodes(values, root, Type.STRING);
NodeState after = root.getNodeState();
NodeState indexed = HOOK.processCommit(before, after, CommitInfo.EMPTY);
final OrderedPropertyIndex index = new OrderedPropertyIndex();
final String nodeTypeName = JcrConstants.NT_BASE;
FilterImpl filter = createFilter(indexed, nodeTypeName);
filter.restrictProperty("somethingNotIndexed", Operator.EQUAL, PropertyValues.newLong(1L));
List<QueryIndex.OrderEntry> sortOrder = ImmutableList.of(createOrderEntry(
ORDERED_PROPERTY, order));
List<IndexPlan> plans = index.getPlans(filter, sortOrder, indexed);
assertNotNull(plans);
assertEquals(1, plans.size());
IndexPlan p = plans.get(0);
assertTrue(p.getEstimatedEntryCount() > 0);
assertNotNull(p.getSortOrder());
assertEquals(1, p.getSortOrder().size());
assertEquals(QueryIndex.OrderEntry.Order.ASCENDING, p.getSortOrder()
.get(0).getOrder());
}
示例5: planOderByNoWhere
@Test
public void planOderByNoWhere() throws IllegalArgumentException, RepositoryException,
CommitFailedException {
NodeBuilder root = EmptyNodeState.EMPTY_NODE.builder();
IndexUtils.createIndexDefinition(root.child(IndexConstants.INDEX_DEFINITIONS_NAME),
TEST_INDEX_NAME, false, ImmutableList.of(ORDERED_PROPERTY), null, OrderedIndex.TYPE,
ImmutableMap.<String, String> of());
NodeState before = root.getNodeState();
final OrderDirection direction = OrderDirection.ASC;
final QueryIndex.OrderEntry.Order order = OrderDirection.ASC.equals(direction) ? QueryIndex.OrderEntry.Order.ASCENDING
: QueryIndex.OrderEntry.Order.DESCENDING;
List<String> values = generateOrderedValues(NUMBER_OF_NODES, direction);
addChildNodes(values, root, Type.STRING);
NodeState after = root.getNodeState();
NodeState indexed = HOOK.processCommit(before, after, CommitInfo.EMPTY);
final OrderedPropertyIndex index = new OrderedPropertyIndex();
final String nodeTypeName = JcrConstants.NT_BASE;
Filter filter = createFilter(indexed, nodeTypeName);
List<QueryIndex.OrderEntry> sortOrder = ImmutableList.of(createOrderEntry(ORDERED_PROPERTY,
order));
List<IndexPlan> plans = index.getPlans(filter, sortOrder, indexed);
assertNotNull(plans);
assertEquals(1, plans.size());
IndexPlan p = plans.get(0);
assertTrue(p.getEstimatedEntryCount() > 0);
assertNotNull(p.getSortOrder());
assertEquals(1, p.getSortOrder().size());
QueryIndex.OrderEntry oe = p.getSortOrder().get(0);
assertNotNull(oe);
assertEquals(ORDERED_PROPERTY, oe.getPropertyName());
assertEquals(QueryIndex.OrderEntry.Order.ASCENDING, oe.getOrder());
}