本文整理汇总了Java中javax.jcr.Item.isNode方法的典型用法代码示例。如果您正苦于以下问题:Java Item.isNode方法的具体用法?Java Item.isNode怎么用?Java Item.isNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jcr.Item
的用法示例。
在下文中一共展示了Item.isNode方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateCell
import javax.jcr.Item; //导入方法依赖的package包/类
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
final Item jcrItem = getJcrItem(source, itemId);
if (jcrItem != null && jcrItem.isNode()) {
final Node node = (Node) jcrItem;
try {
if (NodeUtil.isNodeType(node, NodeTypes.ContentNode.NAME)) {
// Get identifier from the items name propertyName: eg. sitePageMap
final String pageId = PropertyUtil.getString(node, definition.getPropertyName(), StringUtils.EMPTY);
// Find page in website and return page path
if (StringUtils.isNotEmpty(pageId)) {
final Node page = NodeUtil.getNodeByIdentifier(RepositoryConstants.WEBSITE, pageId);
final String pagePath = page.getPath();
final StringBuilder nameBuilder = new StringBuilder();
nameBuilder.append(pagePath);
return nameBuilder.toString().trim();
}
}
} catch (RepositoryException e) {
log.warn("Unable to get name of contact for column", e);
}
}
return StringUtils.EMPTY;
}
示例2: generateCell
import javax.jcr.Item; //导入方法依赖的package包/类
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
final Item jcrItem = getJcrItem(source, itemId);
try {
if (jcrItem == null) {
return StringUtils.EMPTY;
} else if (jcrItem.isNode()) {
Node node = (Node) jcrItem;
return "[" + node.getPrimaryNodeType().getName() + "]";
} else {
javax.jcr.Property property = (javax.jcr.Property) jcrItem;
return PropertyType.nameFromValue(property.getType());
}
} catch (RepositoryException e) {
log.warn("Unable to get the displayed node type for the {}", itemId, e);
return StringUtils.EMPTY;
}
}
示例3: generateCell
import javax.jcr.Item; //导入方法依赖的package包/类
public Object generateCell(Table source, Object itemId, Object columnId) {
String cell = "";
Item jcrItem = getJcrItem(source, itemId);
if ((jcrItem != null) && (jcrItem.isNode())) {
Node node = (Node) jcrItem;
try {
if (isNodeType(node, NT_VANITY)) {
cell = getString(node, PN_VANITY_URL, "");
} else {
cell = node.getName();
}
} catch (RepositoryException e) {
LOGGER.warn("Unable to get the displayed value for the name column.", e);
}
}
return cell;
}
示例4: generateCellHelper
import javax.jcr.Item; //导入方法依赖的package包/类
static Object generateCellHelper(final Item jcrItem, final String nodeTypeName, final String propertyTitle) {
if (jcrItem != null && jcrItem.isNode()) {
Node node = (Node) jcrItem;
try {
if (NodeUtil.isNodeType(node, NodeTypes.Folder.NAME)) {
return node.getName();
}
if (NodeUtil.isNodeType(node, NodeTypes.Deleted.NAME)) {
return node.getName();
}
if (NodeUtil.isNodeType(node, nodeTypeName)) {
Object result = PropertyUtil.getString(node, propertyTitle, StringUtils.EMPTY);
if (result != null) {
return result;
} else {
return PropertyUtil.getString(node, propertyTitle, StringUtils.EMPTY);
}
}
} catch (RepositoryException e) {
LOGGER.info("Unable to get '" + propertyTitle + "' of news for column", e);
}
}
return StringUtils.EMPTY;
}
示例5: generateCellHelper
import javax.jcr.Item; //导入方法依赖的package包/类
static Object generateCellHelper(Item jcrItem, String nodeTypeName, String propertyTitle) {
if (jcrItem != null && jcrItem.isNode()) {
Node node = (Node) jcrItem;
try {
if (NodeUtil.isNodeType(node, NodeTypes.Folder.NAME)) {
return node.getName();
}
if (NodeUtil.isNodeType(node, NodeTypes.Deleted.NAME)) {
return node.getName();
}
if (NodeUtil.isNodeType(node, nodeTypeName)) {
Object result = PropertyUtil.getString(node, propertyTitle, StringUtils.EMPTY);
if (result != null) {
return result;
} else {
return PropertyUtil.getString(node, propertyTitle, StringUtils.EMPTY);
}
}
} catch (RepositoryException e) {
LOGGER.info("Unable to get '" + propertyTitle + "' of blog for column", e);
}
}
return StringUtils.EMPTY;
}
示例6: generateCell
import javax.jcr.Item; //导入方法依赖的package包/类
@Override
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
final Item jcrItem = getJcrItem(source, itemId);
if (jcrItem != null && jcrItem.isNode()) {
final Node node = (Node) jcrItem;
try {
if (NodeUtil.isNodeType(node, BlogsNodeTypes.Blog.NAME)) {
// Get identifier from author
final String authorId = PropertyUtil.getString(node, BlogsNodeTypes.Blog.PROPERTY_AUTHOR, StringUtils.EMPTY);
// Find author in contacts and return first name and last name
if (StringUtils.isNotEmpty(authorId)) {
final Optional<Node> authorOptional = readAuthorDetails(authorId);
if (authorOptional.isPresent()) {
final Node author = authorOptional.get();
final StringBuilder nameBuilder = new StringBuilder();
nameBuilder.append(PropertyUtil.getString(author, ContactsNodeTypes.Contact.PROPERTY_FIRST_NAME, StringUtils.EMPTY));
nameBuilder.append(" ");
nameBuilder.append(PropertyUtil.getString(author, ContactsNodeTypes.Contact.PROPERTY_LAST_NAME, StringUtils.EMPTY));
return nameBuilder.toString().trim();
}
}
}
} catch (RepositoryException e) {
LOGGER.warn("Unable to determine node type", e);
}
}
return StringUtils.EMPTY;
}
示例7: getNodes
import javax.jcr.Item; //导入方法依赖的package包/类
@Override
public NodeIterator getNodes() throws RepositoryException {
List<Node> children = new ArrayList<>();
for (Item item : session.getChildren(this))
if (item.isNode())
children.add((Node)item);
return new NodeIteratorImpl(children);
}
示例8: getProperties
import javax.jcr.Item; //导入方法依赖的package包/类
@Override
public PropertyIterator getProperties() throws RepositoryException {
List<Property> children = new ArrayList<>();
for (Item item : session.getChildren(this))
if (!item.isNode())
children.add((Property)item);
return new PropertyIteratorImpl(children);
}
示例9: generateCell
import javax.jcr.Item; //导入方法依赖的package包/类
@Override
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
String link = "";
final Item jcrItem = getJcrItem(source, itemId);
if (jcrItem != null && jcrItem.isNode()) {
link = _vanityUrlService.createPublicUrl((Node) jcrItem);
}
return link;
}
示例10: constructResource
import javax.jcr.Item; //导入方法依赖的package包/类
private Resource constructResource(Item item) {
return (item.isNode()) ? new NodeResourceImpl(this, (Node)item) : new PropertyResourceImpl(this, (Property)item);
}
示例11: isSame
import javax.jcr.Item; //导入方法依赖的package包/类
@Override
public boolean isSame(Item otherItem) throws RepositoryException {
return Objects.equals(path, otherItem.getPath())
&& (isNode() == otherItem.isNode())
&& (isNode() || getParent().isSame(otherItem.getParent()));
}
示例12: canRemoveChildrenRecursive
import javax.jcr.Item; //导入方法依赖的package包/类
/**
* @param userSession the user session
* @param parentPath the parent path
* @param allPrincipals all principals
* @param parentRoles the roles on the parent
* @return true if permitted
*/
private boolean canRemoveChildrenRecursive(final Session userSession,
final String parentPath,
final Set<Principal> allPrincipals,
final Set<String> parentRoles) {
try {
final FedoraSession internalSession = sessionFactory.getInternalSession();
LOGGER.debug("Recursive child remove permission checks for: {}",
parentPath);
final Item item = getJcrSession(internalSession).getItem(parentPath);
if (!item.isNode()) {
// this is a property and has no children...
return true;
}
final Node parent = (Node) item;
if (!parent.hasNodes()) {
return true;
}
final NodeIterator ni = parent.getNodes();
while (ni.hasNext()) {
final Node n = ni.nextNode();
// are there unique roles?
final Set<String> roles;
final Map<String, Collection<String>> acl = accessRolesProvider.getRoles(n, false);
if (acl != null) {
roles = resolveUserRoles(acl, allPrincipals);
} else {
roles = parentRoles;
}
if (rolesHavePermission(userSession, n.getPath(),
REMOVE_ACTIONS,
roles)) {
if (!canRemoveChildrenRecursive(userSession, n.getPath(),
allPrincipals, roles)) {
return false;
}
} else {
LOGGER.info("Remove permission denied at {} with roles {}", n.getPath(), roles);
return false;
}
}
return true;
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(
"Cannot lookup child permission check information for " +
parentPath, e);
}
}