https://github.com/SCADA-LTS/Scada-LTS
[New Features] Adding description for datasource state
- Adding new datasource state and describing why it is disabled or enabled.
Issue: 718
We need this functionality because the datasource can be disabled not only by the user but also by other situations in the application:
- Disable or enable datasource.
- Import datasource.
- In script run functions: “enableDataSource(xid_ds)” “disableDataSource(xid_ds)”.
- Copy datasource.
- From API (wsdl not tested).
- When the datasource migrates.
Describe code:
Now, state pattern describe only a state of datasources but in future it will be used for other things. for eg. when HttpRetriver is disable (with stop option), the program will create a scheduler which tries to enable HttpRetriver.
We have six classes which set the status:
- MigrationOrErrorSerializeChangeEnableState
(In the new version of program, the datasource definition has been changed, resulting in on/off change of the datasource). - ScryptChangeEnableStateDs
(that datasource is turned off/on from script) - StopChangeEnableStateDs
(that datasource is stopped or it will be sleeping in future when the remote server is not available) - UserChangeEnableStateDs
(that datasource is changed by the user) - UserCpChangeEnableStateDs
(that datasource is changed by the user when a datasosurce copy has been made) - ApiChangeEnableStateDs
(that datasource is changed from API WDSL)
In order to skip using “SeroUtils.jar” library for newly created code, I created class ConfigLocalization.java.
It works as follow:
The description below will also demonstrate (test) if the task works as intended.
I created and enabled new datasource.
As seen, the user has changed the on/off status of datasource
I imported datasource
my github acount: https://github.com/grzesiekb
Changes will been introduced to the released version 0.0.9.8
https://github.com/SCADA-LTS/Scada-LTS/releases
Thank you for your contribution. A nice update to the project. Is there a possibility of optimizing the code from line, like most of the lines for, ver == 1 and ver == 2 are same so if you can create a function having common lines and call for both if and else if?
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
This is not my code "ver == 1" and "ver == 2". I do not use magic numbers in the code.
In my opinion instead of optimizing, this should be rewritten because such versioning of serialized objects doesn't make sense.
Thank you for your review, @codingdefined! Keep up the good work!
Congratulations @grzesiekb! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word
STOP
Do not miss the last post from @steemitboard:
Hi @grzesiekb!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server
hi @grzesiekb
just bumped into your profile. did you abandon Steemit already?
yours
Piotr
Recently, I have a lot of work :)
Rozumiem @grzesiekb
Congratulations @grzesiekb! You received a personal award!
Click here to view your Board of Honor
Hello @grzesiekb! This is a friendly reminder that a Partiko user has just followed you! Congratulations!
To get realtime push notification on your phone about new followers in the future, download and login Partiko using the link below. You will also get 3000 Partiko Points for free, and Partiko Points can be converted into Steem token!
https://partiko.app/referral/partiko
Hello @grzesiekb! This is a friendly reminder that a Partiko user has just followed you! Congratulations!
To get realtime push notification on your phone about new followers in the future, download and login Partiko using the link below. You will also get 3000 Partiko Points for free, and Partiko Points can be converted into Steem token!
https://partiko.app/referral/partiko