[Minor] cleanup formatting

This commit is contained in:
Robert von Burg 2021-07-15 10:16:14 +02:00
parent 29bd9179d7
commit 16eb9bbf37
2 changed files with 13 additions and 9 deletions

View File

@ -5,7 +5,7 @@ weight: 89
## Queries ## Queries
{{% notice warning %}} {{% notice warning %}}
The Query API is deprecated and the search API should be used instead. The Query API is deprecated and the [search API](/documentation/searches) should be used instead.
{{% /notice %}} {{% /notice %}}
As is custom for every framework, querying the model must be possible. Strolch As is custom for every framework, querying the model must be possible. Strolch

View File

@ -28,8 +28,8 @@ however need to configure the realms for their specific project. If the
project only requires one realm, then the `defaultRealm` can be used, where the project only requires one realm, then the `defaultRealm` can be used, where the
developer only is required to configure the mode and any relevant model file. developer only is required to configure the mode and any relevant model file.
If the mode is `CACHED`, then the `PersistenceHandler` component is required to be If the mode is `CACHED`, then the `PersistenceHandler` component is required to
configured, so that the DAOs know how to access the underlying database. be configured, so that the DAOs know how to access the underlying database.
The configuration in the `StrolchConfiguration.xml` file is as follows: The configuration in the `StrolchConfiguration.xml` file is as follows:
@ -45,7 +45,8 @@ The configuration in the `StrolchConfiguration.xml` file is as follows:
<!-- if CACHED: --> <!-- if CACHED: -->
<!--depends>PersistenceHandler</depends--> <!--depends>PersistenceHandler</depends-->
<Properties> <Properties>
<dataStoreMode>EMPTY|TRANSIENT|CACHED</dataStoreMode> <!-- one of EMPTY, TRANSIENT, CACHED-->
<dataStoreMode>TRANSIENT</dataStoreMode>
<dataStoreFile>StrolchModel.xml</dataStoreFile> <dataStoreFile>StrolchModel.xml</dataStoreFile>
</Properties> </Properties>
</Component> </Component>
@ -109,10 +110,13 @@ Opening a transaction is done from a `Service` by calling one of the
`openTx()`-methods. Nevertheless, the realm can be accessed as follows: `openTx()`-methods. Nevertheless, the realm can be accessed as follows:
```java ```java
ComponentContainer container = getAgent().getContainer(); public class Example {
StrolchRealm realm = container.getRealm(StrolchConstants.DEFAULT_REALM); public static void main(String[] args) {
try(StrolchTransaction tx = realm.openTx()) { ComponentContainer container = getAgent().getContainer();
Resource resource = tx.getResourceBy("TestType", "MyTestResource"); StrolchRealm realm = container.getRealm(StrolchConstants.DEFAULT_REALM);
... try (StrolchTransaction tx = realm.openTx()) {
Resource resource = tx.getResourceBy("TestType", "MyTestResource");
}
}
} }
``` ```