Mass assignment of Entity Domains

Is there a faster method of setting the Entity Domain of an Entity? By faster I mean faster than opening the Entity Specification dialog for each Entity, go to General tab and click±select the Domain combo-box.

We are sorry that mass assignment of entity domain is not yet support.
It will be support in future release.
We will notify you when it is supported.

Thank you very much for your response. Is there a public roadmap of planned features available?

What you could do is to set up a “master entity” and then copying that as a new model element instead of creating new views. This would create a new entity with the same domain as you configured earlier so you wouldn’t have to edit this particular setting. Obviously the same applies to every other setting to made.

By default Visual Paradigm will create a new view if you use a copy/paste method. So you’d end up with a new “virtual copy” (an auxiliary view) of the same entity. However, if you right click on the canvas and then use “Paste Model Element” you’ll create a whole new (and separate!) model element, yet based on what you copied.

It has its limitations of course but I could well image that this could be faster than having to manually set everything yourself. Maybe food for thought?

Hope this can help!

Yes, that would do if I were creating new entities. Using the Duplicate hotkey (Ctrl+E by default if I recall correctly) would also work and it’s marginally faster if the destination is the same diagram. But, Entity Domains can work just like that: they can function as “master entity templates” you can edit further after making a separate copy of them, eg. by drag-n-dropping them from Model Explorer > Database Domains > Entity Domains. That creates a new Entity with all the pre-set properties of the Entity Domain, without the unwanted side-effect of a “master entity” (namely that if it’s in a Physical Model, it will be generated as a table).

However, I’m not creating new Entities. I’m transiting them from a Logical Model to a Physical Model and there are some extra Columns and Constraints that are not common in all Physical Models the Logical Models are transited into. Setting the Domain of the Entity does the job perfectly and is exactly what I need. I just need it a bit faster :wink:

I’m thinking about setting up some macros to hasten things up a little bit. Hmm :thinking: Does VP have built-in macro handling or do I have to look for some 3rd party solution?

Now I fully understand what you’re trying to do here. There might be way to automate this and thus making things faster but from a first glimpse I think it could get a little tricky to set up.

VP has no support for macro’s (keyboard recording) but it does provide something a bit more extensive to customize its behavior: plugins. It provides the so called OpenAPI which allows you to write plugins using Java which can then be used to automate tasks within the system.

It is a very powerful way of working but can also be hard to get started with, also because the Plugin API isn’t fully documented. You can still learn a lot from the Javadoc, but sometimes you will run into oddities because not everything is commented / documented. (the classic ‘everything is easy once you know how it works’ :smile:).

I already identified the IERDiagramUIModel which I believe to to be an ERD diagram, I also discovered models such as the IDBTable which I believe to be related but I’m completely unsure at this time.

Anyway, if you wish to rely on “VP solutions” then this is probably your best option. You can find a good overview of documentation (including the OpenAPI) here. If you’re going to look into this deeper then definitely check out VP’s Know How website; this is a must read (and follow) if you’re interested in working with the OpenAPI. Their examples are outstanding and really have taught me a lot about plugin programming.

Maybe food for thought?

… reminds me of a small debug project I had planned. Won’t be of any direct help here, but if I do manage to finish that in a short time I’ll post here as well, because it should definitely help identify those weird models and shapes in a diagram :wink:

Well, this sounds interesting. And though it’s definitely not my intention, I can see myself eventually end up trying to beat that OpenAPI into submission. My only problem is that I’ve “evolved” from being a programmer quite a long time ago :stuck_out_tongue:

I haven’t done anything Java in the last 15 years or so :worried:

Anyway, thanks for the hints!

Okay, this is pretty much entirely out of my reach :worried: I know what I want and I have a vague conjecture what to do to get it. I’ve got absolutely no idea how to do it, though. The help only has tree and index which might be of a help if one knows what one’s looking for, but it does not have search and I’m completely in the darkness.

I want to speed up the process of modifying Entity Domain setting for ERD Entities. The best(?)/fastest way of doing that is adding a submenu to the context menu of Entity, which contains the possible Entity Domains, something similar how stereotypes are added.

Hmm :thinking: Is that even possible using OpenAPI? I mean adding a submenu to the context menu and loading it on the fly with items that can be checked.

For now, let’s suppose it is. I guess I’d need to create a plugin that has a class which implements com.vp.plugin.action.VPContextActionController.

I still don’t know tons of things:

  • where to look for the list of Domain Entities
  • how to fetch them
  • how to force them into a submenu (I guess this will have to something with the update method of VPContextActionController but not very sure about it)
  • how to make the context menu only show for Entity type diagram objects (perhaps <contextTypes all="false"> but <include type="what_goes_here?">)
  • how to get the Entity currently selected
  • and how to set its Entity Domain property to the chosen one

ShelLuser, would you mind wasting some more of your time to help me out here?

Hi Mihály,

I’m not so familiar with open API, but I tried to see how to achieve what you want.

Yes, ShelLuser is right that in open API an Entity is represented by an IDBTable. But I do a quick test using code completion in Java IDE, and I find that IDBTable hasn’t exposed the set/get of domain. If this is true that we need to update open API to expose those methods first. Anyway I’ll need to confirmed this with my colleagues, let me get back to you when there is any news, thanks.

Best Regards,

Antony.

1 Like

Hi Antony,

Thank you very much, I’m eagerly awaiting!

Best regards
Misi

Yeah, agreed with your ideas but I don’t really see it happening this way with OpenAPI because although you can control a lot it does have its limitations. However, there should be other possibilities. Now, keep in mind that I’m now theorizing based on the concept of actually having this kind of access (I also read Antony’s post :wink: )…

But I could imagine a menu option “Update ERD domain”. If you click it and you haven’t specified the domain to set then a dialog would open which allows you to select the domain you wish to set. But if you click it whilst having a model element selected it would then change the domain for that selected model element. Or multiple of course.

That should be doable. Obviously there will be some caveats to work out, like the ability to change the selected domain at a later time, but that’s for later.

In the mean time I re-configured / updated VP for NetBeans usage, so I can once again work on a project and a project design simultaneously, that should help. I’m going to think about the design a bit and set up a basic foundation for this plugin.

Reminds me of a tutorial I never really finished, I’ll see if I can pick that up again soonish.

Not at all, could be fun.

First I’m going to get my last project sorted out (at least into a usable “beta stage”); an API explorer. I have some ideas, but the main function right now is to iterate over all the model elements in the currently active diagram and then mention their classes and other information which can be easily collected. That should help identify a few things.

(edit) One important detail though: There’s currently a heatwave raging in the Netherlands and that is having its effects on me, I hardly spend as much time behind my PC as I normally do. Even so, I am slowly making some progress.

1 Like

Thank you very much! Though I’m afraid I might never bring this to the :end: I’m getting old and my programming skills are failing :slight_smile:

Regarding this exact issue, I’d suggest not spending more time trying to solving it. Roy Keung also said that this will be supported in the (hopefully not so distant) future.

If there was everything ready to implement a quick solution I’d consider pursuing this matter further, but

tells me that the requirements for making it possible are probably not met yet anyway.

I’m always eager to learn something new but I wouldn’t want to waste valuable resources (in this case that would be your time) without any signs of a significant possible gain. Unless, of course, you would make this use case a subject of another tutorial waiting to be finished :wink:

Hi Misi,

I would like to let you know our engineers had deployed a new build which now exposed the get/set method for domain on entity. Please update the software to latest patch build (20180720bc 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.

Best regards,
Rain Wong

2 Likes

Sorry, I’ve briefly tested the setDomain() method and found that it isn’t fully working. I’ll forward to our engineers to follow up and release a newer patch later. Thank you.

2 Likes

Thanks. I’m still struggling with designing the best way to utilize that method.

Has there been any progress on this matter?

Hi Mihály,

Sorry, I have checked and find the fix is already available. I have written a sample plugin to show how to apply domain to multiple selected entities in diagram. Please reference the attached plugin files and see if you understand the code. Feel free to ask me if you have further questions.

plugin.xml (858 Bytes)
ERDDomainPlugin.java (277 Bytes)
ERDDomainActionControl.java (4.2 KB)

Best Regards,

Antony.

Hi Antony,

I cannot get it to work. I compiled and then installed the plugin without any problems, but when I tried it, it did not work. It added a menu item to the context menu of the entities in the Model Explorer but when I select it nothing happens, it only adds an error message to the vp.log:

[2020/03/31 00:26:54] [message] Opening Project: D:\Work\Projects\OKK\hkir-kar-data-modell-vpp-rebuild\Data Model\VPP\HKIR DB Library.vpp
[2020/03/31 00:26:55] [message] Open Project “D:\Work\Projects\OKK\hkir-kar-data-modell-vpp-rebuild\Data Model\VPP\HKIR DB Library.vpp”, Time Used: 1 seconds, Memory: 256.0 MB (268435456), Project File Size: 9.44 MB (9897984), Diagram Count: 70
[2020/03/31 00:27:48] [message] Saved project “.systemproject” to “D:\Work\VP_WS_HKIR.vpprefdata.systemproject.vpp”.
[2020/03/31 00:27:56] [message] [Tue Mar 31 00:27:56 CEST 2020]: Start Visual Paradigm Professional [VP PE]: 16.1 (20200301)
[2020/03/31 00:27:56] [message] Operating system: Windows 10 10.0 running on amd64
[2020/03/31 00:27:56] [message] Java VM: 11.0.2 Java HotSpot™ 64-Bit Server VM, vendor 11.0.2+9-LTS Oracle Corporation
[2020/03/31 00:27:56] [message] User: gemis, language: en
[2020/03/31 00:27:56] [message] Installation ID: c305ab70dcb748cf3a29d35335a3dc58
[2020/03/31 00:27:56] [message] Memory: current=256M, max=4096M
[2020/03/31 00:27:58] [message] start startup getLicenseKey on 31-Mar-2020
[2020/03/31 00:27:58] [message] getLicenseKey in local …
[2020/03/31 00:27:58] [message] finish startup getLicenseKey
[2020/03/31 00:34:46] [message] Workspace: D:\Work\VP_WS_HKIR
[2020/03/31 00:34:49] [message] Opening Project: D:\Work\VP_WS_HKIR.vpprefdata.systemproject.vpp
[2020/03/31 00:34:58] [message] Opening Project: D:\Work\Projects\OKK\hkir-kar-data-modell-vpp-rebuild\Data Model\VPP\HKIR DB Library.vpp
[2020/03/31 00:35:02] [message] Open Project “D:\Work\Projects\OKK\hkir-kar-data-modell-vpp-rebuild\Data Model\VPP\HKIR DB Library.vpp”, Time Used: 4 seconds, Memory: 256.0 MB (268435456), Project File Size: 9.44 MB (9897984), Diagram Count: 70
[2020/03/31 00:35:02] [message] InteropFactory: cannot load com.sun.javafx.embed.swing.newimpl.InteropFactoryN

this line is added to the log immediately after I select the context item

[2020/03/31 00:38:37] [message] Exception in thread “AWT-EventQueue-0”
[2020/03/31 00:38:37] [message] java.lang.NullPointerException
[2020/03/31 00:38:37] [message] at com.vp.plugin.sample.erddomain.actions.ERDDomainActionControl.performAction(Unknown Source)
[2020/03/31 00:38:37] [message] at v.bdz.c.performAction(:56)
[2020/03/31 00:38:37] [message] at v.beh.o.actionPerformed(:31)
[2020/03/31 00:38:37] [message] at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
[2020/03/31 00:38:37] [message] at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
[2020/03/31 00:38:37] [message] at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
[2020/03/31 00:38:37] [message] at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
[2020/03/31 00:38:37] [message] at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
[2020/03/31 00:38:37] [message] at com.jidesoft.plaf.vsnet.VsnetMenuItemUI.doClick(Unknown Source)
[2020/03/31 00:38:37] [message] at com.jidesoft.plaf.vsnet.VsnetMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.Component.processMouseEvent(Component.java:6632)
[2020/03/31 00:38:37] [message] at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.Component.processEvent(Component.java:6397)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.Container.processEvent(Container.java:2263)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
[2020/03/31 00:38:37] [message] at java.base/java.security.AccessController.doPrivileged(Native Method)
[2020/03/31 00:38:37] [message] at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
[2020/03/31 00:38:37] [message] at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
[2020/03/31 00:38:37] [message] at java.base/java.security.AccessController.doPrivileged(Native Method)
[2020/03/31 00:38:37] [message] at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[2020/03/31 00:38:37] [message] at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Hi Mihály,

Sorry, my example is meant to work on view of entities only, that means you must show them on a diagram and then select domain from the popup menu of the visualized entities. I have asked our engineers and they said currently there is no way to get selected model elements from the Model Explorer using open API, so please work on the diagram level in the mean time.

Best Regards,

Antony.

1 Like

It works now, thank you very much!

I grasp most(ish) of the code provided, though not enough to make adjustments to it. Thankfully, that’s not necessary, I can use this now. I’ll study it later if need arises. Thanks again!

EDIT: I’ll try to extend it to work with column domains. I might ask for some help later…

1 Like