Author Topic: ShapeScript for BPMN2.0::Activity?  (Read 11686 times)

Mr Stuff

  • EA User
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
ShapeScript for BPMN2.0::Activity?
« on: July 17, 2017, 10:40:34 pm »
EA V13, W7 64-bit

IIRC adding a FQ stereotype to the UML Types list does not create/match a proper FQ stereotype (it doesn't parse it properly, so a new monolithic only apparently FQ stereotype is created)

Q1: How then can I write a shapescript that will apply only to BPMN2.0 activities?

In UML types, referencing "Activity" as a stereotype, which a BPMN2.0 activity also has, the appearance is unaffected by a shapescript - I assume because the BPMN2.0::Activity stereotype is being trapped and another shapescript is overriding. (If and only if I remove the BPMN2.0 FQ stereotype does the shapescript take effect... but then the TaggedValue I want to display is thrown away silently and without warning. There also doesn't seem to be any way of restoring a BPMN2.0::Activity stereotype through the UI)

Q2: See Q1.

What I want to do: add a new compartment to display a custom TaggedValue value (text) (probably using the shapescripts Geert exported to GitHub as the basis)

What do the great and the good suggest?

Thanks!

Julian

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #1 on: July 18, 2017, 07:24:46 am »
You can simply modify the existing shape script in the MDG which is stored in EA's program folder under MDG Technologies. It's base64 encoded and zipped. You can de-/encode easily with Notepad++.

q.

Mr Stuff

  • EA User
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #2 on: July 18, 2017, 05:24:22 pm »
@qwerty... Thanks for the input, reply much appreciated. TL;DR - didn't get me very far and I'm not happy with EA if that is in fact the only way to do this. "SAD" as they say ;)

Longer: I got the MDG file and I know how to b64 decode in Notepad++ but I was unable to discover how to unzip it as well (if the process is in fact b64 decode, save to zip file, unzip externally, etc. then that's another matter).

And... this is not directed at you, but I need to get it off my chest...

Really??? Doesn't this mean that the UML Types capability is broken? Is there no simpler way - esp. since the whole point of the UML Types & user editable shapescripts is surely to avoid this sort of thing?

To be honest, even if the b64 decode, unzip worked I don't think I would do it because the round-trip effort for debugging, testing etc. is just way too high. I'm at Level 0 on shapescripts (where I was with scripting a month or so ago) and the highlighting & preview are essential to me. I've seen the source thanks to Geert's repo and the chances of me modding it successfully this way are infinitesimal.

Are there any pother possibilities?

Thanks,

Julian

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #3 on: July 18, 2017, 06:05:25 pm »
There is no other way (I know of).

Procedure:

- Search for Stereotype name="Activity"
- Below is a section Image type="EAShapeScript 1.0"
- Copy the b64 part into a new file
- Remove all blanks (since else Notepad++ will croak later)
- Select all b64 text
- Extensions/Mime/b64 Decode -> that should now place a lot of binary rubbish i
- save to temp.zip
- open this file from Windoze -> now you see a file str. dat inside which contains the shape script.

You can modify the script and go all the way back to replace it.

q.
-

Mr Stuff

  • EA User
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #4 on: July 18, 2017, 06:09:53 pm »
Thanks for the extra... I'm going to try being creative - anything rather than have to go through that process every time I make a typo/dislike the result! ;)

Julian

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #5 on: July 18, 2017, 06:11:11 pm »
Well, you try the shape script first in a dummy stereotype. Only then you replace it for real.

q.

Mr Stuff

  • EA User
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #6 on: July 18, 2017, 07:39:17 pm »
<Creative hat on>
It turns out that even if I wanted to jump through those hoops there's no point: the app is virtualised and I have no privileges to modify/replace files, so couldn't update the MDG.

So... I thought, why not take a copy... and change

<Image type="EAShapeScript 1.0" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64"> to
<Image type="EAShapeScript 1.0" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">

for Activity... and then just paste in the plain text of the shapescript, which I can have open in Notepad++ edit, save and ?refresh EA to see the results

I still don't know whether that would work because: although I have added my BPMN2.0 MDG (modified as above) from a local path and have tried disabling the built in BPMN2.0 MDG technology, the latter keeps reenabling itself.

It's also possible that I need to change some ID or Alias or something in the replacement MDG XML file, but I have no idea what might be important.

Any thoughts? Could this work?

Thanks

Julian

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #7 on: July 18, 2017, 08:27:46 pm »
You could simply try out what happens with the string hack (should work, I guess). For the MDG location: if you don't have the rights you need to create a local MDG copy and set the MDG Settings to point to your local folder where you can use this copy instead of the EA located one. You should alter the version so you can distinguish it from the base MDG.

q.

Mr Stuff

  • EA User
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #8 on: July 19, 2017, 12:09:32 am »
That's pretty much what I've done - except for the stated problem of not knowing how to differentiate the two MDGs correctly.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #9 on: July 19, 2017, 09:06:46 am »
If all you want to do is display one of a BPMN Activity's tagged values on a diagram, then rather than messing around with shape scripts and risk losing BPMN functionality, add a Note to the activity (right-click > New Child Element > Attach Note), right-click the note link and "Link this note to an element feature".
The Sparx Team
[email protected]

Mr Stuff

  • EA User
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #10 on: July 19, 2017, 04:08:29 pm »
@KP - thanks.

Just had the same info from Allan in support; my reply - with further questions about a modified local BPMN2.0 MDG XML file (see notes above) - was as follows:

Quote
Thanks for the quick turnaround.

Yes, I have been able to link a note to TaggedValues but only to all of them at once; when only one or two pieces of information are to be highlighted this is a problem as there are 18 tagged values with non-null, non-<memo> values displayed in properties that's already a long list. Our custom tagged value does appear, but it's lost in a sea of unimportant plain text

>>> Yes, messing around with BPMN shape scripts isn't going to work.

It might be helpful to acknowledge this prominently; it would have saved me considerable effort. It is also a significant deficiency in my opinion.

I am trying to replace the BPMN2.0 MDG with non-encoded, non-compressed shapescript for Activity; advice on how to resolve conflicts with the built in BPMN2.0 MDG would be appreciated, i.e. how do I substitute a local MDG XML. As noted in the forum, two XLM files with same name, etc. always enable/disable together: what do I need to change in my version to keep them separate… and if I amend the content, when does EA reload the XML file/how can I force it to?

All input gratefully received.

Julian

Viking

  • EA User
  • **
  • Posts: 453
  • Karma: +2/-2
    • View Profile

Mr Stuff

  • EA User
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #12 on: July 20, 2017, 03:43:02 pm »
@Viking - thanks... Geert's repository is where I got the plain text of the shapescript (rather than the base64 zipped version in the XML) that I would like to past back as plain using <dt:dt string>

Julian

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #13 on: July 21, 2017, 07:52:03 am »
I would like to past back as plain using <dt:dt string>
Enterprise Architect won't understand it if you don't use the same format.

Mr Stuff

  • EA User
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
Re: ShapeScript for BPMN2.0::Activity?
« Reply #14 on: July 24, 2017, 06:20:50 pm »
@Simon

You mean EA will ignore the explicit XML dt tag with a formally recognised schema datatype of string and try to b64 decode and decompress anyway??? Surely EA is interested in the value and not the encoding...?

I hope we have our wires crossed because I have a hard time making sense of that :)

Julian