Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
applications:user:dynamic_objects [2019/12/20 15:18] admin |
applications:user:dynamic_objects [2019/12/20 15:22] admin |
||
---|---|---|---|
Line 2: | Line 2: | ||
~~Title: Using dynamic/user objects~~ | ~~Title: Using dynamic/user objects~~ | ||
- | As dynamic object we think of a dynamic created object which is available in the application without changing the application. Sometimes, it's useful to "inject" objects into your application and use such objects in your business logic. This use-case is already supported via [[jvx:server:lco:inject_objects|]]. The missing part is that it's not automatically possible to access such objects in your application. Sure, if you put an action in your LCO and a simple remote call in your custom application, it'll be easy. But it's not guaranteed that you have a custom application. It's some work to extend the standard ProjX application. So this is not a thing for one minute. | + | As dynamic object we think of a dynamic created object which is available in the application without changing the application. Sometimes, it's useful to "inject" objects into your application and use such objects in your business logic. This use-case is already supported via [[jvx:server:lco:inject_objects|]]. The missing part is that it's not automatically possible to access such objects in your application. Sure, if you put an [[jvx:server:lco:actions|action]] in your LCO and a [[jvx:communication:calling_server_action|simple remote call]] in your [[vaadin:customize_application|custom application]], it'll be easy. But it's not guaranteed that you have a custom application. It's some work to extend the standard ProjX application. So this is not a thing for one minute. |
- | To support this use-case we have dynamic objects, available via standard ProjX API. And here is the API: | + | To support this use-case we have dynamic objects, available via standard ProjX API. And here is it: |
<file java> | <file java> | ||
Line 40: | Line 40: | ||
This object must be [[jvx:server:lco:inject_objects|injected]] in your Session LCO e.g. via ServiceLoader. If it's injected, the API call | This object must be [[jvx:server:lco:inject_objects|injected]] in your Session LCO e.g. via ServiceLoader. If it's injected, the API call | ||
- | <file> | + | <file java> |
((ProjX)getApplication()).getDynamicContent("userDetails"); | ((ProjX)getApplication()).getDynamicContent("userDetails"); | ||
</file> | </file> | ||
Line 46: | Line 46: | ||
will return the Bean instance of your DynamicUserContent. | will return the Bean instance of your DynamicUserContent. | ||
- | So, it's super easy to inject objects and make it accessible in your application without changing your application code. | + | So, it's super easy to inject an object and make it accessible in your application without changing your application code. |