Mass assignment of Entity Domains

It’s complete. Well, half of it, anyway. And it does not seem that I’ll be able to finish it.

Is it true that IDBColumn does not have its setDomain method exposed and therefore the only way to assign a Column Domain to a Column is going through the Column Specification dialog and set its Domain from the dropdown menu there?

Hi Mihály,

You are right. IDBColumn currently does no have setDomain() method. We will add it and I will let you know once it is ready. Thank you.

Best Regards,

Antony.

That’s great, it will make mass changes of Entity and Column Domains within Visual Paradigm possible, thank you very much!

However, applying Column Domains will still be pretty limited, as I can only select columns from a single Entity at a time. I know that exporting to and importing from an XLS does not work currently for Column and Entity Domains. I guess a plugin could be developed to export that as well (with the import part not working for Colums due to reasons above) but that’s way beyond my ability (and available timeframe) to code it.

May I ask you to check if exporting/importing those two extra XLS column would be easily achievable using the built-in export/import without using a plugin, please?

Hi Mihály,

Your request for the import/export of Excel is valid, however I think to solve your problem, you simply need to develop a custom UI for selecting columns instead of relying on selection in the diagram. It would most likely be a tree, which 1st level showing all tables in the project, and columns of each table when its node is expanded. It would require a little more code and it is not that easy if you are not familiar with Java Swing. But don’t worry, I will give you sample code to demonstrate how it can be done. Please be patient.

Best Regards,

Antony.

I would like to let you know our engineers had deployed a new build which now support set domain for column. Please update the software to latest patch build (20200330bn or later) to get this enhancement. Details about update to latest patch can be found at

  • Please make sure you have pressed the “Update to latest patch” button on the left hand side of the dialog right after launching the update program

Feel free to contact me if you require any further information.

If you’re talking about applying Domains to the Columns in VP without having to export to Excel, make changes and then re-import from Excel, that’s a much better idea, if possible, yes.

The reason I was asking for the Excel solution is that I can filter on Columns regardless of which Entity they are part of. It’s exactly that hierarchy (or tree structure) of having to select the Columns after selecting/expanding an Entity that I want to leave out of the process. What I need is to be able to apply the Domain to Columns based more on their name than their parent Entity. For example, each Column (or preferably the selected ones) named description should be of the description_short domain, each Column named description_long should be of the description_long domain, etc.

I’d like to create a dialog that shows a tree, with 1st level being the available Column Domains and the 2nd Level being the Columns themselves (with their parent Entity as a comment, maybe) having that Domain set to them (and obviously, the <unspecified> for those having none set). I’d also try to put on a dropdown list of the available Column Domains so that the selected one could be quickly applied to the checked Columns with a click of a button. Do you think that to be achievable with my limited (or rather nonexistent) knowledge of Java?

Meanwhile, I’ll update to the latest patch build Rain mentioned and start using the plugin you provided (and I butchered it to work with Column Domain instead of Entity Domains) because even in its current restricted form it is still much faster than walking through the Specification dialog for each Column.

As always, Antony and Rain, your help is much appreciated, thank you very much!

I modified the original code provided by Antony.

plugin.xml (1.3 KB)
DomainPlugin.java (266 Bytes)
TableDomainActionControl.java (4.1 KB)
ColumnDomainActionControl.java (4.2 KB)

It keeps working properly for Entities (Tables) so I probably didn’t ruin it completely.

It doesn’t throw an error at line 45 containing columnModel.setDomain(selectedColumnDomain);
when compiling ColumnDomainActionControl.java, so it definitely supports setDomain for Columns.

When invoking the plugin for the selected Column(s) it collects and displays the list of Column Domain (though I’ll have to add some filter so that it only collects the standalone ones). It also doesn’t throw an error when calling columnModel.setDomain(selectedColumnDomain); (line 45) after selecting the wanted Column Domain.

However, the view on the Diagram doesn’t change and after checking Column Specification I can see that the Domain is not modified either. What am I doing wrong?

Hi Mihály,

Your required UI needs an intermediate level of Java UI building knowledge, I will see if I can provide a minimal working plugin for you so you can follow up with. And we will check the column domain set but not working issue for you.

Best Regards,

Antony.

(reposted reply since the original one is lost during hardware failure)

Hi Mihály,

I have checked with ColumnDomainActionControl.java, and find that it simply replace table with column. Unfortunately the handling of table and column is quite different in VP:

  • Column is not a normal shape as table (or e.g. use case, class etc). So you cannot get selected column like you would do with normal shapes. We would refer column (or attribute/operation for class) as a compartment member in diagram level.

  • And in model element level, a column is considered as “composite”, thus you cannot retrieve columns directly, but indirectly via their parents (i.e. table), as you will see in my attached version of ColumnDomainActionControl.java.

I have implemented a minimal working plugin according to your requirements, it is not as easy as the table domain one, but hopefully you can understand it better by modify it and re-run the code yourself to see how it works, and customize it if you like. Please feel free to ask if you have any questions.

ColumnDomainActionControl.java (12.3 KB)

Best Regards,

Antony.

Hi Antony,

Thanks, that helped a lot. I modified it a bit and managed to add a Label and an Entry field to it (though I’m still trying to find out how to make them next to each other instead of below each other).

Can you give me some hints on how to make it actually filter the Tree? I guess I should inject it somewhere into addChildrenToColumnDomainAndColumnsTreeRootNode but I’m not really sure.

I’ve also noticed that when I apply the chosen Domain to the selected Columns there’s a very bad side-effect: it changes the Column Domain and the name of the Column at the same time. Changing the latter is definitely not wanted but I couldn’t yet figure out when, where, and why that happens.

Hi Mihály,

Column name changed when apply domain should be bug, we will check and fix this problem.

And what do you mean by filter the tree? Like only show column domains whose names match the filter text?

Best Regards,

Antony.

Hi Antony,

Thank you very much!

As for the filter, the Column Domains are already displayed as expandable/collapsible containers in the tree (provided there are any Columns that use them). No, what I meant was to filter the Columns.

Take a look at the attached screenshot. It shows that I have tons of columns without any Column Domains assigned to them. I could, for example, filter those Columns based on their name (amount). Or even on their table if I would like to see all the Columns in table call being without Column Domains (but filtering on Columns is more important). And then I could select all those amount columns and assign them to the my_amount_domain Column Domain.

amount might be a bad example, as I only have 4 of those unspecified. But there are 500+ columns called short_name, name, description, value, etc. Being able to assign that ~20 domains in ~20 steps is much faster, easier and much less error-prone than having to search for each of the Columns and editing them separately in their respective Table+Column Specifications dialogs.

Hi Mihály,

The column name followed domain when apply issue has been fixed, we will notify you once the patch is ready.

Regarding the filter, can you reference my attached Java file to see if that is what you want?

ColumnDomainActionControl.java (13.7 KB)

Best Regards,

Antony.

1 Like

I would like to let you know the apply column domain wrongly changed column name problem has been fixed and please update the software to latest patch build (20200430au or later) to get the problem fixed. Details about update to latest patch can be found at

  • Please make sure you have pressed the “Update to latest patch” button on the left hand side of the dialog right after launching the update program

Feel free to contact me if you require any further information.

1 Like

Hi Antony,

Yes, that’s sort of it. I replaced

eachColumn.getNickname().toLowerCase().startsWith(filterText)

on line 374 with

eachColumn.getNickname().toLowerCase().contains(filterText)

It still does not filter on Entities, but that’s really not that important. For Columns it works exactly as I imagined. Thank you very much! :bowing_man:

The bugfix for renaming Column names to Column Domain name also works, thanks again!

Hi Mihály,

My plugin is just as an example to give you an idea about how to apply filter to the tree, you may add another field just for table if you want. Or you can be creative by assuming a filter pattern like table_filter.column_filter that delimits the filter of table and column with a dot (or a white space etc), then you can parse the filter when constructing the tree without the need to use a separate filter field.

Hope this helps,

Antony.

Hi Antony,

Yes, it helps tremendously. I will eventually try to add an Entity filter for that one but it is not my priority currently, I’m content the way it is now as it enables me to modify the data model much faster.

I also intend trying to transform the Entity Domain plugin so that it works the same/similar way, using a filter and a tree instead of having to select Entities from the diagram.

After the last patch I used the plugin to assign an Entity Domain to some Entities and something seems to be broken. As much as the Column Domain plugin was eager to rename the Column it assign the Column Domain to, the Entity Domain plugin has become lazy in the same topic.

Using the Entity Specification dialog to assign an Entity Domain to the Entity will add the necessary Columns to the target Entity. The Columns are named as they were in the Entity Domain. I recorded a short video you can watch here. The copy (Entity42) of the Entity4 is assigned an Entity Domain the traditional way and it got its new Columns with their dedicated Column Domains and names. Then I used the plugin to do the same to Entity4. It also got its Entity Domain set and the new Columns added, however, those Columns were not renamed as they were supposed to.

Is that something I might have ruined in the plugin (and can possibly fix) or is it a bug in VP?

Hi Mihály,

No you did not ruin the plugin, it is our mistake made when fixing the too eager to rename column issue. It has just been fixed and we will notify you once the patch is ready. We are so sorry for the inconvenience that it caused you.

Antony.

1 Like

Hi Mihály,

The issue was fixed and please update your software to latest patch build 20200430ba to get this problem fixed. Feel free to contact me for any help and wish you have a good day!

Best regards,
Rain Wong

1 Like