The Query API is deprecated and the search API should be used instead. +
+As is custom for every framework, querying the model must be possible. Strolch queries are implemented using
- the StrolchQuery
interface and one of its concrete implementations: ResourceQuery
,
+ the StrolchQuery
interface and one of its concrete implementations: ResourceQuery
,
OrderQuery
, ActivityQuery
.
A Strolch element always has two identifiers: Type
and Id
. The type is important as
- it classifies an element. So if a car and a house would be modelled in Strolch, then those would both be a
+ it classifies an element. So if a car and a house would be modelled in Strolch, then those would both be a
Resource
, but one of type Car
and the other of type House
. Both would
- have different parameters.
Thus one of the inputs for every query is it's type, which is defined as the navigation. It is said that we - navigate to the Cars, or Houses. Thus when instantiating a ResourceQuery, pass the navigation to the type of - Resource as well. Same applies for Orders and Activities.
+ navigate to the Cars, or Houses. Thus when instantiating a ResourceQuery, pass the navigation to the type of + Resource as well. Same applies for Orders and Activities.Further input for a StrolchQuery are the selections. These selections get translated into RDBMS
WHERE
clauses. Selections support boolean operations thus allowing for complex querying.
StrolchQueries also support Ordering and object transformation. Following classes provide the most used - scenarios:
+ scenarios:OrderById
OrderByName
@@ -80,7 +82,7 @@
*ToFlatJsonVisitor
+
Example: Query all resources of type Car:
try (StrolchTransaction tx = openTx()) { @@ -89,7 +91,7 @@ try (StrolchTransaction tx = openTx()) { List<Resource> cars = tx.doQuery(query); }-
+
Example: Query all resources of type Car, order by Name and transform to JSON:
try (StrolchTransaction tx = openTx()) { @@ -99,7 +101,7 @@ try (StrolchTransaction tx = openTx()) { List<JsonObject> cars = tx.doQuery(query); }-
+
the previous example can also be written as follows:
try (StrolchTransaction tx = openTx()) { @@ -110,7 +112,7 @@ try (StrolchTransaction tx = openTx()) { List<JsonObject> cars = tx.doQuery(query); }-
+
Example: Query all resources of type Car with color blue:
try (StrolchTransaction tx = openTx()) { @@ -119,7 +121,7 @@ try (StrolchTransaction tx = openTx()) { List<Resource> cars = tx.doQuery(query); }-
+
Example: Query all resources of type Car which are not blue:
try (StrolchTransaction tx = openTx()) { @@ -128,7 +130,7 @@ try (StrolchTransaction tx = openTx()) { List<Resource> cars = tx.doQuery(query); }-
+
Example: Query all resources of type Car with color blue or yellow:
try (StrolchTransaction tx = openTx()) { @@ -139,7 +141,7 @@ try (StrolchTransaction tx = openTx()) { List<Resource> cars = tx.doQuery(query); }-
+
Example: Query all resources of type Car with color blue or yellow owned by Jill:
try (StrolchTransaction tx = openTx()) { @@ -192,7 +194,7 @@ try (StrolchTransaction tx = openTx()) { s.parentNode.insertBefore(g, s); })(); - + diff --git a/li.strolch.website/www.strolch.li/documentation-searches.html b/li.strolch.website/www.strolch.li/documentation-searches.html new file mode 100644 index 000000000..cbc15c7fe --- /dev/null +++ b/li.strolch.website/www.strolch.li/documentation-searches.html @@ -0,0 +1,202 @@ + + + + + + + + + + + +Strolch: Searches + + + + + + + + + + + + ++ ++ + + + + + + + + + + + + + diff --git a/li.strolch.website/www.strolch.li/documentation.html b/li.strolch.website/www.strolch.li/documentation.html index d558c3380..afbcf762a 100644 --- a/li.strolch.website/www.strolch.li/documentation.html +++ b/li.strolch.website/www.strolch.li/documentation.html @@ -63,6 +63,7 @@++ +Documentation: Searches
+This page discusses Strolch Searches.
++ ++ + + + +As is custom for every framework, querying, or searching, the model must be possible. Strolch searches are implemented using + the
+ +StrolchSearch
class and one of its concrete implementations:ResourceSearch
, +OrderSearch
,ActivitySearch
.A Strolch element always has two identifiers:
+ + + + + +Type
andId
. The type is important as + it classifies an element. So if a car and a house would be modelled in Strolch, then those would both be a +Resource
, but one of typeCar
and the other of typeHouse
. Both would + have different parameters.