From 2426daf9fa456cca49e35960e44ff7934e42697f Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Fri, 22 Jun 2018 21:18:36 +0200 Subject: [PATCH] [WIP] Documenting Searches on webseite --- .../www.strolch.li/documentation-queries.html | 34 +-- .../documentation-searches.html | 202 ++++++++++++++++++ .../www.strolch.li/documentation.html | 1 + 3 files changed, 221 insertions(+), 16 deletions(-) create mode 100644 li.strolch.website/www.strolch.li/documentation-searches.html diff --git a/li.strolch.website/www.strolch.li/documentation-queries.html b/li.strolch.website/www.strolch.li/documentation-queries.html index 1d430e16b..ac160274d 100644 --- a/li.strolch.website/www.strolch.li/documentation-queries.html +++ b/li.strolch.website/www.strolch.li/documentation-queries.html @@ -3,7 +3,7 @@ - + @@ -46,30 +46,32 @@
+

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.

+ 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:

-
+

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
+
+    
+    
+
+    
+    
+
+    
+
+
+
+
+
+ + + +
+ +

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 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 + Resource, but one of type Car and the other of type House. Both would + have different parameters.

+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + 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 @@
  • Strolch Realms
  • Strolch Components
  • Strolch Services and Commands
  • +
  • Strolch Searches
  • Strolch Queries
  • Strolch Transactions
  • Strolch Policies