[AUTO] New version of website

This commit is contained in:
Strolch GitHub Actions Build 2021-07-11 18:37:40 +00:00
parent d2dd19801a
commit 74bc26c5e8
131 changed files with 7509 additions and 0 deletions

1
publish/404.html Normal file
View File

@ -0,0 +1 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>404 Page not found</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><style>:root #header+#content>#left>#rlblock_left{display:none!important}p,li,ul{text-align:center}ul{list-style-type:none}</style></head><body data-url=/><section id=body style=margin-left:0><div id=overlay></div><div id=chapter><div id=body-inner><h1>Error</h1><p></p><p>Woops. Looks like this page doesn't exist ¯\_(ツ)_/¯.</p><p></p><p><a href=/>Go to homepage</a></p><p><img src=/images/gopher-404.jpg style=width:50% alt="Page not found!"></p></div></div></section></body></html>

139
publish/api/index.html Normal file
View File

@ -0,0 +1,139 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>API - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/api/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class="dd-item
parent
active"><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class=dd-item><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websiteapi/_index.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > API</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#overview>Overview</a></li><li><a href=#model>Model</a></li><li><a href=#realms>Realms</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>API</h1><h2 id=overview>Overview</h2><p>The Strolch API revolves around the StrolchTransaction object. The main
concept is to implement your use cases in Service implementations. You
open a transaction using the openTx(String)-method and then perform the
use case by adding your Command instances to the transaction.</p><p>Transactions are opened on a StrolchRealm. The realms are used to
separate mandates in a single runtime instance of Strolch. Each realm
has its own ResourceMap, OrderMap, ActivityMap instances from which the
TX retrieves the elements.</p><h2 id=model>Model</h2><p>The Strolch model is implemented in the project li.strolch.model.</p><p>The Strolch model consists of three root level elements: Resource,
Order and Activity. Each element has at least the following attributes:</p><ul><li>Id → the element&rsquo;s id</li><li>Name → the element&rsquo;s name</li><li>Type → the element&rsquo;s type</li></ul><p>Each root element can have any number of ParameterBag instances on it,
which in turn can have any number of Parameters on it. Accessing these
objects is always done by their IDs. Strolch root elements are always
stored in the respective ElementMaps in their Strolch realm. Thus
accessing a certain parameter from a Resource would look like this:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>(</span>realmName<span style=color:#f92672>))</span> <span style=color:#f92672>{</span>
Resource resource <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;TestType&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;MyTestResource&#34;</span><span style=color:#f92672>);</span>
Date date <span style=color:#f92672>=</span> resource<span style=color:#f92672>.</span><span style=color:#a6e22e>getDate</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;@bag01&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;@param6&#34;</span><span style=color:#f92672>);</span>
logger<span style=color:#f92672>.</span><span style=color:#a6e22e>info</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;@param6 date is &#34;</span> <span style=color:#f92672>+</span> date<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>XML Presentation of Strolch&rsquo;s top level elements of Resources:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#75715e>&lt;!-- Resource instance --&gt;</span>
<span style=color:#f92672>&lt;Resource</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;MyTestResource&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Name&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestType&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag01&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param7&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;StringList Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;StringList&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Hello;World&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param6&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Date Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Date&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;2012-11-30T18:12:05.628+01:00&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param5&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;String Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Strolch&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag02&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param4&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Long Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Long&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;4453234566&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param3&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Integer Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Integer&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;77&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param2&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Float Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;44.3&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;TimedState</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@integerState&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Integer State&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;IntegerState&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Value</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>&#34;0&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Value</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;2&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Value</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>&#34;2&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;3&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/TimedState&gt;</span>
<span style=color:#f92672>&lt;/Resource&gt;</span>
</code></pre></div><p>XML Presentation of Strolch&rsquo;s top level elements of Orders:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#75715e>&lt;!-- Order instance --&gt;</span>
<span style=color:#f92672>&lt;Order</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;MyTestOrder&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Name&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestType&#34;</span> <span style=color:#a6e22e>Date=</span><span style=color:#e6db74>&#34;2013-11-20T07:42:57.699Z&#34;</span> <span style=color:#a6e22e>State=</span><span style=color:#e6db74>&#34;CREATED&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag01&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param7&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;StringList Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;StringList&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Hello;World&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param6&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Date Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Date&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;2012-11-30T18:12:05.628+01:00&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param5&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;String Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Strolch&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag02&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param4&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Long Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Long&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;4453234566&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param3&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Integer Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Integer&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;77&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param2&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Float Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;44.3&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Order&gt;</span>
</code></pre></div><p>XML Presentation of Strolch&rsquo;s top level elements of Activities:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#75715e>&lt;!-- Activity instance --&gt;</span>
<span style=color:#f92672>&lt;Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;bicycleProduction&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Bicycle Production&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Series&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;componentProduction&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production of components&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Series&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;consumeGears&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Gears&#34;</span>
<span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;gears&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;Article&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Consume&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;objectives&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production goals&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Objectives&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;quantity&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Quantity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;duration&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;PT0S&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Action&gt;</span>
<span style=color:#f92672>&lt;Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;frameProduction&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production frame&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Series&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;produce&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production frame&#34;</span>
<span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;frameProduction&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;Machine&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Use&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;objectives&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production goals&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Objectives&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;quantity&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Quantity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;duration&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;PT5M&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Action&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;toStock&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Frame ToStock&#34;</span>
<span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;frame&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;Article&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Produce&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;objectives&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production goals&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Objectives&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;quantity&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Quantity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;duration&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;PT1M&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Action&gt;</span>
<span style=color:#f92672>&lt;/Activity&gt;</span>
<span style=color:#f92672>&lt;Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;brakeProduction&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Series&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Herstellen Bremsen&#34;</span> <span style=color:#a6e22e>TimeOrdering=</span><span style=color:#e6db74>&#34;Series&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;produce&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production saddle&#34;</span>
<span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;saddleProduction&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;Machine&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Use&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;objectives&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production goals&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Objectives&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;quantity&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Quantity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;duration&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;PT5M&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Action&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;toStock&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Saddle ToStock&#34;</span>
<span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;frame&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;Article&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Produce&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;objectives&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production goals&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Objectives&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;quantity&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Quantity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;duration&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;PT1M&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Action&gt;</span>
<span style=color:#f92672>&lt;/Activity&gt;</span>
<span style=color:#f92672>&lt;/Activity&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;assembly&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Bicycle assemble&#34;</span>
<span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;bicycleAssembly&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;Assembly&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Use&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;objectives&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production goals&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Objectives&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;quantity&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Quantity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;duration&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;PT5M&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Action&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;toStock&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Bicycle to stock&#34;</span>
<span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;bicycle&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;Product&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Produce&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;objectives&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Production goals&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Objectives&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;quantity&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Quantity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;duration&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Duration&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;PT1M&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Action&gt;</span>
<span style=color:#f92672>&lt;/Activity&gt;</span>
</code></pre></div><h2 id=realms>Realms</h2><p>Strolch realms implement the multi-client capability which is thus baked right
into the Strolch runtime. When configuring a Strolch runtime, realms are
configured and for each realm the data store mode is set. Each realm has its
own persistence configuration and can thus run in one of the 4 modes that the
Strolch agent implements:</p><ul><li>EMPTY
This is a transient data store mode, where no model changes are persisted,
but they are only kept in memory. When the Strolch agent is started, this
realm stays empty as no data is loaded.</li><li>TRANSIENT
This is the same as EMPTY, but with the difference that when the Strolch
agent is started, an XML file is parsed and the in memory realm is populated
with the elements parsed from that XML file.</li><li>CACHED
In this mode, all data is stored in memory, and any changes made are written
back to the persistence layer. This allows for fast in-memory quries, but
makes sure no data is lost when the agent is restarted.</li></ul><p>Strolch Realms are also responsible for opening Transactions, as these are
bound to the persistence layer configured for this realm. At runtime, a realm
is then accessed from the ComponentContainer:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>ComponentContainer container <span style=color:#f92672>=</span> getAgent<span style=color:#f92672>().</span><span style=color:#a6e22e>getContainer</span><span style=color:#f92672>();</span>
StrolchRealm realm <span style=color:#f92672>=</span> container<span style=color:#f92672>.</span><span style=color:#a6e22e>getRealm</span><span style=color:#f92672>(</span>StrolchConstants<span style=color:#f92672>.</span><span style=color:#a6e22e>DEFAULT_REALM</span><span style=color:#f92672>);</span>
<span style=color:#66d9ef>try</span><span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> realm<span style=color:#f92672>.</span><span style=color:#a6e22e>openTx</span><span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
Resource resource <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;TestType&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;MyTestResource&#34;</span><span style=color:#f92672>);</span>
<span style=color:#f92672>...</span>
<span style=color:#f92672>}</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/ title="Strolch Overview"><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/history/ title=History style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

1
publish/api/index.xml Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>API on Strolch</title><link>https://strolch.li/api/</link><description>Recent content in API on Strolch</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://strolch.li/api/index.xml" rel="self" type="application/rss+xml"/></channel></rss>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<svg width="256px" height="108px" viewBox="0 0 256 108" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
<g>
<path d="M152.983963,37.213516 C147.387032,37.213516 143.218557,39.9617169 143.218557,46.5756347 C143.218557,51.5588676 145.965589,55.0189589 152.682374,55.0189589 C158.37516,55.0189589 162.242046,51.6640731 162.242046,46.3698995 C162.242046,40.3696804 158.781954,37.213516 152.983963,37.213516 L152.983963,37.213516 L152.983963,37.213516 Z M141.793607,83.9153973 C140.469187,85.5402374 139.149443,87.2679452 139.149443,89.3054247 C139.149443,93.3722009 144.334904,94.5960913 151.458484,94.5960913 C157.359342,94.5960913 165.397041,94.1822831 165.397041,88.6964018 C165.397041,85.435032 161.530155,85.2339726 156.643945,84.9277078 L141.793607,83.9153973 L141.793607,83.9153973 Z M171.906922,37.5209498 C173.73516,39.8611872 175.670941,43.1178813 175.670941,47.7971872 C175.670941,59.089242 166.819653,65.7008219 154.004457,65.7008219 C150.745425,65.7008219 147.794995,65.2951963 145.965589,64.7867032 L142.607196,70.1778995 L152.576,70.7869224 C170.178046,71.9091142 180.551306,72.4187763 180.551306,85.9435251 C180.551306,97.6458813 170.278575,104.255123 152.576,104.255123 C134.162703,104.255123 127.14316,99.5758174 127.14316,91.5392877 C127.14316,86.9605114 129.178301,84.5244201 132.738922,81.1613516 C129.38053,79.7422466 128.263014,77.1997808 128.263014,74.4515799 C128.263014,72.2118721 129.38053,70.1778995 131.214612,68.2432877 C133.045187,66.3133516 135.07916,64.3775708 137.521096,62.1402009 C132.536694,59.6982648 128.771507,54.4075982 128.771507,46.8783927 C128.771507,35.1807123 136.50411,27.1465205 152.066338,27.1465205 C156.441717,27.1465205 159.088219,27.5486393 161.428457,28.1635068 L181.267872,28.1635068 L181.267872,36.8078904 L171.906922,37.5209498 L171.906922,37.5209498 Z" fill="#2F2707"></path>
<path d="M199.165662,19.0340091 C193.365333,19.0340091 190.009279,15.6744475 190.009279,9.87294977 C190.009279,4.0796347 193.365333,0.92347032 199.165662,0.92347032 C205.066521,0.92347032 208.423744,4.0796347 208.423744,9.87294977 C208.423744,15.6744475 205.066521,19.0340091 199.165662,19.0340091 L199.165662,19.0340091 L199.165662,19.0340091 Z M186.039525,80.1712511 L186.039525,72.1382283 L191.229662,71.4286758 C192.654612,71.2229406 192.85684,70.9190137 192.85684,69.3900274 L192.85684,39.4801096 C192.85684,38.3637626 192.552913,37.6483653 191.53242,37.3456073 L186.039525,35.4109954 L187.15821,27.1734064 L208.219178,27.1734064 L208.219178,69.3900274 C208.219178,71.0207123 208.31737,71.2229406 209.847525,71.4286758 L215.036493,72.1382283 L215.036493,80.1712511 L186.039525,80.1712511 L186.039525,80.1712511 Z" fill="#2F2707"></path>
<path d="M255.267068,76.2272146 C250.890521,78.3617169 244.482338,80.2951598 238.68084,80.2951598 C226.575196,80.2951598 221.998758,75.4171324 221.998758,63.9158356 L221.998758,37.2626119 C221.998758,36.653589 221.998758,36.2456256 221.181662,36.2456256 L214.061589,36.2456256 L214.061589,27.1909406 C223.016913,26.1716164 226.575196,21.6945388 227.693881,10.6058813 L237.359927,10.6058813 L237.359927,25.0564384 C237.359927,25.7659909 237.359927,26.0734247 238.174685,26.0734247 L252.517699,26.0734247 L252.517699,36.2456256 L237.359927,36.2456256 L237.359927,60.5586119 C237.359927,66.5611689 238.786046,68.8990685 244.276603,68.8990685 C247.12884,68.8990685 250.075763,68.188347 252.517699,67.2730594 L255.267068,76.2272146" fill="#2F2707"></path>
<path d="M104.528658,49.5295708 L58.0126393,3.01705936 C55.3357443,0.337826484 50.990758,0.337826484 48.3103562,3.01705936 L38.6513242,12.6760913 L50.9042557,24.9290228 C53.7518174,23.9669772 57.0166941,24.6122374 59.2867945,26.8823379 C61.5674155,29.1664658 62.208,32.4593973 61.2225753,35.3163105 L73.0313059,47.1250411 C75.8882192,46.1407854 79.1846575,46.777863 81.4664475,49.0631598 C84.6553425,52.2508858 84.6553425,57.4176438 81.4664475,60.6077078 C78.2763836,63.7977717 73.1096256,63.7977717 69.9183927,60.6077078 C67.5197078,58.2066849 66.9270502,54.6834703 68.141589,51.7283653 L57.1289132,40.7156895 L57.1277443,69.6962922 C57.9050959,70.0820457 58.6391963,70.5952146 59.2867945,71.2404749 C62.4756895,74.4282009 62.4756895,79.5949589 59.2867945,82.7873607 C56.0967306,85.9762557 50.9276347,85.9762557 47.7422466,82.7873607 C44.5533516,79.5949589 44.5533516,74.4282009 47.7422466,71.2404749 C48.5301187,70.4537717 49.4418995,69.8587763 50.4144658,69.4589954 L50.4144658,40.2083653 C49.4418995,39.8109224 48.5312877,39.2194338 47.7422466,38.4268858 C45.3260274,36.0141735 44.7450594,32.4687489 45.9829772,29.5019543 L33.9053881,17.4220274 L2.01059361,49.314484 C-0.669808219,51.9960548 -0.669808219,56.3410411 2.01059361,59.020274 L48.5266119,105.533954 C51.2046758,108.213187 55.5484932,108.213187 58.2300639,105.533954 L104.528658,59.2365297 C107.20789,56.5561279 107.20789,52.2088037 104.528658,49.5295708" fill="#DE4C36"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="256px" height="256px" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
<defs>
<linearGradient x1="0%" y1="50%" x2="99.7986577%" y2="50%" id="linearGradient-1">
<stop stop-color="#F97A12" offset="26%"></stop>
<stop stop-color="#B07B58" offset="46%"></stop>
<stop stop-color="#577BAE" offset="72%"></stop>
<stop stop-color="#1E7CE5" offset="91%"></stop>
<stop stop-color="#087CFA" offset="100%"></stop>
</linearGradient>
<linearGradient x1="0.344827586%" y1="34.5396825%" x2="121.182266%" y2="77.6190476%" id="linearGradient-2">
<stop stop-color="#F97A12" offset="0%"></stop>
<stop stop-color="#CB7A3E" offset="7%"></stop>
<stop stop-color="#9E7B6A" offset="15%"></stop>
<stop stop-color="#757B91" offset="24%"></stop>
<stop stop-color="#537BB1" offset="33%"></stop>
<stop stop-color="#387CCC" offset="43%"></stop>
<stop stop-color="#237CE0" offset="54%"></stop>
<stop stop-color="#147CEF" offset="66%"></stop>
<stop stop-color="#0B7CF7" offset="79%"></stop>
<stop stop-color="#087CFA" offset="100%"></stop>
</linearGradient>
<linearGradient x1="78.1690141%" y1="97.7493606%" x2="30.1056338%" y2="-6.62404092%" id="linearGradient-3">
<stop stop-color="#FE315D" offset="0%"></stop>
<stop stop-color="#CB417E" offset="8%"></stop>
<stop stop-color="#9E4E9B" offset="16%"></stop>
<stop stop-color="#755BB4" offset="25%"></stop>
<stop stop-color="#5365CA" offset="34%"></stop>
<stop stop-color="#386DDB" offset="44%"></stop>
<stop stop-color="#2374E9" offset="54%"></stop>
<stop stop-color="#1478F3" offset="66%"></stop>
<stop stop-color="#0B7BF8" offset="79%"></stop>
<stop stop-color="#087CFA" offset="100%"></stop>
</linearGradient>
<linearGradient x1="20%" y1="24.0865385%" x2="103.421589%" y2="132.676282%" id="linearGradient-4">
<stop stop-color="#FE315D" offset="0%"></stop>
<stop stop-color="#F63462" offset="4%"></stop>
<stop stop-color="#DF3A71" offset="10%"></stop>
<stop stop-color="#C24383" offset="17%"></stop>
<stop stop-color="#AD4A91" offset="29%"></stop>
<stop stop-color="#755BB4" offset="55%"></stop>
<stop stop-color="#1D76ED" offset="92%"></stop>
<stop stop-color="#087CFA" offset="100%"></stop>
</linearGradient>
</defs>
<g>
<polygon fill="url(#linearGradient-1)" points="64.8 199.6 2.8 150.8 33.6 93.6 122 128"></polygon>
<polygon fill="url(#linearGradient-2)" points="256 68.4 251.2 216.4 152.8 256 93.6 217.6 180 128 142.4 44.8 176.4 4"></polygon>
<polygon fill="url(#linearGradient-3)" points="256 68.4 178 160.4 142.4 44.8 176.4 4"></polygon>
<polygon fill="url(#linearGradient-4)" points="123.2 212.4 20.8 249.6 37.2 192 58.4 120.8 0 101.2 37.2 0 117.2 9.6 196.4 100"></polygon>
<rect fill="#000000" x="48" y="48" width="160" height="160"></rect>
<path d="M63.2,178 L123.2,178 L123.2,188 L63.2,188 L63.2,178 Z M106,80.8 L106,68.8 L73.2,68.8 L73.2,80.8 L82.4,80.8 L82.4,122.8 L73.2,122.8 L73.2,135.2 L106,135.2 L106,122.8 L96.8,122.8 L96.8,80.8 L106,80.8 Z M138,136 C133.433351,136.205984 128.889763,135.242193 124.8,133.2 C121.453966,131.354025 118.472002,128.914237 116,126 L125.2,115.6 C126.861272,117.42513 128.742265,119.03741 130.8,120.4 C132.73613,121.535124 134.957474,122.09046 137.2,122 C139.666127,122.188479 142.064692,121.139107 143.6,119.2 C145.452667,116.813942 146.312461,113.804666 146,110.8 L146,68 L160.8,68 L160.8,111.2 C160.951789,114.737935 160.408195,118.271293 159.2,121.6 C158.144579,124.977032 156.212191,128.013641 153.6,130.4 C149.066749,133.765567 143.638763,135.714074 138,136 Z" fill="#FFFFFF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="https://strolch.li/xsd/StrolchModel-1.6.xsd"
xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation>This is Version 1.6.x of the StrolchModel XSD.</xs:documentation>
</xs:annotation>
<xs:element name="StrolchModel" type="StrolchModelType"/>
<xs:complexType name="StrolchModelType">
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:choice>
<xs:element type="IncludeFileType" name="IncludeFile" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="OrderType" name="Order" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="ResourceType" name="Resource" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="ActivityType" name="Activity" maxOccurs="unbounded" minOccurs="0"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="IncludeFileType">
<xs:attribute type="xs:string" name="file"/>
</xs:complexType>
<xs:complexType name="VersionType">
<xs:attribute type="xs:int" name="Version" use="required"/>
<xs:attribute type="xs:string" name="CreatedBy" use="required"/>
<xs:attribute type="xs:string" name="UpdatedBy" use="required"/>
<xs:attribute type="xs:dateTime" name="Created" use="required"/>
<xs:attribute type="xs:dateTime" name="Updated" use="required"/>
<xs:attribute type="xs:string" name="Deleted" use="required"/>
</xs:complexType>
<xs:complexType name="OrderType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0"/>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
<xs:attribute type="xs:dateTime" name="Date" use="optional"/>
<xs:attribute type="StateType" name="State" use="optional"/>
</xs:complexType>
<xs:complexType name="ResourceType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0"/>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="TimedStateType" name="TimedState" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
</xs:complexType>
<xs:complexType name="ActivityType">
<xs:sequence>
<xs:element type="VersionType" name="Version" maxOccurs="1" minOccurs="0"/>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:sequence maxOccurs="unbounded" minOccurs="0">
<xs:choice>
<xs:element type="ActionType" name="Action" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="ActivityType" name="Activity" maxOccurs="unbounded" minOccurs="0"/>
</xs:choice>
</xs:sequence>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
<xs:attribute type="TimeOrderingType" name="TimeOrdering" use="required"/>
</xs:complexType>
<xs:complexType name="ActionType">
<xs:sequence>
<xs:element type="ParameterBagType" name="ParameterBag" maxOccurs="unbounded" minOccurs="0"/>
<xs:element type="PoliciesType" name="Policies" maxOccurs="1" minOccurs="0"/>
<xs:element type="ValueChangeType" name="ValueChange" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="ResourceId" use="optional"/>
<xs:attribute type="xs:string" name="ResourceType" use="optional"/>
<xs:attribute type="StateType" name="State" use="optional"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
</xs:complexType>
<xs:complexType name="ParameterBagType">
<xs:sequence>
<xs:element type="ParameterType" name="Parameter" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="xs:string" name="Type" use="required"/>
</xs:complexType>
<xs:complexType name="ParameterType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="ParameterValueType" name="Type" use="required"/>
<xs:attribute type="xs:string" name="Value" use="optional"/>
<xs:attribute type="xs:string" name="Interpretation" use="optional"/>
<xs:attribute type="xs:string" name="Uom" use="optional"/>
<xs:attribute type="xs:boolean" name="Hidden" use="optional"/>
<xs:attribute type="xs:int" name="Index" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="PoliciesType">
<xs:sequence>
<xs:element type="PolicyType" name="Policy" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PolicyType">
<xs:attribute type="xs:string" name="Type" use="required"/>
<xs:attribute type="xs:string" name="Value" use="required"/>
</xs:complexType>
<xs:complexType name="TimedStateType">
<xs:sequence>
<xs:element type="ValueType" name="Value" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:string" name="Id" use="required"/>
<xs:attribute type="xs:string" name="Name" use="required"/>
<xs:attribute type="TimedStateTypeType" name="Type" use="required"/>
<xs:attribute type="xs:string" name="Interpretation" use="optional"/>
<xs:attribute type="xs:string" name="Uom" use="optional"/>
<xs:attribute type="xs:boolean" name="Hidden" use="optional"/>
<xs:attribute type="xs:int" name="Index" use="optional"/>
</xs:complexType>
<xs:complexType name="ValueType">
<xs:attribute type="xs:dateTime" name="Time" use="required"/>
<xs:attribute type="xs:string" name="Value" use="required"/>
</xs:complexType>
<xs:complexType name="ValueChangeType">
<xs:attribute type="xs:string" name="StateId" use="optional"/>
<xs:attribute type="xs:dateTime" name="Time" use="required"/>
<xs:attribute type="xs:string" name="Value" use="required"/>
<xs:attribute type="TimedStateTypeType" name="Type" use="required"/>
</xs:complexType>
<xs:simpleType name="StateType">
<xs:restriction base="xs:string">
<xs:enumeration value="Created"/>
<xs:enumeration value="Planning"/>
<xs:enumeration value="Planned"/>
<xs:enumeration value="Execution"/>
<xs:enumeration value="Stopped"/>
<xs:enumeration value="Warning"/>
<xs:enumeration value="Error"/>
<xs:enumeration value="Executed"/>
<xs:enumeration value="Closed"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimeOrderingType">
<xs:restriction base="xs:string">
<xs:enumeration value="Series"/>
<xs:enumeration value="Parallel"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ParameterValueType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean"/>
<xs:enumeration value="String"/>
<xs:enumeration value="Text"/>
<xs:enumeration value="Integer"/>
<xs:enumeration value="Long"/>
<xs:enumeration value="Float"/>
<xs:enumeration value="Date"/>
<xs:enumeration value="Duration"/>
<xs:enumeration value="StringList"/>
<xs:enumeration value="IntegerList"/>
<xs:enumeration value="FloatList"/>
<xs:enumeration value="LongList"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TimedStateTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean"/>
<xs:enumeration value="Integer"/>
<xs:enumeration value="Float"/>
<xs:enumeration value="Long"/>
<xs:enumeration value="FloatList"/>
<xs:enumeration value="StringSet"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -0,0 +1,3 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Categories - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/categories/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class=dd-item><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > Categories</span></div><div class=progress><div class=wrapper></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>category ::
Categories</h1><ul></ul><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-next" href=/api/ title=API style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Categories on Strolch</title><link>https://strolch.li/categories/</link><description>Recent content in Categories on Strolch</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://strolch.li/categories/index.xml" rel="self" type="application/rss+xml"/></channel></rss>

View File

@ -0,0 +1,77 @@
/*
Atom One Dark With support for ReasonML by Gidi Morris, based off work by Daniel Gamage
Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
line-height: 1.3em;
color: #abb2bf;
background: #282c34;
border-radius: 5px;
}
.hljs-keyword, .hljs-operator {
color: #F92672;
}
.hljs-pattern-match {
color: #F92672;
}
.hljs-pattern-match .hljs-constructor {
color: #61aeee;
}
.hljs-function {
color: #61aeee;
}
.hljs-function .hljs-params {
color: #A6E22E;
}
.hljs-function .hljs-params .hljs-typing {
color: #FD971F;
}
.hljs-module-access .hljs-module {
color: #7e57c2;
}
.hljs-constructor {
color: #e2b93d;
}
.hljs-constructor .hljs-string {
color: #9CCC65;
}
.hljs-comment, .hljs-quote {
color: #b18eb1;
font-style: italic;
}
.hljs-doctag, .hljs-formula {
color: #c678dd;
}
.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst {
color: #e06c75;
}
.hljs-literal {
color: #56b6c2;
}
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta-string {
color: #98c379;
}
.hljs-built_in, .hljs-class .hljs-title {
color: #e6c07b;
}
.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-class, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number {
color: #d19a66;
}
.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title {
color: #61aeee;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
.hljs-link {
text-decoration: underline;
}

View File

@ -0,0 +1,47 @@
.autocomplete-suggestions {
text-align: left;
cursor: default;
border: 1px solid #ccc;
border-top: 0;
background: #fff;
box-shadow: -1px 1px 3px rgba(0,0,0,.1);
/* core styles should not be changed */
position: absolute;
display: none;
z-index: 9999;
max-height: 254px;
overflow: hidden;
overflow-y: auto;
box-sizing: border-box;
}
.autocomplete-suggestion {
position: relative;
cursor: pointer;
padding: 7px;
line-height: 23px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #333;
}
.autocomplete-suggestion b {
font-weight: normal;
color: #1f8dd6;
}
.autocomplete-suggestion.selected {
background: #333;
color: #fff;
}
.autocomplete-suggestion:hover {
background: #444;
color: #fff;
}
.autocomplete-suggestion > .context {
font-size: 12px;
}

8
publish/css/featherlight.min.css vendored Normal file
View File

@ -0,0 +1,8 @@
/**
* Featherlight - ultra slim jQuery lightbox
* Version 1.7.13 - http://noelboss.github.io/featherlight/
*
* Copyright 2018, Noël Raoul Bossart (http://www.noelboss.com)
* MIT Licensed.
**/
html.with-featherlight{overflow:hidden}.featherlight{display:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483647;text-align:center;white-space:nowrap;cursor:pointer;background:#333;background:rgba(0,0,0,0)}.featherlight:last-of-type{background:rgba(0,0,0,.8)}.featherlight:before{content:'';display:inline-block;height:100%;vertical-align:middle}.featherlight .featherlight-content{position:relative;text-align:left;vertical-align:middle;display:inline-block;overflow:auto;padding:25px 25px 0;border-bottom:25px solid transparent;margin-left:5%;margin-right:5%;max-height:95%;background:#fff;cursor:auto;white-space:normal}.featherlight .featherlight-inner{display:block}.featherlight link.featherlight-inner,.featherlight script.featherlight-inner,.featherlight style.featherlight-inner{display:none}.featherlight .featherlight-close-icon{position:absolute;z-index:9999;top:0;right:0;line-height:25px;width:25px;cursor:pointer;text-align:center;font-family:Arial,sans-serif;background:#fff;background:rgba(255,255,255,.3);color:#000;border:0;padding:0}.featherlight .featherlight-close-icon::-moz-focus-inner{border:0;padding:0}.featherlight .featherlight-image{width:100%}.featherlight-iframe .featherlight-content{border-bottom:0;padding:0;-webkit-overflow-scrolling:touch}.featherlight iframe{border:0}.featherlight *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}@media only screen and (max-width:1024px){.featherlight .featherlight-content{margin-left:0;margin-right:0;max-height:98%;padding:10px 10px 0;border-bottom:10px solid transparent}}@media print{html.with-featherlight>*>:not(.featherlight){display:none}}

1
publish/css/fontawesome-all.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,159 @@
/*
Put this file in /static/css/hugo-easy-gallery.css
Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/
*/
/*
Grid Layout Styles
*/
.gallery {
overflow: hidden;
margin: 10px;
max-width: 768px;
}
.gallery .box {
float: left;
position: relative;
/* Default: 1 tile wide */
width: 100%;
padding-bottom: 100%;
}
@media only screen and (min-width : 365px) {
/* Tablet view: 2 tiles */
.gallery .box {
width: 50%;
padding-bottom: 50%;
}
}
@media only screen and (min-width : 480px) {
/* Small desktop / ipad view: 3 tiles */
.gallery .box {
width: 33.3%;
padding-bottom: 33.3%; /* */
}
}
@media only screen and (min-width : 9999px) {
/* Medium desktop: 4 tiles */
.box {
width: 25%;
padding-bottom: 25%;
}
}
/*
Transition styles
*/
.gallery.hover-transition figure,
.gallery.hover-effect-zoom .img,
.gallery:not(.caption-effect-appear) figcaption,
.fancy-figure:not(.caption-effect-appear) figcaption {
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
/*
figure styles
*/
figure {
position:relative; /* purely to allow absolution positioning of figcaption */
overflow: hidden;
}
.gallery figure {
position: absolute;
left: 5px;
right: 5px;
top: 5px;
bottom: 5px;
}
.gallery.hover-effect-grow figure:hover {
transform: scale(1.05);
}
.gallery.hover-effect-shrink figure:hover {
transform: scale(0.95);
}
.gallery.hover-effect-slidedown figure:hover {
transform: translateY(5px);
}
.gallery.hover-effect-slideup figure:hover {
transform: translateY(-5px);
}
/*
img / a styles
*/
.gallery .img {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-size: cover;
background-position: 50% 50%;
background-repeat: no-repeat;
}
.gallery.hover-effect-zoom figure:hover .img {
transform: scale(1.05);
}
.gallery img {
display: none; /* only show the img if not inside a gallery */
}
figure a {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
/*
figcaption styles
*/
.gallery figcaption,
.fancy-figure figcaption {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: #000;
color: #FFF;
text-align: center;
font-size: 75%; /* change this if you want bigger text */
background: rgba(0, 0, 0, 0.5);
opacity: 1;
cursor: pointer;
}
.gallery.caption-position-none figcaption,
.fancy-figure.caption-position-none figcaption {
display: none;
}
.gallery.caption-position-center figcaption,
.fancy-figure.caption-position-center figcaption {
top: 0;
padding: 40% 5px;
}
.gallery.caption-position-bottom figcaption,
.fancy-figure.caption-position-bottom figcaption {
padding: 5px;
}
.gallery.caption-effect-fade figure:not(:hover) figcaption,
.gallery.caption-effect-appear figure:not(:hover) figcaption,
.fancy-figure.caption-effect-fade figure:not(:hover) figcaption,
.fancy-figure.caption-effect-appear figure:not(:hover) figcaption {
background: rgba(0, 0, 0, 0);
opacity: 0;
}
.gallery.caption-effect-slide.caption-position-bottom figure:not(:hover) figcaption,
.fancy-figure.caption-effect-slide.caption-position-bottom figure:not(:hover) figcaption {
margin-bottom: -100%;
}
.gallery.caption-effect-slide.caption-position-center figure:not(:hover) figcaption,
.fancy-figure.caption-effect-slide.caption-position-center figure:not(:hover) figcaption {
top: 100%;
}
figcaption p {
margin: auto; /* override style in theme */
}

254
publish/css/hugo-theme.css Normal file
View File

@ -0,0 +1,254 @@
/* Insert here special css for hugo theme, on top of any other imported css */
/* Table of contents */
.progress ul {
list-style: none;
margin: 0;
padding: 0 5px;
}
#TableOfContents {
font-size: 13px !important;
max-height: 85vh;
overflow: auto;
padding: 15px !important;
}
#TableOfContents > ul > li > ul > li > ul li {
margin-right: 8px;
}
#TableOfContents > ul > li > a {
font-weight: bold; padding: 0 18px; margin: 0 2px;
}
#TableOfContents > ul > li > ul > li > a {
font-weight: bold;
}
#TableOfContents > ul > li > ul > li > ul > li > ul > li > ul > li {
display: none;
}
body {
font-size: 16px !important;
color: #323232 !important;
}
#body a.highlight, #body a.highlight:hover, #body a.highlight:focus {
text-decoration: none;
outline: none;
outline: 0;
}
#body a.highlight {
line-height: 1.1;
display: inline-block;
}
#body a.highlight:after {
display: block;
content: "";
height: 1px;
width: 0%;
background-color: #0082a7; /*#CE3B2F*/
-webkit-transition: width 0.5s ease;
-moz-transition: width 0.5s ease;
-ms-transition: width 0.5s ease;
transition: width 0.5s ease;
}
#body a.highlight:hover:after, #body a.highlight:focus:after {
width: 100%;
}
.progress {
position:absolute;
background-color: rgba(246, 246, 246, 0.97);
width: auto;
border: thin solid #ECECEC;
display:none;
z-index:200;
}
#toc-menu {
border-right: thin solid #DAD8D8 !important;
padding-right: 1rem !important;
margin-right: 0.5rem !important;
}
#sidebar-toggle-span {
border-right: thin solid #DAD8D8 !important;
padding-right: 0.5rem !important;
margin-right: 1rem !important;
}
.btn {
display: inline-block !important;
padding: 6px 12px !important;
margin-bottom: 0 !important;
font-size: 14px !important;
font-weight: normal !important;
line-height: 1.42857143 !important;
text-align: center !important;
white-space: nowrap !important;
vertical-align: middle !important;
-ms-touch-action: manipulation !important;
touch-action: manipulation !important;
cursor: pointer !important;
-webkit-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;
background-image: none !important;
border: 1px solid transparent !important;
border-radius: 4px !important;
-webkit-transition: all 0.15s !important;
-moz-transition: all 0.15s !important;
transition: all 0.15s !important;
}
.btn:focus {
/*outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;*/
outline: none !important;
}
.btn:hover,
.btn:focus {
color: #2b2b2b !important;
text-decoration: none !important;
}
.btn-default {
color: #333 !important;
background-color: #fff !important;
border-color: #ccc !important;
}
.btn-default:hover,
.btn-default:focus,
.btn-default:active {
color: #fff !important;
background-color: #9e9e9e !important;
border-color: #9e9e9e !important;
}
.btn-default:active {
background-image: none !important;
}
/* anchors */
.anchor {
color: #00bdf3;
font-size: 0.5em;
cursor:pointer;
visibility:hidden;
margin-left: 0.5em;
position: absolute;
margin-top:0.1em;
}
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, h5:hover .anchor, h6:hover .anchor {
visibility:visible;
}
/* Redfines headers style */
h2, h3, h4, h5, h6 {
font-weight: 400;
line-height: 1.1;
}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
font-weight: inherit;
}
h2 {
font-size: 2.5rem;
line-height: 110% !important;
margin: 2.5rem 0 1.5rem 0;
}
h3 {
font-size: 2rem;
line-height: 110% !important;
margin: 2rem 0 1rem 0;
}
h4 {
font-size: 1.5rem;
line-height: 110% !important;
margin: 1.5rem 0 0.75rem 0;
}
h5 {
font-size: 1rem;
line-height: 110% !important;
margin: 1rem 0 0.2rem 0;
}
h6 {
font-size: 0.5rem;
line-height: 110% !important;
margin: 0.5rem 0 0.2rem 0;
}
p {
margin: 1rem 0;
}
figcaption h4 {
font-weight: 300 !important;
opacity: .85;
font-size: 1em;
text-align: center;
margin-top: -1.5em;
}
.select-style {
border: 0;
width: 150px;
border-radius: 0px;
overflow: hidden;
display: inline-flex;
}
.select-style svg {
fill: #ccc;
width: 14px;
height: 14px;
pointer-events: none;
margin: auto;
}
.select-style svg:hover {
fill: #e6e6e6;
}
.select-style select {
padding: 0;
width: 130%;
border: none;
box-shadow: none;
background: transparent;
background-image: none;
-webkit-appearance: none;
margin: auto;
margin-left: 0px;
margin-right: -20px;
}
.select-style select:focus {
outline: none;
}
.select-style :hover {
cursor: pointer;
}
@media only all and (max-width: 47.938em) {
#breadcrumbs .links, #top-github-link-text {
display: none;
}
}
.is-sticky #top-bar {
box-shadow: -1px 2px 5px 1px rgba(0, 0, 0, 0.1);
}

102
publish/css/hybrid.css Normal file
View File

@ -0,0 +1,102 @@
/*
vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid)
*/
/*background color*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #1d1f21;
}
/*selection color*/
.hljs::selection,
.hljs span::selection {
background: #373b41;
}
.hljs::-moz-selection,
.hljs span::-moz-selection {
background: #373b41;
}
/*foreground color*/
.hljs {
color: #c5c8c6;
}
/*color: fg_yellow*/
.hljs-title,
.hljs-name {
color: #f0c674;
}
/*color: fg_comment*/
.hljs-comment,
.hljs-meta,
.hljs-meta .hljs-keyword {
color: #707880;
}
/*color: fg_red*/
.hljs-number,
.hljs-symbol,
.hljs-literal,
.hljs-deletion,
.hljs-link {
color: #cc6666
}
/*color: fg_green*/
.hljs-string,
.hljs-doctag,
.hljs-addition,
.hljs-regexp,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #b5bd68;
}
/*color: fg_purple*/
.hljs-attribute,
.hljs-code,
.hljs-selector-id {
color: #b294bb;
}
/*color: fg_blue*/
.hljs-keyword,
.hljs-selector-tag,
.hljs-bullet,
.hljs-tag {
color: #81a2be;
}
/*color: fg_aqua*/
.hljs-subst,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable {
color: #8abeb7;
}
/*color: fg_orange*/
.hljs-type,
.hljs-built_in,
.hljs-builtin-name,
.hljs-quote,
.hljs-section,
.hljs-selector-class {
color: #de935f;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

615
publish/css/nucleus.css Normal file
View File

@ -0,0 +1,615 @@
*, *::before, *::after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; }
@-webkit-viewport {
width: device-width; }
@-moz-viewport {
width: device-width; }
@-ms-viewport {
width: device-width; }
@-o-viewport {
width: device-width; }
@viewport {
width: device-width; }
html {
font-size: 100%;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%; }
body {
margin: 0; }
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block; }
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline; }
audio:not([controls]) {
display: none;
height: 0; }
[hidden],
template {
display: none; }
a {
background: transparent;
text-decoration: none; }
a:active,
a:hover {
outline: 0; }
abbr[title] {
border-bottom: 1px dotted; }
b,
strong {
font-weight: bold; }
dfn {
font-style: italic; }
mark {
background: #FFFF27;
color: #333; }
sub,
sup {
font-size: 0.8rem;
line-height: 0;
position: relative;
vertical-align: baseline; }
sup {
top: -0.5em; }
sub {
bottom: -0.25em; }
img {
border: 0;
max-width: 100%; }
svg:not(:root) {
overflow: hidden; }
figure {
margin: 1em 40px; }
hr {
height: 0; }
pre {
overflow: auto; }
button,
input,
optgroup,
select,
textarea {
color: inherit;
font: inherit;
margin: 0; }
button {
overflow: visible; }
button,
select {
text-transform: none; }
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer; }
button[disabled],
html input[disabled] {
cursor: default; }
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0; }
input {
line-height: normal; }
input[type="checkbox"],
input[type="radio"] {
padding: 0; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto; }
input[type="search"] {
-webkit-appearance: textfield; }
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none; }
legend {
border: 0;
padding: 0; }
textarea {
overflow: auto; }
optgroup {
font-weight: bold; }
table {
border-collapse: collapse;
border-spacing: 0;
table-layout: fixed;
width: 100%; }
tr, td, th {
vertical-align: middle; }
th, td {
padding: 0.425rem 0; }
th {
text-align: left; }
.container {
width: 75em;
margin: 0 auto;
padding: 0; }
@media only all and (min-width: 60em) and (max-width: 74.938em) {
.container {
width: 60em; } }
@media only all and (min-width: 48em) and (max-width: 59.938em) {
.container {
width: 48em; } }
@media only all and (min-width: 30.063em) and (max-width: 47.938em) {
.container {
width: 30em; } }
@media only all and (max-width: 30em) {
.container {
width: 100%; } }
.grid {
display: -webkit-box;
display: -moz-box;
display: box;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-flow: row;
-moz-flex-flow: row;
flex-flow: row;
list-style: none;
margin: 0;
padding: 0; }
@media only all and (max-width: 47.938em) {
.grid {
-webkit-flex-flow: row wrap;
-moz-flex-flow: row wrap;
flex-flow: row wrap; } }
.block {
-webkit-box-flex: 1;
-moz-box-flex: 1;
box-flex: 1;
-webkit-flex: 1;
-moz-flex: 1;
-ms-flex: 1;
flex: 1;
min-width: 0;
min-height: 0; }
@media only all and (max-width: 47.938em) {
.block {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 100%;
-moz-flex: 0 100%;
-ms-flex: 0 100%;
flex: 0 100%; } }
.content {
margin: 0.625rem;
padding: 0.938rem; }
@media only all and (max-width: 47.938em) {
body [class*="size-"] {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 100%;
-moz-flex: 0 100%;
-ms-flex: 0 100%;
flex: 0 100%; } }
.size-1-2 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 50%;
-moz-flex: 0 50%;
-ms-flex: 0 50%;
flex: 0 50%; }
.size-1-3 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 33.33333%;
-moz-flex: 0 33.33333%;
-ms-flex: 0 33.33333%;
flex: 0 33.33333%; }
.size-1-4 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 25%;
-moz-flex: 0 25%;
-ms-flex: 0 25%;
flex: 0 25%; }
.size-1-5 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 20%;
-moz-flex: 0 20%;
-ms-flex: 0 20%;
flex: 0 20%; }
.size-1-6 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 16.66667%;
-moz-flex: 0 16.66667%;
-ms-flex: 0 16.66667%;
flex: 0 16.66667%; }
.size-1-7 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 14.28571%;
-moz-flex: 0 14.28571%;
-ms-flex: 0 14.28571%;
flex: 0 14.28571%; }
.size-1-8 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 12.5%;
-moz-flex: 0 12.5%;
-ms-flex: 0 12.5%;
flex: 0 12.5%; }
.size-1-9 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 11.11111%;
-moz-flex: 0 11.11111%;
-ms-flex: 0 11.11111%;
flex: 0 11.11111%; }
.size-1-10 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 10%;
-moz-flex: 0 10%;
-ms-flex: 0 10%;
flex: 0 10%; }
.size-1-11 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 9.09091%;
-moz-flex: 0 9.09091%;
-ms-flex: 0 9.09091%;
flex: 0 9.09091%; }
.size-1-12 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 8.33333%;
-moz-flex: 0 8.33333%;
-ms-flex: 0 8.33333%;
flex: 0 8.33333%; }
@media only all and (min-width: 48em) and (max-width: 59.938em) {
.size-tablet-1-2 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 50%;
-moz-flex: 0 50%;
-ms-flex: 0 50%;
flex: 0 50%; }
.size-tablet-1-3 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 33.33333%;
-moz-flex: 0 33.33333%;
-ms-flex: 0 33.33333%;
flex: 0 33.33333%; }
.size-tablet-1-4 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 25%;
-moz-flex: 0 25%;
-ms-flex: 0 25%;
flex: 0 25%; }
.size-tablet-1-5 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 20%;
-moz-flex: 0 20%;
-ms-flex: 0 20%;
flex: 0 20%; }
.size-tablet-1-6 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 16.66667%;
-moz-flex: 0 16.66667%;
-ms-flex: 0 16.66667%;
flex: 0 16.66667%; }
.size-tablet-1-7 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 14.28571%;
-moz-flex: 0 14.28571%;
-ms-flex: 0 14.28571%;
flex: 0 14.28571%; }
.size-tablet-1-8 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 12.5%;
-moz-flex: 0 12.5%;
-ms-flex: 0 12.5%;
flex: 0 12.5%; }
.size-tablet-1-9 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 11.11111%;
-moz-flex: 0 11.11111%;
-ms-flex: 0 11.11111%;
flex: 0 11.11111%; }
.size-tablet-1-10 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 10%;
-moz-flex: 0 10%;
-ms-flex: 0 10%;
flex: 0 10%; }
.size-tablet-1-11 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 9.09091%;
-moz-flex: 0 9.09091%;
-ms-flex: 0 9.09091%;
flex: 0 9.09091%; }
.size-tablet-1-12 {
-webkit-box-flex: 0;
-moz-box-flex: 0;
box-flex: 0;
-webkit-flex: 0 8.33333%;
-moz-flex: 0 8.33333%;
-ms-flex: 0 8.33333%;
flex: 0 8.33333%; } }
@media only all and (max-width: 47.938em) {
@supports not (flex-wrap: wrap) {
.grid {
display: block;
-webkit-box-lines: inherit;
-moz-box-lines: inherit;
box-lines: inherit;
-webkit-flex-wrap: inherit;
-moz-flex-wrap: inherit;
-ms-flex-wrap: inherit;
flex-wrap: inherit; }
.block {
display: block;
-webkit-box-flex: inherit;
-moz-box-flex: inherit;
box-flex: inherit;
-webkit-flex: inherit;
-moz-flex: inherit;
-ms-flex: inherit;
flex: inherit; } } }
.first-block {
-webkit-box-ordinal-group: 0;
-webkit-order: -1;
-ms-flex-order: -1;
order: -1; }
.last-block {
-webkit-box-ordinal-group: 2;
-webkit-order: 1;
-ms-flex-order: 1;
order: 1; }
.fixed-blocks {
-webkit-flex-flow: row wrap;
-moz-flex-flow: row wrap;
flex-flow: row wrap; }
.fixed-blocks .block {
-webkit-box-flex: inherit;
-moz-box-flex: inherit;
box-flex: inherit;
-webkit-flex: inherit;
-moz-flex: inherit;
-ms-flex: inherit;
flex: inherit;
width: 25%; }
@media only all and (min-width: 60em) and (max-width: 74.938em) {
.fixed-blocks .block {
width: 33.33333%; } }
@media only all and (min-width: 48em) and (max-width: 59.938em) {
.fixed-blocks .block {
width: 50%; } }
@media only all and (max-width: 47.938em) {
.fixed-blocks .block {
width: 100%; } }
body {
font-size: 1.05rem;
line-height: 1.7; }
h1, h2, h3, h4, h5, h6 {
margin: 0.85rem 0 1.7rem 0;
text-rendering: optimizeLegibility; }
h1 {
font-size: 3.25rem; }
h2 {
font-size: 2.55rem; }
h3 {
font-size: 2.15rem; }
h4 {
font-size: 1.8rem; }
h5 {
font-size: 1.4rem; }
h6 {
font-size: 0.9rem; }
p {
margin: 1.7rem 0; }
ul, ol {
margin-top: 1.7rem;
margin-bottom: 1.7rem; }
ul ul, ul ol, ol ul, ol ol {
margin-top: 0;
margin-bottom: 0; }
blockquote {
margin: 1.7rem 0;
padding-left: 0.85rem; }
cite {
display: block;
font-size: 0.925rem; }
cite:before {
content: "\2014 \0020"; }
pre {
margin: 1.7rem 0;
padding: 0.938rem; }
code {
vertical-align: bottom; }
small {
font-size: 0.925rem; }
hr {
border-left: none;
border-right: none;
border-top: none;
margin: 1.7rem 0; }
fieldset {
border: 0;
padding: 0.938rem;
margin: 0 0 1.7rem 0; }
input,
label,
select {
display: block; }
label {
margin-bottom: 0.425rem; }
label.required:after {
content: "*"; }
label abbr {
display: none; }
textarea, input[type="email"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="url"], input[type="color"], input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="month"], input[type="time"], input[type="week"], select[multiple=multiple] {
-webkit-transition: border-color;
-moz-transition: border-color;
transition: border-color;
border-radius: 0.1875rem;
margin-bottom: 0.85rem;
padding: 0.425rem 0.425rem;
width: 100%; }
textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="text"]:focus, input[type="url"]:focus, input[type="color"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, select[multiple=multiple]:focus {
outline: none; }
textarea {
resize: vertical; }
input[type="checkbox"], input[type="radio"] {
display: inline;
margin-right: 0.425rem; }
input[type="file"] {
width: 100%; }
select {
width: auto;
max-width: 100%;
margin-bottom: 1.7rem; }
button,
input[type="submit"] {
cursor: pointer;
user-select: none;
vertical-align: middle;
white-space: nowrap;
border: inherit; }

2
publish/css/perfect-scrollbar.min.css vendored Normal file
View File

@ -0,0 +1,2 @@
/* perfect-scrollbar v0.6.13 */
.ps-container{-ms-touch-action:auto;touch-action:auto;overflow:hidden !important;-ms-overflow-style:none}@supports (-ms-overflow-style: none){.ps-container{overflow:auto !important}}@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none){.ps-container{overflow:auto !important}}.ps-container.ps-active-x>.ps-scrollbar-x-rail,.ps-container.ps-active-y>.ps-scrollbar-y-rail{display:block;background-color:transparent}.ps-container.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail{background-color:#eee;opacity:.9}.ps-container.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail>.ps-scrollbar-x{background-color:#999;height:11px}.ps-container.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail{background-color:#eee;opacity:.9}.ps-container.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail>.ps-scrollbar-y{background-color:#999;width:11px}.ps-container>.ps-scrollbar-x-rail{display:none;position:absolute;opacity:0;-webkit-transition:background-color .2s linear, opacity .2s linear;-o-transition:background-color .2s linear, opacity .2s linear;-moz-transition:background-color .2s linear, opacity .2s linear;transition:background-color .2s linear, opacity .2s linear;bottom:0px;height:15px}.ps-container>.ps-scrollbar-x-rail>.ps-scrollbar-x{position:absolute;background-color:#aaa;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;-o-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;-moz-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;bottom:2px;height:6px}.ps-container>.ps-scrollbar-x-rail:hover>.ps-scrollbar-x,.ps-container>.ps-scrollbar-x-rail:active>.ps-scrollbar-x{height:11px}.ps-container>.ps-scrollbar-y-rail{display:none;position:absolute;opacity:0;-webkit-transition:background-color .2s linear, opacity .2s linear;-o-transition:background-color .2s linear, opacity .2s linear;-moz-transition:background-color .2s linear, opacity .2s linear;transition:background-color .2s linear, opacity .2s linear;right:0;width:15px}.ps-container>.ps-scrollbar-y-rail>.ps-scrollbar-y{position:absolute;background-color:#aaa;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, -webkit-border-radius .2s ease-in-out;-o-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;-moz-transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out;transition:background-color .2s linear, height .2s linear, width .2s ease-in-out, border-radius .2s ease-in-out, -webkit-border-radius .2s ease-in-out, -moz-border-radius .2s ease-in-out;right:2px;width:6px}.ps-container>.ps-scrollbar-y-rail:hover>.ps-scrollbar-y,.ps-container>.ps-scrollbar-y-rail:active>.ps-scrollbar-y{width:11px}.ps-container:hover.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail{background-color:#eee;opacity:.9}.ps-container:hover.ps-in-scrolling.ps-x>.ps-scrollbar-x-rail>.ps-scrollbar-x{background-color:#999;height:11px}.ps-container:hover.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail{background-color:#eee;opacity:.9}.ps-container:hover.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail>.ps-scrollbar-y{background-color:#999;width:11px}.ps-container:hover>.ps-scrollbar-x-rail,.ps-container:hover>.ps-scrollbar-y-rail{opacity:.6}.ps-container:hover>.ps-scrollbar-x-rail:hover{background-color:#eee;opacity:.9}.ps-container:hover>.ps-scrollbar-x-rail:hover>.ps-scrollbar-x{background-color:#999}.ps-container:hover>.ps-scrollbar-y-rail:hover{background-color:#eee;opacity:.9}.ps-container:hover>.ps-scrollbar-y-rail:hover>.ps-scrollbar-y{background-color:#999}

49
publish/css/tags.css Normal file
View File

@ -0,0 +1,49 @@
/* Tags */
#head-tags{
margin-left:1em;
margin-top:1em;
}
#body .tags a.tag-link {
display: inline-block;
line-height: 2em;
font-size: 0.8em;
position: relative;
margin: 0 16px 8px 0;
padding: 0 10px 0 12px;
background: #8451a1;
-webkit-border-bottom-right-radius: 3px;
border-bottom-right-radius: 3px;
-webkit-border-top-right-radius: 3px;
border-top-right-radius: 3px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.2);
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
color: #fff;
}
#body .tags a.tag-link:before {
content: "";
position: absolute;
top:0;
left: -1em;
width: 0;
height: 0;
border-color: transparent #8451a1 transparent transparent;
border-style: solid;
border-width: 1em 1em 1em 0;
}
#body .tags a.tag-link:after {
content: "";
position: absolute;
top: 10px;
left: 1px;
width: 5px;
height: 5px;
-webkit-border-radius: 50%;
border-radius: 100%;
background: #fff;
}

128
publish/css/theme-blue.css Normal file
View File

@ -0,0 +1,128 @@
:root{
--MAIN-TEXT-color:#323232; /* Color of text by default */
--MAIN-TITLES-TEXT-color: #5e5e5e; /* Color of titles h2-h3-h4-h5 */
--MAIN-LINK-color:#1C90F3; /* Color of links */
--MAIN-LINK-HOVER-color:#167ad0; /* Color of hovered links */
--MAIN-ANCHOR-color: #1C90F3; /* color of anchors on titles */
--MENU-HOME-LINK-color: #323232; /* Color of the home button text */
--MENU-HOME-LINK-HOVER-color: #5e5e5e; /* Color of the hovered home button text */
--MENU-HEADER-BG-color:#1C90F3; /* Background color of menu header */
--MENU-HEADER-BORDER-color:#33a1ff; /*Color of menu header border */
--MENU-SEARCH-BG-color:#167ad0; /* Search field background color (by default borders + icons) */
--MENU-SEARCH-BOX-color: #33a1ff; /* Override search field border color */
--MENU-SEARCH-BOX-ICONS-color: #a1d2fd; /* Override search field icons color */
--MENU-SECTIONS-ACTIVE-BG-color:#20272b; /* Background color of the active section and its childs */
--MENU-SECTIONS-BG-color:#252c31; /* Background color of other sections */
--MENU-SECTIONS-LINK-color: #ccc; /* Color of links in menu */
--MENU-SECTIONS-LINK-HOVER-color: #e6e6e6; /* Color of links in menu, when hovered */
--MENU-SECTION-ACTIVE-CATEGORY-color: #777; /* Color of active category text */
--MENU-SECTION-ACTIVE-CATEGORY-BG-color: #fff; /* Color of background for the active category (only) */
--MENU-VISITED-color: #33a1ff; /* Color of 'page visited' icons in menu */
--MENU-SECTION-HR-color: #20272b; /* Color of <hr> separator in menu */
}
body {
color: var(--MAIN-TEXT-color) !important;
}
textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="text"]:focus, input[type="url"]:focus, input[type="color"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, select[multiple=multiple]:focus {
border-color: none;
box-shadow: none;
}
h2, h3, h4, h5 {
color: var(--MAIN-TITLES-TEXT-color) !important;
}
a {
color: var(--MAIN-LINK-color);
}
.anchor {
color: var(--MAIN-ANCHOR-color);
}
a:hover {
color: var(--MAIN-LINK-HOVER-color);
}
#sidebar ul li.visited > a .read-icon {
color: var(--MENU-VISITED-color);
}
#body a.highlight:after {
display: block;
content: "";
height: 1px;
width: 0%;
-webkit-transition: width 0.5s ease;
-moz-transition: width 0.5s ease;
-ms-transition: width 0.5s ease;
transition: width 0.5s ease;
background-color: var(--MAIN-LINK-HOVER-color);
}
#sidebar {
background-color: var(--MENU-SECTIONS-BG-color);
}
#sidebar #header-wrapper {
background: var(--MENU-HEADER-BG-color);
color: var(--MENU-SEARCH-BOX-color);
border-color: var(--MENU-HEADER-BORDER-color);
}
#sidebar .searchbox {
border-color: var(--MENU-SEARCH-BOX-color);
background: var(--MENU-SEARCH-BG-color);
}
#sidebar ul.topics > li.parent, #sidebar ul.topics > li.active {
background: var(--MENU-SECTIONS-ACTIVE-BG-color);
}
#sidebar .searchbox * {
color: var(--MENU-SEARCH-BOX-ICONS-color);
}
#sidebar a {
color: var(--MENU-SECTIONS-LINK-color);
}
#sidebar a:hover {
color: var(--MENU-SECTIONS-LINK-HOVER-color);
}
#sidebar ul li.active > a {
background: var(--MENU-SECTION-ACTIVE-CATEGORY-BG-color);
color: var(--MENU-SECTION-ACTIVE-CATEGORY-color) !important;
}
#sidebar hr {
border-color: var(--MENU-SECTION-HR-color);
}
#body .tags a.tag-link {
background-color: var(--MENU-HEADER-BG-color);
}
#body .tags a.tag-link:before {
border-right-color: var(--MENU-HEADER-BG-color);
}
#homelinks {
background: var(--MENU-HEADER-BG-color);
background-color: var(--MENU-HEADER-BORDER-color);
border-bottom-color: var(--MENU-HEADER-BORDER-color);
}
#homelinks a {
color: var(--MENU-HOME-LINK-color);
}
#homelinks a:hover {
color: var(--MENU-HOME-LINK-HOVERED-color);
}

128
publish/css/theme-green.css Normal file
View File

@ -0,0 +1,128 @@
:root{
--MAIN-TEXT-color:#323232; /* Color of text by default */
--MAIN-TITLES-TEXT-color: #5e5e5e; /* Color of titles h2-h3-h4-h5 */
--MAIN-LINK-color:#599a3e; /* Color of links */
--MAIN-LINK-HOVER-color:#3f6d2c; /* Color of hovered links */
--MAIN-ANCHOR-color: #599a3e; /* color of anchors on titles */
--MENU-HOME-LINK-color: #323232; /* Color of the home button text */
--MENU-HOME-LINK-HOVER-color: #5e5e5e; /* Color of the hovered home button text */
--MENU-HEADER-BG-color:#74b559; /* Background color of menu header */
--MENU-HEADER-BORDER-color:#9cd484; /*Color of menu header border */
--MENU-SEARCH-BG-color:#599a3e; /* Search field background color (by default borders + icons) */
--MENU-SEARCH-BOX-color: #84c767; /* Override search field border color */
--MENU-SEARCH-BOX-ICONS-color: #c7f7c4; /* Override search field icons color */
--MENU-SECTIONS-ACTIVE-BG-color:#1b211c; /* Background color of the active section and its childs */
--MENU-SECTIONS-BG-color:#222723; /* Background color of other sections */
--MENU-SECTIONS-LINK-color: #ccc; /* Color of links in menu */
--MENU-SECTIONS-LINK-HOVER-color: #e6e6e6; /* Color of links in menu, when hovered */
--MENU-SECTION-ACTIVE-CATEGORY-color: #777; /* Color of active category text */
--MENU-SECTION-ACTIVE-CATEGORY-BG-color: #fff; /* Color of background for the active category (only) */
--MENU-VISITED-color: #599a3e; /* Color of 'page visited' icons in menu */
--MENU-SECTION-HR-color: #18211c; /* Color of <hr> separator in menu */
}
body {
color: var(--MAIN-TEXT-color) !important;
}
textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="text"]:focus, input[type="url"]:focus, input[type="color"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, select[multiple=multiple]:focus {
border-color: none;
box-shadow: none;
}
h2, h3, h4, h5 {
color: var(--MAIN-TITLES-TEXT-color) !important;
}
a {
color: var(--MAIN-LINK-color);
}
.anchor {
color: var(--MAIN-ANCHOR-color);
}
a:hover {
color: var(--MAIN-LINK-HOVER-color);
}
#sidebar ul li.visited > a .read-icon {
color: var(--MENU-VISITED-color);
}
#body a.highlight:after {
display: block;
content: "";
height: 1px;
width: 0%;
-webkit-transition: width 0.5s ease;
-moz-transition: width 0.5s ease;
-ms-transition: width 0.5s ease;
transition: width 0.5s ease;
background-color: var(--MAIN-LINK-HOVER-color);
}
#sidebar {
background-color: var(--MENU-SECTIONS-BG-color);
}
#sidebar #header-wrapper {
background: var(--MENU-HEADER-BG-color);
color: var(--MENU-SEARCH-BOX-color);
border-color: var(--MENU-HEADER-BORDER-color);
}
#sidebar .searchbox {
border-color: var(--MENU-SEARCH-BOX-color);
background: var(--MENU-SEARCH-BG-color);
}
#sidebar ul.topics > li.parent, #sidebar ul.topics > li.active {
background: var(--MENU-SECTIONS-ACTIVE-BG-color);
}
#sidebar .searchbox * {
color: var(--MENU-SEARCH-BOX-ICONS-color);
}
#sidebar a {
color: var(--MENU-SECTIONS-LINK-color);
}
#sidebar a:hover {
color: var(--MENU-SECTIONS-LINK-HOVER-color);
}
#sidebar ul li.active > a {
background: var(--MENU-SECTION-ACTIVE-CATEGORY-BG-color);
color: var(--MENU-SECTION-ACTIVE-CATEGORY-color) !important;
}
#sidebar hr {
border-color: var(--MENU-SECTION-HR-color);
}
#body .tags a.tag-link {
background-color: var(--MENU-HEADER-BG-color);
}
#body .tags a.tag-link:before {
border-right-color: var(--MENU-HEADER-BG-color);
}
#homelinks {
background: var(--MENU-HEADER-BG-color);
background-color: var(--MENU-HEADER-BORDER-color);
border-bottom-color: var(--MENU-HEADER-BORDER-color);
}
#homelinks a {
color: var(--MENU-HOME-LINK-color);
}
#homelinks a:hover {
color: var(--MENU-HOME-LINK-HOVERED-color);
}

128
publish/css/theme-red.css Normal file
View File

@ -0,0 +1,128 @@
:root{
--MAIN-TEXT-color:#323232; /* Color of text by default */
--MAIN-TITLES-TEXT-color: #5e5e5e; /* Color of titles h2-h3-h4-h5 */
--MAIN-LINK-color:#f31c1c; /* Color of links */
--MAIN-LINK-HOVER-color:#d01616; /* Color of hovered links */
--MAIN-ANCHOR-color: #f31c1c; /* color of anchors on titles */
--MENU-HOME-LINK-color: #ccc; /* Color of the home button text */
--MENU-HOME-LINK-HOVER-color: #e6e6e6; /* Color of the hovered home button text */
--MENU-HEADER-BG-color:#dc1010; /* Background color of menu header */
--MENU-HEADER-BORDER-color:#e23131; /*Color of menu header border */
--MENU-SEARCH-BG-color:#b90000; /* Search field background color (by default borders + icons) */
--MENU-SEARCH-BOX-color: #ef2020; /* Override search field border color */
--MENU-SEARCH-BOX-ICONS-color: #fda1a1; /* Override search field icons color */
--MENU-SECTIONS-ACTIVE-BG-color:#2b2020; /* Background color of the active section and its childs */
--MENU-SECTIONS-BG-color:#312525; /* Background color of other sections */
--MENU-SECTIONS-LINK-color: #ccc; /* Color of links in menu */
--MENU-SECTIONS-LINK-HOVER-color: #e6e6e6; /* Color of links in menu, when hovered */
--MENU-SECTION-ACTIVE-CATEGORY-color: #777; /* Color of active category text */
--MENU-SECTION-ACTIVE-CATEGORY-BG-color: #fff; /* Color of background for the active category (only) */
--MENU-VISITED-color: #ff3333; /* Color of 'page visited' icons in menu */
--MENU-SECTION-HR-color: #2b2020; /* Color of <hr> separator in menu */
}
body {
color: var(--MAIN-TEXT-color) !important;
}
textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="text"]:focus, input[type="url"]:focus, input[type="color"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, select[multiple=multiple]:focus {
border-color: none;
box-shadow: none;
}
h2, h3, h4, h5 {
color: var(--MAIN-TITLES-TEXT-color) !important;
}
a {
color: var(--MAIN-LINK-color);
}
.anchor {
color: var(--MAIN-ANCHOR-color);
}
a:hover {
color: var(--MAIN-LINK-HOVER-color);
}
#sidebar ul li.visited > a .read-icon {
color: var(--MENU-VISITED-color);
}
#body a.highlight:after {
display: block;
content: "";
height: 1px;
width: 0%;
-webkit-transition: width 0.5s ease;
-moz-transition: width 0.5s ease;
-ms-transition: width 0.5s ease;
transition: width 0.5s ease;
background-color: var(--MAIN-LINK-HOVER-color);
}
#sidebar {
background-color: var(--MENU-SECTIONS-BG-color);
}
#sidebar #header-wrapper {
background: var(--MENU-HEADER-BG-color);
color: var(--MENU-SEARCH-BOX-color);
border-color: var(--MENU-HEADER-BORDER-color);
}
#sidebar .searchbox {
border-color: var(--MENU-SEARCH-BOX-color);
background: var(--MENU-SEARCH-BG-color);
}
#sidebar ul.topics > li.parent, #sidebar ul.topics > li.active {
background: var(--MENU-SECTIONS-ACTIVE-BG-color);
}
#sidebar .searchbox * {
color: var(--MENU-SEARCH-BOX-ICONS-color);
}
#sidebar a {
color: var(--MENU-SECTIONS-LINK-color);
}
#sidebar a:hover {
color: var(--MENU-SECTIONS-LINK-HOVER-color);
}
#sidebar ul li.active > a {
background: var(--MENU-SECTION-ACTIVE-CATEGORY-BG-color);
color: var(--MENU-SECTION-ACTIVE-CATEGORY-color) !important;
}
#sidebar hr {
border-color: var(--MENU-SECTION-HR-color);
}
#body .tags a.tag-link {
background-color: var(--MENU-HEADER-BG-color);
}
#body .tags a.tag-link:before {
border-right-color: var(--MENU-HEADER-BG-color);
}
#homelinks {
background: var(--MENU-HEADER-BG-color);
background-color: var(--MENU-HEADER-BORDER-color);
border-bottom-color: var(--MENU-HEADER-BORDER-color);
}
#homelinks a {
color: var(--MENU-HOME-LINK-color);
}
#homelinks a:hover {
color: var(--MENU-HOME-LINK-HOVERED-color);
}

1151
publish/css/theme.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,45 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Development - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/development/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class=dd-item><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class="dd-item
parent
active"><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedevelopment/_index.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > Development</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#prerequisites>Prerequisites</a></li><li><a href=#building-strolch>Building Strolch</a></li><li><a href=#creating-a-strolch-app>Creating a Strolch App</a><ul><li><a href=#creating-a-java-strolch-web-app>Creating a Java Strolch Web App</a></li><li><a href=#creating-a-simple-java-strolch-app>Creating a simple Java Strolch App</a></li></ul></li><li><a href=#tools-used>Tools used</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Development</h1><h2 id=prerequisites>Prerequisites</h2><p>To start developing Strolch you need an installed:</p><ul><li>Java JDK 11</li><li>Apache Maven 3.x</li></ul><h2 id=building-strolch>Building Strolch</h2><p>Setting up Strolch is just a few lines:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>git clone https://github.com/4treesCH/strolch.git
cd strolch
mvn clean install -DskipTests
</code></pre></div><div class="notices tip"><p>Note: To run the tests you will need to configure the PostgreSQL Databases. See
the README in the module.</p></div><p>After running the Maven build, you will have a full build of all Strolch
projects. Now you can start modifying the projects, and add your own features,
or, far more interesting, start developing your projects using the Strolch
agent.</p><h2 id=creating-a-strolch-app>Creating a Strolch App</h2><p>To create your own Strolch App, you can use Maven&rsquo;s archetype generation. There
are two versions, one is a simple Java App which you can use to directly access
the Strolch runtime, and the second is to create a Java Web App, which is the
usual way to run Strolch runtimes.</p><div class="notices tip"><p>Note: you need to have installed Strolch to your local maven repo, otherwise the
archetype won&rsquo;t be available.</p></div><h3 id=creating-a-java-strolch-web-app>Creating a Java Strolch Web App</h3><p>The following shows the maven command to create the new maven project. Note that you should replace the placeholders in the brackets:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>mvn archetype:generate <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DarchetypeGroupId<span style=color:#f92672>=</span>li.strolch <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DarchetypeArtifactId<span style=color:#f92672>=</span>li.strolch.mvn.archetype.webapp <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DarchetypeVersion<span style=color:#f92672>=</span>1.6.0-SNAPSHOT <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DgroupId<span style=color:#f92672>=</span>&lt;my.groupid&gt; <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DartifactId<span style=color:#f92672>=</span>&lt;my-artifactId&gt; <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -Dversion<span style=color:#f92672>=</span>&lt;my.version&gt; <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DappName<span style=color:#f92672>=</span><span style=color:#e6db74>&#34;&lt;my app name&gt;&#34;</span>
</code></pre></div><h4 id=install-the-web-dependencies>Install the web dependencies</h4><p>The Strolch Web App uses <a href=https://nodejs.org/download/release/v11.15.0/>NodeJS v11.x</a> to build the web dependencies. Please
download the relevant platform&rsquo;s package, unpack it, and add the <code>bin</code> directory
to your path variable.</p><p>Once NodeJS is installed, then you can prepare the web dependencies:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>cd src/main/webapp/
npm install gulp -g
npm install
gulp
</code></pre></div><div class="notices tip"><p>Note: Whenever the bower.json is changed then you should
again call npm install inside the webapp folder.</p></div><h4 id=building-the-war>Building the WAR</h4><p>Building the WAR uses the <code>package</code> maven goal, but to have the optimized WAR
use the <code>release</code> profile:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>mvn clean package -Prelease
</code></pre></div><p>Happy coding =))</p><h3 id=creating-a-simple-java-strolch-app>Creating a simple Java Strolch App</h3><p>The following shows the maven command to create the new maven project. Note that
you should replace the placeholders in the brackets:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>mvn archetype:generate <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DarchetypeGroupId<span style=color:#f92672>=</span>li.strolch <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DarchetypeArtifactId<span style=color:#f92672>=</span>li.strolch.mvn.archetype.main <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DarchetypeVersion<span style=color:#f92672>=</span>1.6.0-SNAPSHOT <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DgroupId<span style=color:#f92672>=</span>&lt;my.groupid&gt; <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DartifactId<span style=color:#f92672>=</span>&lt;my-artifactId&gt; <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -Dversion<span style=color:#f92672>=</span>&lt;my.version&gt; <span style=color:#ae81ff>\
</span><span style=color:#ae81ff></span> -DappName<span style=color:#f92672>=</span><span style=color:#e6db74>&#34;&lt;my app name&gt;&#34;</span>
</code></pre></div><p>You change into the directory of the new project and then build the project by calling:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>cd &lt;my-artifactId&gt;
mvn clean package
</code></pre></div><p>Start the program using:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>mvn exec:java
</code></pre></div><p>Happy coding =))</p><h2 id=tools-used>Tools used</h2><p>The following tools are used to develop Strolch and Strolch-based projects:</p><ul><li><a href="https://www.jetbrains.com/idea/download/#section=linux" target=_blank>IntelliJ</a></li><li><a href=https://maven.apache.org/ target=_blank>Apache Maven</a></li><li><a href=http://git-scm.com/ target=_blank>Git SCM</a></li></ul><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/download/ title=Download><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/api/ title=API style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Development on Strolch</title><link>https://strolch.li/development/</link><description>Recent content in Development on Strolch</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://strolch.li/development/index.xml" rel="self" type="application/rss+xml"/></channel></rss>

View File

@ -0,0 +1,19 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Architecture - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/architecture/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class="dd-item active"><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/architecture.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Architecture</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#architecture>Architecture</a><ul><li><a href=#birds-view>Birds View</a></li><li><a href=#squirrel-view>Squirrel View</a></li></ul></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Architecture</h1><h2 id=architecture>Architecture</h2><h3 id=birds-view>Birds View</h3><p>A Strolch agent&rsquo;s architecture can be seen as a simple three-tier architecture.
The presentation layer is mostly a web frontend, where the communication with
the agent is done via REST API calls.</p><p>The agent itself implements the business logic using Services, Commands,
Queries etc.</p><p>The agent can communicate with other 3rd systems using any API, where it is
preferred to use JSON over REST.</p><p>The agent can use a standard RDBMS as a storage system, where currently DAOs
have been implemented only for PostgreSQL. Should it be required, then any
JDBC cabable RDBMS can be used, as no PostgreSQL specific SQL commands are used.</p><p>The following diagram helps visualize this:</p><p><img src=/assets/images/Strolch-Bird-View.svg alt="Strolch Architecture Birds View"></p><h3 id=squirrel-view>Squirrel View</h3><p>The following diagram shows a more detailed view of the architecture of a
Strolch Agent:</p><p><img src=/assets/images/Strolch-Squirrel-View.svg alt="Strolch Architecture Squirrel View"></p><p>A Strolch agent consists of the following main parts:</p><ul><li>REST Endpoints → expose an API to access the Strolch agent outside of the
Java VM</li><li>Services and Commands → implements business logic</li><li>Searches → implements specific queries against the Strolch model</li><li>Components → Implements additional logic, which is best implement as a
component. E.g. active components which have threads, etc.</li><li>Realms → implements multi-tenant capabilities</li></ul><p>In addition to the main parts, Strolch contains inherit capabilities, which
gives Strolch unique features when compared to other Java Frameworks:</p><ul><li>Policies → Policies allow injecting different algorithms. All root elements
can store Policy definitions, so that a service can delegate to a Policy and
thus behave differently, depending on the element being accessed.</li><li>Transactions → Transactions handle locking/unlocking of objects, updating the
model and are the central API for the developer.</li><li>Privileges → Strolch is user agnostic and any action, i.e. Service, Query,
etc. is authorized against the authenticated user.</li><li>Observers → modifications to the model are propagated to listeners using the
observer pattern.</li><li>Audits → Every access (read, modify) of the model are audited</li><li>Versioning → modifications to objects are versioned and thus can be rolled
back at a later time.</li></ul><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/ title=Documentation><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/model/ title=Model style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,63 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Components - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/components/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class="dd-item active"><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/components.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Components</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#components>Components</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Components</h1><h2 id=components>Components</h2><p>A Strolch agent can be easily extended with arbitrary components. An agent
is basically a container for classes extending StrolchComponent with a life
cycle. These classes mostly implement an interface which describes the
operations that are supported by the component.</p><p>The following represents a list of the most used components:</p><ul><li><code>RealmHandler</code>: li.strolch.agent.impl.DefaultRealmHandler</li><li><code>PrivilegeHandler</code>: li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler</li><li><code>EnumHandler</code>: li.strolch.runtime.query.enums.DefaultEnumHandler</li><li><code>PolicyHandler</code>: li.strolch.policy.DefaultPolicyHandler</li><li><code>ServiceHandler</code>: li.strolch.service.api.DefaultServiceHandler</li><li><code>StrolchSessionHandler</code>: li.strolch.rest.DefaultStrolchSessionHandler</li><li><code>PersistenceHandler</code>: multiple implementations</li><li><code>PostInitializer</code>: project specific implementation</li><li><code>MailHandler</code>: li.strolch.handler.mail.SmtpMailHandler</li></ul><p>A component has a life-cycle, which is governed by the Agent&rsquo;s own life-cycle.
The life-cycle is as follows:</p><pre><code>setup -&gt; initialize -&gt; start &lt;-&gt; stop -&gt; destroy
</code></pre><p>The setup step is used to instantiate the component, the initialize step is
used to validate configuration parameters, and the run step is used to start
the component, i.e. start threads, etc. The stop step stops these threads and
also allows the component to be started again. The destroy step destroys the
instance and makes it unusable anymore, i.e. shutdown of the agent.</p><p>Each component has its own configuration parameters. A component is
registered in the <code>StrolchConfiguration.xml</code> file with a</p><ul><li>name</li><li>api class name</li><li>implementation class name</li><li>configuration parameters</li><li>any required dependencies</li></ul><p>The dependencies is an important feature as the dependencies of a component
are always started before the actual component.</p><p>By example of the <code>MailHandler</code> we shall show how a strolch component would
be implemented.</p><p>First define an interface:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>public</span> <span style=color:#66d9ef>interface</span> <span style=color:#a6e22e>MailHandler</span> <span style=color:#f92672>{</span>
<span style=color:#66d9ef>void</span> <span style=color:#a6e22e>sendMail</span><span style=color:#f92672>(</span>String subject<span style=color:#f92672>,</span> String text<span style=color:#f92672>,</span> String recipient<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>Then implement a concrete <code>MailHandler</code>:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>public</span> <span style=color:#66d9ef>class</span> <span style=color:#a6e22e>SmtpMailHandler</span> <span style=color:#66d9ef>extends</span> StrolchComponent <span style=color:#66d9ef>implements</span> MailHandler <span style=color:#f92672>{</span>
<span style=color:#75715e>// instance fields with configuration properties to send the mail
</span><span style=color:#75715e></span>
<span style=color:#66d9ef>public</span> <span style=color:#a6e22e>SmtpMailHandler</span><span style=color:#f92672>(</span>ComponentContainer container<span style=color:#f92672>,</span> String componentName<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
<span style=color:#66d9ef>super</span><span style=color:#f92672>(</span>container<span style=color:#f92672>,</span> componentName<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>initialize</span><span style=color:#f92672>(</span>ComponentConfiguration configuration<span style=color:#f92672>)</span> <span style=color:#66d9ef>throws</span> Exception <span style=color:#f92672>{</span>
<span style=color:#75715e>// store any properties needed from the configuration
</span><span style=color:#75715e></span>
<span style=color:#66d9ef>super</span><span style=color:#f92672>.</span><span style=color:#a6e22e>initialize</span><span style=color:#f92672>(</span>configuration<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>sendMail</span><span style=color:#f92672>(</span>String subject<span style=color:#f92672>,</span> String text<span style=color:#f92672>,</span> String recipient<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
<span style=color:#75715e>// send the e-mail using SMTP, or store in stack to send by thread
</span><span style=color:#75715e></span> <span style=color:#f92672>}</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>Now that the component is written, it must be registered on the component, so
that it is loaded when the agent is started. For this the
<code>StrolchConfiguration.xml</code> file must be modified to include a component
element:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;StrolchConfiguration&gt;</span>
<span style=color:#f92672>&lt;env</span> <span style=color:#a6e22e>id=</span><span style=color:#e6db74>&#34;dev&#34;</span><span style=color:#f92672>&gt;</span>
...
<span style=color:#f92672>&lt;Component&gt;</span>
<span style=color:#f92672>&lt;name&gt;</span>MailHandler<span style=color:#f92672>&lt;/name&gt;</span>
<span style=color:#f92672>&lt;api&gt;</span>li.strolch.handler.mail.MailHandler<span style=color:#f92672>&lt;/api&gt;</span>
<span style=color:#f92672>&lt;impl&gt;</span>li.strolch.handler.mail.SmtpMailHandler<span style=color:#f92672>&lt;/impl&gt;</span>
<span style=color:#f92672>&lt;Properties&gt;</span>
<span style=color:#f92672>&lt;username&gt;</span>test<span style=color:#f92672>&lt;/username&gt;</span>
<span style=color:#f92672>&lt;password&gt;</span>test<span style=color:#f92672>&lt;/password&gt;</span>
<span style=color:#f92672>&lt;hostName&gt;</span>localhost<span style=color:#f92672>&lt;/hostName&gt;</span>
...
<span style=color:#f92672>&lt;/Properties&gt;</span>
<span style=color:#f92672>&lt;/Component&gt;</span>
...
<span style=color:#f92672>&lt;/env&gt;</span>
<span style=color:#f92672>&lt;/StrolchConfiguration&gt;</span>
</code></pre></div><p>Now when the agent is started, the component can be retrieved and used.
E.g from inside a Service:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>MailHandler mailHandler <span style=color:#f92672>=</span> getComponent<span style=color:#f92672>(</span>MailHandler<span style=color:#f92672>.</span><span style=color:#a6e22e>class</span><span style=color:#f92672>);</span>
mailHandler<span style=color:#f92672>.</span><span style=color:#a6e22e>sendMail</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;My Subject&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;Hello World&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;test@test.ch&#34;</span><span style=color:#f92672>);</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/realms/ title=Realms><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/services-and-commands/ title="Services and Commands" style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Documentation - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent
active"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/_index.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > Documentation</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#overview>Overview</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Documentation</h1><h2 id=overview>Overview</h2><p>Strolch&rsquo;s documentation has only just begun, but as more and more details of
the implementation in Strolch are fixed, more documentation can be created and
will be available here.</p><p>Currently we have the following topics of discussion:</p><ul class="children children-li"><li><a href=/documentation/architecture/>Architecture</a></li><li><a href=/documentation/model/>Model</a></li><li><a href=/documentation/do-and-donts/>Do and Don't</a></li><li><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li><a href=/documentation/realms/>Realms</a></li><li><a href=/documentation/components/>Components</a></li><li><a href=/documentation/services-and-commands/>Services and Commands</a></li><li><a href=/documentation/searches/>Searches</a></li><li><a href=/documentation/queries/>Queries</a></li><li><a href=/documentation/transactions/>Transactions</a></li><li><a href=/documentation/policies/>Policies</a></li><li><a href=/documentation/observers/>Observers</a></li><li><a href=/documentation/versioning/>Versioning</a></li><li><a href=/documentation/reports/>Reports</a></li><li><a href=/documentation/priviles/>Privileges</a></li></ul><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/history/ title=History><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/architecture/ title=Architecture style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Documentation on Strolch</title><link>https://strolch.li/documentation/</link><description>Recent content in Documentation on Strolch</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://strolch.li/documentation/index.xml" rel="self" type="application/rss+xml"/><item><title>Architecture</title><link>https://strolch.li/documentation/architecture/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/architecture/</guid><description>Architecture Birds View A Strolch agent&amp;rsquo;s architecture can be seen as a simple three-tier architecture. The presentation layer is mostly a web frontend, where the communication with the agent is done via REST API calls.
The agent itself implements the business logic using Services, Commands, Queries etc.
The agent can communicate with other 3rd systems using any API, where it is preferred to use JSON over REST.
The agent can use a standard RDBMS as a storage system, where currently DAOs have been implemented only for PostgreSQL.</description></item><item><title>Model</title><link>https://strolch.li/documentation/model/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/model/</guid><description>Model Before we dive into the entire model, let&amp;rsquo;s show an example and how it would be modelled in Strolch and use in Strolch:
A possible model would look as follows:
&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34; ?&amp;gt; &amp;lt;StrolchModel xmlns=&amp;#34;https://strolch.li/xsd/StrolchModel-1.6.xsd&amp;#34;&amp;gt; &amp;lt;Resource Id=&amp;#34;Product&amp;#34; Name=&amp;#34;Product Template&amp;#34; Type=&amp;#34;Template&amp;#34;&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;parameters&amp;#34; Name=&amp;#34;Parameters&amp;#34; Type=&amp;#34;Parameters&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;description&amp;#34; Name=&amp;#34;Description&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;color&amp;#34; Name=&amp;#34;Color&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;form&amp;#34; Name=&amp;#34;Form&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;relations&amp;#34; Name=&amp;#34;Relations&amp;#34; Type=&amp;#34;Relations&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;articles&amp;#34; Name=&amp;#34;Articles&amp;#34; Type=&amp;#34;StringList&amp;#34; Interpretation=&amp;#34;Resource-Ref&amp;#34; Uom=&amp;#34;Article&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;/Resource&amp;gt; &amp;lt;Resource Id=&amp;#34;Article&amp;#34; Name=&amp;#34;Article Template&amp;#34; Type=&amp;#34;Template&amp;#34;&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;parameters&amp;#34; Name=&amp;#34;Parameters&amp;#34; Type=&amp;#34;Parameters&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;description&amp;#34; Name=&amp;#34;Description&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;barcode&amp;#34; Name=&amp;#34;Barcode&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;relations&amp;#34; Name=&amp;#34;Relations&amp;#34; Type=&amp;#34;Relations&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;product&amp;#34; Name=&amp;#34;Product&amp;#34; Type=&amp;#34;String&amp;#34; Interpretation=&amp;#34;Resource-Ref&amp;#34; Uom=&amp;#34;Product&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;/Resource&amp;gt; &amp;lt;Resource Id=&amp;#34;Customer&amp;#34; Name=&amp;#34;Customer Template&amp;#34; Type=&amp;#34;Template&amp;#34;&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;address&amp;#34; Name=&amp;#34;Address&amp;#34; Type=&amp;#34;Address&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;street&amp;#34; Name=&amp;#34;Street&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;zip&amp;#34; Name=&amp;#34;Zip&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;city&amp;#34; Name=&amp;#34;City&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;country&amp;#34; Name=&amp;#34;Country&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;/Resource&amp;gt; &amp;lt;Order Id=&amp;#34;Order&amp;#34; Name=&amp;#34;Order&amp;#34; Type=&amp;#34;Template&amp;#34;&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;quantities&amp;#34; Name=&amp;#34;Quantities per Article Id&amp;#34; Type=&amp;#34;Quantities&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;quantity&amp;#34; Name=&amp;#34;Quantity&amp;#34; Type=&amp;#34;Float&amp;#34; Value=&amp;#34;0&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;relations&amp;#34; Name=&amp;#34;Relations&amp;#34; Type=&amp;#34;Relations&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;articles&amp;#34; Name=&amp;#34;Articles&amp;#34; Type=&amp;#34;StringList&amp;#34; Interpretation=&amp;#34;Resource-Ref&amp;#34; Uom=&amp;#34;Article&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;customer&amp;#34; Name=&amp;#34;Customer&amp;#34; Type=&amp;#34;String&amp;#34; Interpretation=&amp;#34;Resource-Ref&amp;#34; Uom=&amp;#34;Customer&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;/Order&amp;gt; &amp;lt;/StrolchModel&amp;gt; Let&amp;rsquo;s go through this model:</description></item><item><title>Do and Don't</title><link>https://strolch.li/documentation/do-and-donts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/do-and-donts/</guid><description>This page discusses things you should and shouldn&amp;rsquo;t do when using Strolch The following is a simple list of do&amp;rsquo;s and don&amp;rsquo;ts:
1 Service per use-case, should mostly delegate to Commands. Commands implement use-cases or parts of it, and are thus reusable. Subclass ResourceSearch, OrderSearch and ActivitySearch when implementing use-case specific search - this allows privilege checking. One Transaction at a time - no TX inside of another TX. Commands are added to TXs and performed on close: tx.</description></item><item><title>Runtime Configuration</title><link>https://strolch.li/documentation/runtime-configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/runtime-configuration/</guid><description>Runtime Configuration A Strolch runtime configuration comprises two parts: a configuration part, and a model part. The configuration are files located in the ..config/ folder, and the model are files located in the ../data folder.
In an absolute minimal configuration, the Strolch runtime requires the following folder structure:
../config/ ../StrolchConfiguration.xml → configures the Strolch agent ../PrivilegeConfig.xml → configures user management ../PrivilegeUsers.xml → contains the users in an XML based user management file .</description></item><item><title>Realms</title><link>https://strolch.li/documentation/realms/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/realms/</guid><description>Realms Realms implement multi-tenant capabilities. A Strolch agent can have an arbitrary number of realms configured and each realm has its own persistence configuration, allowing to separate mandates completely.
A realm can run in one of the following modes:
EMPTY This is a transient data store mode, where no model changes are persisted - they are only kept in memory. When the Strolch agent is started, this realm is empty as no data is loaded.</description></item><item><title>Components</title><link>https://strolch.li/documentation/components/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/components/</guid><description>Components A Strolch agent can be easily extended with arbitrary components. An agent is basically a container for classes extending StrolchComponent with a life cycle. These classes mostly implement an interface which describes the operations that are supported by the component.
The following represents a list of the most used components:
RealmHandler: li.strolch.agent.impl.DefaultRealmHandler PrivilegeHandler: li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler EnumHandler: li.strolch.runtime.query.enums.DefaultEnumHandler PolicyHandler: li.strolch.policy.DefaultPolicyHandler ServiceHandler: li.strolch.service.api.DefaultServiceHandler StrolchSessionHandler: li.strolch.rest.DefaultStrolchSessionHandler PersistenceHandler: multiple implementations PostInitializer: project specific implementation MailHandler: li.</description></item><item><title>Services and Commands</title><link>https://strolch.li/documentation/services-and-commands/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/services-and-commands/</guid><description>Services and Commands Services are written to implement a specific use-case. Commands are written to implement re-usable parts of a use-case. The use-case can be abstract e.g., AddResourceService or very specific e.g. CreatePatientService.
Should the use-case be re-usable in different scenarios, then commands should implement the logic, and the services should then execute the commands. E.g. The CreatePatientService would use a CreatePatientResourceCommand and then use an AddResourceCommand in a single transaction, so that the task of creating the actual Patient Resource can be re-used somewhere else.</description></item><item><title>Searches</title><link>https://strolch.li/documentation/searches/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/searches/</guid><description>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.</description></item><item><title>Queries</title><link>https://strolch.li/documentation/queries/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/queries/</guid><description>Queries 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, 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 Resource, but one of type Car and the other of type House.</description></item><item><title>Transactions</title><link>https://strolch.li/documentation/transactions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/transactions/</guid><description>Transactions Strolch Transactions play a central role in a Strolch agent. A transaction is opened for a realm, and grants access to the model of the agent. Transactions are implemented as a Java try-with-resources by implementing the AutoCloseable interface. This makes it trivial to understand the scope of a transaction.
Transactions handle the following:
Opening and closing database connections Releasing locks to strolch elements, if tx.lock(StrolchRootElement) or tx.lock(Locator) was called Performing Commands by executing them in the added order, and validating them first.</description></item><item><title>Policies</title><link>https://strolch.li/documentation/policies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/policies/</guid><description>Policies Policies are an integral part when writing business logic in Strolch. In many cases it would suffice to write all such logic in Services and Commands, but as soon as behaviour can change, depending on the element being accessed, then this would quickly lead to many if/else blocks.
Since writing large if/else blocks is not maintanable in the long run, Strolch offers a different approach. All Strolch elements can store Policy definitions.</description></item><item><title>Observers</title><link>https://strolch.li/documentation/observers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/observers/</guid><description>Observers All changes done in a Strolch transaction are recorded and then propagated to any registered observers.
The observer feature is opt-in and is configured for each realm. In the StrolchConfiguration.xml file enable observers by adding the enableObserverUpdates property per realm:
&amp;lt;StrolchConfiguration&amp;gt; &amp;lt;env id=&amp;#34;dev&amp;#34;&amp;gt; ... &amp;lt;Component&amp;gt; &amp;lt;name&amp;gt;RealmHandler&amp;lt;/name&amp;gt; &amp;lt;api&amp;gt;li.strolch.agent.api.RealmHandler&amp;lt;/api&amp;gt; &amp;lt;impl&amp;gt;li.strolch.agent.impl.DefaultRealmHandler&amp;lt;/impl&amp;gt; &amp;lt;depends&amp;gt;PrivilegeHandler&amp;lt;/depends&amp;gt; &amp;lt;Properties&amp;gt; &amp;lt;realms&amp;gt;defaultRealm, otherRealm&amp;lt;/realms&amp;gt; &amp;lt;enableObserverUpdates&amp;gt;true&amp;lt;/enableObserverUpdates&amp;gt; &amp;lt;dataStoreMode&amp;gt;TRANSIENT&amp;lt;/dataStoreMode&amp;gt; &amp;lt;dataStoreFile&amp;gt;StrolchModel.xml&amp;lt;/dataStoreFile&amp;gt; &amp;lt;enableObserverUpdates.otherRealm&amp;gt;true&amp;lt;/enableObserverUpdates.otherRealm&amp;gt; &amp;lt;dataStoreMode.otherRealm&amp;gt;TRANSIENT&amp;lt;/dataStoreMode.otherRealm&amp;gt; &amp;lt;dataStoreFile.otherRealm&amp;gt;StrolchModel.xml&amp;lt;/dataStoreFile.otherRealm&amp;gt; &amp;lt;/Properties&amp;gt; &amp;lt;/Component&amp;gt; &amp;lt;/env&amp;gt; ... &amp;lt;/StrolchConfiguration&amp;gt; Registering for updates is done by registering an Observer on the ObserverHandler of the realm itself:</description></item><item><title>Versioning</title><link>https://strolch.li/documentation/versioning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/versioning/</guid><description>Versioning One of Strolch&amp;rsquo;s features that sets it apart from other frameworks, is that versioning is baked into Strolch&amp;rsquo;s fabric. The feature is opt-in, as it is not required in all projects, but it only needs enabling, for all modifications to objects to be versioned, so that rollbacks can be done when needed.
The feature is enabled for each realm. In the StrolchConfiguration.xml file enable it by adding the enableVersioning propery per realm:</description></item><item><title>Reports</title><link>https://strolch.li/documentation/reports/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/reports/</guid><description>Reports Since Strolch has a generic model, it was rather straight forward to create a simple API for writing reports. In Strolch a report is defined by using its own model, i.e. a Report is a Resource of type Report.
A report consists of the following parts:
policy definition, thus allowing extensions basic configuration like base object type, order direction, etc. column definitions joins ordering definition filters An example of a report is as follows:</description></item><item><title>Privileges</title><link>https://strolch.li/documentation/priviles/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/priviles/</guid><description>Privileges No framework is complete without user management and privilege validation. The basic form would be Users and Roles, and then validating that an authenticated user has a given role. In Strolch we go a step further: A User has roles assigned, and each role has a set of Privileges. The privileges can overlap, a validation is performed to make sure that the one role doesn&amp;rsquo;t deny and another role allows a specific action.</description></item></channel></rss>

View File

@ -0,0 +1,264 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Model - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/model/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class="dd-item active"><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/model.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Model</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#model>Model</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Model</h1><h2 id=model>Model</h2><p>Before we dive into the entire model, let&rsquo;s show an example and how it would
be modelled in Strolch and use in Strolch:</p><p><img src=/assets/images/strolch-model-example.png alt="Strolch model example"></p><p>A possible model would look as follows:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#75715e>&lt;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34; ?&gt;</span>
<span style=color:#f92672>&lt;StrolchModel</span> <span style=color:#a6e22e>xmlns=</span><span style=color:#e6db74>&#34;https://strolch.li/xsd/StrolchModel-1.6.xsd&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Resource</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;Product&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Product Template&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Template&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;parameters&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Parameters&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Parameters&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;description&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Description&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;color&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Color&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;form&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Form&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;relations&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Relations&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Relations&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;articles&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Articles&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;StringList&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Article&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Resource&gt;</span>
<span style=color:#f92672>&lt;Resource</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;Article&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Article Template&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Template&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;parameters&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Parameters&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Parameters&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;description&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Description&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;barcode&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Barcode&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;relations&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Relations&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Relations&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;product&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Product&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Product&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Resource&gt;</span>
<span style=color:#f92672>&lt;Resource</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;Customer&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Customer Template&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Template&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;address&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Address&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Address&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;street&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Street&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;zip&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Zip&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;city&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;City&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;country&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Country&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Resource&gt;</span>
<span style=color:#f92672>&lt;Order</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;Order&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Order&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Template&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;quantities&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Quantities per Article Id&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Quantities&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;quantity&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Quantity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Float&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;0&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;relations&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Relations&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Relations&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;articles&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Articles&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;StringList&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Article&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;customer&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Customer&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Customer&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;/Order&gt;</span>
<span style=color:#f92672>&lt;/StrolchModel&gt;</span>
</code></pre></div><p>Let&rsquo;s go through this model:</p><ul><li>In the above model we see that the id and name fields are always on the
element, and thus aren&rsquo;t added as parameters. Further most elements have a
parameters ParameterBag, with one or more parameters, modelling the fields.</li><li>Note that in this example the Type of all the elements is Template. Strolch
has API support to create a clone of these elements, so that they have a
unique ID, and the proper type for persistence.</li><li>The Product element has three parameters: description, color and form. In
this case they are all of type String. Further the relations ParameterBag
defines the relationships, i.e. the product knows its articles. Note how
the relation is first defined in a relations ParameterBag and that the
Parameter has Interpretation=&ldquo;Resource-Ref&rdquo; Uom=&ldquo;Product&rdquo; attributes.
Strolch has API support for this, making it trivial to retrieve a dependency.</li><li>The Article element has two parameters description and barcode. Further it
has a reference to its Product.</li><li>The Order element doesn&rsquo;t model the date and state fields as parameters, as
these are inherently part of an Order element. The Order does define two
references to customer and articles. A special case is the quantities
ParameterBag. This bag of parameters is used to store the per article
quantity for this order. With ParameterBags, you can eliminate the use of
simple aggregate classes, as is commonly used in object-oriented programming.</li><li>The Customer element models a address ParameterBag to store the address of
a customer. Using a separate bag allows for further more direct fields to
stored on the default parameters bag.</li></ul><p>Now that we have a basic understanding of te model, it is of far more interest
in how to create and interact with these elements at runtime. The following
listing will perform simple operations:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> runtimeMock<span style=color:#f92672>.</span><span style=color:#a6e22e>openUserTx</span><span style=color:#f92672>(</span>certificate<span style=color:#f92672>,</span> <span style=color:#66d9ef>false</span><span style=color:#f92672>))</span> <span style=color:#f92672>{</span>
<span style=color:#75715e>/*
</span><span style=color:#75715e> * create a new product
</span><span style=color:#75715e> */</span>
Resource dafalgan <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceTemplate</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Product&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
dafalgan<span style=color:#f92672>.</span><span style=color:#a6e22e>setName</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Dafalgan 100mg&#34;</span><span style=color:#f92672>);</span>
dafalgan<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;description&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Dafalgan is for pain.&#34;</span><span style=color:#f92672>);</span>
dafalgan<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;color&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Yellow&#34;</span><span style=color:#f92672>);</span>
dafalgan<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;form&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;flat&#34;</span><span style=color:#f92672>);</span>
StringListParameter articlesP <span style=color:#f92672>=</span> dafalgan<span style=color:#f92672>.</span><span style=color:#a6e22e>getRelationsParam</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;articles&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
<span style=color:#75715e>/*
</span><span style=color:#75715e> * create articles
</span><span style=color:#75715e> */</span>
Resource dafalgan1 <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceTemplate</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Article&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
dafalgan1<span style=color:#f92672>.</span><span style=color:#a6e22e>setName</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Dafalgan 100mg 10 pce&#34;</span><span style=color:#f92672>);</span>
dafalgan1<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;description&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;This is pack with 10 pieces.&#34;</span><span style=color:#f92672>);</span>
dafalgan1<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;barcode&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;654654&#34;</span><span style=color:#f92672>);</span>
Resource dafalgan2 <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceTemplate</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Article&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
dafalgan2<span style=color:#f92672>.</span><span style=color:#a6e22e>setName</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Dafalgan 100mg 20 pce&#34;</span><span style=color:#f92672>);</span>
dafalgan2<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;description&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;This is pack with 20 pieces.&#34;</span><span style=color:#f92672>);</span>
dafalgan2<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;barcode&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;654655&#34;</span><span style=color:#f92672>);</span>
<span style=color:#75715e>/*
</span><span style=color:#75715e> * add reference to product
</span><span style=color:#75715e> */</span>
dafalgan1<span style=color:#f92672>.</span><span style=color:#a6e22e>getRelationParam</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;product&#34;</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span>dafalgan<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
articlesP<span style=color:#f92672>.</span><span style=color:#a6e22e>addValue</span><span style=color:#f92672>(</span>dafalgan1<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
dafalgan2<span style=color:#f92672>.</span><span style=color:#a6e22e>getRelationParam</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;product&#34;</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span>dafalgan<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
articlesP<span style=color:#f92672>.</span><span style=color:#a6e22e>addValue</span><span style=color:#f92672>(</span>dafalgan2<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
<span style=color:#75715e>/*
</span><span style=color:#75715e> * create a new customer
</span><span style=color:#75715e> */</span>
Resource customer1 <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceTemplate</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Customer&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
customer1<span style=color:#f92672>.</span><span style=color:#a6e22e>setName</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;John Doe&#34;</span><span style=color:#f92672>);</span>
<span style=color:#75715e>// set address
</span><span style=color:#75715e></span> ParameterBag addressBag <span style=color:#f92672>=</span> customer1<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameterBag</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;address&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
addressBag<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;street&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Main Str. 1&#34;</span><span style=color:#f92672>);</span>
addressBag<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;zip&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;1234&#34;</span><span style=color:#f92672>);</span>
addressBag<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;city&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Hometown&#34;</span><span style=color:#f92672>);</span>
addressBag<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;country&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Switzerland&#34;</span><span style=color:#f92672>);</span>
<span style=color:#75715e>/*
</span><span style=color:#75715e> * create a new order
</span><span style=color:#75715e> */</span>
Order order <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getOrderTemplate</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Order&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
order<span style=color:#f92672>.</span><span style=color:#a6e22e>setName</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Order for &#34;</span> <span style=color:#f92672>+</span> customer1<span style=color:#f92672>.</span><span style=color:#a6e22e>getName</span><span style=color:#f92672>());</span>
order<span style=color:#f92672>.</span><span style=color:#a6e22e>setDate</span><span style=color:#f92672>(</span>LocalDate<span style=color:#f92672>.</span><span style=color:#a6e22e>of</span><span style=color:#f92672>(</span>2021<span style=color:#f92672>,</span> 2<span style=color:#f92672>,</span> 1<span style=color:#f92672>));</span>
order<span style=color:#f92672>.</span><span style=color:#a6e22e>setState</span><span style=color:#f92672>(</span>State<span style=color:#f92672>.</span><span style=color:#a6e22e>PLANNED</span><span style=color:#f92672>);</span>
<span style=color:#75715e>// store reference to customer
</span><span style=color:#75715e></span> order<span style=color:#f92672>.</span><span style=color:#a6e22e>getRelationParam</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;customer&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span>customer1<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
StringListParameter orderArticlesP <span style=color:#f92672>=</span> order<span style=color:#f92672>.</span><span style=color:#a6e22e>getRelationsParam</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;articles&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
ParameterBag quantitiesBag <span style=color:#f92672>=</span> order<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameterBag</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;quantities&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
FloatParameter quantityT <span style=color:#f92672>=</span> quantitiesBag<span style=color:#f92672>.</span><span style=color:#a6e22e>removeParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;quantity&#34;</span><span style=color:#f92672>);</span>
<span style=color:#75715e>// order quantity of 20 for Dafalgan 1
</span><span style=color:#75715e></span> FloatParameter q1P <span style=color:#f92672>=</span> quantityT<span style=color:#f92672>.</span><span style=color:#a6e22e>getClone</span><span style=color:#f92672>();</span>
q1P<span style=color:#f92672>.</span><span style=color:#a6e22e>setId</span><span style=color:#f92672>(</span>dafalgan1<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
q1P<span style=color:#f92672>.</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span>20<span style=color:#f92672>);</span>
quantitiesBag<span style=color:#f92672>.</span><span style=color:#a6e22e>addParameter</span><span style=color:#f92672>(</span>q1P<span style=color:#f92672>);</span>
orderArticlesP<span style=color:#f92672>.</span><span style=color:#a6e22e>addValue</span><span style=color:#f92672>(</span>dafalgan1<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
<span style=color:#75715e>// set order quantity of 10 for Dafalgan 2
</span><span style=color:#75715e></span> FloatParameter q2P <span style=color:#f92672>=</span> quantityT<span style=color:#f92672>.</span><span style=color:#a6e22e>getClone</span><span style=color:#f92672>();</span>
orderArticlesP<span style=color:#f92672>.</span><span style=color:#a6e22e>addValue</span><span style=color:#f92672>(</span>dafalgan2<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
q2P<span style=color:#f92672>.</span><span style=color:#a6e22e>setId</span><span style=color:#f92672>(</span>dafalgan2<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
q2P<span style=color:#f92672>.</span><span style=color:#a6e22e>setValue</span><span style=color:#f92672>(</span>20<span style=color:#f92672>);</span>
quantitiesBag<span style=color:#f92672>.</span><span style=color:#a6e22e>addParameter</span><span style=color:#f92672>(</span>q2P<span style=color:#f92672>);</span>
<span style=color:#75715e>// keep IDs for later use
</span><span style=color:#75715e></span> dafalganId <span style=color:#f92672>=</span> dafalgan<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>();</span>
dafalgan1Id <span style=color:#f92672>=</span> dafalgan1<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>();</span>
dafalgan2Id <span style=color:#f92672>=</span> dafalgan2<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>();</span>
customerId <span style=color:#f92672>=</span> customer1<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>();</span>
orderId <span style=color:#f92672>=</span> order<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>();</span>
<span style=color:#75715e>/*
</span><span style=color:#75715e> * persist
</span><span style=color:#75715e> */</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>add</span><span style=color:#f92672>(</span>dafalgan<span style=color:#f92672>);</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>add</span><span style=color:#f92672>(</span>dafalgan1<span style=color:#f92672>);</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>add</span><span style=color:#f92672>(</span>dafalgan2<span style=color:#f92672>);</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>add</span><span style=color:#f92672>(</span>customer1<span style=color:#f92672>);</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>add</span><span style=color:#f92672>(</span>order<span style=color:#f92672>);</span>
<span style=color:#75715e>// commit
</span><span style=color:#75715e></span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>commitOnClose</span><span style=color:#f92672>();</span>
<span style=color:#f92672>}</span>
</code></pre></div><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> runtimeMock<span style=color:#f92672>.</span><span style=color:#a6e22e>openUserTx</span><span style=color:#f92672>(</span>certificate<span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>))</span> <span style=color:#f92672>{</span>
<span style=color:#75715e>// get order
</span><span style=color:#75715e></span> Order order <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getOrderBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Order&#34;</span><span style=color:#f92672>,</span> orderId<span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
assertNotNull<span style=color:#f92672>(</span>orderId<span style=color:#f92672>);</span>
assertEquals<span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Order for John Doe&#34;</span><span style=color:#f92672>,</span> order<span style=color:#f92672>.</span><span style=color:#a6e22e>getName</span><span style=color:#f92672>());</span>
<span style=color:#75715e>// get customer
</span><span style=color:#75715e></span> Resource customer <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceByRelation</span><span style=color:#f92672>(</span>order<span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;customer&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
assertNotNull<span style=color:#f92672>(</span>customer<span style=color:#f92672>);</span>
assertEquals<span style=color:#f92672>(</span><span style=color:#e6db74>&#34;John Doe&#34;</span><span style=color:#f92672>,</span> customer<span style=color:#f92672>.</span><span style=color:#a6e22e>getName</span><span style=color:#f92672>());</span>
<span style=color:#75715e>// get articles
</span><span style=color:#75715e></span> List<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> articles <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourcesByRelation</span><span style=color:#f92672>(</span>order<span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;articles&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
assertEquals<span style=color:#f92672>(</span>2<span style=color:#f92672>,</span> articles<span style=color:#f92672>.</span><span style=color:#a6e22e>size</span><span style=color:#f92672>());</span>
<span style=color:#75715e>// get products
</span><span style=color:#75715e></span> List<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> products <span style=color:#f92672>=</span> articles<span style=color:#f92672>.</span><span style=color:#a6e22e>stream</span><span style=color:#f92672>().</span><span style=color:#a6e22e>map</span><span style=color:#f92672>(</span>a <span style=color:#f92672>-&gt;</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceByRelation</span><span style=color:#f92672>(</span>a<span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;product&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>))</span>
<span style=color:#f92672>.</span><span style=color:#a6e22e>distinct</span><span style=color:#f92672>().</span><span style=color:#a6e22e>collect</span><span style=color:#f92672>(</span>Collectors<span style=color:#f92672>.</span><span style=color:#a6e22e>toList</span><span style=color:#f92672>());</span>
assertEquals<span style=color:#f92672>(</span>1<span style=color:#f92672>,</span> products<span style=color:#f92672>.</span><span style=color:#a6e22e>size</span><span style=color:#f92672>());</span>
<span style=color:#75715e>// search for all orders in state PLANNED and with customer
</span><span style=color:#75715e></span> List<span style=color:#f92672>&lt;</span>Order<span style=color:#f92672>&gt;</span> orders <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> OrderSearch<span style=color:#f92672>().</span><span style=color:#a6e22e>types</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Order&#34;</span><span style=color:#f92672>).</span><span style=color:#a6e22e>stateIsIn</span><span style=color:#f92672>(</span>State<span style=color:#f92672>.</span><span style=color:#a6e22e>PLANNED</span><span style=color:#f92672>)</span>
<span style=color:#f92672>.</span><span style=color:#a6e22e>where</span><span style=color:#f92672>(</span>ExpressionsSupport<span style=color:#f92672>.</span><span style=color:#a6e22e>relationParam</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;customer&#34;</span><span style=color:#f92672>).</span><span style=color:#a6e22e>isEqualTo</span><span style=color:#f92672>(</span>customerId<span style=color:#f92672>)).</span><span style=color:#a6e22e>search</span><span style=color:#f92672>(</span>tx<span style=color:#f92672>).</span><span style=color:#a6e22e>toList</span><span style=color:#f92672>();</span>
assertEquals<span style=color:#f92672>(</span>1<span style=color:#f92672>,</span> orders<span style=color:#f92672>.</span><span style=color:#a6e22e>size</span><span style=color:#f92672>());</span>
<span style=color:#f92672>}</span>
</code></pre></div><div class="notices tip"><p>Note: Checkout <a href=https://github.com/4treesCH/strolch/blob/develop/li.strolch.service/src/test/resources/transienttest/data/example-model.xml target=_blank>example-model.xml</a> and <a href=https://github.com/4treesCH/strolch/blob/develop/li.strolch.service/src/test/java/li/strolch/service/SimpleModelTest.java target=_blank>SimpleModelTest.java</a> for these examples.</p></div><div class="notices tip"><p>There is an XML Schema which defines the model in XML: <a href=/assets/xsd/StrolchModel-1.6.xsd target=_blank>StrolchModel-1.6.xsd</a></p></div><p>Here is an example of all the possible elements in Strolch:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;StrolchModel</span> <span style=color:#a6e22e>xmlns:xsi=</span><span style=color:#e6db74>&#34;http://www.w3.org/2001/XMLSchema-instance&#34;</span>
<span style=color:#a6e22e>xmlns=</span><span style=color:#e6db74>&#34;https://strolch.li/xsd/StrolchModel-1.6.xsd&#34;</span>
<span style=color:#a6e22e>xsi:schemaLocation=</span><span style=color:#e6db74>&#34;https://strolch.li/xsd/StrolchModel-1.6.xsd StrolchModel-1.6.xsd&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;IncludeFile</span> <span style=color:#a6e22e>file=</span><span style=color:#e6db74>&#34;Include1.xml&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Order</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@test1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Order&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Order&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Version</span> <span style=color:#a6e22e>Version=</span><span style=color:#e6db74>&#34;0&#34;</span> <span style=color:#a6e22e>CreatedBy=</span><span style=color:#e6db74>&#34;test&#34;</span> <span style=color:#a6e22e>CreatedAt=</span><span style=color:#e6db74>&#34;2012-11-30T18:12:05.628+01:00&#34;</span> <span style=color:#a6e22e>Deleted=</span><span style=color:#e6db74>&#34;false&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag01&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag01&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;Policies&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;PlanningPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:SimplePlanning&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;ConfirmationPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:NoConfirmation&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Policies&gt;</span>
<span style=color:#f92672>&lt;/Order&gt;</span>
<span style=color:#f92672>&lt;Resource</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;MyTestResource&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Name&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestType&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Version</span> <span style=color:#a6e22e>Version=</span><span style=color:#e6db74>&#34;0&#34;</span> <span style=color:#a6e22e>CreatedBy=</span><span style=color:#e6db74>&#34;test&#34;</span> <span style=color:#a6e22e>CreatedAt=</span><span style=color:#e6db74>&#34;2012-11-30T18:12:05.628+01:00&#34;</span> <span style=color:#a6e22e>Deleted=</span><span style=color:#e6db74>&#34;false&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag01&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag 01&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag02&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag 02&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;TimedState</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@booleanState&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean State&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Value</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>&#34;1970-01-01T00:02:00.000+01:00&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;false&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/TimedState&gt;</span>
<span style=color:#f92672>&lt;Policies&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;PlanningPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:SimplePlanning&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;ConfirmationPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:NoConfirmation&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Policies&gt;</span>
<span style=color:#f92672>&lt;/Resource&gt;</span>
<span style=color:#f92672>&lt;Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;activity_1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Activity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;parentType&#34;</span> <span style=color:#a6e22e>TimeOrdering=</span><span style=color:#e6db74>&#34;Series&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Version</span> <span style=color:#a6e22e>Version=</span><span style=color:#e6db74>&#34;0&#34;</span> <span style=color:#a6e22e>CreatedBy=</span><span style=color:#e6db74>&#34;test&#34;</span> <span style=color:#a6e22e>CreatedAt=</span><span style=color:#e6db74>&#34;2012-11-30T18:12:05.628+01:00&#34;</span> <span style=color:#a6e22e>Deleted=</span><span style=color:#e6db74>&#34;false&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag01&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;Policies&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;PlanningPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:SimplePlanning&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;ConfirmationPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:NoConfirmation&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Policies&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;action_1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Action 1&#34;</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;dummyId&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;dummyType&#34;</span> <span style=color:#a6e22e>State=</span><span style=color:#e6db74>&#34;Created&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Use&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag01&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;Policies&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;PlanningPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:SimplePlanning&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;ConfirmationPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:NoConfirmation&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Policies&gt;</span>
<span style=color:#f92672>&lt;ValueChange</span> <span style=color:#a6e22e>StateId=</span><span style=color:#e6db74>&#34;dummyId&#34;</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>&#34;2012-11-30T18:12:05.628+01:00&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;5&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Integer&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;ValueChange</span> <span style=color:#a6e22e>StateId=</span><span style=color:#e6db74>&#34;dummyId&#34;</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>&#34;2012-11-30T18:12:06.628+01:00&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;6&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Integer&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Action&gt;</span>
<span style=color:#f92672>&lt;Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;child_activity&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Child Activity&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;childType&#34;</span> <span style=color:#a6e22e>TimeOrdering=</span><span style=color:#e6db74>&#34;Series&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@bag01&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Test Bag&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;TestBag&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;@param1&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Boolean Param&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;Policies&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;PlanningPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:SimplePlanning&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;ConfirmationPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:NoConfirmation&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Policies&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;action_2&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Action 2&#34;</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;dummyId&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;dummyType&#34;</span> <span style=color:#a6e22e>State=</span><span style=color:#e6db74>&#34;Planned&#34;</span>
<span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Use&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ValueChange</span> <span style=color:#a6e22e>StateId=</span><span style=color:#e6db74>&#34;dummyId&#34;</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>&#34;2012-11-30T18:12:05.628+01:00&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;5&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Integer&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;ValueChange</span> <span style=color:#a6e22e>StateId=</span><span style=color:#e6db74>&#34;dummyId&#34;</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>&#34;2012-11-30T18:12:06.628+01:00&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;6&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Integer&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Action&gt;</span>
<span style=color:#f92672>&lt;Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;action_3&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Action 3&#34;</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>&#34;dummyId&#34;</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>&#34;dummyType&#34;</span> <span style=color:#a6e22e>State=</span><span style=color:#e6db74>&#34;Created&#34;</span>
<span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Use&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Activity&gt;</span>
<span style=color:#f92672>&lt;/Activity&gt;</span>
<span style=color:#f92672>&lt;/StrolchModel&gt;</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/architecture/ title=Architecture><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/do-and-donts/ title="Do and Don't" style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,46 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Observers - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/observers/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class="dd-item active"><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/observers.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Observers</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#observers>Observers</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Observers</h1><h2 id=observers>Observers</h2><p>All changes done in a Strolch transaction are recorded and then propagated to
any registered observers.</p><p>The observer feature is opt-in and is configured for each realm. In the
<code>StrolchConfiguration.xml</code> file enable observers by adding the
<code>enableObserverUpdates</code> property per realm:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;StrolchConfiguration&gt;</span>
<span style=color:#f92672>&lt;env</span> <span style=color:#a6e22e>id=</span><span style=color:#e6db74>&#34;dev&#34;</span><span style=color:#f92672>&gt;</span>
...
<span style=color:#f92672>&lt;Component&gt;</span>
<span style=color:#f92672>&lt;name&gt;</span>RealmHandler<span style=color:#f92672>&lt;/name&gt;</span>
<span style=color:#f92672>&lt;api&gt;</span>li.strolch.agent.api.RealmHandler<span style=color:#f92672>&lt;/api&gt;</span>
<span style=color:#f92672>&lt;impl&gt;</span>li.strolch.agent.impl.DefaultRealmHandler<span style=color:#f92672>&lt;/impl&gt;</span>
<span style=color:#f92672>&lt;depends&gt;</span>PrivilegeHandler<span style=color:#f92672>&lt;/depends&gt;</span>
<span style=color:#f92672>&lt;Properties&gt;</span>
<span style=color:#f92672>&lt;realms&gt;</span>defaultRealm, otherRealm<span style=color:#f92672>&lt;/realms&gt;</span>
<span style=color:#f92672>&lt;enableObserverUpdates&gt;</span>true<span style=color:#f92672>&lt;/enableObserverUpdates&gt;</span>
<span style=color:#f92672>&lt;dataStoreMode&gt;</span>TRANSIENT<span style=color:#f92672>&lt;/dataStoreMode&gt;</span>
<span style=color:#f92672>&lt;dataStoreFile&gt;</span>StrolchModel.xml<span style=color:#f92672>&lt;/dataStoreFile&gt;</span>
<span style=color:#f92672>&lt;enableObserverUpdates.otherRealm&gt;</span>true<span style=color:#f92672>&lt;/enableObserverUpdates.otherRealm&gt;</span>
<span style=color:#f92672>&lt;dataStoreMode.otherRealm&gt;</span>TRANSIENT<span style=color:#f92672>&lt;/dataStoreMode.otherRealm&gt;</span>
<span style=color:#f92672>&lt;dataStoreFile.otherRealm&gt;</span>StrolchModel.xml<span style=color:#f92672>&lt;/dataStoreFile.otherRealm&gt;</span>
<span style=color:#f92672>&lt;/Properties&gt;</span>
<span style=color:#f92672>&lt;/Component&gt;</span>
<span style=color:#f92672>&lt;/env&gt;</span>
...
<span style=color:#f92672>&lt;/StrolchConfiguration&gt;</span>
</code></pre></div><p>Registering for updates is done by registering an Observer on the
ObserverHandler of the realm itself:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>ObserverHandler observerHandler <span style=color:#f92672>=</span> container<span style=color:#f92672>.</span><span style=color:#a6e22e>getRealm</span><span style=color:#f92672>(</span>StrolchConstants<span style=color:#f92672>.</span><span style=color:#a6e22e>DEFAULT_REALM</span><span style=color:#f92672>).</span><span style=color:#a6e22e>getObserverHandler</span><span style=color:#f92672>();</span>
observerHandler<span style=color:#f92672>.</span><span style=color:#a6e22e>registerObserver</span><span style=color:#f92672>(</span>Tags<span style=color:#f92672>.</span><span style=color:#a6e22e>RESOURCE</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>new</span> Observer<span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>update</span><span style=color:#f92672>(</span>String key<span style=color:#f92672>,</span> List<span style=color:#f92672>&lt;</span>StrolchRootElement<span style=color:#f92672>&gt;</span> elements<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
logger<span style=color:#f92672>.</span><span style=color:#a6e22e>info</span><span style=color:#f92672>(</span>elements<span style=color:#f92672>.</span><span style=color:#a6e22e>size</span><span style=color:#f92672>()</span> <span style=color:#f92672>+</span> <span style=color:#e6db74>&#34; resources were updated!&#34;</span><span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>remove</span><span style=color:#f92672>(</span>String key<span style=color:#f92672>,</span> List<span style=color:#f92672>&lt;</span>StrolchRootElement<span style=color:#f92672>&gt;</span> elements<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
logger<span style=color:#f92672>.</span><span style=color:#a6e22e>info</span><span style=color:#f92672>(</span>elements<span style=color:#f92672>.</span><span style=color:#a6e22e>size</span><span style=color:#f92672>()</span> <span style=color:#f92672>+</span> <span style=color:#e6db74>&#34; resources were removed!&#34;</span><span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>add</span><span style=color:#f92672>(</span>String key<span style=color:#f92672>,</span> List<span style=color:#f92672>&lt;</span>StrolchRootElement<span style=color:#f92672>&gt;</span> elements<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
logger<span style=color:#f92672>.</span><span style=color:#a6e22e>info</span><span style=color:#f92672>(</span>elements<span style=color:#f92672>.</span><span style=color:#a6e22e>size</span><span style=color:#f92672>()</span> <span style=color:#f92672>+</span> <span style=color:#e6db74>&#34; resources were added!&#34;</span><span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#f92672>});</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/policies/ title=Policies><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/versioning/ title=Versioning style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,68 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Policies - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/policies/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class="dd-item active"><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/policies.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Policies</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#policies>Policies</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Policies</h1><h2 id=policies>Policies</h2><p>Policies are an integral part when writing business logic in Strolch. In many
cases it would suffice to write all such logic in <code>Services</code> and <code>Commands</code>, but
as soon as behaviour can change, depending on the element being accessed, then
this would quickly lead to many if/else blocks.</p><p>Since writing large if/else blocks is not maintanable in the long run, Strolch
offers a different approach. All Strolch elements can store Policy definitions.
This is a simple key/value store where the key defines the type of policy, and
the value references the policy to use.</p><p>Currently there are two ways to reference a policy in Strolch, either via a key
which defines a further lookup in the <code>PolicyHandler</code>, or directly as the name
of the class to instantiate.</p><p>Using policies in Strolch gives the additional possibility of easily changing
the behaviour at runtime, as a Service and/or Command would delegate the
behaviour to the currently configured policy on the releveant element.</p><p>Policies are implemented by defining an abstract class and extends
StrolchPolicy. This abstract class then defines the API of the actual policy. A
concrete class then extends this abstract class and implements the concrete
methods.</p><p>Policies are registered on Resources, Orders, Activities and Actions. The
following shows defining two policies on a Resource, a PlanningPolicy, an
ExecutionPolicy in XML:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;Resource</span> <span style=color:#960050;background-color:#1e0010>...</span><span style=color:#f92672>&gt;</span>
...
<span style=color:#f92672>&lt;Policies&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;PlanningPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;key:SimplePlanning&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;ExecutionPolicy&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;java:li.strolch.policytest.TestSimulatedExecutionPolicy&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Policies&gt;</span>
<span style=color:#f92672>&lt;/Resource&gt;</span>
</code></pre></div><div class="notices tip"><p>Note how the PlanningPolicy has a value of key:SimplePlanning
and the ExecutionPolicy defines a reference to an actual class.</p></div><p>To use the PolicyHandler, it must be configured in the StrolchConfiguration.xml
as follows:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml>
<span style=color:#f92672>&lt;Component&gt;</span>
<span style=color:#f92672>&lt;name&gt;</span>PolicyHandler<span style=color:#f92672>&lt;/name&gt;</span>
<span style=color:#f92672>&lt;api&gt;</span>li.strolch.policy.PolicyHandler<span style=color:#f92672>&lt;/api&gt;</span>
<span style=color:#f92672>&lt;impl&gt;</span>li.strolch.policy.DefaultPolicyHandler<span style=color:#f92672>&lt;/impl&gt;</span>
<span style=color:#f92672>&lt;Properties&gt;</span>
<span style=color:#f92672>&lt;readPolicyFile&gt;</span>true<span style=color:#f92672>&lt;/readPolicyFile&gt;</span>
<span style=color:#f92672>&lt;policyConfigFile&gt;</span>StrolchPolicies.xml<span style=color:#f92672>&lt;/policyConfigFile&gt;</span>
<span style=color:#f92672>&lt;/Properties&gt;</span>
<span style=color:#f92672>&lt;/Component&gt;</span>
</code></pre></div><p>And this policy handler implementation requires a file where the lookups for the
policies is defined, e.g.:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml>
<span style=color:#f92672>&lt;StrolchPolicies&gt;</span>
<span style=color:#f92672>&lt;PolicyType</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;PlanningPolicy&#34;</span>
<span style=color:#a6e22e>Api=</span><span style=color:#e6db74>&#34;li.strolch.policytest.TestPlanningPolicy&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Key=</span><span style=color:#e6db74>&#34;SimplePlanning&#34;</span>
<span style=color:#a6e22e>Class=</span><span style=color:#e6db74>&#34;li.strolch.policytest.TestSimplePlanningPolicy&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/PolicyType&gt;</span>
<span style=color:#f92672>&lt;PolicyType</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;ConfirmationPolicy&#34;</span>
<span style=color:#a6e22e>Api=</span><span style=color:#e6db74>&#34;li.strolch.policytest.TestConfirmationPolicy&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Key=</span><span style=color:#e6db74>&#34;NoConfirmation&#34;</span>
<span style=color:#a6e22e>Class=</span><span style=color:#e6db74>&#34;li.strolch.policytest.TestNoConfirmationPolicy&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/PolicyType&gt;</span>
<span style=color:#f92672>&lt;/StrolchPolicies&gt;</span>
</code></pre></div><p>Now at runtime we can access the policies:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>PolicyHandler policyHandler<span style=color:#f92672>=</span>getComponent<span style=color:#f92672>(</span>PolicyHandler<span style=color:#f92672>.</span><span style=color:#a6e22e>class</span><span style=color:#f92672>);</span>
<span style=color:#66d9ef>try</span><span style=color:#f92672>(</span>StrolchTransaction tx<span style=color:#f92672>=</span>openTx<span style=color:#f92672>()){</span>
Resource res<span style=color:#f92672>=</span>tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;TestType&#34;</span><span style=color:#f92672>,</span><span style=color:#e6db74>&#34;MyTestResource&#34;</span><span style=color:#f92672>);</span>
PolicyDefs policyDefs<span style=color:#f92672>=</span>res<span style=color:#f92672>.</span><span style=color:#a6e22e>getPolicyDefs</span><span style=color:#f92672>();</span>
PolicyDef planningPolicyDef<span style=color:#f92672>=</span>policyDefs<span style=color:#f92672>.</span><span style=color:#a6e22e>getPolicyDef</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;PlanningPolicy&#34;</span><span style=color:#f92672>);</span>
PlanningPolicy planningPolicy<span style=color:#f92672>=</span>policyHandler<span style=color:#f92672>.</span><span style=color:#a6e22e>getPolicy</span><span style=color:#f92672>(</span>planningPolicyDef<span style=color:#f92672>,</span>tx<span style=color:#f92672>);</span>
planningPolicy<span style=color:#f92672>.</span><span style=color:#a6e22e>plan</span><span style=color:#f92672>(...);</span>
PolicyDef executionPolicyDef<span style=color:#f92672>=</span>res<span style=color:#f92672>.</span><span style=color:#a6e22e>getPolicyDefs</span><span style=color:#f92672>().</span><span style=color:#a6e22e>getPolicyDef</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;ExecutionPolicy&#34;</span><span style=color:#f92672>);</span>
ExecutionPolicy executionPolicy<span style=color:#f92672>=</span>policyHandler<span style=color:#f92672>.</span><span style=color:#a6e22e>getPolicy</span><span style=color:#f92672>(</span>executionPolicyDef<span style=color:#f92672>,</span>tx<span style=color:#f92672>);</span>
executionPolicy<span style=color:#f92672>.</span><span style=color:#a6e22e>execute</span><span style=color:#f92672>(...);</span>
<span style=color:#f92672>}</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/transactions/ title=Transactions><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/observers/ title=Observers style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,73 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Privileges - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/priviles/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class="dd-item active"><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/priviles.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Privileges</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#privileges>Privileges</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Privileges</h1><h2 id=privileges>Privileges</h2><p>No framework is complete without user management and privilege validation. The
basic form would be Users and Roles, and then validating that an authenticated
user has a given role. In Strolch we go a step further: A User has roles
assigned, and each role has a set of Privileges. The privileges can overlap, a
validation is performed to make sure that the one role doesn&rsquo;t deny and another
role allows a specific action.</p><p>As explained in
the <a href=/documentation/runtime-configuration.md>Privilege Configuration</a> section,
users are defined in the <code>PrivilegeUsers.xml</code> file, and roles are defined in the
<code>PrivilegeRoles.xml</code> file.</p><p>Let&rsquo;s assume the following user and role definition:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;Users&gt;</span>
<span style=color:#f92672>&lt;User</span> <span style=color:#a6e22e>userId=</span><span style=color:#e6db74>&#34;1&#34;</span> <span style=color:#a6e22e>username=</span><span style=color:#e6db74>&#34;jill&#34;</span> <span style=color:#a6e22e>password=</span><span style=color:#e6db74>&#34;$PBKDF2WithHmacSHA512,10000,256$61646d696e$cb69962946617da006a2f95776d78b49e5ec7941d2bdb2d25cdb05f957f64344&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Firstname&gt;</span>Jill<span style=color:#f92672>&lt;/Firstname&gt;</span>
<span style=color:#f92672>&lt;Lastname&gt;</span>Someone<span style=color:#f92672>&lt;/Lastname&gt;</span>
<span style=color:#f92672>&lt;State&gt;</span>ENABLED<span style=color:#f92672>&lt;/State&gt;</span>
<span style=color:#f92672>&lt;Locale&gt;</span>en-GB<span style=color:#f92672>&lt;/Locale&gt;</span>
<span style=color:#f92672>&lt;Roles&gt;</span>
<span style=color:#f92672>&lt;Role&gt;</span>AppUser<span style=color:#f92672>&lt;/Role&gt;</span>
<span style=color:#f92672>&lt;/Roles&gt;</span>
<span style=color:#f92672>&lt;Properties&gt;</span>
<span style=color:#f92672>&lt;Property</span> <span style=color:#a6e22e>name=</span><span style=color:#e6db74>&#34;realm&#34;</span> <span style=color:#a6e22e>value=</span><span style=color:#e6db74>&#34;execution&#34;</span> <span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Properties&gt;</span>
<span style=color:#f92672>&lt;/User&gt;</span>
<span style=color:#f92672>&lt;/Users&gt;</span>
</code></pre></div><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;Roles&gt;</span>
<span style=color:#f92672>&lt;Role</span> <span style=color:#a6e22e>name=</span><span style=color:#e6db74>&#34;AppUser&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Privilege</span> <span style=color:#a6e22e>name=</span><span style=color:#e6db74>&#34;li.strolch.service.api.Service&#34;</span> <span style=color:#a6e22e>policy=</span><span style=color:#e6db74>&#34;DefaultPrivilege&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;AllAllowed&gt;</span>true<span style=color:#f92672>&lt;/AllAllowed&gt;</span>
<span style=color:#f92672>&lt;/Privilege&gt;</span>
<span style=color:#f92672>&lt;Privilege</span> <span style=color:#a6e22e>name=</span><span style=color:#e6db74>&#34;li.strolch.model.query.StrolchQuery&#34;</span> <span style=color:#a6e22e>policy=</span><span style=color:#e6db74>&#34;DefaultPrivilege&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;AllAllowed&gt;</span>true<span style=color:#f92672>&lt;/AllAllowed&gt;</span>
<span style=color:#f92672>&lt;/Privilege&gt;</span>
<span style=color:#f92672>&lt;Privilege</span> <span style=color:#a6e22e>name=</span><span style=color:#e6db74>&#34;li.strolch.search.StrolchSearch&#34;</span> <span style=color:#a6e22e>policy=</span><span style=color:#e6db74>&#34;DefaultPrivilege&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;AllAllowed&gt;</span>true<span style=color:#f92672>&lt;/AllAllowed&gt;</span>
<span style=color:#f92672>&lt;/Privilege&gt;</span>
<span style=color:#f92672>&lt;/Role&gt;</span>
<span style=color:#f92672>&lt;/Roles&gt;</span>
</code></pre></div><p>This configuration contains one user and one role. The user <code>jill</code> has the role
<code>AppUser</code> and the role <code>AppUser</code> has three privileges assigned.</p><p>Note how the user&rsquo;s password is configured similar to a unix password
definition: Using the dollar sign & first the hashing algorithm is configured (
algorithm, iterations, key length), then the salt, followed by the password
hash.</p><div class="notices tip"><p>Note: The password can also still be saved using two separate fields: a salt and
password field. This configuration will be immediately changed to the unix form,
so won&rsquo;t be described further here.</p></div><p>Further a user always has a firstname and last name. Optionally a locale can be
set, otherwise the system locale is used. The user&rsquo;s state must be defined as
one of <code>NEW</code>, <code>ENABLED</code>, <code>DISABLED</code>, <code>EXPIRED</code> or <code>SYSTEM</code>. A user can only
authenticate/login with the state <code>ENABLED</code>. A user can have any number of
properties, which can then be used at runtime. A user can also reference any
number of roles, the assigned privilege can overlap, a global configuration mode
defines how duplicate privileges are handled.</p><p>Roles have a name and any number of <code>Privilege</code> definitions. A Privilege has a
name, which in many cases is the name of Java class/interface on which an action
is being invoked. The <code>policy</code> value defines which policy to use when evaluating
the privilege access. The privilege definition is defined in the
<code>PrivilegeConfig.xml</code> and is the name of a class to call for privilege validation.</p><p>Further the privilege definitions can have a <code>AllAllowed</code> boolean flag, or any
number of Allow or Deny values. How these values are interpreted is defined in
the policy implementation. A policy takes three input parameters:</p><ul><li><code>PrivilegeContext</code> → supplied by privilege and gives access to the Certificate,
thus identifying the user for which privilege access is to be validated.</li><li><code>IPrivilege</code> → Contains the privilege values: <code>AllAllowed</code>, <code>Allow</code> and <code>Deny</code></li><li><code>Restrictable</code> → An interface from which the privilege name is retrieved, and
the associated value. The value is an object, and is cast to the relevant
input in the concrete privilege policy.</li></ul><p>The following privilege policies are already implemented:</p><ul><li><code>DefaultPrivilege</code> → simple policy where the passed <code>Restrictable</code> is expected to
return a String value, which is compared with allow and deny values.</li><li>Internal: <code>RoleAccessPrivilege</code> → policy used for the internal privileges
<code>PrivilegeGetRole</code>, <code>PrivilegeAddRole</code>, <code>PrivilegeModifyRole</code> or <code>PrivilegeModifyRole</code></li><li>Internal: <code>UserAccessPrivilege</code> → policy used for the internal privileges
<code>PrivilegeGetUser</code>, <code>PrivilegeAddUser</code>, <code>PrivilegeRemoveUser</code>, <code>PrivilegeModifyUser</code>,
<code>PrivilegeAddRoleToUser</code>, <code>PrivilegeRemoveRoleFromUser</code>, <code>PrivilegeSetUserState</code>,
<code>PrivilegeSetUserLocale</code> or <code>PrivilegeSetUserPassword</code></li><li>Internal: <code>UserAccessWithSameOrganisationPrivilege</code> → Same as the
<code>UserAccessPrivilege</code> but expects the authenticated user to have a property
<code>organisation</code> and validates that the user being modified is in the same
organisation.</li><li>Internal: <code>UsernameFromCertificatePrivilege</code> → This policy expects a
<code>Restrictable</code> to return the <code>certificate</code> of another authenticated user and is
used when modifying an authenticated user, i.e. killing a session, or
modifying its current state, e.g. locale etc.</li><li>Internal: <code>UsernameFromCertificateWithSameOrganisationPrivilege</code> → Same as
<code>UsernameFromCertificatePrivilege</code> but expects the authenticated user to have a
property <code>organisation</code> and validates that the user being modified is in the
same organisation.</li></ul><div class="notices tip"><p>Note: As a rule, the sequence is <code>AllAllowed → Allow → Deny → default deny</code></p></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/reports/ title=Reports><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/plc/ title=PLC style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,61 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Queries - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/queries/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class="dd-item active"><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/queries.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Queries</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#queries>Queries</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Queries</h1><h2 id=queries>Queries</h2><div class="notices warning"><p>The Query API is deprecated and the search API should be used instead.</p></div><p>As is custom for every framework, querying the model must be possible. Strolch
queries are implemented using the <code>StrolchQuery</code> interface and one of its concrete
implementations: <code>ResourceQuery</code>, <code>OrderQuery</code>, <code>ActivityQuery</code>.</p><p>A Strolch element always has two identifiers: <code>Type</code> and <code>Id</code>. 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 <code>Resource</code>, but one of type <code>Car</code> and the other
of type <code>House</code>. Both would have different parameters.</p><p>Thus one of the inputs for every query is it&rsquo;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.</p><p>Further input for a StrolchQuery are the selections. These selections get
translated into RDBMS <code>WHERE</code> clauses. Selections support boolean operations thus
allowing for complex querying.</p><p>StrolchQueries also support Ordering and object transformation. Following
classes provide the most used scenarios:</p><ul><li>OrderById</li><li>OrderByName</li><li>OrderByParameter</li><li>*ToDomVisitor</li><li>*ToSaxVisitor</li><li>*ToJsonVisitor</li><li>*ToFlatJsonVisitor</li></ul><p>Example: Query all resources of type Car:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
ResourceQuery<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> query <span style=color:#f92672>=</span> ResourceQuery<span style=color:#f92672>.</span><span style=color:#a6e22e>query</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>);</span>
query<span style=color:#f92672>.</span><span style=color:#a6e22e>withAny</span><span style=color:#f92672>();</span>
List<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> cars <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>doQuery</span><span style=color:#f92672>(</span>query<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>Example: Query all resources of type Car, order by Name and transform to JSON:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
ResourceQuery<span style=color:#f92672>&lt;</span>JsonObject<span style=color:#f92672>&gt;</span> query <span style=color:#f92672>=</span> ResourceQuery<span style=color:#f92672>.</span><span style=color:#a6e22e>query</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>new</span> ResourceToJsonVisitor<span style=color:#f92672>(),</span>
<span style=color:#66d9ef>new</span> OrderByName<span style=color:#f92672>());</span>
query<span style=color:#f92672>.</span><span style=color:#a6e22e>withAny</span><span style=color:#f92672>();</span>
List<span style=color:#f92672>&lt;</span>JsonObject<span style=color:#f92672>&gt;</span> cars <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>doQuery</span><span style=color:#f92672>(</span>query<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>the previous example can also be written as follows:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
ResourceQuery<span style=color:#f92672>&lt;</span>JsonObject<span style=color:#f92672>&gt;</span> query <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> ResourceQuery<span style=color:#f92672>&lt;&gt;();</span>
query<span style=color:#f92672>.</span><span style=color:#a6e22e>setNavigation</span><span style=color:#f92672>(</span><span style=color:#66d9ef>new</span> StrolchTypeNavigation<span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>));</span>
query<span style=color:#f92672>.</span><span style=color:#a6e22e>setResourceVisitor</span><span style=color:#f92672>(</span><span style=color:#66d9ef>new</span> ResourceToJsonVisitor<span style=color:#f92672>());</span>
query<span style=color:#f92672>.</span><span style=color:#a6e22e>withAny</span><span style=color:#f92672>();</span>
List<span style=color:#f92672>&lt;</span>JsonObject<span style=color:#f92672>&gt;</span> cars <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>doQuery</span><span style=color:#f92672>(</span>query<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>Example: Query all resources of type Car with color blue:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
ResourceQuery<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> query <span style=color:#f92672>=</span> ResourceQuery<span style=color:#f92672>.</span><span style=color:#a6e22e>query</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>);</span>
query<span style=color:#f92672>.</span><span style=color:#a6e22e>with</span><span style=color:#f92672>(</span>ParameterSelection<span style=color:#f92672>.</span><span style=color:#a6e22e>stringSelection</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;parameters&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;color&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;blue&#34;</span><span style=color:#f92672>,</span> StringMatchMode<span style=color:#f92672>.</span><span style=color:#a6e22e>es</span><span style=color:#f92672>()));</span>
List<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> cars <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>doQuery</span><span style=color:#f92672>(</span>query<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>Example: Query all resources of type Car which are not blue:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
ResourceQuery<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> query <span style=color:#f92672>=</span> ResourceQuery<span style=color:#f92672>.</span><span style=color:#a6e22e>query</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>);</span>
query<span style=color:#f92672>.</span><span style=color:#a6e22e>not</span><span style=color:#f92672>(</span>ParameterSelection<span style=color:#f92672>.</span><span style=color:#a6e22e>stringSelection</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;parameters&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;color&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;blue&#34;</span><span style=color:#f92672>,</span> StringMatchMode<span style=color:#f92672>.</span><span style=color:#a6e22e>es</span><span style=color:#f92672>()));</span>
List<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> cars <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>doQuery</span><span style=color:#f92672>(</span>query<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>Example: Query all resources of type Car with color blue or yellow:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
ResourceQuery<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> query <span style=color:#f92672>=</span> ResourceQuery<span style=color:#f92672>.</span><span style=color:#a6e22e>query</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>);</span>
query<span style=color:#f92672>.</span><span style=color:#a6e22e>or</span><span style=color:#f92672>().</span><span style=color:#a6e22e>with</span><span style=color:#f92672>(</span>
ParameterSelection<span style=color:#f92672>.</span><span style=color:#a6e22e>stringSelection</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;parameters&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;color&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;blue&#34;</span><span style=color:#f92672>,</span> StringMatchMode<span style=color:#f92672>.</span><span style=color:#a6e22e>es</span><span style=color:#f92672>()),</span>
ParameterSelection<span style=color:#f92672>.</span><span style=color:#a6e22e>stringSelection</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;parameters&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;color&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;yellow&#34;</span><span style=color:#f92672>,</span> StringMatchMode<span style=color:#f92672>.</span><span style=color:#a6e22e>es</span><span style=color:#f92672>()));</span>
List<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> cars <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>doQuery</span><span style=color:#f92672>(</span>query<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>Example: Query all resources of type Car with color blue or yellow owned by Jill:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
ResourceQuery<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> query <span style=color:#f92672>=</span> ResourceQuery<span style=color:#f92672>.</span><span style=color:#a6e22e>query</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>);</span>
StringParameterSelection owner <span style=color:#f92672>=</span> ParameterSelection<span style=color:#f92672>.</span><span style=color:#a6e22e>stringSelection</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;parameters&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;owner&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;Jill&#34;</span><span style=color:#f92672>,</span> StringMatchMode<span style=color:#f92672>.</span><span style=color:#a6e22e>es</span><span style=color:#f92672>());</span>
OrSelection colors <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> OrSelection<span style=color:#f92672>().</span><span style=color:#a6e22e>with</span><span style=color:#f92672>(</span>
ParameterSelection<span style=color:#f92672>.</span><span style=color:#a6e22e>stringSelection</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;parameters&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;color&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;blue&#34;</span><span style=color:#f92672>,</span> StringMatchMode<span style=color:#f92672>.</span><span style=color:#a6e22e>es</span><span style=color:#f92672>()),</span>
ParameterSelection<span style=color:#f92672>.</span><span style=color:#a6e22e>stringSelection</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;parameters&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;color&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;yellow&#34;</span><span style=color:#f92672>,</span> StringMatchMode<span style=color:#f92672>.</span><span style=color:#a6e22e>es</span><span style=color:#f92672>()));</span>
query<span style=color:#f92672>.</span><span style=color:#a6e22e>and</span><span style=color:#f92672>().</span><span style=color:#a6e22e>with</span><span style=color:#f92672>(</span>owner<span style=color:#f92672>,</span> colors<span style=color:#f92672>);</span>
List<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> cars <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>doQuery</span><span style=color:#f92672>(</span>query<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/searches/ title=Searches><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/transactions/ title=Transactions style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,82 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Realms - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/realms/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class="dd-item active"><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/realms.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Realms</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#realms>Realms</a></li><li><a href=#multi-realm>Multi-Realm</a></li><li><a href=#access-realm>Access realm</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Realms</h1><h2 id=realms>Realms</h2><p>Realms implement multi-tenant capabilities. A Strolch agent can have an
arbitrary number of realms configured and each realm has its own persistence
configuration, allowing to separate mandates completely.</p><p>A realm can run in one of the following modes:</p><ul><li>EMPTY
This is a transient data store mode, where no model changes are
persisted - they are only kept in memory. When the Strolch agent is
started, this realm is empty as no data is loaded.</li><li>TRANSIENT
This is the same as EMPTY, but with the difference that when the Strolch
agent is started, a model file is parsed and the in-memory realm is
populated with the elements parsed from the model file.</li><li>CACHED
In this mode, all data is stored in-memory, and any changes made are
written back to the persistence layer. This allows for fast in-memory
qeuries, but makes sure no data is lost when the agent is restarted.</li></ul><p>Realms are mostly hidden from a developer as a <code>StrolchTransaction</code> exposes
all important operations needed to access Strolch objects. A developer will
however need to configure the realms for their specific project. If the
project only requires one realm, then the <code>defaultRealm</code> can be used, where the
developer only is required to configure the mode and any relevant model file.</p><p>If the mode is <code>CACHED</code>, then the <code>PersistenceHandler</code> component is required to be
configured, so that the DAOs know how to access the underlying database.</p><p>The configuration in the <code>StrolchConfiguration.xml</code> file is as follows:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;StrolchConfiguration&gt;</span>
<span style=color:#f92672>&lt;env</span> <span style=color:#a6e22e>id=</span><span style=color:#e6db74>&#34;dev&#34;</span><span style=color:#f92672>&gt;</span>
...
<span style=color:#f92672>&lt;Component&gt;</span>
<span style=color:#f92672>&lt;name&gt;</span>RealmHandler<span style=color:#f92672>&lt;/name&gt;</span>
<span style=color:#f92672>&lt;api&gt;</span>li.strolch.agent.api.RealmHandler<span style=color:#f92672>&lt;/api&gt;</span>
<span style=color:#f92672>&lt;impl&gt;</span>li.strolch.agent.impl.DefaultRealmHandler<span style=color:#f92672>&lt;/impl&gt;</span>
<span style=color:#f92672>&lt;depends&gt;</span>PrivilegeHandler<span style=color:#f92672>&lt;/depends&gt;</span>
<span style=color:#75715e>&lt;!-- if CACHED: --&gt;</span>
<span style=color:#75715e>&lt;!--depends&gt;PersistenceHandler&lt;/depends--&gt;</span>
<span style=color:#f92672>&lt;Properties&gt;</span>
<span style=color:#f92672>&lt;dataStoreMode&gt;</span>EMPTY|TRANSIENT|CACHED<span style=color:#f92672>&lt;/dataStoreMode&gt;</span>
<span style=color:#f92672>&lt;dataStoreFile&gt;</span>StrolchModel.xml<span style=color:#f92672>&lt;/dataStoreFile&gt;</span>
<span style=color:#f92672>&lt;/Properties&gt;</span>
<span style=color:#f92672>&lt;/Component&gt;</span>
...
<span style=color:#f92672>&lt;/env&gt;</span>
<span style=color:#f92672>&lt;/StrolchConfiguration&gt;</span>
</code></pre></div><h2 id=multi-realm>Multi-Realm</h2><p>A multi-realm configuration would be as follows.</p><div class="notices tip"><p>Note how the defaultRealm is still enabled, and has its configuration as
before. Further the PostgreSQL PersistenceHandler is configured to show how the
realms are connected to the persistence handler:</p></div><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;StrolchConfiguration&gt;</span>
<span style=color:#f92672>&lt;env</span> <span style=color:#a6e22e>id=</span><span style=color:#e6db74>&#34;dev&#34;</span><span style=color:#f92672>&gt;</span>
...
<span style=color:#f92672>&lt;Component&gt;</span>
<span style=color:#f92672>&lt;name&gt;</span>RealmHandler<span style=color:#f92672>&lt;/name&gt;</span>
<span style=color:#f92672>&lt;api&gt;</span>li.strolch.agent.api.RealmHandler<span style=color:#f92672>&lt;/api&gt;</span>
<span style=color:#f92672>&lt;impl&gt;</span>li.strolch.agent.impl.DefaultRealmHandler<span style=color:#f92672>&lt;/impl&gt;</span>
<span style=color:#f92672>&lt;depends&gt;</span>PrivilegeHandler<span style=color:#f92672>&lt;/depends&gt;</span>
<span style=color:#f92672>&lt;depends&gt;</span>PersistenceHandler<span style=color:#f92672>&lt;/depends&gt;</span>
<span style=color:#f92672>&lt;Properties&gt;</span>
<span style=color:#f92672>&lt;realms&gt;</span>defaultRealm, cachedRealm<span style=color:#f92672>&lt;/realms&gt;</span>
<span style=color:#f92672>&lt;dataStoreMode&gt;</span>TRANSIENT<span style=color:#f92672>&lt;/dataStoreMode&gt;</span>
<span style=color:#f92672>&lt;dataStoreFile&gt;</span>DefaultRealm.xml<span style=color:#f92672>&lt;/dataStoreFile&gt;</span>
<span style=color:#f92672>&lt;dataStoreMode.cachedRealm&gt;</span>CACHED<span style=color:#f92672>&lt;/dataStoreMode.cachedRealm&gt;</span>
<span style=color:#f92672>&lt;dataStoreMode.emptyRealm&gt;</span>EMPTY<span style=color:#f92672>&lt;/dataStoreMode.emptyRealm&gt;</span>
<span style=color:#f92672>&lt;/Properties&gt;</span>
<span style=color:#f92672>&lt;/Component&gt;</span>
<span style=color:#f92672>&lt;Component&gt;</span>
<span style=color:#f92672>&lt;name&gt;</span>PersistenceHandler<span style=color:#f92672>&lt;/name&gt;</span>
<span style=color:#f92672>&lt;api&gt;</span>li.strolch.persistence.api.PersistenceHandler<span style=color:#f92672>&lt;/api&gt;</span>
<span style=color:#f92672>&lt;impl&gt;</span>li.strolch.persistence.postgresql.PostgreSqlPersistenceHandler<span style=color:#f92672>&lt;/impl&gt;</span>
<span style=color:#f92672>&lt;Properties&gt;</span>
<span style=color:#f92672>&lt;allowSchemaCreation&gt;</span>true<span style=color:#f92672>&lt;/allowSchemaCreation&gt;</span>
<span style=color:#f92672>&lt;allowSchemaDrop&gt;</span>true<span style=color:#f92672>&lt;/allowSchemaDrop&gt;</span>
<span style=color:#f92672>&lt;db.url.cachedRealm&gt;</span>jdbc:postgresql://localhost/testdb2<span style=color:#f92672>&lt;/db.url.cachedRealm&gt;</span>
<span style=color:#f92672>&lt;db.username.cachedRealm&gt;</span>testuser2<span style=color:#f92672>&lt;/db.username.cachedRealm&gt;</span>
<span style=color:#f92672>&lt;db.password.cachedRealm&gt;</span>test<span style=color:#f92672>&lt;/db.password.cachedRealm&gt;</span>
<span style=color:#f92672>&lt;db.pool.maximumPoolSize.cachedRealm&gt;</span>1<span style=color:#f92672>&lt;/db.pool.maximumPoolSize.cachedRealm&gt;</span>
<span style=color:#f92672>&lt;/Properties&gt;</span>
<span style=color:#f92672>&lt;/Component&gt;</span>
...
<span style=color:#f92672>&lt;/env&gt;</span>
<span style=color:#f92672>&lt;/StrolchConfiguration&gt;</span>
</code></pre></div><h2 id=access-realm>Access realm</h2><p>Accessing a realm is done in multiple ways. Important is to note, that a user
should use the <code>StrolchTransaction</code> object, instead of accessing the Realm directly.</p><p>Opening a transaction is done from a <code>Service</code> by calling one of the
<code>openTx()</code>-methods. Nevertheless, the realm can be accessed as follows:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>ComponentContainer container <span style=color:#f92672>=</span> getAgent<span style=color:#f92672>().</span><span style=color:#a6e22e>getContainer</span><span style=color:#f92672>();</span>
StrolchRealm realm <span style=color:#f92672>=</span> container<span style=color:#f92672>.</span><span style=color:#a6e22e>getRealm</span><span style=color:#f92672>(</span>StrolchConstants<span style=color:#f92672>.</span><span style=color:#a6e22e>DEFAULT_REALM</span><span style=color:#f92672>);</span>
<span style=color:#66d9ef>try</span><span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> realm<span style=color:#f92672>.</span><span style=color:#a6e22e>openTx</span><span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
Resource resource <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;TestType&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;MyTestResource&#34;</span><span style=color:#f92672>);</span>
<span style=color:#f92672>...</span>
<span style=color:#f92672>}</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/runtime-configuration/ title="Runtime Configuration"><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/components/ title=Components style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,159 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Reports - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/reports/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class="dd-item active"><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/reports.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Reports</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#reports>Reports</a></li><li><a href=#genericreport>GenericReport</a><ul><li><a href=#parameters>Parameters</a></li><li><a href=#lookups>Lookups</a></li><li><a href=#ordering>Ordering</a></li><li><a href=#filtering>Filtering</a></li><li><a href=#joins>Joins</a></li><li><a href=#execution-of-reports>Execution of Reports</a></li><li><a href=#filter-criteria>Filter Criteria</a></li><li><a href=#date-range-filtering>Date Range Filtering</a></li></ul></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Reports</h1><h2 id=reports>Reports</h2><p>Since Strolch has a generic model, it was rather straight forward to create a
simple API for writing reports. In Strolch a report is defined by using its own
model, i.e. a Report is a <code>Resource</code> of type <code>Report</code>.</p><p>A report consists of the following parts:</p><ul><li>policy definition, thus allowing extensions</li><li>basic configuration like base object type, order direction, etc.</li><li>column definitions</li><li>joins</li><li>ordering definition</li><li>filters</li></ul><p>An example of a report is as follows:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml>
<span style=color:#f92672>&lt;Resource</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;stockReport&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Stock Report&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Report&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;parameters&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;parameters&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Parameters&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;objectType&#34;</span> <span style=color:#a6e22e>Index=</span><span style=color:#e6db74>&#34;20&#34;</span> <span style=color:#a6e22e>Hidden=</span><span style=color:#e6db74>&#34;false&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Object Type&#34;</span>
<span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Player&#34;</span>
<span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Player&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;descending&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Descending order&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Boolean&#34;</span>
<span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;true&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;ordering&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Ordering&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Ordering&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;name&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Name&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span>
<span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Player&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;$name&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;noTeamFilter&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Filter&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Filter&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;policy&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Filter Policy&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span>
<span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;ReportFilterPolicy&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;key:Equals&#34;</span>
<span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;!&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;fieldRef&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Field reference&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span>
<span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Slot&#34;</span>
<span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Bags/relations/team&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;columns&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Display Columns&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Display&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;name&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Player&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span>
<span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Player&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;$name&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;birthDate&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Birth date&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span>
<span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Player&#34;</span>
<span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Bags/parameters/birthDate&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;team&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span>
<span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;$name&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;joins&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Joins&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Joins&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Index=</span><span style=color:#e6db74>&#34;10&#34;</span> <span style=color:#a6e22e>Hidden=</span><span style=color:#e6db74>&#34;false&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span>
<span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Player&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;Policies&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;ReportPolicy&#34;</span>
<span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;java:li.strolch.report.policy.GenericReport&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/Policies&gt;</span>
<span style=color:#f92672>&lt;/Resource&gt;</span>
</code></pre></div><p>This report</p><ul><li>shows all Resources of type player (parameter <code>objectType</code>) → marks the object
type to be show in the filter criteria (default), and that its sorting index
is at 20.</li><li>orders the report by player&rsquo;s name (parameter bag <code>ordering</code>)</li><li>filters out all players with no team assigned (parameter bag <code>noTeamFilter</code>)</li><li>defines three columns: Player, Birth date, Team (paramger bag <code>columns</code>)</li><li>joins in the resource of type <code>Team</code></li><li>Uses the <code>GenericReport</code> class to generate the report</li></ul><h2 id=genericreport>GenericReport</h2><p>The default generic report implemented in Strolch has the following features and
options:</p><h3 id=parameters>Parameters</h3><p>The parameters bag can contain the following parameters:</p><ul><li><p><code>objectType</code> → the base type of object to get the input for the report. This
means that the <code>Interpretation</code> is set to one of:</p><ul><li><code>Resource-Ref</code></li><li><code>Order-Ref</code></li><li><code>Activity-Ref</code></li></ul><p>and that the <code>UOM</code> and <code>value</code> of the parameter is set to the type of element with
which to retrieve the elements from the strolch model.</p></li><li><p><code>descending</code> → boolean flag to define if sorting is in descending order</p></li><li><p><code>allowMissingColumns</code> → flag to define if no exception should be thrown if a
column is missing</p></li><li><p><code>dateRangeSel</code> → defines a lookup parameter to use as a date range selector.
This requires input when executing the report</p></li></ul><div class="notices warning"><p>Note: that the attributes Hidden and Index define the
visibility and sorting index as filter criteria respectively.</p></div><h3 id=lookups>Lookups</h3><p>Many of the features of the generic report rely on looking up a value on the
referenced element. The following shows the ways that a lookup can be performed:</p><ul><li><code>$id</code> → lookup the ID of the element</li><li><code>$name</code> → lookup the name of the element</li><li><code>$type</code> → lookup the type of the element</li><li><code>$date</code> → lookup the date of the element (only possible on <code>Order</code>
and <code>Activity</code> elements)</li><li><code>$state</code> → lookup the state of the element (only possible on <code>Order</code>
and <code>Activity</code> elements)</li><li><code>Bags/&lt;bag_id>/&lt;param_id></code> → a lookup on the selected element by bag ID and
parameter ID</li><li><code>$search:&lt;parent_ref_id>:Bags/&lt;bag_id>/&lt;param_id></code> → searches for a parameter
with the given bag and parameter, and if it does not exist, looks for the
parent with the given parent_ref_id on the element. This allows a recursive
search up a tree of elements which all have the same parameter referencing a
parent. relations bag</li></ul><div class="notices warning"><p>Note: these definitions are set as the value of a
Parameter, and the Interpretation and UOM of the parameter is used to find the
element on which to perform the lookup. I.e. the following definition:</p></div><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;name&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Player&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Player&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;$name&#34;</span><span style=color:#f92672>/&gt;</span>
</code></pre></div><p>defines that we want to lookup the name of the resource of type Player.</p><h3 id=ordering>Ordering</h3><p>Ordering, i.e sorting is done by adding the parameter bag with the id <code>ordering</code>
and each parameter defines a column to order by. The sequence of the ordering is
defined by the <code>index</code> value assigned to each parameter.</p><h3 id=filtering>Filtering</h3><p>Filtering use additional Strolch Policies which implement the operator function.
I.e. performing an equals, etc. The following <code>ReportFilterPolicy</code> are available
and should be added in your <code>StrolchPolicies.xml</code> file:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;StrolchPolicies&gt;</span>
...
<span style=color:#f92672>&lt;PolicyType</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;ReportFilterPolicy&#34;</span> <span style=color:#a6e22e>Api=</span><span style=color:#e6db74>&#34;li.strolch.report.policy.ReportFilterPolicy&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Key=</span><span style=color:#e6db74>&#34;GreaterThan&#34;</span> <span style=color:#a6e22e>Class=</span><span style=color:#e6db74>&#34;li.strolch.report.policy.GreaterThanReportFilter&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Key=</span><span style=color:#e6db74>&#34;LessThan&#34;</span> <span style=color:#a6e22e>Class=</span><span style=color:#e6db74>&#34;li.strolch.report.policy.LessThanReportFilter&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Key=</span><span style=color:#e6db74>&#34;Equals&#34;</span> <span style=color:#a6e22e>Class=</span><span style=color:#e6db74>&#34;li.strolch.report.policy.EqualsReportFilter&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Key=</span><span style=color:#e6db74>&#34;Contains&#34;</span> <span style=color:#a6e22e>Class=</span><span style=color:#e6db74>&#34;li.strolch.report.policy.ContainsReportFilter&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Key=</span><span style=color:#e6db74>&#34;IsIn&#34;</span> <span style=color:#a6e22e>Class=</span><span style=color:#e6db74>&#34;li.strolch.report.policy.IsInReportFilter&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Policy</span> <span style=color:#a6e22e>Key=</span><span style=color:#e6db74>&#34;ValueRef&#34;</span> <span style=color:#a6e22e>Class=</span><span style=color:#e6db74>&#34;li.strolch.report.policy.ValueRefReportFilter&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/PolicyType&gt;</span>
...
<span style=color:#f92672>&lt;/StrolchPolicies&gt;</span>
</code></pre></div><p>From this we can see that we can perform a <code>GreaterThan</code>, <code>LessThan</code> and <code>Equals</code>
filtering. These filters can also be negated by prefixing the filter value with
an exclamation mark (!).</p><p>A special case for the filter values are filters on dates. If you are filtering
on a date, then you can use the special operator <code>now()</code>. This filter will use the
current date and time and will add/subtract the ISO8601 period passed as an
argument to the operator.</p><p>The following shows examples of these filters:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;minQtyFilter&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Filter&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Filter&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;policy&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Filter Policy&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;ReportFilterPolicy&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;key:GreaterThan&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;10&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;fieldRef&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Field reference&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Product&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Bags/parameters/quantity&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;notEmptyFilter&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Filter&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Filter&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;policy&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Filter Policy&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;ReportFilterPolicy&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;key:Equals&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;!&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;fieldRef&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Field reference&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Bags/relations/team&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
<span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;threeMonthsAgoFilter&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Filter&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Filter&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;policy&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Filter Policy&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;ReportFilterPolicy&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;key:LessThan&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;now(-P3M)&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;fieldRef&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Field reference&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;FromStock&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;$date&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
</code></pre></div><div class="notices tip"><p>Note: One parameter defines which policy gets used and the <code>key:&lt;name></code> value
references a policy defined in the <code>StrolchPolicies.xml</code> file. Further the lookup
is defined in the <code>fieldRef</code> parameter.</p></div><h3 id=joins>Joins</h3><p>To add columns from data which is not on the element denoted by the base object
type, we can join further elements. This is done by adding the parameter bag
<code>joins</code> and then each parameter references an element to join. The joining is done
as follows:</p><ul><li>The <code>Intepretation</code> and <code>UOM</code> define which object we want to join, i.e. resource
of type foo</li><li>The value of the parameter defines the type of element on which to find the
reference</li><li>The join ordering is not relevant, as the tree is traversed accordingly</li><li>At least one join must reference the base object type</li><li>The lookup of the join is done by finding a parameter with any ID, which has
the same <code>Interpretation</code> and <code>UOM</code> as the join definition</li><li>The attributes <code>Hidden</code> and <code>Index</code> define the visibility and sorting index as
filter criteria respectively.</li></ul><p>Thus the following:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;joins&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Joins&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Joins&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Index=</span><span style=color:#e6db74>&#34;10&#34;</span> <span style=color:#a6e22e>Hidden=</span><span style=color:#e6db74>&#34;false&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Player&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;Country&#34;</span> <span style=color:#a6e22e>Index=</span><span style=color:#e6db74>&#34;5&#34;</span> <span style=color:#a6e22e>Hidden=</span><span style=color:#e6db74>&#34;false&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Team&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Country&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Team&#34;</span><span style=color:#f92672>/&gt;</span>
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
</code></pre></div><p>Performs two joins: First we join a resource of type <code>Team</code> by finding the
relevant parameter on the <code>Player</code> resource, and then we lookup a resource of type
<code>Country</code> on the previously joined <code>Team</code> resource.</p><h3 id=execution-of-reports>Execution of Reports</h3><p>To execute a reports, we must instantiate the Report and can then directly
generate a JsonObject stream, which we can then pipe to a browser, file, etc.:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>Stream<span style=color:#f92672>&lt;</span>JsonObject<span style=color:#f92672>&gt;</span> jsonObjectStream <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> Report<span style=color:#f92672>(</span>tx<span style=color:#f92672>,</span> reportId<span style=color:#f92672>).</span><span style=color:#a6e22e>doReportAsJson</span><span style=color:#f92672>();</span>
</code></pre></div><p>If you prefer a CSV report:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>CSVPrinter csvP <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> CSVPrinter<span style=color:#f92672>(</span><span style=color:#66d9ef>new</span> OutputStreamWriter<span style=color:#f92672>(</span>out<span style=color:#f92672>),</span>
CSVFormat<span style=color:#f92672>.</span><span style=color:#a6e22e>DEFAULT</span><span style=color:#f92672>.</span><span style=color:#a6e22e>withHeader</span><span style=color:#f92672>(</span>headers<span style=color:#f92672>).</span><span style=color:#a6e22e>withDelimiter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#39;;&#39;</span><span style=color:#f92672>)))</span> <span style=color:#f92672>{</span>
<span style=color:#75715e>// do report without AsJson, and then iterating each row and sending to a CSV writer
</span><span style=color:#75715e></span> report<span style=color:#f92672>.</span><span style=color:#a6e22e>doReport</span><span style=color:#f92672>().</span><span style=color:#a6e22e>forEach</span><span style=color:#f92672>(</span>row <span style=color:#f92672>-&gt;</span> <span style=color:#f92672>{</span>
<span style=color:#66d9ef>try</span> <span style=color:#f92672>{</span>
csvP<span style=color:#f92672>.</span><span style=color:#a6e22e>printRecord</span><span style=color:#f92672>(</span>row<span style=color:#f92672>.</span><span style=color:#a6e22e>valueStream</span><span style=color:#f92672>().</span><span style=color:#a6e22e>collect</span><span style=color:#f92672>(</span>Collectors<span style=color:#f92672>.</span><span style=color:#a6e22e>toList</span><span style=color:#f92672>()));</span> <span style=color:#75715e>// add to CSV
</span><span style=color:#75715e></span> <span style=color:#f92672>}</span> <span style=color:#66d9ef>catch</span> <span style=color:#f92672>(</span>Exception e<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
logger<span style=color:#f92672>.</span><span style=color:#a6e22e>error</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Could not write CSV row&#34;</span><span style=color:#f92672>,</span> e<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#f92672>});</span>
<span style=color:#f92672>}</span>
</code></pre></div><h3 id=filter-criteria>Filter Criteria</h3><p>Predefining filters is a good start, but in some case you only want a portion of
the actual filtered data. For instance if you make a stock report, you might
only want one location. This information is dynamic and thus not stored on the
report definition.</p><p>To perform these dynamic filterings, one would call the <code>filter()</code>-method on the
report, passing the type of element to be filtered, and to which element IDs to
reduce the report data to. The following reduces the report to only return the
rows with the <code>product01</code> Product and <code>location02</code> Location elements:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>new</span> Report<span style=color:#f92672>(</span>tx<span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;stockReport&#34;</span><span style=color:#f92672>)</span>
<span style=color:#f92672>.</span><span style=color:#a6e22e>filter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Product&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;product01&#34;</span><span style=color:#f92672>)</span>
<span style=color:#f92672>.</span><span style=color:#a6e22e>filter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Location&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;location02&#34;</span><span style=color:#f92672>)</span>
<span style=color:#f92672>.</span><span style=color:#a6e22e>doReportAsJson</span><span style=color:#f92672>()</span>
</code></pre></div><p>It is possible to find the possible filter criteria dynamically using the
generateFilterCriteria() method.</p><h3 id=date-range-filtering>Date Range Filtering</h3><p>The last option to filter dynamically is using a date range selector. Define the
dateRangeSel lookup parameter, and then set the date range on the instantiated
report:</p><p>Model the report in XML:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;parameters&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;parameters&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;Parameters&#34;</span><span style=color:#f92672>&gt;</span>
...
<span style=color:#f92672>&lt;Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>&#34;dateRangeSel&#34;</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>&#34;Date Range Selector&#34;</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>&#34;String&#34;</span> <span style=color:#a6e22e>Interpretation=</span><span style=color:#e6db74>&#34;Resource-Ref&#34;</span> <span style=color:#a6e22e>Uom=</span><span style=color:#e6db74>&#34;Product&#34;</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>&#34;Bags/parameters/expirationDate&#34;</span><span style=color:#f92672>/&gt;</span>
...
<span style=color:#f92672>&lt;/ParameterBag&gt;</span>
</code></pre></div><p>And now call the report in Java:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>Date from <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> Date<span style=color:#f92672>(</span>LocalDate<span style=color:#f92672>.</span><span style=color:#a6e22e>of</span><span style=color:#f92672>(</span>2016<span style=color:#f92672>,</span> 1<span style=color:#f92672>,</span> 1<span style=color:#f92672>).</span><span style=color:#a6e22e>toEpochDay</span><span style=color:#f92672>()</span> <span style=color:#f92672>*</span> 86400000<span style=color:#f92672>);</span>
Date to <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> Date<span style=color:#f92672>(</span>LocalDate<span style=color:#f92672>.</span><span style=color:#a6e22e>of</span><span style=color:#f92672>(</span>2017<span style=color:#f92672>,</span> 1<span style=color:#f92672>,</span> 1<span style=color:#f92672>).</span><span style=color:#a6e22e>toEpochDay</span><span style=color:#f92672>()</span> <span style=color:#f92672>*</span> 86400000<span style=color:#f92672>);</span>
DateRange dateRange <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> DateRange<span style=color:#f92672>().</span><span style=color:#a6e22e>from</span><span style=color:#f92672>(</span>from<span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>).</span><span style=color:#a6e22e>to</span><span style=color:#f92672>(</span>to<span style=color:#f92672>,</span> <span style=color:#66d9ef>false</span><span style=color:#f92672>);</span>
List<span style=color:#f92672>&lt;</span>JsonObject<span style=color:#f92672>&gt;</span> result <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> Report<span style=color:#f92672>(</span>tx<span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;stockReport&#34;</span><span style=color:#f92672>)</span> <span style=color:#75715e>//
</span><span style=color:#75715e></span> <span style=color:#f92672>.</span><span style=color:#a6e22e>filter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Product&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;product01&#34;</span><span style=color:#f92672>)</span> <span style=color:#75715e>//
</span><span style=color:#75715e></span> <span style=color:#f92672>.</span><span style=color:#a6e22e>dateRange</span><span style=color:#f92672>(</span>dateRange<span style=color:#f92672>)</span> <span style=color:#75715e>//
</span><span style=color:#75715e></span> <span style=color:#f92672>.</span><span style=color:#a6e22e>doReportAsJson</span><span style=color:#f92672>()</span>
</code></pre></div><div class="notices tip"><p>Note: See the <a href=https://github.com/4treesCH/strolch/blob/develop/li.strolch.service/src/test/java/li/strolch/report/GenericReportTest.java>GenericReportTest</a> for examples.</p></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/versioning/ title=Versioning><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/priviles/ title=Privileges style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,111 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Runtime Configuration - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/runtime-configuration/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class="dd-item active"><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/runtime-configuration.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Runtime Configuration</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#runtime-configuration>Runtime Configuration</a></li><li><a href=#strolchconfigurationxml>StrolchConfiguration.xml</a></li><li><a href=#privilege-configuration>Privilege Configuration</a></li><li><a href=#implementing-a-strolchcomponent>Implementing a StrolchComponent</a></li><li><a href=#starting-the-agent>Starting the agent</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Runtime Configuration</h1><h2 id=runtime-configuration>Runtime Configuration</h2><p>A Strolch runtime configuration comprises two parts: a configuration part, and
a model part. The configuration are files located in the <code>..config/</code> folder,
and the model are files located in the <code>../data</code> folder.</p><p>In an absolute minimal configuration, the Strolch runtime requires the
following folder structure:</p><ul><li><code>../config/</code><ul><li><code>../StrolchConfiguration.xml</code> → configures the Strolch agent</li><li><code>../PrivilegeConfig.xml</code> → configures user management</li><li><code>../PrivilegeUsers.xml</code> → contains the users in an XML based user management file</li><li><code>../PrivilegeRoles.xml</code> → contains the roles and privileges in an XML based user management</li></ul></li></ul><h2 id=strolchconfigurationxml>StrolchConfiguration.xml</h2><p>The StrolchConfiguration.xml file configures the Strolch agent. The StrolchConfiguration.xml defines the following:</p><ul><li><code>&lt;StrolchConfiguration></code> root element</li><li><code>&lt;env id="xxx"></code> different environments with the possibility of having a
global environment for configuration valid in multiple environments.<ul><li><code>&lt;Runtime></code> element which defines the agents name and a few other
properties e.g. <code>locale</code> and <code>verbose</code>:</li><li><code>&lt;applicationName></code> the agent&rsquo;s name</li><li><code>&lt;Properties></code><ul><li><code>&lt;locale></code> the agent&rsquo;s internal locale for log messages etc.</li><li><code>&lt;verbose></code> the logging level for some internal logging. (Logging is
mostly done using log4j over slf4j)</li></ul></li><li><code>&lt;Component></code> elements for each component used in the agent. A component
is configured by defining the following child elements:<ul><li><p><code>&lt;name></code> the name of the component, use when defining dependencies
between components. The name is mostly set to the simple name of the
interface of the component</p></li><li><p><code>&lt;api></code> the full class name to the interface of the component. During
runtime this interface will be used to access the component e.g.:</p><p><code>ServiceHandler svcHandler = agent.getContainer().getComponent(ServiceHandler.class);</code></p></li><li><p><code>&lt;impl></code> the full class name of the concrete implementation of the
component. During initialization this class will be instantiated and
registered under the component name and interface. This class must
extend the class li.strolch.agent.api.StrolchComponent</p></li><li><p><code>&lt;depends></code> any number of these elements, where the content is the name
of another component, on which this component depends. Depending
components are initialized and started after the component they depend
on and are stopped and destroyed before</p></li><li><p><code>&lt;Properties></code></p></li><li><p><code>&lt;...></code> any number of properties which the component requires. The
element&rsquo;s name will be the key with which the value can be accessed at
runtime.</p></li></ul></li></ul></li></ul><div class="notices warning"><p>When a property is missing, and the component has a hard coded default value, then when the component is initialized, the use of the default value and its key is logged. This makes it easy to see which new properties can be configured. Should the component not define a default value, then the component will thrown an exception on initialization. In this case it can be a good moment to read the JavaDoc (or source code) for the component in question to see how it is configured.</p></div><h2 id=privilege-configuration>Privilege Configuration</h2><p>In Strolch authentication and authorization is baked in. To open a transaction,
and thus access the Strolch model, a Certificate object is required, which
means the user has been authenticated and possibly authorized.</p><p>The PrivilegeConfig.xml defines the following:</p><ul><li><code>&lt;Privilege></code> root element<ul><li><code>&lt;Container></code> configures the individual Privilege components<ul><li><code>&lt;Parameters></code> base configuration properties for Privilege</li><li><code>&lt;EncryptionHandler></code> configures the hashing algorithms and other
encryption specific configuration</li><li><code>&lt;PersistenceHandler></code> configures the persistence of the roles and users</li><li><code>&lt;UserChallengeHandler></code> configures a challenge handler so that a user
can reset their password. The default challenge handler is the
<code>li.strolch.privilege.handler.MailUserChallengeHandler</code> which sends a
challenge to the user&rsquo;s defined e-mail address.</li><li><code>&lt;SsoHandler></code> the SSO Handler is used to implement a SingleSignOn and
can be used to start a session using a LDAP token, etc. There is no
default implementation as this is project specific.</li></ul></li><li><code>&lt;Policies></code> configures the available privilege policies at runtime, the
name is referenced from the model file</li></ul></li></ul><p>The <code>PrivilegeUsers.xml</code> and <code>PrivilegeRoles.xml</code> define the users and roles
and is used when in <code>PrvilegeConfig.xml</code> the <code>PersistenceHandler</code> is set to
<code>ch.eitchnet.privilege.handler.XmlPersistenceHandler</code>:</p><ul><li><code>&lt;Users></code> configures all users<ul><li><code>&lt;User></code> configures a specific user<ul><li><code>&lt;Firstname></code> configures a user&rsquo;s first name</li><li><code>&lt;Lastname></code> configure a user&rsquo;s last name</li><li><code>&lt;State></code> configures the user&rsquo;s state, see <code>li.strolch.privilege.model.UserState</code></li><li><code>&lt;Locale></code> configure the user&rsquo;s locale</li><li><code>&lt;Roles></code> configures the user&rsquo;s roles<ul><li><code>&lt;Role></code> adds a role to the user</li><li><code>&lt;Properties></code> configures user specific properties. What properties
are used is not specified and is dependent on the concrete agent<ul><li><code>&lt;Property></code> defines a single property</li></ul></li></ul></li></ul></li><li><code>&lt;Roles></code> configures all roles<ul><li><code>&lt;Role></code> configures a specific role<ul><li><code>&lt;Privilege></code> configures a specific privilege for this role<ul><li><code>&lt;AllAllowed></code> if set to true, then defines that all values
associated with this privilege are allowed</li><li><code>&lt;Allow></code> defines one allowed value for this privilege</li><li><code>&lt;Deny></code> defines one denied value for this privilege</li></ul></li></ul></li></ul></li></ul></li></ul><h2 id=implementing-a-strolchcomponent>Implementing a StrolchComponent</h2><p>Implementing a strolch component requires an interface, which defines the
component&rsquo;s API and a concrete class which implements the interface and
extends the class <code>StrolchComponent</code>.</p><p>The StrolchComponent class adds the state model to the class, which
transitions as follows:</p><p><code>UNDEFINED => SETUP => INITIALIZED => STARTED &lt;=> STOPPED => DESTROYED</code></p><p>Components can switch between <code>STARTED</code> and <code>STOPPED</code>, but once <code>DESTROYED</code> no
further state change is possible. The component&rsquo;s state is changed by changes
to the agent&rsquo;s lifecycle.</p><p>A component&rsquo;s state is changed by a call to the appropriate method on the
component, override the methods as necessary. Note that it is good practice
that the <code>initialize()</code>-method is used to get all the configuration properties,
and that they should there be evaluated and that the method so return quickly.
The <code>start()</code>-method is called after the agent&rsquo;s initialization and should be
where additional threads are started. Correctly implementing these methods
allows to quickly detect a wrongly configured agent, which might take longer
to start for whatever reason.</p><p>The following shows a basic implementation of a component on the basis of a
post initializer (a component which performs some actions in its
<code>start()</code>-method which should be done after everything else is started in the
agent).</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>public</span> <span style=color:#66d9ef>class</span> <span style=color:#a6e22e>SimplePostInitializer</span>
<span style=color:#66d9ef>extends</span> StrolchComponent
<span style=color:#66d9ef>implements</span> PostInitializer <span style=color:#f92672>{</span>
<span style=color:#66d9ef>public</span> <span style=color:#a6e22e>SimplePostInitializer</span><span style=color:#f92672>(</span>ComponentContainer container<span style=color:#f92672>,</span>
String componentName<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
<span style=color:#66d9ef>super</span><span style=color:#f92672>(</span>container<span style=color:#f92672>,</span> componentName<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>initialize</span><span style=color:#f92672>(</span>ComponentConfiguration configuration<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
<span style=color:#75715e>// do some initialization, validate configuration values, etc.
</span><span style=color:#75715e></span> <span style=color:#75715e>// now call super, to update state
</span><span style=color:#75715e></span> <span style=color:#66d9ef>super</span><span style=color:#f92672>.</span><span style=color:#a6e22e>initialize</span><span style=color:#f92672>(</span>configuration<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>start</span><span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
<span style=color:#75715e>// start any threads, or perform long running start work
</span><span style=color:#75715e></span> <span style=color:#75715e>// now call super, to update state
</span><span style=color:#75715e></span> <span style=color:#66d9ef>super</span><span style=color:#f92672>.</span><span style=color:#a6e22e>start</span><span style=color:#f92672>();</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>stop</span><span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
<span style=color:#75715e>// stop threads and timers, but be ready to start again
</span><span style=color:#75715e></span> <span style=color:#75715e>// now call super, to update state
</span><span style=color:#75715e></span> <span style=color:#66d9ef>super</span><span style=color:#f92672>.</span><span style=color:#a6e22e>stop</span><span style=color:#f92672>();</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>destroy</span><span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
<span style=color:#75715e>// destroy this component, release all resources and don&#39;t worry about
</span><span style=color:#75715e></span> <span style=color:#75715e>// being called to start again now call super, to update state
</span><span style=color:#75715e></span> <span style=color:#66d9ef>super</span><span style=color:#f92672>.</span><span style=color:#a6e22e>destroy</span><span style=color:#f92672>();</span>
<span style=color:#f92672>}</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>The new component would then be registered in the <code>StrolchConfiguration.xml</code>
as follows:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;StrolchConfiguration&gt;</span>
<span style=color:#f92672>&lt;env</span> <span style=color:#a6e22e>id=</span><span style=color:#e6db74>&#34;...&#34;</span><span style=color:#f92672>&gt;</span>
...
<span style=color:#f92672>&lt;Component&gt;</span>
<span style=color:#f92672>&lt;name&gt;</span>SimplePostInitializer<span style=color:#f92672>&lt;/name&gt;</span>
<span style=color:#f92672>&lt;api&gt;</span>li.strolch.agent.api.PostInitializer<span style=color:#f92672>&lt;/api&gt;</span>
<span style=color:#f92672>&lt;impl&gt;</span>li.strolch.documentation.SimplePostInitializer<span style=color:#f92672>&lt;/impl&gt;</span>
<span style=color:#f92672>&lt;/Component&gt;</span>
...
<span style=color:#f92672>&lt;/env&gt;</span>
<span style=color:#f92672>&lt;/StrolchConfiguration&gt;</span>
</code></pre></div><p>And can be access at runtime using:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>PostInitializer postInitializer <span style=color:#f92672>=</span> getContainer<span style=color:#f92672>().</span><span style=color:#a6e22e>getComponent</span><span style=color:#f92672>(</span>PostInitializer<span style=color:#f92672>.</span><span style=color:#a6e22e>class</span><span style=color:#f92672>);</span>
</code></pre></div><h2 id=starting-the-agent>Starting the agent</h2><p>When a Strolch runtime is started, then the root path to the runtime configuration must be passed. In Java this is done by calling:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>StrolchAgent agent <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> StrolchAgent<span style=color:#f92672>();</span>
agent<span style=color:#f92672>.</span><span style=color:#a6e22e>setup</span><span style=color:#f92672>(</span>environment<span style=color:#f92672>,</span> rootPath<span style=color:#f92672>);</span>
agent<span style=color:#f92672>.</span><span style=color:#a6e22e>initialize</span><span style=color:#f92672>();</span>
agent<span style=color:#f92672>.</span><span style=color:#a6e22e>start</span><span style=color:#f92672>();</span>
</code></pre></div><p>In Servlet 3.0 applications one would implement the
<code>javax.servlet.ServletContextListener</code> interface, add the <code>@WebListener</code>
annotation to the class and in the <code>contextInitialized()</code>-method start Strolch:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>String realPath <span style=color:#f92672>=</span> sce<span style=color:#f92672>.</span><span style=color:#a6e22e>getServletContext</span><span style=color:#f92672>().</span><span style=color:#a6e22e>getRealPath</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;/WEB-INF&#34;</span><span style=color:#f92672>);</span>
String environment <span style=color:#f92672>=</span> StrolchEnvironment<span style=color:#f92672>.</span><span style=color:#a6e22e>getEnvironmentFromEnvProperties</span><span style=color:#f92672>(</span>pathF<span style=color:#f92672>);</span>
<span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>agent</span> <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> StrolchAgent<span style=color:#f92672>();</span>
<span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>agent</span><span style=color:#f92672>.</span><span style=color:#a6e22e>setup</span><span style=color:#f92672>(</span>environment<span style=color:#f92672>,</span> <span style=color:#66d9ef>new</span> File<span style=color:#f92672>(</span>realPath<span style=color:#f92672>));</span>
<span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>agent</span><span style=color:#f92672>.</span><span style=color:#a6e22e>initialize</span><span style=color:#f92672>();</span>
<span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>agent</span><span style=color:#f92672>.</span><span style=color:#a6e22e>start</span><span style=color:#f92672>();</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/do-and-donts/ title="Do and Don't"><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/realms/ title=Realms style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,53 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Searches - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/searches/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class="dd-item active"><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/searches.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Searches</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#searches>Searches</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Searches</h1><h2 id=searches>Searches</h2><p>As is custom for every framework, querying, or searching, the model must be
possible. Strolch searches are implemented using the <code>StrolchSearch</code> class and
one of its concrete implementations: <code>ResourceSearch</code>, <code>OrderSearch</code>,
<code>ActivitySearch</code>.</p><p>A Strolch element always has two identifiers: <code>Type</code> and <code>Id</code>. 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 <code>Resource</code>, but one of type <code>Car</code>
and the other of type <code>House</code>. Both would have different parameters. Thus when
searching for objects, the first thing to do is define the type of object being
searched.</p><p>The Strolch search API is very expressive and offers multiple ways to perform
the same search. The search API consists of three components: The search
classes, the search expressions and the search predicates. The concept was taken
from the <a href=https://camel.apache.org/>Apache Camel</a> project.</p><p>There are four main search classes:</p><ul><li>RootElementSearch - search for any of Resource, Order or Activity elements</li><li>ResourceSearch - search for Resources</li><li>OrderSearch - search for Orders</li><li>ActivitySearch - search for Activities</li></ul><p>No search is useful without a <code>where</code> clause, which are called search
expressions. When writing a search, there are multiple ways to add such where
clauses. Either</p><ul><li>override the <code>define()</code>-method in your sub class and add the where clauses by
calling the <code>where()</code> method, or</li><li>define special methods on the class e.g. <code>byColor()</code> which also calls the
<code>where()</code>-method to add a search expression, or</li><li>directly call the <code>where()</code>-method after instantiating a search.</li></ul><p>When extending the class, then the search expressions are available as methods
on the super class, otherwise you can statically import them from
<a href=https://github.com/4treesCH/strolch/blob/develop/li.strolch.agent/src/main/java/li/strolch/search/ExpressionsSupport.java>ExpressionsSupport</a>
.</p><p>And of course a where clause needs operators, which are called search
predicates. Just as search expressions are available in sub classes, so are
search predicates and can also be statically imported through
<a href=https://github.com/4treesCH/strolch/blob/develop/li.strolch.agent/src/main/java/li/strolch/search/PredicatesSupport.java>PredicatesSupport</a>
.</p><p>Examples of search expressions with search predicates follow:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>ResourceSearch search<span style=color:#f92672>=</span><span style=color:#66d9ef>new</span> ResourceSearch<span style=color:#f92672>();</span>
<span style=color:#75715e>// predicate either as parameter, or chained
</span><span style=color:#75715e></span>search<span style=color:#f92672>.</span><span style=color:#a6e22e>where</span><span style=color:#f92672>(</span>id<span style=color:#f92672>().</span><span style=color:#a6e22e>isEqualTo</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;myId&#34;</span><span style=color:#f92672>));</span>
search<span style=color:#f92672>.</span><span style=color:#a6e22e>where</span><span style=color:#f92672>(</span>id<span style=color:#f92672>(</span>isEqualTo<span style=color:#f92672>(</span><span style=color:#e6db74>&#34;myId&#34;</span><span style=color:#f92672>)));</span>
<span style=color:#75715e>// negating
</span><span style=color:#75715e></span>search<span style=color:#f92672>.</span><span style=color:#a6e22e>where</span><span style=color:#f92672>(</span>id<span style=color:#f92672>(</span>isEqualTo<span style=color:#f92672>(</span><span style=color:#e6db74>&#34;myId&#34;</span><span style=color:#f92672>)).</span><span style=color:#a6e22e>not</span><span style=color:#f92672>());</span>
search<span style=color:#f92672>.</span><span style=color:#a6e22e>where</span><span style=color:#f92672>(</span>param<span style=color:#f92672>(</span><span style=color:#e6db74>&#34;bagId&#34;</span><span style=color:#f92672>,</span><span style=color:#e6db74>&#34;paramId&#34;</span><span style=color:#f92672>).</span><span style=color:#a6e22e>isIn</span><span style=color:#f92672>(</span>Arrays<span style=color:#f92672>.</span><span style=color:#a6e22e>asList</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;red&#34;</span><span style=color:#f92672>,</span><span style=color:#e6db74>&#34;blue&#34;</span><span style=color:#f92672>,</span><span style=color:#e6db74>&#34;green&#34;</span><span style=color:#f92672>)));</span>
search<span style=color:#f92672>.</span><span style=color:#a6e22e>where</span><span style=color:#f92672>(</span>paramNull<span style=color:#f92672>(</span><span style=color:#e6db74>&#34;bagId&#34;</span><span style=color:#f92672>,</span><span style=color:#e6db74>&#34;paramId&#34;</span><span style=color:#f92672>)));</span>
<span style=color:#75715e>// boolean operations
</span><span style=color:#75715e></span>search<span style=color:#f92672>.</span><span style=color:#a6e22e>where</span><span style=color:#f92672>(</span>id<span style=color:#f92672>(</span>isEqualTo<span style=color:#f92672>(</span><span style=color:#e6db74>&#34;myId&#34;</span><span style=color:#f92672>))</span> <span style=color:#75715e>//
</span><span style=color:#75715e></span> <span style=color:#f92672>.</span><span style=color:#a6e22e>or</span><span style=color:#f92672>(</span>name<span style=color:#f92672>(</span>isEqualTo<span style=color:#f92672>(</span><span style=color:#e6db74>&#34;myName&#34;</span><span style=color:#f92672>))));</span>
</code></pre></div><p>Note how the predicates can be chained to the search expression, or passed as a
parameter to the expression.</p><p>In addition to using predefined search search expressions, one can also just
pass a lambda expression which performs a custom filter:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>personSearch<span style=color:#f92672>.</span><span style=color:#a6e22e>where</span><span style=color:#f92672>(</span>person <span style=color:#f92672>-&gt;</span> person<span style=color:#f92672>.</span><span style=color:#a6e22e>getName</span><span style=color:#f92672>().</span><span style=color:#a6e22e>length</span><span style=color:#f92672>()</span> <span style=color:#f92672>==</span> 3<span style=color:#f92672>);</span>
</code></pre></div><p>See
the <a href=https://github.com/4treesCH/strolch/blob/develop/li.strolch.agent/src/test/java/li/strolch/search/StrolchSearchTest.java>StrolchSearchTest</a>
for many ways in which you can implement tests.</p><div class="notices tip"><p>Note that strolch searches requires privileges, thus when you
use a strolch search, add it to the role of the user in <code>PrivilegeRoles.xml</code>:</p></div><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml>
<span style=color:#f92672>&lt;Privilege</span> <span style=color:#a6e22e>name=</span><span style=color:#e6db74>&#34;li.strolch.search.StrolchSearch&#34;</span> <span style=color:#a6e22e>policy=</span><span style=color:#e6db74>&#34;DefaultPrivilege&#34;</span><span style=color:#f92672>&gt;</span>
<span style=color:#f92672>&lt;Allow&gt;</span>internal
<span style=color:#f92672>&lt;/Allow&gt;</span> <span style=color:#75715e>&lt;!-- internal used for when the search is done in an internal service --&gt;</span>
<span style=color:#f92672>&lt;Allow&gt;</span>li.strolch.bookshop.search.BookSearch<span style=color:#f92672>&lt;/Allow&gt;</span>
<span style=color:#f92672>&lt;/Privilege&gt;</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/services-and-commands/ title="Services and Commands"><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/queries/ title=Queries style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,78 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Services and Commands - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/services-and-commands/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class="dd-item active"><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/services-and-commands.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Services and Commands</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#services-and-commands>Services and Commands</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Services and Commands</h1><h2 id=services-and-commands>Services and Commands</h2><p><code>Services</code> are written to implement a specific use-case. <code>Commands</code> are written to
implement re-usable parts of a use-case. The use-case can be abstract
e.g., <code>AddResourceService</code> or very specific e.g. <code>CreatePatientService</code>.</p><p>Should the use-case be re-usable in different scenarios, then commands should
implement the logic, and the services should then execute the commands. E.g.
The <code>CreatePatientService</code> would use a <code>CreatePatientResourceCommand</code> and then
use an <code>AddResourceCommand</code> in a single transaction, so that the task of
creating the actual Patient Resource can be re-used somewhere else.</p><p>Services extend the abstract class <code>AbstractService</code> and then implement the
method <code>internalDoService(ServiceArgument)</code>. AbstractService defines generic
template arguments with which the concrete service can define a specific
input ServiceArgument class and output ServiceResult class.</p><p>The AbstractService class has multiple helper methods:</p><ul><li><code>openTx():StrolchTransaction</code> - to open a transaction</li><li><code>runPrivileged()</code> - to perform a <code>SystemUserAction</code></li><li><code>getComponent():V</code> - to retrieve a specific StrolchComponent</li></ul><p>there are more - check the JavaDocs.</p><p>Commands extend the <code>Command</code> class and then implement the method <code>doCommand()</code>.
Commands have helper methods:</p><ul><li><code>tx()</code> - to get the current transaction</li><li><code>getPolicy()</code> - to retrieve a <code>StrolchPolicy</code> instance</li><li><code>runPrivileged()</code> - to perform a <code>SystemUserAction</code></li></ul><p>there are more - check the JavaDocs.</p><p>The following code snippets shows how a Service and Command are used to
perform the task of adding a new Order. Note how:</p><ul><li>the Service opens the transaction</li><li>adds the command to the TX</li><li>calls <code>tx.commitOnClose()</code></li><li>the command validates its input</li><li>locks the object</li><li>performs the work</li><li>and implements an undo</li></ul><p>AddOrderService:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>public</span> <span style=color:#66d9ef>class</span> <span style=color:#a6e22e>AddOrderService</span> <span style=color:#66d9ef>extends</span> AbstractService<span style=color:#f92672>&lt;</span>AddOrderService<span style=color:#f92672>.</span><span style=color:#a6e22e>AddOrderArg</span><span style=color:#f92672>,</span> ServiceResult<span style=color:#f92672>&gt;</span> <span style=color:#f92672>{</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>protected</span> ServiceResult <span style=color:#a6e22e>getResultInstance</span><span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
<span style=color:#66d9ef>return</span> <span style=color:#66d9ef>new</span> ServiceResult<span style=color:#f92672>();</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>protected</span> ServiceResult <span style=color:#a6e22e>internalDoService</span><span style=color:#f92672>(</span>AddOrderArg arg<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
<span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>(</span>arg<span style=color:#f92672>.</span><span style=color:#a6e22e>realm</span><span style=color:#f92672>))</span> <span style=color:#f92672>{</span>
AddOrderCommand command <span style=color:#f92672>=</span> <span style=color:#66d9ef>new</span> AddOrderCommand<span style=color:#f92672>(</span>getContainer<span style=color:#f92672>(),</span> tx<span style=color:#f92672>);</span>
command<span style=color:#f92672>.</span><span style=color:#a6e22e>setOrder</span><span style=color:#f92672>(</span>arg<span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>);</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>addCommand</span><span style=color:#f92672>(</span>command<span style=color:#f92672>);</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>commitOnClose</span><span style=color:#f92672>();</span>
<span style=color:#f92672>}</span>
<span style=color:#66d9ef>return</span> ServiceResult<span style=color:#f92672>.</span><span style=color:#a6e22e>success</span><span style=color:#f92672>();</span>
<span style=color:#f92672>}</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>static</span> <span style=color:#66d9ef>class</span> <span style=color:#a6e22e>AddOrderArg</span> <span style=color:#66d9ef>extends</span> ServiceArgument <span style=color:#f92672>{</span>
<span style=color:#66d9ef>public</span> Order order<span style=color:#f92672>;</span>
<span style=color:#f92672>}</span>
<span style=color:#f92672>}</span>
</code></pre></div><p>AddOrderCommand:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>public</span> <span style=color:#66d9ef>class</span> <span style=color:#a6e22e>AddOrderCommand</span> <span style=color:#66d9ef>extends</span> Command <span style=color:#f92672>{</span>
<span style=color:#66d9ef>private</span> Order order<span style=color:#f92672>;</span>
<span style=color:#66d9ef>public</span> <span style=color:#a6e22e>AddOrderCommand</span><span style=color:#f92672>(</span>ComponentContainer container<span style=color:#f92672>,</span> StrolchTransaction tx<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
<span style=color:#66d9ef>super</span><span style=color:#f92672>(</span>container<span style=color:#f92672>,</span> tx<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>setOrder</span><span style=color:#f92672>(</span>Order order<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
<span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span> <span style=color:#f92672>=</span> order<span style=color:#f92672>;</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>validate</span><span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
DBC<span style=color:#f92672>.</span><span style=color:#a6e22e>PRE</span><span style=color:#f92672>.</span><span style=color:#a6e22e>assertNotNull</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Order may not be null!&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>doCommand</span><span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
tx<span style=color:#f92672>().</span><span style=color:#a6e22e>lock</span><span style=color:#f92672>(</span><span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>);</span>
OrderMap orderMap <span style=color:#f92672>=</span> tx<span style=color:#f92672>().</span><span style=color:#a6e22e>getOrderMap</span><span style=color:#f92672>();</span>
<span style=color:#66d9ef>if</span> <span style=color:#f92672>(</span>orderMap<span style=color:#f92672>.</span><span style=color:#a6e22e>hasElement</span><span style=color:#f92672>(</span>tx<span style=color:#f92672>(),</span> <span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>.</span><span style=color:#a6e22e>getType</span><span style=color:#f92672>(),</span> <span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>()))</span> <span style=color:#f92672>{</span>
String msg <span style=color:#f92672>=</span> MessageFormat<span style=color:#f92672>.</span><span style=color:#a6e22e>format</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;The Order {0} already exists!&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>.</span><span style=color:#a6e22e>getLocator</span><span style=color:#f92672>());</span>
<span style=color:#66d9ef>throw</span> <span style=color:#66d9ef>new</span> StrolchException<span style=color:#f92672>(</span>msg<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
orderMap<span style=color:#f92672>.</span><span style=color:#a6e22e>add</span><span style=color:#f92672>(</span>tx<span style=color:#f92672>(),</span> <span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#a6e22e>@Override</span>
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>undo</span><span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
<span style=color:#66d9ef>if</span> <span style=color:#f92672>(</span><span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span> <span style=color:#f92672>!=</span> <span style=color:#66d9ef>null</span> <span style=color:#f92672>&amp;&amp;</span> tx<span style=color:#f92672>().</span><span style=color:#a6e22e>isRollingBack</span><span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
OrderMap orderMap <span style=color:#f92672>=</span> tx<span style=color:#f92672>().</span><span style=color:#a6e22e>getOrderMap</span><span style=color:#f92672>();</span>
<span style=color:#66d9ef>if</span> <span style=color:#f92672>(</span>orderMap<span style=color:#f92672>.</span><span style=color:#a6e22e>hasElement</span><span style=color:#f92672>(</span>tx<span style=color:#f92672>(),</span> <span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>.</span><span style=color:#a6e22e>getType</span><span style=color:#f92672>(),</span> <span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>()))</span>
orderMap<span style=color:#f92672>.</span><span style=color:#a6e22e>remove</span><span style=color:#f92672>(</span>tx<span style=color:#f92672>(),</span> <span style=color:#66d9ef>this</span><span style=color:#f92672>.</span><span style=color:#a6e22e>order</span><span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#f92672>}</span>
<span style=color:#f92672>}</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/components/ title=Components><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/searches/ title=Searches style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,59 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Transactions - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/transactions/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class="dd-item active"><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/transactions.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Transactions</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#transactions>Transactions</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Transactions</h1><h2 id=transactions>Transactions</h2><p>Strolch Transactions play a central role in a Strolch agent. A transaction is
opened for a realm, and grants access to the model of the agent. Transactions
are implemented as a Java <code>try-with-resources</code> by implementing
the <code>AutoCloseable</code>
interface. This makes it trivial to understand the scope of a transaction.</p><p>Transactions handle the following:</p><ul><li>Opening and closing database connections</li><li>Releasing locks to strolch elements, if <code>tx.lock(StrolchRootElement)</code> or
<code>tx.lock(Locator)</code> was called</li><li>Performing Commands by executing them in the added order, and validating them
first.</li><li>Exception handling</li><li>Auditing</li><li>Updating observers</li></ul><p>When a transaction is opened, it is by default read-only, i.e. does not perform
any commands when it is closed. Should the TX perform commands, then it is
important to call <code>tx.commitOnClose()</code>, but only at the end of the work, so that
exception handling can properly work if something goes wrong.</p><p><code>StrolchTransaction</code> offers a myriad of methods:</p><ul><li>find element by its <code>Locator</code></li><li>get methods for elements by type and id, or using a <code>StringParameter</code> or
<code>StringListParameter</code> references</li><li>methods to add, update or remove elements</li><li>assert privilege access</li><li>get a new element by its template</li><li>check if an element exists by type and id</li><li>get streams for elements</li><li>add commands for execution</li></ul><p>Transactions are opened by accessing the realm, but there are convenience
methods depending on the use-case:</p><ul><li>In Services: by calling one of the <code>openTx()</code>-methods</li><li>In Commands: Transactions are already open, use method <code>tx()</code> to get instance.</li><li>REST API: <code>RestfulStrolchComponent.openTx()</code></li></ul><div class="notices warning"><p>Note: don&rsquo;t open a new TX inside a TX for the same realm!</p></div><p>Important is to always open the transaction as a <code>try-with-resource</code> block and to
define if the TX should commit, or not:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>(...))</span> <span style=color:#f92672>{</span>
<span style=color:#75715e>// read lock our object
</span><span style=color:#75715e></span> Locator ferrariLoc <span style=color:#f92672>=</span> Resource<span style=color:#f92672>.</span><span style=color:#a6e22e>locatorFor</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;ferrari&#34;</span><span style=color:#f92672>);</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>lock</span><span style=color:#f92672>(</span>ferrariLoc<span style=color:#f92672>);</span>
<span style=color:#75715e>// find a car by locator
</span><span style=color:#75715e></span> Resource ferrari <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>findElement</span><span style=color:#f92672>(</span>ferrariLoc<span style=color:#f92672>);</span>
<span style=color:#75715e>// get a car by ID
</span><span style=color:#75715e></span> Resource opel <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;opel&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
<span style=color:#75715e>// modify ball
</span><span style=color:#75715e></span> opel<span style=color:#f92672>.</span><span style=color:#a6e22e>setName</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Opel Corsa&#34;</span><span style=color:#f92672>);</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>update</span><span style=color:#f92672>(</span>opel<span style=color:#f92672>);</span>
<span style=color:#75715e>// get by string reference
</span><span style=color:#75715e></span> StringParameter ownerP <span style=color:#f92672>=</span> ferrari<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;relations&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;owner&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
Resource owner <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span>ownerP<span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
<span style=color:#75715e>// get by string list reference
</span><span style=color:#75715e></span> StringListParameter previousOwnersP <span style=color:#f92672>=</span> opel<span style=color:#f92672>.</span><span style=color:#a6e22e>getParameter</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;relations&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;previousOwners&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
List<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> previousOwners <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourcesBy</span><span style=color:#f92672>(</span>previousOwnersP<span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
<span style=color:#75715e>// check resource exists
</span><span style=color:#75715e></span> <span style=color:#66d9ef>if</span> <span style=color:#f92672>(</span>tx<span style=color:#f92672>.</span><span style=color:#a6e22e>hasResource</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;audi&#34;</span><span style=color:#f92672>))</span> <span style=color:#f92672>{</span>
Resource audi <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;audi&#34;</span><span style=color:#f92672>,</span> <span style=color:#66d9ef>true</span><span style=color:#f92672>);</span>
<span style=color:#75715e>// assert has privilege to remove a car
</span><span style=color:#75715e></span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>assertHasPrivilege</span><span style=color:#f92672>(</span>Operation<span style=color:#f92672>.</span><span style=color:#a6e22e>REMOVE</span><span style=color:#f92672>,</span> audi<span style=color:#f92672>);</span>
<span style=color:#75715e>// remove the car
</span><span style=color:#75715e></span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>remove</span><span style=color:#f92672>(</span>audi<span style=color:#f92672>);</span>
<span style=color:#f92672>}</span>
<span style=color:#75715e>// iterate all cars
</span><span style=color:#75715e></span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>streamResources</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car&#34;</span><span style=color:#f92672>).</span><span style=color:#a6e22e>forEach</span><span style=color:#f92672>(</span>car <span style=color:#f92672>-&gt;</span> <span style=color:#f92672>{</span>
logger<span style=color:#f92672>.</span><span style=color:#a6e22e>info</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;Car: &#34;</span> <span style=color:#f92672>+</span> car<span style=color:#f92672>.</span><span style=color:#a6e22e>getId</span><span style=color:#f92672>());</span>
<span style=color:#f92672>});</span>
<span style=color:#75715e>// commit if TX was changed
</span><span style=color:#75715e></span> <span style=color:#66d9ef>if</span> <span style=color:#f92672>(</span>tx<span style=color:#f92672>.</span><span style=color:#a6e22e>needsCommit</span><span style=color:#f92672>())</span>
tx<span style=color:#f92672>.</span><span style=color:#a6e22e>commitOnClose</span><span style=color:#f92672>();</span>
<span style=color:#f92672>}</span>
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/queries/ title=Queries><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/policies/ title=Policies style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,39 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Versioning - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/documentation/versioning/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class="dd-item
parent"><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class="dd-item active"><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedocumentation/versioning.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > <a href=/documentation/>Documentation</a> > Versioning</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#versioning>Versioning</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Versioning</h1><h2 id=versioning>Versioning</h2><p>One of Strolch&rsquo;s features that sets it apart from other frameworks, is that
versioning is baked into Strolch&rsquo;s fabric. The feature is opt-in, as it is not
required in all projects, but it only needs enabling, for all modifications to
objects to be versioned, so that rollbacks can be done when needed.</p><p>The feature is enabled for each realm. In the <code>StrolchConfiguration.xml</code> file
enable it by adding the <code>enableVersioning</code> propery per realm:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#f92672>&lt;StrolchConfiguration&gt;</span>
<span style=color:#f92672>&lt;env</span> <span style=color:#a6e22e>id=</span><span style=color:#e6db74>&#34;dev&#34;</span><span style=color:#f92672>&gt;</span>
...
<span style=color:#f92672>&lt;Component&gt;</span>
<span style=color:#f92672>&lt;name&gt;</span>RealmHandler<span style=color:#f92672>&lt;/name&gt;</span>
<span style=color:#f92672>&lt;api&gt;</span>li.strolch.agent.api.RealmHandler<span style=color:#f92672>&lt;/api&gt;</span>
<span style=color:#f92672>&lt;impl&gt;</span>li.strolch.agent.impl.DefaultRealmHandler<span style=color:#f92672>&lt;/impl&gt;</span>
<span style=color:#f92672>&lt;depends&gt;</span>PrivilegeHandler<span style=color:#f92672>&lt;/depends&gt;</span>
<span style=color:#f92672>&lt;Properties&gt;</span>
<span style=color:#f92672>&lt;realms&gt;</span>defaultRealm, otherRealm<span style=color:#f92672>&lt;/realms&gt;</span>
<span style=color:#f92672>&lt;enableVersioning&gt;</span>true<span style=color:#f92672>&lt;/enableVersioning&gt;</span>
<span style=color:#f92672>&lt;dataStoreMode&gt;</span>TRANSIENT<span style=color:#f92672>&lt;/dataStoreMode&gt;</span>
<span style=color:#f92672>&lt;dataStoreFile&gt;</span>StrolchModel.xml<span style=color:#f92672>&lt;/dataStoreFile&gt;</span>
<span style=color:#f92672>&lt;enableVersioning.otherRealm&gt;</span>true<span style=color:#f92672>&lt;/enableVersioning.otherRealm&gt;</span>
<span style=color:#f92672>&lt;dataStoreMode.otherRealm&gt;</span>TRANSIENT<span style=color:#f92672>&lt;/dataStoreMode.otherRealm&gt;</span>
<span style=color:#f92672>&lt;dataStoreFile.otherRealm&gt;</span>StrolchModel.xml<span style=color:#f92672>&lt;/dataStoreFile.otherRealm&gt;</span>
<span style=color:#f92672>&lt;/Properties&gt;</span>
<span style=color:#f92672>&lt;/Component&gt;</span>
<span style=color:#f92672>&lt;/env&gt;</span>
...
<span style=color:#f92672>&lt;/StrolchConfiguration&gt;</span>
</code></pre></div><p>Once versioning is enabled, versioning is handled automatically. The API for versioning is implemented on the ElementMaps.</p><p>Example: Revert to previous version of a Resource:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>Resource res <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>&#34;TestType&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;MyTestResource&#34;</span><span style=color:#f92672>);</span>
ResourceMap resourceMap <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceMap</span><span style=color:#f92672>();</span>
Resource previousVersion <span style=color:#f92672>=</span> resourceMap<span style=color:#f92672>.</span><span style=color:#a6e22e>revertToVersion</span><span style=color:#f92672>(</span>tx<span style=color:#f92672>,</span> res<span style=color:#f92672>);</span>
<span style=color:#75715e>// or
</span><span style=color:#75715e></span>Resource previousVersion <span style=color:#f92672>=</span> resourceMap<span style=color:#f92672>.</span><span style=color:#a6e22e>revertToVersion</span><span style=color:#f92672>(</span>tx<span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;TestType&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;MyTestResource&#34;</span><span style=color:#f92672>,</span> 1<span style=color:#f92672>);</span>
</code></pre></div><p>Example: Retrieve all versions of a Resource:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java>List<span style=color:#f92672>&lt;</span>Resource<span style=color:#f92672>&gt;</span> versions <span style=color:#f92672>=</span> resourceMap<span style=color:#f92672>.</span><span style=color:#a6e22e>getVersionsFor</span><span style=color:#f92672>(</span>tx<span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;TestType&#34;</span><span style=color:#f92672>,</span> <span style=color:#e6db74>&#34;MyTestResource&#34;</span><span style=color:#f92672>);</span>
</code></pre></div><div class="notices tip"><p>Note: When reverting to a previous version, it is important to remember, that
any references on an element to other elements will also be restored. As long as
the relationship is to the same element, then this is not an issue, but should
the relationship have changed, then it this must be handled and the user
performing a revert be allowed to decided which element to reference in the
reverted version.</p></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/documentation/observers/ title=Observers><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/reports/ title=Reports style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1,8 @@
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>Download - Strolch</title><link href=/css/nucleus.css?1626028660 rel=stylesheet><link href=/css/fontawesome-all.min.css?1626028660 rel=stylesheet><link href=/css/hybrid.css?1626028660 rel=stylesheet><link href=/css/featherlight.min.css?1626028660 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1626028660 rel=stylesheet><link href=/css/auto-complete.css?1626028660 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1626028660 rel=stylesheet><link href=/css/theme.css?1626028660 rel=stylesheet><link href=/css/hugo-theme.css?1626028660 rel=stylesheet><link href=/css/theme-green.css?1626028660 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1626028660></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/download/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1626028660></script><script type=text/javascript src=/js/auto-complete.js?1626028660></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1626028660></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class=dd-item><a href=/api/>API</a></li><li data-nav-id=/history/ title=History class=dd-item><a href=/history/>History</a></li><li data-nav-id=/documentation/ title=Documentation class=dd-item><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class="dd-item
parent
active"><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org>Grav</a> and <a href=https://gohugo.io/>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch/tree/develop/li.strolch.websitedownload/_index.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > Download</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#download>Download</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>Download</h1><h2 id=download>Download</h2><p>Strolch is
on <a href=https://mvnrepository.com/artifact/li.strolch/li.strolch.agent>Maven central</a>
, but if the latest version is not there, then build it locally. A guide can be
found on the <a href=/development>development</a> page.</p><p>Strolch is also built on <a href=https://ci.4trees.ch/>Jenkins</a>, so you can see if the
latest version passes all tests.</p><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/tutorial/crud-book/ title="CRUD Book"><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/development/ title=Development style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1626028660></script><script src=/js/perfect-scrollbar.min.js?1626028660></script><script src=/js/perfect-scrollbar.jquery.min.js?1626028660></script><script src=/js/jquery.sticky.js?1626028660></script><script src=/js/featherlight.min.js?1626028660></script><script src=/js/highlight.pack.js?1626028660></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1626028660></script><script src=/js/learn.js?1626028660></script><script src=/js/hugo-learn.js?1626028660></script><script src=/mermaid/mermaid.js?1626028660></script><script>mermaid.initialize({startOnLoad:true});</script></body></html>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Download on Strolch</title><link>https://strolch.li/download/</link><description>Recent content in Download on Strolch</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://strolch.li/download/index.xml" rel="self" type="application/rss+xml"/></channel></rss>

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
google-site-verification: google052dbec2d053a4e1.html

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>History on Strolch</title><link>https://strolch.li/history/</link><description>Recent content in History on Strolch</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://strolch.li/history/index.xml" rel="self" type="application/rss+xml"/></channel></rss>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="896" height="1024"><path d="M128 768h256v64H128v-64zm320-384H128v64h320v-64zm128 192V448L384 640l192 192V704h320V576H576zm-288-64H128v64h160v-64zM128 704h160v-64H128v64zm576 64h64v128c-1 18-7 33-19 45s-27 18-45 19H64c-35 0-64-29-64-64V192c0-35 29-64 64-64h192C256 57 313 0 384 0s128 57 128 128h192c35 0 64 29 64 64v320h-64V320H64v576h640V768zM128 256h512c0-35-29-64-64-64h-64c-35 0-64-29-64-64s-29-64-64-64-64 29-64 64-29 64-64 64h-64c-35 0-64 29-64 64z"/></svg>

After

Width:  |  Height:  |  Size: 509 B

BIN
publish/images/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

28
publish/index.html Normal file

File diff suppressed because one or more lines are too long

1
publish/index.json Normal file

File diff suppressed because one or more lines are too long

33
publish/index.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Strolch Overview on Strolch</title><link>https://strolch.li/</link><description>Recent content in Strolch Overview on Strolch</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://strolch.li/index.xml" rel="self" type="application/rss+xml"/><item><title>Architecture</title><link>https://strolch.li/documentation/architecture/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/architecture/</guid><description>Architecture Birds View A Strolch agent&amp;rsquo;s architecture can be seen as a simple three-tier architecture. The presentation layer is mostly a web frontend, where the communication with the agent is done via REST API calls.
The agent itself implements the business logic using Services, Commands, Queries etc.
The agent can communicate with other 3rd systems using any API, where it is preferred to use JSON over REST.
The agent can use a standard RDBMS as a storage system, where currently DAOs have been implemented only for PostgreSQL.</description></item><item><title>Configuration</title><link>https://strolch.li/tutorial/configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/tutorial/configuration/</guid><description>Configuration Let&amp;rsquo;s start by creating a new Apache Maven project. We&amp;rsquo;ll need a POM with the proper dependencies. We expect you to be familiar with Apache Maven, so we&amp;rsquo;ll just show you a working POM file:
pom.xml
&amp;lt;?xml version=&amp;#34;1.0&amp;#34;?&amp;gt; &amp;lt;project xmlns=&amp;#34;http://maven.apache.org/POM/4.0.0&amp;#34; xmlns:xsi=&amp;#34;http://www.w3.org/2001/XMLSchema-instance&amp;#34; xsi:schemaLocation=&amp;#34;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&amp;#34;&amp;gt; &amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt; &amp;lt;groupId&amp;gt;li.strolch&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;strolch-bookshop&amp;lt;/artifactId&amp;gt; &amp;lt;version&amp;gt;0.1.0-SNAPSHOT&amp;lt;/version&amp;gt; &amp;lt;packaging&amp;gt;war&amp;lt;/packaging&amp;gt; &amp;lt;name&amp;gt;strolch-bookshop&amp;lt;/name&amp;gt; &amp;lt;description&amp;gt;Bookshop built on Strolch&amp;lt;/description&amp;gt; &amp;lt;inceptionYear&amp;gt;2017&amp;lt;/inceptionYear&amp;gt; &amp;lt;properties&amp;gt; &amp;lt;project.build.sourceEncoding&amp;gt;UTF-8&amp;lt;/project.build.sourceEncoding&amp;gt; &amp;lt;maven.build.timestamp.format&amp;gt;yyyy-MM-dd HH:mm:ss&amp;lt;/maven.build.timestamp.format&amp;gt; &amp;lt;buildTimestamp&amp;gt;${maven.build.timestamp}&amp;lt;/buildTimestamp&amp;gt; &amp;lt;jdk.version&amp;gt;1.8&amp;lt;/jdk.version&amp;gt; &amp;lt;jersey.version&amp;gt;2.25.1&amp;lt;/jersey.version&amp;gt; &amp;lt;slf4j.version&amp;gt;1.7.25&amp;lt;/slf4j.version&amp;gt; &amp;lt;logback.version&amp;gt;1.2.3&amp;lt;/logback.version&amp;gt; &amp;lt;petitparser.version&amp;gt;2.1.0&amp;lt;/petitparser.version&amp;gt; &amp;lt;hikaricp.version&amp;gt;2.7.1&amp;lt;/hikaricp.version&amp;gt; &amp;lt;postgresql.version&amp;gt;42.1.4&amp;lt;/postgresql.version&amp;gt; &amp;lt;gson.version&amp;gt;2.8.2&amp;lt;/gson.version&amp;gt; &amp;lt;annotation.version&amp;gt;1.3.1&amp;lt;/annotation.version&amp;gt; &amp;lt;javaxmail.version&amp;gt;1.6.0&amp;lt;/javaxmail.version&amp;gt; &amp;lt;serverlet.</description></item><item><title>Model</title><link>https://strolch.li/documentation/model/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/model/</guid><description>Model Before we dive into the entire model, let&amp;rsquo;s show an example and how it would be modelled in Strolch and use in Strolch:
A possible model would look as follows:
&amp;lt;?xml version=&amp;#34;1.0&amp;#34; encoding=&amp;#34;UTF-8&amp;#34; ?&amp;gt; &amp;lt;StrolchModel xmlns=&amp;#34;https://strolch.li/xsd/StrolchModel-1.6.xsd&amp;#34;&amp;gt; &amp;lt;Resource Id=&amp;#34;Product&amp;#34; Name=&amp;#34;Product Template&amp;#34; Type=&amp;#34;Template&amp;#34;&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;parameters&amp;#34; Name=&amp;#34;Parameters&amp;#34; Type=&amp;#34;Parameters&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;description&amp;#34; Name=&amp;#34;Description&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;color&amp;#34; Name=&amp;#34;Color&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;form&amp;#34; Name=&amp;#34;Form&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;relations&amp;#34; Name=&amp;#34;Relations&amp;#34; Type=&amp;#34;Relations&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;articles&amp;#34; Name=&amp;#34;Articles&amp;#34; Type=&amp;#34;StringList&amp;#34; Interpretation=&amp;#34;Resource-Ref&amp;#34; Uom=&amp;#34;Article&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;/Resource&amp;gt; &amp;lt;Resource Id=&amp;#34;Article&amp;#34; Name=&amp;#34;Article Template&amp;#34; Type=&amp;#34;Template&amp;#34;&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;parameters&amp;#34; Name=&amp;#34;Parameters&amp;#34; Type=&amp;#34;Parameters&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;description&amp;#34; Name=&amp;#34;Description&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;barcode&amp;#34; Name=&amp;#34;Barcode&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;relations&amp;#34; Name=&amp;#34;Relations&amp;#34; Type=&amp;#34;Relations&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;product&amp;#34; Name=&amp;#34;Product&amp;#34; Type=&amp;#34;String&amp;#34; Interpretation=&amp;#34;Resource-Ref&amp;#34; Uom=&amp;#34;Product&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;/Resource&amp;gt; &amp;lt;Resource Id=&amp;#34;Customer&amp;#34; Name=&amp;#34;Customer Template&amp;#34; Type=&amp;#34;Template&amp;#34;&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;address&amp;#34; Name=&amp;#34;Address&amp;#34; Type=&amp;#34;Address&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;street&amp;#34; Name=&amp;#34;Street&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;zip&amp;#34; Name=&amp;#34;Zip&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;city&amp;#34; Name=&amp;#34;City&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;country&amp;#34; Name=&amp;#34;Country&amp;#34; Type=&amp;#34;String&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;/Resource&amp;gt; &amp;lt;Order Id=&amp;#34;Order&amp;#34; Name=&amp;#34;Order&amp;#34; Type=&amp;#34;Template&amp;#34;&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;quantities&amp;#34; Name=&amp;#34;Quantities per Article Id&amp;#34; Type=&amp;#34;Quantities&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;quantity&amp;#34; Name=&amp;#34;Quantity&amp;#34; Type=&amp;#34;Float&amp;#34; Value=&amp;#34;0&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;ParameterBag Id=&amp;#34;relations&amp;#34; Name=&amp;#34;Relations&amp;#34; Type=&amp;#34;Relations&amp;#34;&amp;gt; &amp;lt;Parameter Id=&amp;#34;articles&amp;#34; Name=&amp;#34;Articles&amp;#34; Type=&amp;#34;StringList&amp;#34; Interpretation=&amp;#34;Resource-Ref&amp;#34; Uom=&amp;#34;Article&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;Parameter Id=&amp;#34;customer&amp;#34; Name=&amp;#34;Customer&amp;#34; Type=&amp;#34;String&amp;#34; Interpretation=&amp;#34;Resource-Ref&amp;#34; Uom=&amp;#34;Customer&amp;#34; Value=&amp;#34;&amp;#34;/&amp;gt; &amp;lt;/ParameterBag&amp;gt; &amp;lt;/Order&amp;gt; &amp;lt;/StrolchModel&amp;gt; Let&amp;rsquo;s go through this model:</description></item><item><title>Model</title><link>https://strolch.li/tutorial/model/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/tutorial/model/</guid><description>Model Looking back at our functionality, we can list the following entities that need to be modelled (We&amp;rsquo;ll go into detail further down):
Book → books can be orderd UserCart → we want to store the cart of the user Account → we need to know where to send the orders PurchaseOrder → we need to know what was ordered and keep track of its state FromStock → we want to use activities to implement the process of an order In Strolch we model entities by defining the element as a template.</description></item><item><title>CRUD Book</title><link>https://strolch.li/tutorial/crud-book/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/tutorial/crud-book/</guid><description>Preparation Since Books are central to the bookshop, we&amp;rsquo;ll first create the CRUD REST API for them. The API will be as follows:
GET ../rest/books?query=,offset=,limit= GET ../rest/books/{id} POST ../rest/books PUT ../rest/books/{id} DELETE ../rest/books/{id} Thus corresponding with querying, getting, creating, updating and removing of books. So let&amp;rsquo;s go ahead and add these REST APIs to our project.
Our project is using JAX-RS 2.0 as the API and Jersey 2.x as the implementation, thus first we need to configure JAX-RS.</description></item><item><title>Do and Don't</title><link>https://strolch.li/documentation/do-and-donts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/do-and-donts/</guid><description>This page discusses things you should and shouldn&amp;rsquo;t do when using Strolch The following is a simple list of do&amp;rsquo;s and don&amp;rsquo;ts:
1 Service per use-case, should mostly delegate to Commands. Commands implement use-cases or parts of it, and are thus reusable. Subclass ResourceSearch, OrderSearch and ActivitySearch when implementing use-case specific search - this allows privilege checking. One Transaction at a time - no TX inside of another TX. Commands are added to TXs and performed on close: tx.</description></item><item><title>Runtime Configuration</title><link>https://strolch.li/documentation/runtime-configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/runtime-configuration/</guid><description>Runtime Configuration A Strolch runtime configuration comprises two parts: a configuration part, and a model part. The configuration are files located in the ..config/ folder, and the model are files located in the ../data folder.
In an absolute minimal configuration, the Strolch runtime requires the following folder structure:
../config/ ../StrolchConfiguration.xml → configures the Strolch agent ../PrivilegeConfig.xml → configures user management ../PrivilegeUsers.xml → contains the users in an XML based user management file .</description></item><item><title>Architecture</title><link>https://strolch.li/plc/architecture/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/plc/architecture/</guid><description>Architecture Overview The Strolch PLC architecture sees the Strolch Agent as the server, managing logical devices, i.e. multiple sensors and actors together and thus deciding on further steps. With this architecture multiple PLCs can be combined together in one agent for flow control.
PLC Architecture On the agent side the two main classes are the PlcGwServerHandler and the PlcGwService
The PlcGwServerHandler handles connections from remote PLCs over WebSockets and sends the requests to these PLCs.</description></item><item><title>Realms</title><link>https://strolch.li/documentation/realms/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/realms/</guid><description>Realms Realms implement multi-tenant capabilities. A Strolch agent can have an arbitrary number of realms configured and each realm has its own persistence configuration, allowing to separate mandates completely.
A realm can run in one of the following modes:
EMPTY This is a transient data store mode, where no model changes are persisted - they are only kept in memory. When the Strolch agent is started, this realm is empty as no data is loaded.</description></item><item><title>Components</title><link>https://strolch.li/documentation/components/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/components/</guid><description>Components A Strolch agent can be easily extended with arbitrary components. An agent is basically a container for classes extending StrolchComponent with a life cycle. These classes mostly implement an interface which describes the operations that are supported by the component.
The following represents a list of the most used components:
RealmHandler: li.strolch.agent.impl.DefaultRealmHandler PrivilegeHandler: li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler EnumHandler: li.strolch.runtime.query.enums.DefaultEnumHandler PolicyHandler: li.strolch.policy.DefaultPolicyHandler ServiceHandler: li.strolch.service.api.DefaultServiceHandler StrolchSessionHandler: li.strolch.rest.DefaultStrolchSessionHandler PersistenceHandler: multiple implementations PostInitializer: project specific implementation MailHandler: li.</description></item><item><title>Services and Commands</title><link>https://strolch.li/documentation/services-and-commands/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/services-and-commands/</guid><description>Services and Commands Services are written to implement a specific use-case. Commands are written to implement re-usable parts of a use-case. The use-case can be abstract e.g., AddResourceService or very specific e.g. CreatePatientService.
Should the use-case be re-usable in different scenarios, then commands should implement the logic, and the services should then execute the commands. E.g. The CreatePatientService would use a CreatePatientResourceCommand and then use an AddResourceCommand in a single transaction, so that the task of creating the actual Patient Resource can be re-used somewhere else.</description></item><item><title>Searches</title><link>https://strolch.li/documentation/searches/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/searches/</guid><description>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.</description></item><item><title>Queries</title><link>https://strolch.li/documentation/queries/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/queries/</guid><description>Queries 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, 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 Resource, but one of type Car and the other of type House.</description></item><item><title>Example Set-Up</title><link>https://strolch.li/plc/example-set-up/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/plc/example-set-up/</guid><description>Example Set-Up This example setup describes the movement of containers over conveyors. The conveyors have motors which can be started and stopped by a GPIO output pin controlled on a Raspberry Pi and each conveyor has a light barrier to detect the occupancy of a container and the Raspberry Pi detects this on GPIO input pins.
Further at each conveyor location is a barcode reader to read the ID of a container.</description></item><item><title>Transactions</title><link>https://strolch.li/documentation/transactions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/transactions/</guid><description>Transactions Strolch Transactions play a central role in a Strolch agent. A transaction is opened for a realm, and grants access to the model of the agent. Transactions are implemented as a Java try-with-resources by implementing the AutoCloseable interface. This makes it trivial to understand the scope of a transaction.
Transactions handle the following:
Opening and closing database connections Releasing locks to strolch elements, if tx.lock(StrolchRootElement) or tx.lock(Locator) was called Performing Commands by executing them in the added order, and validating them first.</description></item><item><title>Policies</title><link>https://strolch.li/documentation/policies/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/policies/</guid><description>Policies Policies are an integral part when writing business logic in Strolch. In many cases it would suffice to write all such logic in Services and Commands, but as soon as behaviour can change, depending on the element being accessed, then this would quickly lead to many if/else blocks.
Since writing large if/else blocks is not maintanable in the long run, Strolch offers a different approach. All Strolch elements can store Policy definitions.</description></item><item><title>Observers</title><link>https://strolch.li/documentation/observers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/observers/</guid><description>Observers All changes done in a Strolch transaction are recorded and then propagated to any registered observers.
The observer feature is opt-in and is configured for each realm. In the StrolchConfiguration.xml file enable observers by adding the enableObserverUpdates property per realm:
&amp;lt;StrolchConfiguration&amp;gt; &amp;lt;env id=&amp;#34;dev&amp;#34;&amp;gt; ... &amp;lt;Component&amp;gt; &amp;lt;name&amp;gt;RealmHandler&amp;lt;/name&amp;gt; &amp;lt;api&amp;gt;li.strolch.agent.api.RealmHandler&amp;lt;/api&amp;gt; &amp;lt;impl&amp;gt;li.strolch.agent.impl.DefaultRealmHandler&amp;lt;/impl&amp;gt; &amp;lt;depends&amp;gt;PrivilegeHandler&amp;lt;/depends&amp;gt; &amp;lt;Properties&amp;gt; &amp;lt;realms&amp;gt;defaultRealm, otherRealm&amp;lt;/realms&amp;gt; &amp;lt;enableObserverUpdates&amp;gt;true&amp;lt;/enableObserverUpdates&amp;gt; &amp;lt;dataStoreMode&amp;gt;TRANSIENT&amp;lt;/dataStoreMode&amp;gt; &amp;lt;dataStoreFile&amp;gt;StrolchModel.xml&amp;lt;/dataStoreFile&amp;gt; &amp;lt;enableObserverUpdates.otherRealm&amp;gt;true&amp;lt;/enableObserverUpdates.otherRealm&amp;gt; &amp;lt;dataStoreMode.otherRealm&amp;gt;TRANSIENT&amp;lt;/dataStoreMode.otherRealm&amp;gt; &amp;lt;dataStoreFile.otherRealm&amp;gt;StrolchModel.xml&amp;lt;/dataStoreFile.otherRealm&amp;gt; &amp;lt;/Properties&amp;gt; &amp;lt;/Component&amp;gt; &amp;lt;/env&amp;gt; ... &amp;lt;/StrolchConfiguration&amp;gt; Registering for updates is done by registering an Observer on the ObserverHandler of the realm itself:</description></item><item><title>Versioning</title><link>https://strolch.li/documentation/versioning/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/versioning/</guid><description>Versioning One of Strolch&amp;rsquo;s features that sets it apart from other frameworks, is that versioning is baked into Strolch&amp;rsquo;s fabric. The feature is opt-in, as it is not required in all projects, but it only needs enabling, for all modifications to objects to be versioned, so that rollbacks can be done when needed.
The feature is enabled for each realm. In the StrolchConfiguration.xml file enable it by adding the enableVersioning propery per realm:</description></item><item><title>Reports</title><link>https://strolch.li/documentation/reports/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/reports/</guid><description>Reports Since Strolch has a generic model, it was rather straight forward to create a simple API for writing reports. In Strolch a report is defined by using its own model, i.e. a Report is a Resource of type Report.
A report consists of the following parts:
policy definition, thus allowing extensions basic configuration like base object type, order direction, etc. column definitions joins ordering definition filters An example of a report is as follows:</description></item><item><title>Privileges</title><link>https://strolch.li/documentation/priviles/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://strolch.li/documentation/priviles/</guid><description>Privileges No framework is complete without user management and privilege validation. The basic form would be Users and Roles, and then validating that an authenticated user has a given role. In Strolch we go a step further: A User has roles assigned, and each role has a set of Privileges. The privileges can overlap, a validation is performed to make sure that the one role doesn&amp;rsquo;t deny and another role allows a specific action.</description></item></channel></rss>

File diff suppressed because one or more lines are too long

7
publish/js/clipboard.min.js vendored Normal file

File diff suppressed because one or more lines are too long

9
publish/js/featherlight.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

94
publish/js/hugo-learn.js Normal file
View File

@ -0,0 +1,94 @@
// Get Parameters from some url
var getUrlParameter = function getUrlParameter(sPageURL) {
var url = sPageURL.split('?');
var obj = {};
if (url.length == 2) {
var sURLVariables = url[1].split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
obj[sParameterName[0]] = sParameterName[1];
}
}
return obj;
};
// Execute actions on images generated from Markdown pages
var images = $("div#body-inner img").not(".inline");
// Wrap image inside a featherlight (to get a full size view in a popup)
images.wrap(function(){
var image =$(this);
var o = getUrlParameter(image[0].src);
var f = o['featherlight'];
// IF featherlight is false, do not use feather light
if (f != 'false') {
if (!image.parent("a").length) {
return "<a href='" + image[0].src + "' data-featherlight='image'></a>";
}
}
});
// Change styles, depending on parameters set to the image
images.each(function(index){
var image = $(this)
var o = getUrlParameter(image[0].src);
if (typeof o !== "undefined") {
var h = o["height"];
var w = o["width"];
var c = o["classes"];
image.css("width", function() {
if (typeof w !== "undefined") {
return w;
} else {
return "auto";
}
});
image.css("height", function() {
if (typeof h !== "undefined") {
return h;
} else {
return "auto";
}
});
if (typeof c !== "undefined") {
var classes = c.split(',');
for (i = 0; i < classes.length; i++) {
image.addClass(classes[i]);
}
}
}
});
// Stick the top to the top of the screen when scrolling
$(document).ready(function(){
$("#top-bar").sticky({topSpacing:0, zIndex: 1000});
});
jQuery(document).ready(function() {
// Add link button for every
var text, clip = new ClipboardJS('.anchor');
$("h1~h2,h1~h3,h1~h4,h1~h5,h1~h6").append(function(index, html){
var element = $(this);
var url = encodeURI(document.location.origin + document.location.pathname);
var link = url + "#"+element[0].id;
return " <span class='anchor' data-clipboard-text='"+link+"'>" +
"<i class='fas fa-link fa-lg'></i>" +
"</span>"
;
});
$(".anchor").on('mouseleave', function(e) {
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-s tooltipped-w');
});
clip.on('success', function(e) {
e.clearSelection();
$(e.trigger).attr('aria-label', 'Link copied to clipboard!').addClass('tooltipped tooltipped-s');
});
$('code.language-mermaid').each(function(index, element) {
var content = $(element).html().replace(/&amp;/g, '&');
$(element).parent().replaceWith('<div class="mermaid" align="center">' + content + '</div>');
});
});

2
publish/js/jquery-3.3.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

288
publish/js/jquery.sticky.js Executable file
View File

@ -0,0 +1,288 @@
// Sticky Plugin v1.0.4 for jQuery
// =============
// Author: Anthony Garand
// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
// Improvements by Leonardo C. Daronco (daronco)
// Created: 02/14/2011
// Date: 07/20/2015
// Website: http://stickyjs.com/
// Description: Makes an element on the page stick on the screen as you scroll
// It will only set the 'top' and 'position' of your element, you
// might need to adjust the width in some cases.
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var slice = Array.prototype.slice; // save ref to original slice()
var splice = Array.prototype.splice; // save ref to original slice()
var defaults = {
topSpacing: 0,
bottomSpacing: 0,
className: 'is-sticky',
wrapperClassName: 'sticky-wrapper',
center: false,
getWidthFrom: '',
widthFromWrapper: true, // works only when .getWidthFrom is empty
responsiveWidth: false,
zIndex: 'inherit'
},
$window = $(window),
$document = $(document),
sticked = [],
windowHeight = $window.height(),
scroller = function() {
var scrollTop = $window.scrollTop(),
documentHeight = $document.height(),
dwh = documentHeight - windowHeight,
extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
for (var i = 0, l = sticked.length; i < l; i++) {
var s = sticked[i],
elementTop = s.stickyWrapper.offset().top,
etse = elementTop - s.topSpacing - extra;
//update height in case of dynamic content
s.stickyWrapper.css('height', s.stickyElement.outerHeight());
if (scrollTop <= etse) {
if (s.currentTop !== null) {
s.stickyElement
.css({
'width': '',
'position': '',
'top': '',
'z-index': ''
});
s.stickyElement.parent().removeClass(s.className);
s.stickyElement.trigger('sticky-end', [s]);
s.currentTop = null;
}
}
else {
var newTop = documentHeight - s.stickyElement.outerHeight()
- s.topSpacing - s.bottomSpacing - scrollTop - extra;
if (newTop < 0) {
newTop = newTop + s.topSpacing;
} else {
newTop = s.topSpacing;
}
if (s.currentTop !== newTop) {
var newWidth;
if (s.getWidthFrom) {
padding = s.stickyElement.innerWidth() - s.stickyElement.width();
newWidth = $(s.getWidthFrom).width() - padding || null;
} else if (s.widthFromWrapper) {
newWidth = s.stickyWrapper.width();
}
if (newWidth == null) {
newWidth = s.stickyElement.width();
}
s.stickyElement
.css('width', newWidth)
.css('position', 'fixed')
.css('top', newTop)
.css('z-index', s.zIndex);
s.stickyElement.parent().addClass(s.className);
if (s.currentTop === null) {
s.stickyElement.trigger('sticky-start', [s]);
} else {
// sticky is started but it have to be repositioned
s.stickyElement.trigger('sticky-update', [s]);
}
if (s.currentTop === s.topSpacing && s.currentTop > newTop || s.currentTop === null && newTop < s.topSpacing) {
// just reached bottom || just started to stick but bottom is already reached
s.stickyElement.trigger('sticky-bottom-reached', [s]);
} else if(s.currentTop !== null && newTop === s.topSpacing && s.currentTop < newTop) {
// sticky is started && sticked at topSpacing && overflowing from top just finished
s.stickyElement.trigger('sticky-bottom-unreached', [s]);
}
s.currentTop = newTop;
}
// Check if sticky has reached end of container and stop sticking
var stickyWrapperContainer = s.stickyWrapper.parent();
var unstick = (s.stickyElement.offset().top + s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + stickyWrapperContainer.outerHeight()) && (s.stickyElement.offset().top <= s.topSpacing);
if( unstick ) {
s.stickyElement
.css('position', 'absolute')
.css('top', '')
.css('bottom', 0)
.css('z-index', '');
} else {
s.stickyElement
.css('position', 'fixed')
.css('top', newTop)
.css('bottom', '')
.css('z-index', s.zIndex);
}
}
}
},
resizer = function() {
windowHeight = $window.height();
for (var i = 0, l = sticked.length; i < l; i++) {
var s = sticked[i];
var newWidth = null;
if (s.getWidthFrom) {
if (s.responsiveWidth) {
newWidth = $(s.getWidthFrom).width();
}
} else if(s.widthFromWrapper) {
newWidth = s.stickyWrapper.width();
}
if (newWidth != null) {
s.stickyElement.css('width', newWidth);
}
}
},
methods = {
init: function(options) {
return this.each(function() {
var o = $.extend({}, defaults, options);
var stickyElement = $(this);
var stickyId = stickyElement.attr('id');
var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName;
var wrapper = $('<div></div>')
.attr('id', wrapperId)
.addClass(o.wrapperClassName);
stickyElement.wrapAll(function() {
if ($(this).parent("#" + wrapperId).length == 0) {
return wrapper;
}
});
var stickyWrapper = stickyElement.parent();
if (o.center) {
stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
}
if (stickyElement.css("float") === "right") {
stickyElement.css({"float":"none"}).parent().css({"float":"right"});
}
o.stickyElement = stickyElement;
o.stickyWrapper = stickyWrapper;
o.currentTop = null;
sticked.push(o);
methods.setWrapperHeight(this);
methods.setupChangeListeners(this);
});
},
setWrapperHeight: function(stickyElement) {
var element = $(stickyElement);
var stickyWrapper = element.parent();
if (stickyWrapper) {
stickyWrapper.css('height', element.outerHeight());
}
},
setupChangeListeners: function(stickyElement) {
if (window.MutationObserver) {
var mutationObserver = new window.MutationObserver(function(mutations) {
if (mutations[0].addedNodes.length || mutations[0].removedNodes.length) {
methods.setWrapperHeight(stickyElement);
}
});
mutationObserver.observe(stickyElement, {subtree: true, childList: true});
} else {
if (window.addEventListener) {
stickyElement.addEventListener('DOMNodeInserted', function() {
methods.setWrapperHeight(stickyElement);
}, false);
stickyElement.addEventListener('DOMNodeRemoved', function() {
methods.setWrapperHeight(stickyElement);
}, false);
} else if (window.attachEvent) {
stickyElement.attachEvent('onDOMNodeInserted', function() {
methods.setWrapperHeight(stickyElement);
});
stickyElement.attachEvent('onDOMNodeRemoved', function() {
methods.setWrapperHeight(stickyElement);
});
}
}
},
update: scroller,
unstick: function(options) {
return this.each(function() {
var that = this;
var unstickyElement = $(that);
var removeIdx = -1;
var i = sticked.length;
while (i-- > 0) {
if (sticked[i].stickyElement.get(0) === that) {
splice.call(sticked,i,1);
removeIdx = i;
}
}
if(removeIdx !== -1) {
unstickyElement.unwrap();
unstickyElement
.css({
'width': '',
'position': '',
'top': '',
'float': '',
'z-index': ''
})
;
}
});
}
};
// should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
if (window.addEventListener) {
window.addEventListener('scroll', scroller, false);
window.addEventListener('resize', resizer, false);
} else if (window.attachEvent) {
window.attachEvent('onscroll', scroller);
window.attachEvent('onresize', resizer);
}
$.fn.sticky = function(method) {
if (methods[method]) {
return methods[method].apply(this, slice.call(arguments, 1));
} else if (typeof method === 'object' || !method ) {
return methods.init.apply( this, arguments );
} else {
$.error('Method ' + method + ' does not exist on jQuery.sticky');
}
};
$.fn.unstick = function(method) {
if (methods[method]) {
return methods[method].apply(this, slice.call(arguments, 1));
} else if (typeof method === 'object' || !method ) {
return methods.unstick.apply( this, arguments );
} else {
$.error('Method ' + method + ' does not exist on jQuery.sticky');
}
};
$(function() {
setTimeout(scroller, 0);
});
}));

443
publish/js/learn.js Normal file
View File

@ -0,0 +1,443 @@
// Scrollbar Width function
function getScrollBarWidth() {
var inner = document.createElement('p');
inner.style.width = "100%";
inner.style.height = "200px";
var outer = document.createElement('div');
outer.style.position = "absolute";
outer.style.top = "0px";
outer.style.left = "0px";
outer.style.visibility = "hidden";
outer.style.width = "200px";
outer.style.height = "150px";
outer.style.overflow = "hidden";
outer.appendChild(inner);
document.body.appendChild(outer);
var w1 = inner.offsetWidth;
outer.style.overflow = 'scroll';
var w2 = inner.offsetWidth;
if (w1 == w2) w2 = outer.clientWidth;
document.body.removeChild(outer);
return (w1 - w2);
};
function setMenuHeight() {
$('#sidebar .highlightable').height($('#sidebar').innerHeight() - $('#header-wrapper').height() - 40);
$('#sidebar .highlightable').perfectScrollbar('update');
}
function fallbackMessage(action) {
var actionMsg = '';
var actionKey = (action === 'cut' ? 'X' : 'C');
if (/iPhone|iPad/i.test(navigator.userAgent)) {
actionMsg = 'No support :(';
}
else if (/Mac/i.test(navigator.userAgent)) {
actionMsg = 'Press ⌘-' + actionKey + ' to ' + action;
}
else {
actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action;
}
return actionMsg;
}
// for the window resize
$(window).resize(function() {
setMenuHeight();
});
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
(function($, sr) {
var debounce = function(func, threshold, execAsap) {
var timeout;
return function debounced() {
var obj = this, args = arguments;
function delayed() {
if (!execAsap)
func.apply(obj, args);
timeout = null;
};
if (timeout)
clearTimeout(timeout);
else if (execAsap)
func.apply(obj, args);
timeout = setTimeout(delayed, threshold || 100);
};
}
// smartresize
jQuery.fn[sr] = function(fn) { return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery, 'smartresize');
jQuery(document).ready(function() {
jQuery('#sidebar .category-icon').on('click', function() {
$( this ).toggleClass("fa-angle-down fa-angle-right") ;
$( this ).parent().parent().children('ul').toggle() ;
return false;
});
var sidebarStatus = searchStatus = 'open';
$('#sidebar .highlightable').perfectScrollbar();
setMenuHeight();
jQuery('#overlay').on('click', function() {
jQuery(document.body).toggleClass('sidebar-hidden');
sidebarStatus = (jQuery(document.body).hasClass('sidebar-hidden') ? 'closed' : 'open');
return false;
});
jQuery('[data-sidebar-toggle]').on('click', function() {
jQuery(document.body).toggleClass('sidebar-hidden');
sidebarStatus = (jQuery(document.body).hasClass('sidebar-hidden') ? 'closed' : 'open');
return false;
});
jQuery('[data-clear-history-toggle]').on('click', function() {
sessionStorage.clear();
location.reload();
return false;
});
jQuery('[data-search-toggle]').on('click', function() {
if (sidebarStatus == 'closed') {
jQuery('[data-sidebar-toggle]').trigger('click');
jQuery(document.body).removeClass('searchbox-hidden');
searchStatus = 'open';
return false;
}
jQuery(document.body).toggleClass('searchbox-hidden');
searchStatus = (jQuery(document.body).hasClass('searchbox-hidden') ? 'closed' : 'open');
return false;
});
var ajax;
jQuery('[data-search-input]').on('input', function() {
var input = jQuery(this),
value = input.val(),
items = jQuery('[data-nav-id]');
items.removeClass('search-match');
if (!value.length) {
$('ul.topics').removeClass('searched');
items.css('display', 'block');
sessionStorage.removeItem('search-value');
$(".highlightable").unhighlight({ element: 'mark' })
return;
}
sessionStorage.setItem('search-value', value);
$(".highlightable").unhighlight({ element: 'mark' }).highlight(value, { element: 'mark' });
if (ajax && ajax.abort) ajax.abort();
jQuery('[data-search-clear]').on('click', function() {
jQuery('[data-search-input]').val('').trigger('input');
sessionStorage.removeItem('search-input');
$(".highlightable").unhighlight({ element: 'mark' })
});
});
$.expr[":"].contains = $.expr.createPseudo(function(arg) {
return function( elem ) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
};
});
if (sessionStorage.getItem('search-value')) {
var searchValue = sessionStorage.getItem('search-value')
$(document.body).removeClass('searchbox-hidden');
$('[data-search-input]').val(searchValue);
$('[data-search-input]').trigger('input');
var searchedElem = $('#body-inner').find(':contains(' + searchValue + ')').get(0);
if (searchedElem) {
searchedElem.scrollIntoView(true);
var scrolledY = window.scrollY;
if(scrolledY){
window.scroll(0, scrolledY - 125);
}
}
}
// clipboard
var clipInit = false;
$('code').each(function() {
var code = $(this),
text = code.text();
if (text.length > 5) {
if (!clipInit) {
var text, clip = new ClipboardJS('.copy-to-clipboard', {
text: function(trigger) {
text = $(trigger).prev('code').text();
return text.replace(/^\$\s/gm, '');
}
});
var inPre;
clip.on('success', function(e) {
e.clearSelection();
inPre = $(e.trigger).parent().prop('tagName') == 'PRE';
$(e.trigger).attr('aria-label', 'Copied to clipboard!').addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'));
});
clip.on('error', function(e) {
inPre = $(e.trigger).parent().prop('tagName') == 'PRE';
$(e.trigger).attr('aria-label', fallbackMessage(e.action)).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'));
$(document).one('copy', function(){
$(e.trigger).attr('aria-label', 'Copied to clipboard!').addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'));
});
});
clipInit = true;
}
code.after('<span class="copy-to-clipboard" title="Copy to clipboard" />');
code.next('.copy-to-clipboard').on('mouseleave', function() {
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-s tooltipped-w');
});
}
});
// allow keyboard control for prev/next links
jQuery(function() {
jQuery('.nav-prev').click(function(){
location.href = jQuery(this).attr('href');
});
jQuery('.nav-next').click(function() {
location.href = jQuery(this).attr('href');
});
});
jQuery('input, textarea').keydown(function (e) {
// left and right arrow keys
if (e.which == '37' || e.which == '39') {
e.stopPropagation();
}
});
jQuery(document).keydown(function(e) {
// prev links - left arrow key
if(e.which == '37') {
jQuery('.nav.nav-prev').click();
}
// next links - right arrow key
if(e.which == '39') {
jQuery('.nav.nav-next').click();
}
});
$('#top-bar a:not(:has(img)):not(.btn)').addClass('highlight');
$('#body-inner a:not(:has(img)):not(.btn):not(a[rel="footnote"])').addClass('highlight');
var touchsupport = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
if (!touchsupport){ // browser doesn't support touch
$('#toc-menu').hover(function() {
$('.progress').stop(true, false, true).fadeToggle(100);
});
$('.progress').hover(function() {
$('.progress').stop(true, false, true).fadeToggle(100);
});
}
if (touchsupport){ // browser does support touch
$('#toc-menu').click(function() {
$('.progress').stop(true, false, true).fadeToggle(100);
});
$('.progress').click(function() {
$('.progress').stop(true, false, true).fadeToggle(100);
});
}
/**
* Fix anchor scrolling that hides behind top nav bar
* Courtesy of https://stackoverflow.com/a/13067009/28106
*
* We could use pure css for this if only heading anchors were
* involved, but this works for any anchor, including footnotes
**/
(function (document, history, location) {
var HISTORY_SUPPORT = !!(history && history.pushState);
var anchorScrolls = {
ANCHOR_REGEX: /^#[^ ]+$/,
OFFSET_HEIGHT_PX: 50,
/**
* Establish events, and fix initial scroll position if a hash is provided.
*/
init: function () {
this.scrollToCurrent();
$(window).on('hashchange', $.proxy(this, 'scrollToCurrent'));
$('body').on('click', 'a', $.proxy(this, 'delegateAnchors'));
},
/**
* Return the offset amount to deduct from the normal scroll position.
* Modify as appropriate to allow for dynamic calculations
*/
getFixedOffset: function () {
return this.OFFSET_HEIGHT_PX;
},
/**
* If the provided href is an anchor which resolves to an element on the
* page, scroll to it.
* @param {String} href
* @return {Boolean} - Was the href an anchor.
*/
scrollIfAnchor: function (href, pushToHistory) {
var match, anchorOffset;
if (!this.ANCHOR_REGEX.test(href)) {
return false;
}
match = document.getElementById(href.slice(1));
if (match) {
anchorOffset = $(match).offset().top - this.getFixedOffset();
$('html, body').animate({ scrollTop: anchorOffset });
// Add the state to history as-per normal anchor links
if (HISTORY_SUPPORT && pushToHistory) {
history.pushState({}, document.title, location.pathname + href);
}
}
return !!match;
},
/**
* Attempt to scroll to the current location's hash.
*/
scrollToCurrent: function (e) {
if (this.scrollIfAnchor(window.location.hash) && e) {
e.preventDefault();
}
},
/**
* If the click event's target was an anchor, fix the scroll position.
*/
delegateAnchors: function (e) {
var elem = e.target;
if (this.scrollIfAnchor(elem.getAttribute('href'), true)) {
e.preventDefault();
}
}
};
$(document).ready($.proxy(anchorScrolls, 'init'));
})(window.document, window.history, window.location);
});
jQuery(window).on('load', function() {
// store this page in session
sessionStorage.setItem(jQuery('body').data('url'), 1);
// loop through the sessionStorage and see if something should be marked as visited
for (var url in sessionStorage) {
if (sessionStorage.getItem(url) == 1) jQuery('[data-nav-id="' + url + '"]').addClass('visited');
}
$(".highlightable").highlight(sessionStorage.getItem('search-value'), { element: 'mark' });
});
$(function() {
$('a[rel="lightbox"]').featherlight({
root: 'section#body'
});
});
jQuery.extend({
highlight: function(node, re, nodeName, className) {
if (node.nodeType === 3) {
var match = node.data.match(re);
if (match) {
var highlight = document.createElement(nodeName || 'span');
highlight.className = className || 'highlight';
var wordNode = node.splitText(match.index);
wordNode.splitText(match[0].length);
var wordClone = wordNode.cloneNode(true);
highlight.appendChild(wordClone);
wordNode.parentNode.replaceChild(highlight, wordNode);
return 1; //skip added node in parent
}
} else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children
!/(script|style)/i.test(node.tagName) && // ignore script and style nodes
!(node.tagName === nodeName.toUpperCase() && node.className === className)) { // skip if already highlighted
for (var i = 0; i < node.childNodes.length; i++) {
i += jQuery.highlight(node.childNodes[i], re, nodeName, className);
}
}
return 0;
}
});
jQuery.fn.unhighlight = function(options) {
var settings = {
className: 'highlight',
element: 'span'
};
jQuery.extend(settings, options);
return this.find(settings.element + "." + settings.className).each(function() {
var parent = this.parentNode;
parent.replaceChild(this.firstChild, this);
parent.normalize();
}).end();
};
jQuery.fn.highlight = function(words, options) {
var settings = {
className: 'highlight',
element: 'span',
caseSensitive: false,
wordsOnly: false
};
jQuery.extend(settings, options);
if (!words) { return; }
if (words.constructor === String) {
words = [words];
}
words = jQuery.grep(words, function(word, i) {
return word != '';
});
words = jQuery.map(words, function(word, i) {
return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
});
if (words.length == 0) { return this; }
;
var flag = settings.caseSensitive ? "" : "i";
var pattern = "(" + words.join("|") + ")";
if (settings.wordsOnly) {
pattern = "\\b" + pattern + "\\b";
}
var re = new RegExp(pattern, flag);
return this.each(function() {
jQuery.highlight(this, re, settings.element, settings.className);
});
};

View File

@ -0,0 +1,80 @@
/*
Put this file in /static/js/load-photoswipe.js
Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/
*/
/* Show an alert if this js file has been loaded twice */
if (window.loadphotoswipejs) {
window.alert("You've loaded load-photoswipe.js twice. See https://github.com/liwenyip/hugo-easy-gallery/issues/6")
}
var loadphotoswipejs = 1
/* TODO: Make the share function work */
$( document ).ready(function() {
/*
Initialise Photoswipe
*/
var items = []; // array of slide objects that will be passed to PhotoSwipe()
// for every figure element on the page:
$('figure').each( function() {
if ($(this).attr('class') == 'no-photoswipe') return true; // ignore any figures where class="no-photoswipe"
// get properties from child a/img/figcaption elements,
var $figure = $(this),
$a = $figure.find('a'),
$img = $figure.find('img'),
$src = $a.attr('href'),
$title = $img.attr('alt'),
$msrc = $img.attr('src');
// if data-size on <a> tag is set, read it and create an item
if ($a.data('size')) {
var $size = $a.data('size').split('x');
var item = {
src : $src,
w : $size[0],
h : $size[1],
title : $title,
msrc : $msrc
};
console.log("Using pre-defined dimensions for " + $src);
// if not, set temp default size then load the image to check actual size
} else {
var item = {
src : $src,
w : 800, // temp default size
h : 600, // temp default size
title : $title,
msrc : $msrc
};
console.log("Using default dimensions for " + $src);
// load the image to check its dimensions
// update the item as soon as w and h are known (check every 30ms)
var img = new Image();
img.src = $src;
var wait = setInterval(function() {
var w = img.naturalWidth,
h = img.naturalHeight;
if (w && h) {
clearInterval(wait);
item.w = w;
item.h = h;
console.log("Got actual dimensions for " + img.src);
}
}, 30);
}
// Save the index of this image then add it to the array
var index = items.length;
items.push(item);
// Event handler for click on a figure
$figure.on('click', function(event) {
event.preventDefault(); // prevent the normal behaviour i.e. load the <a> hyperlink
// Get the PSWP element and initialise it with the desired options
var $pswp = $('.pswp')[0];
var options = {
index: index,
bgOpacity: 0.8,
showHideOpacity: true
}
new PhotoSwipe($pswp, PhotoSwipeUI_Default, items, options).init();
});
});
});

6
publish/js/lunr.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More