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

Java NotFoundException类代码示例

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

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



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

示例1: convert

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
public Error convert(final Exception exception) {
    Class errorClass = exception.getClass();
    Class causeClass;

    if (errorClass.equals(ConstraintViolationException.class)) {
        causeClass = exception.getCause().getClass();

        /*if (causeClass.equals(UniqueConstraintViolationKernelException.class)) {
            return analyseUniqueConstraintViolation((ConstraintViolationException) exception);
        }*/
    }
    else if (errorClass.equals(NotFoundException.class)) {
        return analyseNotFound((NotFoundException) exception);
    }

    return new Error(
            Error.EXCEPTION,
            exception.getMessage()
    );
}
 
开发者ID:owetterau,项目名称:neo4j-websockets,代码行数:21,代码来源:ExceptionToErrorConverter.java


示例2: shouldNotBeAbleToIndexNodeThatIsNotCommitted

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
@Ignore( "an issue that should be fixed at some point" )
@Test( expected = NotFoundException.class )
public void shouldNotBeAbleToIndexNodeThatIsNotCommitted() throws Exception
{
    Index<Node> index = nodeIndex(
            LuceneIndexImplementation.EXACT_CONFIG );
    Node node = graphDb.createNode();
    String key = "noob";
    String value = "Johan";

    WorkThread thread = new WorkThread( "other thread", index, graphDb, node );
    thread.beginTransaction();
    try
    {
        thread.add( node, key, value );
    }
    finally
    {
        thread.rollback();
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:22,代码来源:TestLuceneIndex.java


示例3: shouldThrowIllegalStateForActionsAfterDeletedOnIndex

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
@Test
public void shouldThrowIllegalStateForActionsAfterDeletedOnIndex()
{
    restartTx();
    index.delete();
    restartTx();
    try
    {
        index.query( key, "own" );
        fail( "Should fail" );
    }
    catch ( NotFoundException e )
    {
        assertThat( e.getMessage(), containsString( "doesn't exist" ) );
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:17,代码来源:TestIndexDeletion.java


示例4: getNodeById

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
public Node getNodeById( long id )
{
    NodeBatchImpl node = nodes.get( id );
    if ( node == null )
    {
        try
        {
            node = new NodeBatchImpl( id, this,
                batchInserter.getNodeProperties( id ) );
            nodes.put( id, node );
        }
        catch ( InvalidRecordException e )
        {
            throw new NotFoundException( e );
        }
    }
    return node;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:19,代码来源:BatchGraphDatabaseImpl.java


示例5: getRelationshipById

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
public Relationship getRelationshipById( long id )
{
    RelationshipBatchImpl rel = rels.get( id );
    if ( rel == null )
    {
        try
        {
            SimpleRelationship simpleRel =
                batchInserter.getRelationshipById( id );
            Map<String,Object> props =
                batchInserter.getRelationshipProperties( id );
            rel = new RelationshipBatchImpl( simpleRel, this, props );
            rels.put( id, rel );
        }
        catch ( InvalidRecordException e )
        {
            throw new NotFoundException( e );
        }
    }
    return rel;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:22,代码来源:BatchGraphDatabaseImpl.java


示例6: getSingleRelationship

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
public Relationship getSingleRelationship( RelationshipType type,
    Direction dir )
{
    Iterator<Relationship> relItr =
        newRelIterator( dir, new RelationshipType[] { type } );
    if ( relItr.hasNext() )
    {
        Relationship rel = relItr.next();
        if ( relItr.hasNext() )
        {
            throw new NotFoundException( "More than one relationship[" +
                type + ", " + dir + "] found for " + this );
        }
        return rel;
    }
    return null;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:18,代码来源:BatchGraphDatabaseImpl.java


示例7: renameFile

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
public static boolean renameFile( File srcFile, File renameToFile )
{
    if ( !srcFile.exists() )
    {
        throw new NotFoundException( "Source file[" + srcFile.getName()
                + "] not found" );
    }
    if ( renameToFile.exists() )
    {
        throw new NotFoundException( "Target file[" + renameToFile.getName()
                + "] already exists" );
    }
    int count = 0;
    boolean renamed = false;
    do
    {
        renamed = srcFile.renameTo( renameToFile );
        if ( !renamed )
        {
            count++;
            waitSome();
        }
    }
    while ( !renamed && count <= WINDOWS_RETRY_COUNT );
    return renamed;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:27,代码来源:FileUtils.java


示例8: getSingleRelationship

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
public Relationship getSingleRelationship( NodeManager nodeManager, RelationshipType type,
    Direction dir )
{
    DirectionWrapper direction = RelIdArray.wrap( dir );
    RelationshipType types[] = new RelationshipType[] { type };
    Iterator<Relationship> rels = new IntArrayIterator( getAllRelationshipsOfType( nodeManager,
            direction, types ), this, direction, nodeManager, types, !hasMoreRelationshipsToLoad() );
    if ( !rels.hasNext() )
    {
        return null;
    }
    Relationship rel = rels.next();
    if ( rels.hasNext() )
    {
        throw new NotFoundException( "More than one relationship[" +
            type + ", " + dir + "] found for " + this );
    }
    return rel;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:20,代码来源:NodeImpl.java


示例9: getIndexFor

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
public PropertyIndex getIndexFor( int keyId )
{
    PropertyIndex index = idToIndexMap.get( keyId );
    if ( index == null )
    {
        TxCommitHook commitHook = txCommitHooks.get( getTransaction() );
        if ( commitHook != null )
        {
            index = commitHook.getIndex( keyId );
            if ( index != null )
            {
                return index;
            }
        }
        String indexString;
        indexString = persistenceManager.loadIndex( keyId );
        if ( indexString == null )
        {
            throw new NotFoundException( "Index not found [" + keyId + "]" );
        }
        index = new PropertyIndex( indexString, keyId );
        addPropertyIndex( index );
    }
    return index;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:26,代码来源:PropertyIndexManager.java


示例10: hasNext

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
@Override
public synchronized boolean hasNext()
{
    while ( currentNode == null && currentNodeId <= highId )
    {
        try
        {
            currentNode = getNodeById( currentNodeId++ );
        }
        catch ( NotFoundException e )
        {
            // ok we try next
        }
    }
    return currentNode != null;
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-mobile-android,代码行数:17,代码来源:EmbeddedGraphDbImpl.java


示例11: isSingleValue

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
@Override
public boolean isSingleValue() {
	// TODO handle false Metadata
	String value = "";
	try (Transaction tx = mRepo.beginTx()) {
		value = (String) mMe.getProperty(KEY_META_CARDINALITY);
		tx.success();
	} catch (NotFoundException e) {
		log.warn("This Metadata does not has the Cardinality-Property set! "
				+ this);
	}
	if (value.equals(VALUE_META_CARDINALITY_SINGLE)) {
		return true;
	}
	return false;
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:17,代码来源:Neo4JMetadata.java


示例12: getDeleteTimestamp

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
@Override
public long getDeleteTimestamp() {
	// TODO handle false Metadata
	if(this.isNotify()) {
		return getPublishTimestamp();
	}
	String value = "";
	try (Transaction tx = mRepo.beginTx()) {
		value = mMe.getProperty(KEY_TIMESTAMP_DELETE,
				InternalMetadata.METADATA_NOT_DELETED_TIMESTAMP + "")
				.toString();
		tx.success();
	} catch (NotFoundException e) {
		log.warn("This Metadata does not has a DeleteTimestamp! " + this);
	}
	return Long.parseLong(value);
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:18,代码来源:Neo4JMetadata.java


示例13: getStatementForASTNode

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
public static Node getStatementForASTNode(Node node)
{
	Node n = node;
	Node parent = node;

	while (true)
	{

		try
		{
			Object property = n.getProperty(NodeKeys.IS_CFG_NODE);
			return n;
		}
		catch (NotFoundException ex)
		{

		}

		Iterable<Relationship> rels = n
				.getRelationships(Direction.INCOMING);
		for (Relationship rel : rels)
		{
			parent = rel.getStartNode();
			break;
		}

		if (n == parent)
			return null;
		n = parent;
	}
}
 
开发者ID:RUB-SysSec,项目名称:EvilCoder,代码行数:32,代码来源:Traversals.java


示例14: analyseNotFound

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
protected Error analyseNotFound(final NotFoundException notFoundException) {
    ObjectNode detailsNode = jsonObjectMapper.getObjectMapper().createObjectNode();

    return new Error(
            Error.NOT_FOUND,
            notFoundException.getMessage(),
            detailsNode
    );
}
 
开发者ID:owetterau,项目名称:neo4j-websockets,代码行数:10,代码来源:ExceptionToErrorConverter.java


示例15: shouldThrowIllegalStateForActionsAfterDeletedOnIndex2

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
@Test
public void shouldThrowIllegalStateForActionsAfterDeletedOnIndex2()
{
    restartTx();
    index.delete();
    restartTx();
    try
    {
        index.add( node, key, value );
    }
    catch ( NotFoundException e )
    {
        assertThat( e.getMessage(), containsString( "doesn't exist" ) );
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:16,代码来源:TestIndexDeletion.java


示例16: activate

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
@Override
public void activate(final Collection<Neo4jPosLengthMatch> matches) {
	for (final Neo4jPosLengthMatch match : matches) {
		final Node segment = match.getSegment();
		try {
			final Number lengthNumber = (Number) segment.getProperty(ModelConstants.LENGTH);
			final int length = Neo4jHelper.numberToInt(lengthNumber);

			segment.setProperty(ModelConstants.LENGTH, -length + 1);
		} catch (final NotFoundException e) {
			// do nothing (node has been removed)
		}
	}
}
 
开发者ID:FTSRG,项目名称:trainbenchmark,代码行数:15,代码来源:Neo4jApiTransformationRepairPosLength.java


示例17: activate

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
@Override
public void activate(final Collection<Neo4jPosLengthMatch> matches) throws IOException {
	for (final Neo4jPosLengthMatch match : matches) {
		try {
			final Map<String, Object> parameters = ImmutableMap.of( //
				QueryConstants.VAR_SEGMENT, match.getSegment() //
			);
			driver.runTransformation(transformationDefinition, parameters);
		} catch (final NotFoundException e) {
			// do nothing (node has been removed)
		}
	}
}
 
开发者ID:FTSRG,项目名称:trainbenchmark,代码行数:14,代码来源:Neo4jCypherTransformationRepairPosLength.java


示例18: get

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
/**
 * GET Node {"id": …}
 *
 * Fetch a single node by ID.
 */
@Override
public PropertyContainer get(RequestInterface request, DatabaseInterface database) throws ClientError, ServerError {
    long id = resolveNode(database, request.getArgument("id")).getId();
    try {
        Node node = database.getNode(id);
        responder.sendBody(node);
        return node;
    } catch (NotFoundException ex) {
        throw new ClientError("Node " + id + " not found");
    }
}
 
开发者ID:technige,项目名称:zerograph,代码行数:17,代码来源:NodeResource.java


示例19: set

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
/**
 * SET Node {"id": …, "labels": …, "properties": …}
 *
 * Replace all labels and properties on a node identified by ID.
 * This will not create a node with the given ID if one does not
 * already exist.
 */
@Override
public PropertyContainer set(RequestInterface request, DatabaseInterface database) throws ClientError, ServerError {
    long id = resolveNode(database, request.getArgument("id")).getId();
    List labelNames = request.getArgumentAsList("labels");
    Map<String, Object> properties = request.getArgumentAsMap("properties");
    try {
        Node node = database.putNode(id, labelNames, properties);
        responder.sendBody(node);
        return node;
    } catch (NotFoundException ex) {
        throw new ClientError("Node " + id + " not found");
    }
}
 
开发者ID:technige,项目名称:zerograph,代码行数:21,代码来源:NodeResource.java


示例20: patch

import org.neo4j.graphdb.NotFoundException; //导入依赖的package包/类
/**
 * PATCH Node {"id": …, "labels": …}
 * PATCH Node {"id": …, "properties": …}
 * PATCH Node {"id": …, "labels": …, "properties": …}
 *
 * Add new labels and properties to a node identified by ID.
 * This will not create a node with the given ID if one does not
 * already exist and any existing labels and properties will be
 * maintained.
 */
@Override
public PropertyContainer patch(RequestInterface request, DatabaseInterface database) throws ClientError, ServerError {
    long id = resolveNode(database, request.getArgument("id")).getId();
    List labelNames = request.getArgumentAsList("labels", new ArrayList());
    Map<String, Object> properties = request.getArgumentAsMap("properties", new HashMap<String, Object>());
    try {
        Node node = database.patchNode(id, labelNames, properties);
        responder.sendBody(node);
        return node;
    } catch (NotFoundException ex) {
        throw new ClientError("Node " + id + " not found");
    }
}
 
开发者ID:technige,项目名称:zerograph,代码行数:24,代码来源:NodeResource.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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