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


Java Item类代码示例

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


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


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