当前位置: 首页>>代码示例>>Java>>正文


Java Item.isNode方法代码示例

本文整理汇总了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;
}
 
开发者ID:gtenham,项目名称:magnolia-templating,代码行数:26,代码来源:PagePathColumnFormatter.java

示例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;
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:19,代码来源:NTColumnFormatter.java

示例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;
}
 
开发者ID:aperto,项目名称:magnolia-vanity-url,代码行数:18,代码来源:FolderUrlNameColumnFormatter.java

示例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;
}
 
开发者ID:tricode,项目名称:magnolia-news,代码行数:28,代码来源:GenericColumnFormatter.java

示例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;
}
 
开发者ID:tricode,项目名称:magnolia-blog,代码行数:29,代码来源:BlogColumnFormatterUtil.java

示例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;
}
 
开发者ID:tricode,项目名称:magnolia-blog,代码行数:34,代码来源:AuthorNameColumnFormatter.java

示例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);
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:9,代码来源:NodeImpl.java

示例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);
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:9,代码来源:NodeImpl.java

示例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;
}
 
开发者ID:aperto,项目名称:magnolia-vanity-url,代码行数:12,代码来源:LinkColumnFormatter.java

示例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);
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:4,代码来源:ResourceResolverImpl.java

示例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()));
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:7,代码来源:ItemImpl.java

示例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);
    }
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:57,代码来源:AbstractRolesAuthorizationDelegate.java


注:本文中的javax.jcr.Item.isNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。