• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Item类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.jcr.Item的典型用法代码示例。如果您正苦于以下问题:Java Item类的具体用法?Java Item怎么用?Java Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Item类属于javax.jcr包,在下文中一共展示了Item类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: buildParams

import javax.jcr.Item; //导入依赖的package包/类
@Override
protected Map<String, Object> buildParams(final Item jcrItem) {
    Map<String, Object> params = super.buildParams(jcrItem);
    params.put(ExportCommand.EXPORT_EXTENSION, ".xml");
    params.put(ExportCommand.EXPORT_FORMAT, Boolean.TRUE);
    params.put(ExportCommand.EXPORT_KEEP_HISTORY, Boolean.FALSE);
    try {
        if (getItems().size() > 1) {
            params.put(ExportCommand.EXPORT_OUTPUT_STREAM, new FileOutputStream(fileOutput));
        } else {
            params.put(ExportCommand.EXPORT_OUTPUT_STREAM, tempFileStreamResource.getTempFileOutputStream());
        }
    } catch (IOException e) {
        throw new IllegalStateException("Failed to bind command to temp file output stream: ", e);
    }
    return params;
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:18,代码来源:ExportMultipleAction.java


示例4: 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


示例5: 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


示例6: 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


示例7: 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


示例8: generateCell

import javax.jcr.Item; //导入依赖的package包/类
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    // QueryableJcrContainer container = (QueryableJcrContainer) source.getContainerDataSource();
    // container.getReferencePath()
    final Item jcrItem = getJcrItem(source, itemId);
    if (jcrItem != null) {
        try {
            return createLinkButton(jcrItem.getPath(), jcrItem.getSession().getWorkspace().getName(), jcrItem.getPath(), subAppContext, adminEventBus, eventBus, module);
        } catch (RepositoryException re) {
            log.info("Failed to retrieve path for item '{}':", jcrItem.toString(), re);
        }
    }
    return null;

}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:16,代码来源:ListViewLinkToPathColumnFormatter.java


示例9: getRootItemIds

import javax.jcr.Item; //导入依赖的package包/类
@Override
public Collection<Item> getRootItemIds() throws RepositoryException {
    if (StringUtils.isNotBlank(getPagePath())) {
        ArrayList<Item> rootIds = new ArrayList<>();
        rootIds.add(getRootNode());
        return rootIds;
    }
    return getChildren(getRootNode());
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:10,代码来源:RootableHierarchicalJcrContainer.java


示例10: isRoot

import javax.jcr.Item; //导入依赖的package包/类
@Override
public boolean isRoot(Item item) throws RepositoryException {
    if (item != null) {
        try {
            int rootDepth = getRootNode().getDepth();
            if (StringUtils.isBlank(getPagePath())) {
                rootDepth++;
            }
            return item.getDepth() <= rootDepth;
        } catch (RepositoryException e) {
            handleRepositoryException(log, "Cannot determine depth of jcr item", e);
        }
    }
    return true;
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:16,代码来源:RootableHierarchicalJcrContainer.java


示例11: getCustomReplacement

import javax.jcr.Item; //导入依赖的package包/类
private JsonNode getCustomReplacement(Item item) {
    try {
        final String path = item.getPath();

        Optional<String> keyOptional = config.customInserts.keySet().stream()
                .filter(pathSuffix -> path.endsWith(pathSuffix)).findFirst();
        if (keyOptional.isPresent())
            return config.customInserts.get(keyOptional.get());
    } catch (RepositoryException e) {
        log.debug("Failed to get path of JCR item", e);
    }

    return null;
}
 
开发者ID:rah003,项目名称:neat-jsonfn,代码行数:15,代码来源:JsonBuilder.java


示例12: removeItem

import javax.jcr.Item; //导入依赖的package包/类
Item removeItem(@Nonnull ItemImpl item) {
    changedItems.add(item.getParentImpl().getPath());
    for (ItemImpl descendant : getDescendants(item))
        itemStore.remove(descendant.getPath());
    itemStore.remove(item.getPath());
    return item;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:SessionImpl.java


示例13: getChildren

import javax.jcr.Item; //导入依赖的package包/类
List<Item> getChildren(Item parent) {
    List<Item> children = new ArrayList<>();
    for (ItemImpl item : itemStore.values())
        if (item.getParentImpl() == parent)
            children.add(item);
    return children;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:SessionImpl.java


示例14: 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


示例15: 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


示例16: getAncestor

import javax.jcr.Item; //导入依赖的package包/类
@Override
@Nullable
public Item getAncestor(int depth) throws ItemNotFoundException, RepositoryException {
    int myDepth = getDepth();
    if (depth > myDepth) throw new ItemNotFoundException();
    return (depth < myDepth) ? ((NodeImpl)getParent()).getAncestor(depth) : null;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:ItemImpl.java


示例17: 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


示例18: getItem

import javax.jcr.Item; //导入依赖的package包/类
/**
 * @see org.springframework.extensions.jcr.JcrOperations#getItem(java.lang.String)
 */
@Override
public Item getItem(final String absPath) {
    return execute(new JcrCallback<Item>() {
        /**
         * @see JcrCallback#doInJcr(javax.jcr.Session)
         */
        @Override
        public Item doInJcr(Session session) throws RepositoryException {
            return session.getItem(absPath);
        }
    }, true);
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:16,代码来源:JcrTemplate.java


示例19: 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);

    return GenericColumnFormatter.generateCellHelper(jcrItem, NewsNodeTypes.News.NAME, NewsNodeTypes.News.PROPERTY_TITLE);
}
 
开发者ID:tricode,项目名称:magnolia-news,代码行数:7,代码来源:NewsTitleColumnFormatter.java


示例20: generateCell

import javax.jcr.Item; //导入依赖的package包/类
public Object generateCell(final Table source, final Object itemId, final Object columnId) {
    final Item jcrItem = getJcrItem(source, itemId);

    return BlogColumnFormatterUtil.generateCellHelper(jcrItem, BlogsNodeTypes.Blog.NAME, BlogsNodeTypes.Blog.PROPERTY_TITLE);
}
 
开发者ID:tricode,项目名称:magnolia-blog,代码行数:6,代码来源:BlogNameColumnFormatter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RelDataTypeSystem类代码示例发布时间:2022-05-22
下一篇:
Java PackedInts类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap