Adding description for datasource state [develop Scada-LTS]

in #utopian-io6 years ago (edited)

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:

  1. MigrationOrErrorSerializeChangeEnableState
    (In the new version of program, the datasource definition has been changed, resulting in on/off change of the datasource).
  2. ScryptChangeEnableStateDs
    (that datasource is turned off/on from script)
  3. StopChangeEnableStateDs
    (that datasource is stopped or it will be sleeping in future when the remote server is not available)
  4. UserChangeEnableStateDs
    (that datasource is changed by the user)
  5. UserCpChangeEnableStateDs
    (that datasource is changed by the user when a datasosurce copy has been made)
  6. 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.

1-test.png
2-test_start.png

As seen, the user has changed the on/off status of datasource

I imported datasource

3.png

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

Pull request:

https://github.com/SCADA-LTS/Scada-LTS/pull/722

Sort:  

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) :

You received more than 500 upvotes. Your next target is to reach 1000 upvotes.

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:

Trick or Treat - Publish your scariest halloween story and win a new badge
SteemitBoard notifications improved

Support SteemitBoard's project! Vote for its witness and get one more award!

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

Congratulations @grzesiekb! You received a personal award!

1 Year on Steemit

Click here to view your Board of Honor

Support SteemitBoard's project! Vote for its witness and get one more award!

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

Coin Marketplace

STEEM 0.30
TRX 0.32
JST 0.050
BTC 100017.31
ETH 3988.05
SBD 4.07