return (T) app.get(map.get(GraphObject.id));
} else {
throw new FrameworkException(type.getSimpleName(), new IdNotFoundToken(source));
}
} else if (source instanceof GraphObject) {
GraphObject obj = (GraphObject)source;
if (propertyKey != null) {
results = (Result<T>) app.nodeQuery(NodeInterface.class).and(propertyKey, obj.getProperty(propertyKey)).getResult();
} else {
// fetch property key for "id", may be different for AbstractNode and AbstractRelationship!
PropertyKey<String> idProperty = StructrApp.getConfiguration().getPropertyKeyForDatabaseName(obj.getClass(), GraphObject.id.dbName());
return (T) app.get(obj.getProperty(idProperty));
}
} else {
return (T) app.get(source.toString());
}
int size = results.size();
switch (size) {
case 0 :
throw new FrameworkException(type.getSimpleName(), new IdNotFoundToken(source));
case 1 :
return results.get(0);
default :