merge repo branch

This commit is contained in:
Michael Hunger
2011-03-29 14:12:34 +02:00
53 changed files with 669 additions and 239 deletions

View File

@@ -16,7 +16,7 @@
The aspect introduces some internal fields and some public methods (<xref linkend="reference:programming-model:introduced-methods"/>)
to the entities for accessing the backing
state via <code>getPersistentState()</code> and creating relationships with <code>relateTo</code>
and retrieving relationship entities via <code>getRelationshipTo</code>. It also introduces finder methods like
and retrieving relationship entities via <code>getRelationshipTo</code>. It also introduces graphRepository methods like
<code>find(Class&lt;? extends NodeEntity&gt;, TraversalDescription)</code>
and equals and hashCode delegation.
</para>

View File

@@ -43,21 +43,21 @@
The <code>Finder</code> instances are created via a FinderFactory to be bound to a concrete node or relationship entity class.
The <code>FinderFactory</code> is configured in the Spring context and can be injected.
<programlisting language="java"><![CDATA[
NodeFinder<Person> finder = finderFactory.createNodeEntityFinder(Person.class);
NodeFinder<Person> graphRepository = graphRepositoryFactory.createNodeEntityFinder(Person.class);
Person dave=finder.findById(123);
Person dave=graphRepository.findById(123);
long numberOfPeople = finder.count();
long numberOfPeople = graphRepository.count();
Person mark = finder.findByPropertyValue(null,"name", "mark");
Person mark = graphRepository.findByPropertyValue(null,"name", "mark");
Iterable<Person> devs = finder.findAllByProperyValue(null, "occupation","developer");
Iterable<Person> devs = graphRepository.findAllByProperyValue(null, "occupation","developer");
Iterable<Person> middleAgedPeople = finder.findAllByRange(null, "age",20,40);
Iterable<Person> middleAgedPeople = graphRepository.findAllByRange(null, "age",20,40);
Iterable<Person> aTeam = finder.findAllByQuery(null, "name","A*");
Iterable<Person> aTeam = graphRepository.findAllByQuery(null, "name","A*");
Iterable<Person> davesFriends = finder.findAllByTraversal(dave,
Iterable<Person> davesFriends = graphRepository.findAllByTraversal(dave,
Traversal.description().pruneAfterDepth(1)
.relationships(KNOWS).filter(returnAllButStartNode()));
]]></programlisting>

View File

@@ -27,7 +27,7 @@
</para>
<para>
Query access to the index happens with the Node- and RelationshipFinders that are created via an instance of
<code>org.springframework.data.graph.neo4j.finder.FinderFactory</code>. The methods
<code>org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory</code>. The methods
<code>findByPropertyValue</code> and <code>findAllByPropertyValue</code> work on the exact indexes and
return the first or all matches. To do range queries, use <code>findAllByRange</code> (please note that
currently both values are inclusive).
@@ -44,13 +44,13 @@ class Person {
}
NodeFinder<Person> finder = finderFactory.createNodeEntityFinder(Person.class);
NodeFinder<Person> graphRepository = graphRepositoryFactory.createNodeEntityFinder(Person.class);
// exact finder
Person mark = finder.findByProperyValue("people","name","mark");
// exact graphRepository
Person mark = graphRepository.findByProperyValue("people","name","mark");
// numeric range queries
for (Person middleAgedDeveloper : finder.findAllByRange(null, "age", 20, 40)) {
for (Person middleAgedDeveloper : graphRepository.findAllByRange(null, "age", 20, 40)) {
Developer developer=middleAgedDeveloper.projectTo(Developer.class);
}
]]></programlisting>
@@ -76,10 +76,10 @@ class Person {
String name;
}
NodeFinder<Person> finder = finderFactory.createNodeEntityFinder(Person.class);
NodeFinder<Person> graphRepository = graphRepositoryFactory.createNodeEntityFinder(Person.class);
// exact finder
Person mark = finder.findAllByQuery("people-search","name","ma*");
// exact graphRepository
Person mark = graphRepository.findAllByQuery("people-search","name","ma*");
]]></programlisting>
</para>
<note>

View File

@@ -33,7 +33,7 @@ class Trainee {
Set<Training> trainings;
}
for (Person person : finder.findAllByProperyValue("occupation","developer")) {
for (Person person : graphRepository.findAllByProperyValue("occupation","developer")) {
Developer developer = person.projectTo(Developer.class);
if (developer.isJavaDeveloper()) {
trainInSpringData(developer.projectTo(Trainee.class));