本文整理汇总了Java中org.neo4j.graphdb.NotFoundException类的典型用法代码示例。如果您正苦于以下问题:Java NotFoundException类的具体用法?Java NotFoundException怎么用?Java NotFoundException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotFoundException类属于org.neo4j.graphdb包,在下文中一共展示了NotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
);
}
示例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();
}
}
示例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" ) );
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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
);
}
示例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" ) );
}
}