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

Java ItemNotFoundException类代码示例

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

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



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

示例1: getNode

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
private Node getNode(final String baseResourcePath, final String label) throws RepositoryException {
    try {
        final Node frozenNode = getJcrSession(session).getNodeByIdentifier(label);

        /*
         * We found a node whose identifier is the "label" for the version.  Now
         * we must do due diligence to make sure it's a frozen node representing
         * a version of the subject node.
         */
        final Property p = frozenNode.getProperty("jcr:frozenUuid");
        if (p != null) {
            final Node subjectNode = getJcrSession(session).getNode(baseResourcePath);
            if (p.getString().equals(subjectNode.getIdentifier())) {
                return frozenNode;
            }
        }

    } catch (final ItemNotFoundException ex) {
        /*
         * the label wasn't a uuid of a frozen node but
         * instead possibly a version label.
         */
    }
    return null;
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:26,代码来源:HttpResourceConverter.java


示例2: createNode

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
private NodeImpl createNode(@Nonnull String path, @Nonnull Map<String, Object> properties) throws ItemNotFoundException, ItemExistsException {
    NodeImpl node = new NodeImpl((SessionImpl)session, path);

    for (String propName : properties.keySet()) {
        Object mapVal = properties.get(propName);
        setNodeProperty(node, propName, mapVal);
    }
    return node;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:10,代码来源:ResourceResolverImpl.java


示例3: getAncestor

import javax.jcr.ItemNotFoundException; //导入依赖的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


示例4: getParent

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Override
@Nonnull
public Node getParent() throws ItemNotFoundException, RepositoryException {
    if (session.getRootNode() == this) throw new ItemNotFoundException();
    if (Strings.isNullOrEmpty(Paths.parent(path))) return session.getRootNode();
    return session.getNode(Paths.parent(path));
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:8,代码来源:ItemImpl.java


示例5: checkPermission

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Deprecated
@Override
public void checkPermission(ItemId id, int permissions)
        throws AccessDeniedException, ItemNotFoundException,
        RepositoryException {
    out(String.format("checkPermission %s %s", id, permissions));
    if(!isGranted(id, permissions)) {
        throw new AccessDeniedException(String.format(
                "access denied on %s with permissions %s", id, permissions));
    }
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:12,代码来源:AorraAccessManager.java


示例6: isGranted

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Deprecated
@Override
public boolean isGranted(ItemId id, int permissions)
        throws ItemNotFoundException, RepositoryException {
    out(String.format("isGranted %s %s", id, permissions));
    Permission p = getPermission(id);
    boolean result;
    result = (permissions == org.apache.jackrabbit.core.security.authorization.Permission.READ)
            ?p.isRead():p.isWrite();
    out("isGranted: "+result);
    return result;
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:13,代码来源:AorraAccessManager.java


示例7: grant

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
public void grant(Principal principal, String path, Permission permission) throws RepositoryException {
    ItemId id = resolvePath(ctx.getNamePathResolver().getQPath(path));
    if(id != null) {
        PermissionStore.getInstance().grant(ctx.getSession(), "default", principal.getName(), id.toString(), permission);
    } else {
        throw new ItemNotFoundException(String.format("could not resolve path %s to id", path));
    }
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:9,代码来源:AorraAccessManager.java


示例8: sendNotification

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
private void sendNotification(Session session, User to, String msg)
    throws ItemNotFoundException, RepositoryException {
  NotificationDAO notificationDao = new NotificationDAO(session, jcrom);
  Notification notification = new Notification(to, msg);
  notificationDao.create(notification);
  session.save();
  fileStore.getEventManager().tell(Events.create(notification));
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:9,代码来源:NotifierImpl.java


示例9: getWebResourceGroupForNode

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
public String getWebResourceGroupForNode(Node childNode)
		throws RepositoryException {

	if (childNode.isNodeType(WebResourceGroup.NODE_TYPE)) {
		return childNode.getProperty(WebResourceGroup.NAME).getString();
	}
	int depth = childNode.getDepth();
	if (depth > 0) {
		return getWebResourceGroupForNode(childNode.getParent());
	} else {
		throw new ItemNotFoundException();
	}
}
 
开发者ID:bobpaulin,项目名称:sling-web-resource,代码行数:14,代码来源:WebResourceInventoryManagerImpl.java


示例10: getFrozenNode

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
private Node getFrozenNode(final String label) throws RepositoryException {
    try {
        final Session session = getSession();

        final Node frozenNode = session.getNodeByIdentifier(label);

        final String baseUUID = getNode().getIdentifier();

        /*
         * We found a node whose identifier is the "label" for the version.  Now
         * we must do due dilligence to make sure it's a frozen node representing
         * a version of the subject node.
         */
        final Property p = frozenNode.getProperty(JCR_FROZEN_UUID);
        if (p != null) {
            if (p.getString().equals(baseUUID)) {
                return frozenNode;
            }
        }
        /*
         * Though a node with an id of the label was found, it wasn't the
         * node we were looking for, so fall through and look for a labeled
         * node.
         */
    } catch (final ItemNotFoundException ex) {
        /*
         * the label wasn't a uuid of a frozen node but
         * instead possibly a version label.
         */
    }
    return null;
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:33,代码来源:FedoraResourceImpl.java


示例11: badProperty

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Test(expected = RepositoryException.class)
public void badProperty() throws AccessDeniedException,
                         ItemNotFoundException, RepositoryException {
    when(mockProperty.getParent()).thenThrow(
            new RepositoryException("Bad property!"));
    // we exhaust the mock of mockProperty.getParent() to replace it with an
    // exception
    mockProperty.getParent();
    createSingleValuedLiteralTriple();
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:11,代码来源:PropertyToTripleTest.java


示例12: testDoForwardWithExplicitVersionedDatastream

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Test
public void testDoForwardWithExplicitVersionedDatastream() throws Exception {
    when(session.getNodeByIdentifier("x")).thenThrow(new ItemNotFoundException());
    when(mockVersionManager.getVersionHistory("/" + path)).thenReturn(mockVersionHistory);
    when(mockVersionHistory.hasVersionLabel("x")).thenReturn(true);
    when(mockVersionHistory.getVersionByLabel("x")).thenReturn(mockVersion);
    when(mockVersion.getFrozenNode()).thenReturn(versionedNode);
    final FedoraResource converted = converter.convert(versionedResource);
    assertEquals(versionedNode, getJcrNode(converted));
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:11,代码来源:HttpResourceConverterTest.java


示例13: testDoForwardWithMissingVersionedDatastream

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Test(expected = RepositoryRuntimeException.class)
public void testDoForwardWithMissingVersionedDatastream() throws Exception {
    when(session.getNodeByIdentifier("x")).thenThrow(new ItemNotFoundException());
    when(mockVersionManager.getVersionHistory("/" + path)).thenReturn(mockVersionHistory);
    when(mockVersionHistory.hasVersionLabel("x")).thenReturn(false);
    converter.convert(versionedResource);
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:8,代码来源:HttpResourceConverterTest.java


示例14: checkId

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
protected Node checkId(String id) throws NotFoundException {
	// TODO improve
	try {
		return getTemplate().getNodeByUUID(id);
	} catch (DataRetrievalFailureException e) {
		if (e.getCause() instanceof ItemNotFoundException) {
			throw new NotFoundException("Id '" + id + "' not found");
		}
		
		throw e;
	}		
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:13,代码来源:AbstractJcrDao.java


示例15: internalGetEntity

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
private T internalGetEntity(String id) throws RepositoryException {
	Node n = null;
	try {
		n = session.getNodeByIdentifier(id);
	} catch (ItemNotFoundException e) {
		// else: no matching node found -> ignore exception.
	}

	return getEntity(n);
}
 
开发者ID:hlta,项目名称:playweb,代码行数:11,代码来源:EntityManagerImpl.java


示例16: getAncestorWithFiveThrowsException

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Test(expected = ItemNotFoundException.class)
public void getAncestorWithFiveThrowsException() throws Exception {
	Node testObj = aNode("/content/ko/foobar");
	
	testObj.getAncestor(5);
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:7,代码来源:NodeTestDriver.java


示例17: getAncestorWithNegativeValueThrowsException

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Test(expected = ItemNotFoundException.class)
public void getAncestorWithNegativeValueThrowsException() throws Exception {
	Node testObj = aNode("/content/ko/foobar");
	
	testObj.getAncestor(-10);
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:7,代码来源:NodeTestDriver.java


示例18: getPrimaryItemThrowsException

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Test(expected = ItemNotFoundException.class)
public void getPrimaryItemThrowsException() throws Exception {
	Node testObj = aNode("/content");
	
	testObj.getPrimaryItem();
}
 
开发者ID:quatico-solutions,项目名称:aem-testing,代码行数:7,代码来源:NodeTestDriver.java


示例19: getNodeByUUID

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Override
public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException {
    return null;  //TODO: Implement IDs
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:SessionImpl.java


示例20: getNodeByIdentifier

import javax.jcr.ItemNotFoundException; //导入依赖的package包/类
@Override
public Node getNodeByIdentifier(String id) throws ItemNotFoundException, RepositoryException {
    return null;  //TODO: Implement IDs
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:SessionImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java IoSessionConfig类代码示例发布时间:2022-05-22
下一篇:
Java FileAsset类代码示例发布时间: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