本文整理汇总了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;
}
示例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: 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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}