Remove extraction of sub-objects in activities requirements
Description
An activity can take data as input. To pass them to the activity itself, the syntax uses the deprecated object reflection mechanism based on camp. This allows to extract sub-objects but also exposes the initial container of the ActivitySeries
; this is very cumbersome for normal people to understand why this syntax always starts with "@values".
Here is an example:
<extension implements="sight::activity::extension::Activity">
<id>TestBuilder0</id>
<title>Title Test0</title>
<desc>Desc Test0</desc>
<icon>Icon Test0</icon>
<requirements>
<requirement name="imageSeries" type="sight::data::ImageSeries" minOccurs="1" maxOccurs="1" />
<requirement name="modelSeries" type="sight::data::ModelSeries" minOccurs="0" maxOccurs="2" >
<key>key1</key>
<key>key2</key>
</requirement>
</requirements>
<builder>::activity::builder::ActivitySeries</builder>
<appConfig id="TestBuilderCfg0">
<parameters>
<parameter replace="RefModel" by="@values.modelSeries" />
<parameter replace="RefImage" by="@values.imageSeries.value.image" />
</parameters>
</appConfig>
</extension>
Analysis of current implementation
Activity requirements parsing
graph TD
A[sight::core::runtime::detail::profile::Profile] -->|"Profile::setup()"| B(sight::core::runtime::detail::profile::Initializer)
B -->|"Initializer::apply()"| C(sight::core::runtime::detail::profile::Module)
C -->|"Module::initialize()"| D(sight::module::appXml::appXml::Plugin)
D -->|"Plugin::initialize()"| E(sight::service::AppConfigManager)
E -->|"AppConfigManager::startModule()"| F(sight::core::runtime::detail::Module)
F -->|"Module::startPlugin()"| G(sight::module::activity::Plugin)
G -->|"Plugin::start()"| H(sight::activity::extension::Activity)
H -->|"Activity::parseBundleInformation()"| I{sight::activity::extension::Activity::ActivityInfo}
AppConfig parameters parsing
graph TD
A[sight::service::SConfigController] -->|"SConfigController::starting()"| B(sight::service::helper::ConfigLauncher)
B -->|"ConfigLauncher::startConfig()"| C(sight::service::AppConfigManager)
C -->|"AppConfigManager::createService()"| D(sight::service::IService)
D -->|"IService::configure()"| E(sight::module::ui::qt::activity::SView)
E -->|"SView::configuring()"| F(sight::ui::base::view::IActivityView)
F -->|"IActivityView::configuring()"| G{sight::activity::IActivityLauncher}
G -->|"IActivityLauncher::parseConfiguration()"| G
AppConfig parameters translating
graph TD
A[sight::module::ui::qt::activity::SView] -->|"SView::launchActivity()"| B{sight::activity::IActivityLauncher}
A -->|"SView::launchActivity()"| E{sight::service::IAppConfigManager}
E -->|"IAppConfigManager::setConfig"| E
AA[sight::module::ui::qml::activity::SView] -->|"SView::launchActivity()"| B{sight::activity::IActivityLauncher}
AAA[sight::module::ui::qt::activity::SDynamicView] -->|"SDynamicView::createViewInfo()"| B{sight::activity::IActivityLauncher}
AAA -->|"SDynamicView::launchTab()"| E
AAAA{sight::module::ui::qt::activity::SLauncher} -->|"SLauncher::launchActivitySeries"| C(sight::data::reflection)
AAAA -->|"SLauncher::launchActivitySeries"| D(sight::core::tools::fwID)
AAAA -->|"SLauncher::launchSeries"| C
AAAA -->|"SLauncher::launchSeries"| D
AAAA -->|"SLauncher::buildActivity()"| E
B -->|"IActivityLauncher::translateParameters()"| C
C -->|"reflection::getObject()"| AAAA
C -->|"reflection::getObject()"| B
B -->|"IActivityLauncher::translateParameters()"| D
D -->|"fwID::getID()"| AAAA
D -->|"fwID::getID()"| B
Proposal
- Only use the keys declared in the
<requirements/>
section in the replacement syntax. - If any extraction must be done, do that in the activity itself with the new extraction services.
- Possibly, remove the replacement section, and use the requirement name as a parameter name of the appConfig.
- Update the documentation
Outcomes
- KISS
💋
Links / references
https://sight.pages.ircad.fr/sight-doc/SAD/src/Activities.html?highlight=activity