javax.jcr.Item.isNode()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中javax.jcr.Item.isNode()方法的一些代码示例,展示了Item.isNode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.isNode()方法的具体详情如下:
包路径:javax.jcr.Item
类名称:Item
方法名:isNode

Item.isNode介绍

[英]Indicates whether this Item is a Node or a Property. Returns true if this Item is a Node; Returns false if this Item is a Property.
[中]指示此ItemNode还是Property。如果此ItemNode,则返回true;如果此ItemProperty,则返回false

代码示例

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
   * Returns <code>true</code> if the item is a node and the polarity is
   * positive (true).
   * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
   */
  @Override
  protected boolean matches(Item item) throws RepositoryException {
    return item.isNode() == isNode;
  }
}

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

/**
 * {@inheritDoc}
 *
 * Returns {@code true} if the item is a node and the polarity is
 * positive (true).
 */
public boolean matches(Item item) throws RepositoryException {
  return item.isNode() == isNode;
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons

private <T extends Item> void move(T item, Node parent) throws RepositoryException {
  if (item.isNode()) {
    move((Node) item, parent);
  }
  else {
    move((Property) item, parent);
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

@Override
public boolean recomputeDerivedData() throws RepositoryException {
  if(item.isNode()) {
    return ((SessionDecorator)getSession()).computeDerivedData((Node) item);
  }
  return false;
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-mockutils

@Override
public MockNode getNode(final String absPath) throws RepositoryException {
  Item item = getItem(absPath);
  if (!item.isNode()) {
    throw new PathNotFoundException("No such node: " + absPath);
  }
  return (MockNode) item;
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
public Item getAncestor(int depth) throws ItemNotFoundException, AccessDeniedException, RepositoryException {
  Item item = super.getAncestor(depth);
  if (item.isNode()) {
    return wrapNode((Node) item);
  } else {
    return wrapProperty((Property) item);
  }
}

代码示例来源:origin: info.magnolia/magnolia-core

private void export(String path, Exporter exporter) throws PathNotFoundException, SAXException, RepositoryException {
  Item item = getItem(path);
  if (item.isNode()) {
    exporter.export((Node) item);
  } else {
    throw new PathNotFoundException("XML export is not defined for properties: " + path);
  }
}

代码示例来源:origin: pentaho/pentaho-platform

public Object doInJcr( final Session session ) throws RepositoryException {
  Item item = session.getItem( absPath );
  Assert.isTrue( !item.isNode() );
  return ( (Property) item ).getString();
 }
} );

代码示例来源:origin: info.magnolia/magnolia-core

@Override
public Item getAncestor(int depth) throws ItemNotFoundException, AccessDeniedException, RepositoryException {
  Item item = super.getAncestor(depth);
  if (item.isNode()) {
    return wrapNode((Node) item);
  } else {
    return wrapProperty((Property) item);
  }
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

/** {@inheritDoc} */
@Override
public void save() throws AccessDeniedException, ConstraintViolationException, InvalidItemStateException,
    ReferentialIntegrityException, VersionException, LockException, RepositoryException {
  if(item.isNode()) {
    ((SessionDecorator)getSession()).postSave((Node)item);
  }
  super.save();
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

public JcrItemModel(T item) {
  super(item);
  setUserId();
  relPath = null;
  uuid = null;
  if (item != null) {
    TraceMonitor.track(item);
    property = !item.isNode();
    doSave();
  }
}

代码示例来源:origin: pentaho/pentaho-platform

public Object doInJcr( final Session session ) throws RepositoryException {
  Item item = session.getItem( absPath );
  Assert.isTrue( !item.isNode() );
  return ( (Property) item ).getDate().getTime();
 }
} );

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
   * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
   */
  @Override
  protected boolean matches(Item item) throws RepositoryException {
    if (item.isNode()) {
      return ((Node) item).getDefinition().isMandatory() == isMandatory;
    }
    return ((Property) item).getDefinition().isMandatory() == isMandatory;
  }
}

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

public boolean matches(Item item) throws RepositoryException {
  if (item.isNode()) {
    return ((Node) item).getDefinition().isMandatory() == isMandatory;
  } else {
    return ((Property) item).getDefinition().isMandatory() == isMandatory;
  }
}

代码示例来源:origin: apache/jackrabbit

/**
   * @see org.apache.jackrabbit.commons.predicate.DepthPredicate#matches(javax.jcr.Item)
   */
  @Override
  protected boolean matches(Item item) throws RepositoryException {
    if (item.isNode()) {
      return ((Node) item).getDefinition().isMandatory() == isMandatory;
    }
    return ((Property) item).getDefinition().isMandatory() == isMandatory;
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test if all returned items are of type node.
 */
public void testGetProperties() throws RepositoryException {
  PropertyIterator properties = testRootNode.getProperties();
  while (properties.hasNext()) {
    Item item = (Item) properties.next();
    assertFalse("Item is not a property", item.isNode());
  }
}

代码示例来源:origin: pentaho/pentaho-platform

public Object doInJcr( final Session session ) throws RepositoryException {
  Item item;
  try {
   item = session.getItem( absPath );
  } catch ( PathNotFoundException e ) {
   return null;
  }
  Assert.isTrue( item.isNode() );
  return ( (Node) item ).getUUID();
 }
} );

代码示例来源:origin: pentaho/pentaho-platform

public Object doInJcr( final Session session ) throws RepositoryException {
  Item item = session.getItem( absPath );
  Assert.isTrue( item.isNode() );
  return ( (Node) item ).isLocked();
 }
} );

代码示例来源:origin: pentaho/pentaho-platform

public Object doInJcr( final Session session ) throws RepositoryException {
  Item item = session.getItem( absPath );
  Assert.isTrue( item.isNode() );
  Node node = ( (Node) item );
  return node.getVersionHistory().getPath();
 }
} );

代码示例来源:origin: net.adamcin.commons/net.adamcin.commons.jcr

public void removeItem(String path) throws RepositoryException {
  Item item = getSession().getItem(path);
  if (item.isNode()) {
    new NodeProxy((Node) item).remove();
  } else {
    item.remove();
    processChanges(Text.getRelativeParent(path, 1), path);
  }
}

相关文章