Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DeBAAT

Pages: 1 2 [3] 4 5
31
General Board / Re: Find/Search op to find element in current diagram
« on: August 07, 2023, 10:36:12 pm »
You could try to find an element that matches your filter. I usually to that by clicking Ctrl-F (on a diagram).
Usually, I can find my object that way.
That step 1. Next, you can use the option "Find element on all diagrams". It will open a pop-up with a list of all diagrams that particular element is used. Select the diagram you want to analyse and open it. In my experience, the diagram opens with the element selected and most of the time in the middle of the screen.

32
Did some research and came along the following text in the page with "Changes and fixes for Build 1008" (EA 10):
Quote
Automation functions ExportPackageXMI and ExportPackageXMIEx will no longer show publish package dialog if EA window is hidden or SuppressEADialogs is true.

And on the manual page for EA_OnPostNewElement in EA 16.1 (https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/broadcastpostnewelement.html) it reads:

Quote
Set Repository.SuppressEADialogs to True to suppress Enterprise Architect from showing its default 'Properties' dialog.

Maybe this could help?

33
PCS General Board / WebEA with Dynamics and - or Scripts
« on: July 31, 2023, 09:50:03 pm »
As a team, we are using WebEA to share EA Repository information with the rest of the organisation.
This works rather well, even using Legends to provide insight into the various settings defined in TaggedValues like Platform which is an indication for an Application whether it is implemented OnPremise, Cloud or WorkStation.

Now I'm wondering whether WebEA is really static or capable of handling some dynamics.
What I mean is that WebEA is showing diagram images 'automatically' generated when the diagram is modified and stored.
Now, when I change the TaggedValue of an element, in EA it directly shows on the diagram with that legend.
There is however no '*' indicating that the diagram is modified and  thus it will not be rerendered and stored.

Is there any option to define some script or something else (Button?) to enable the users of WebEA to re-render the diagram image?
If so, would these users then need some specific authorisations to allow them to use that option?

34
General Board / Re: Create Custom Reference Data
« on: July 31, 2023, 05:00:27 pm »
Hai Jayson,
If you are looking for an option to automatically generate the list of values to use on a legend, maybe my script could be of help.
See the topic "https://sparxsystems.com/forums/smf/index.php/topic,46615.msg278990.html".

35
General Board / Re: Autocolor legends used flexibly
« on: July 31, 2023, 02:50:35 am »
At last found some time to work on the script.

It resulted in the code at the end of this post.
The basic working is a JavaScript on a Diagram.
With the selected diagram, it processes all elements on the diagram.
For every Legend element, it determines the TaggedValue that is used for the auto coloring of elements.
With the TaggedValue Property found, it looks for all distinct values present in the t_objectproperties table.
Each value found is assigned a separate color, choosen from a predefined list of colors.
After processing, the diagram is reloaded.

For now, I have some issues I'm still struggling with:
  • Using the Repository.Execute() method works for updating the values in the database. However, I can't seem to get a result from the execution. Is there a way to tell whether the update was successful?
  • I use a predefined list of colors to assign to the different TaggedValues but I'm not quite fond of these colors. Any suggestions on where to find a better list of colors to assign?

Any suggestion for improvement of the code is also always welcome.

The code itself:
Code: [Select]
!INC Local Scripts.EAConstants-JavaScript

/*
 * This code has been included from the default Diagram Script template.
 *
 * For all LegendElements on the selected diagram:
 *   If TaggedValue filter
 *      Find all TaggedValues for this Value
 *      Update t_xref list of properties for this legend
 *   Refresh Diagram
 *
 *
 * Script Name: RefreshDynamicLegend
 * Author:      J de Baat
 * Purpose:     Refresh the set of color definitions of all legend elements supporting all values occuring on the selected diagram
 * Date:        27-07-2023
 */

/*
 * A list of colors to use for generating the list of legend values
 * Hexadecimal to Decimal converter via https://www.rapidtables.com/convert/number/hex-to-decimal.html
 */
var legendColors =[ "1029550", // #0FB5AE
            "4212426", // #4046CA
            "16155921", // #F68511
            "14564738", // #DE3D82
            "8291578", // #7E84FA
            "7528554", // #72E06A
            "1342195", // #147AF3
            "7546579", // #7326D3
            "15255040", // #E8C600
            "13327616", // #CB5D00
            "36701", // #008F5D
            "12380465", // #BCE931
            "0" // #black
];

/*
 * Test whether an element is a Legend
 */
function ElementIsLegend( theElement )
{
// Cast theElement to EA.Element so we get intellisense
var inputElement as EA.Element;
inputElement = theElement;

return ( (inputElement.ObjectType == 4) && (inputElement.Subtype == 76) );

}

/*
 * Get the filter value for the LegendElement
 */
function GetLegendFilter( theElement )
{
// Cast theElement to EA.Element so we get intellisense
var inputElement as EA.Element;
inputElement = theElement;

// Find the TaggedValue in the string of format "*LegendTypeObj=Filter=" + "TaggedValue." + strLegendTaggedValue + ":;*"
var strLegendTaggedValue01 = inputElement.StyleEx.split("LegendTypeObj=Filter=");
var strLegendTaggedValue02 = strLegendTaggedValue01[1].split(":;");
var strLegendTaggedValue03 = strLegendTaggedValue02[0].split(".");
if ( strLegendTaggedValue03[0] == "TaggedValue" )
{
// Check for strLegendTaggedValue to be of format strLegendValue + ":AppliesTo=*"
var strLegendTaggedValue04 = strLegendTaggedValue03[1].split(":AppliesTo=");
return strLegendTaggedValue04[0];
}
return false;

}

/*
 * Get all values for theTaggedValueProperty from the t_objectproperties table
 */
function GetLegendTaggedValuesForProperty( theTaggedValueProperty )
{

// Get all the TaggedValues registered for theTaggedValueProperty
var strSQLQuery = "select distinct t_objectproperties.Value as TaggedValues from t_objectproperties"
                      + " where t_objectproperties.Property = '" + theTaggedValueProperty + "'"
                      + " order by t_objectproperties.Value";
var sqlResponse = Repository.SQLQuery( strSQLQuery );

// Convert the sqlResponse from XML to an array of TaggedValues
var arrResponse = convertXMLtoTagNameArray( sqlResponse, "TaggedValues" );

return arrResponse;

}

/*
 * Extract an array from the XML resultset of an SQLQuery based on the xmlTagName
 */
function convertXMLtoTagNameArray( xmlString, xmlTagName )
{

var xmlDOM = new COMObject( "MSXML2.DOMDocument" );
xmlDOM.validateOnParse = false;
xmlDOM.async = false;
if ( xmlDOM.loadXML( xmlString ) ){
var nodeList = xmlDOM.documentElement.selectNodes( '//' + xmlTagName );
if ( nodeList.length > 0 ) {
return nodeList;
}
}

return false;

}

/*
 * Update the Description value for the LegendElement in the t_xref table
 */
function updateLegendElementXRef( theElement, theLegendDescription )
{

// Cast theElement to EA.Element so we get intellisense
var inputElement as EA.Element;
inputElement = theElement;

// Get all the TaggedValues registered for theTaggedValueProperty
var strSQLQuery = "update t_xref set Description = '" + theLegendDescription + "'"
                      + " where Name = 'CustomProperties'"
                      + " and Type = 'element property'"
                      + " and Client = '" + inputElement.ElementGUID + "'";
var sqlResponse = Repository.Execute( strSQLQuery );

return true;

// TODO: Check sqlResponse as result of Repository.Execute
//Session.Output("strSQLQuery ==> Resulted in: " + sqlResponse );
//return sqlResponse;

}

/*
 * Make a new property string for the theValueName and theValueIndex
 */
function getLegendPropString( theValueName, theValueIndex )
{

var strPropOutput = "";

strPropOutput += "@PROP=";
strPropOutput += "@NAME=";
strPropOutput += theValueName;
strPropOutput += "@ENDNAME;";
strPropOutput += "@TYPE=LEGEND_OBJECTSTYLE@ENDTYPE;";
strPropOutput += "@VALU=#Back_Ground_Color#=";
strPropOutput += legendColors[theValueIndex % legendColors.length ];
strPropOutput += ";";
strPropOutput += "#Pen_Color#=0;";
strPropOutput += "#Pen_Size#=1;";
strPropOutput += "#Legend_Type#=LEGEND_OBJECTSTYLE;";
strPropOutput += "@ENDVALU;";
strPropOutput += "@PRMT=";
strPropOutput += theValueIndex;
strPropOutput += "@ENDPRMT;";
strPropOutput += "@ENDPROP;";

return strPropOutput;

}

/*
 * Make a new property string for theLegendName and theLegendTitle
 */
function getLegendStyleSetting( theLegendName, theLegendTitle )
{

var strPropOutput = "";

strPropOutput += "@PROP=";
strPropOutput += "@NAME=";
strPropOutput += theLegendName;
strPropOutput += "@ENDNAME;";
strPropOutput += "@TYPE=LEGEND_STYLE_SETTINGS@ENDTYPE;";
strPropOutput += "@VALU=#TITLE#=";
strPropOutput += theLegendTitle;
strPropOutput += ";";
strPropOutput += "@ENDVALU;";
strPropOutput += "@PRMT=";
strPropOutput += "@ENDPRMT;";
strPropOutput += "@ENDPROP;";

return strPropOutput;

}

/*
 * Process a LegendElement provided as parameter
 */
function ProcessLegendElement( theElement )
{

// Cast theElement to EA.Element so we get intellisense
var inputElement as EA.Element;
currentElement = theElement;

// Check whether the currentElement is a Legend
if ( ElementIsLegend( currentElement ) )
{
var strLegendFilterProperty = "";
var strLegendTaggedValues = "";
var strLegendProperty = "";

strLegendFilterProperty = GetLegendFilter( currentElement );
strLegendTaggedValues = GetLegendTaggedValuesForProperty( strLegendFilterProperty );

// Process the strLegendTaggedValues found
if ( strLegendTaggedValues.length > 0 ) {

// Add all getLegendPropString found for all strLegendTaggedValues
for ( var i = 0 ; i < strLegendTaggedValues.length ; i++ ) {
strLegendProperty += getLegendPropString( strLegendTaggedValues.item(i).text, i );
}

// Add the getLegendStyleSetting found
strLegendProperty += getLegendStyleSetting( currentElement.Name, currentElement.Name );

// Refresh the currentElement and Update the currentDiagram to reflect the changes
var boolResult = updateLegendElementXRef( currentElement, strLegendProperty );
if ( boolResult ) {
Session.Output("Legend(" + currentElement.Name + ") UPDATED successfully!!!" );
} else {
Session.Output("Legend(" + currentElement.Name + ") update NOT successful!!!" );
}
} else {
Session.Output("Legend(" + currentElement.Name + ") found NO valid strLegendTaggedValues!!!" );
}
}

}

/*
 * Diagram Script main function
 */
function RefreshDynamicLegendScript()
{
// Get a reference to the current diagram
var currentDiagram as EA.Diagram;
currentDiagram = Repository.GetCurrentDiagram();

Session.Output("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" );

if ( currentDiagram != null )
{
Session.Output("Selected Diagram(DiagramID: " + currentDiagram.DiagramID + ") Name= " + currentDiagram.Name );

// Get a reference to any selected connector/objects
var diagramObjects as EA.Collection;
var currentElement as EA.Element;
diagramObjects = currentDiagram.DiagramObjects;

// Check whether this diagram has any objects in it
if ( diagramObjects.Count > 0 )
{
Session.Output("Selected diagramObjects.Count: " + diagramObjects.Count );
// One or more diagram objects are selected
for ( var i = 0 ; i < diagramObjects.Count ; i++ )
{
// Process the currentDiagramElement
var currentDiagramElement as EA.Element;
var currentElement as EA.Element;
currentDiagramElement = diagramObjects.GetAt( i );
currentElement = Repository.GetElementByID( currentDiagramElement.ElementID );

// Process the currentElement when it is a Legend
ProcessLegendElement( currentElement );
}

// Reload diagram when all processing is done
Repository.ReloadDiagram( currentDiagram.DiagramID );
}
else
{
// No objects on this diagram
Session.Output("No objects on this diagram" );
}
}
else
{
Session.Prompt( "This script requires a diagram to be visible.", promptOK)
}

Session.Output("===========================================================================================" );

}

RefreshDynamicLegendScript();

36
Thanks for the concern about me spending my time ;)

And some reactions:
Quote
Note you only have the images stored in the database if you have PCS licensed, because it is the only way to use the Worker that continuously create a cache of the recently saved diagrams as images in the database.
The first part of this statement is not true. The Worker might be indeed only part of the PCS license. However, in the regular client application, there are some options related to Cloud behaviour. One setting enables EA to explicitly store the diagram image every time it is saved by the user. And a button is available to batch create all diagram images.
This could also be concluded from looking at the size of the QEA or EAP files. They are much larger after the batch creation of all images, provided they were not there yet.
I also believe there are even some drawbacks when using the Worker because that may render possibly unwanted results when the diagrams are changed without you intending. I sometimes have it when I turn back to a previously neatly created diagram which now shows some additional connections that were added on other diagrams since the last time I looked at this particular diagram.

Quote
Pls. ignore my post above. You were talking about the PCS image store. You can't read those since EA's cache uses some proprietary format and (IIRC) only when using PCS.
Your remark might be valid as I am not talking about the PCS image store. As explained above, these images are generated and stored in the repository, whether you are using PCS or not. There may be however a proprietary format used which is 'decoded' when using the WebEA PCS functionality.

37
Thanks for the quick reply.

What do you mean with :
Quote
a zip with a file str.dat inside
?

Just using
Code: [Select]
gzuncompress($StrContent) or
Code: [Select]
gzdecode($StrContent) still doesn't render the image.

Looking at some example data, it looks like the information I receive is base64 encoded (some strings end with "==").
Should I then first do a base64 decode before the dzuncompress is applied?

38
For a project I'm working on, I'm trying to display EA images in a PHP web application.
So far, I've located the information in the t_document table, as also indicated in the post "https://sparxsystems.com/forums/smf/index.php/topic,47559.msg277179.html".
The images are also automatically generated with the cloud option as they show in WebEA.

Unfortunately, I cannot decode the string I find in the StrContent column of t_document to show on my PHP page.
It seems to be some string that would render as "image/png" but it doesn't show the image.
Decoding base64 doesn't help either.

Any suggestions are highly appreciated.

39
General Board / Re: UML and ArchiMate together in a model
« on: May 26, 2023, 03:39:59 pm »
The GUIDs are part of the export generated by the excel sheet and used to update the elements.
And you might be right about the connections when they also ought to be changed, e.g. when a certain BPMN connector type is not supported in the ArchiMate model.
I have not yet experienced this however because the mapping from BPMN to ArchiMate is pretty straightforward at the level I use it.

40
General Board / Re: UML and ArchiMate together in a model
« on: May 25, 2023, 04:38:06 pm »
I tend to use the same philosophy as in using ArchiMate where possible and only use BPMN and UML when needed.

Quote
When it comes to the work already done in UML that matches ArchiMate artefacts, I would convert it into ArchiMate either by redoing it manually or by scripting. I cannot tell which approach that is best suited for you.

For this trick, I use the export/importer from Geert:
  • Put all UML elements to migrate in a package, optionally layered when needed.
  • Export all elements
  • Change the stereotype of the UML elements to match the ArchiMate types
  • Import all elements using the update option to change the attributes of each element
If necessary, I manually create a dummy ArchiMate element for each stereotype to get the correct definitions to change the UML elements to.

41
You might try to run the 64 bits Ultimate next to 32 bit EA Lite as they are (by definition) deployed in different folders on windows itself ("Program Files" vs "Program Files (x86)"). I've done this when testing V16 (64bit) before removing V15.2 (32bit).

42
General Board / Re: SQL Database Schema upgrade
« on: March 06, 2023, 05:26:41 pm »
Just a thought:
Would it be possible to create a new repository with the latest schema and use the transfer option to migrate the old model to the new DB instance?

43
Quote
Any gotcha' with the driver installation or usage?

Not particularly. I just installed it and it worked.
If believe I could even use the same sql queries to access the data in the database as I used for MySQL. But this are really simple queries  ;).

44
Hai.
I'm using the same SQLite3 driver with no problems whatsoever.
It took me some time to figure out why I couldn't connect in the first place and eventually came across that driver.
Works fine now.
Also works for access by Power BI for creating nice reports.


45
PCS General Board / Re: Question about WebEA tokens and image cache
« on: February 08, 2023, 06:00:29 am »
Hai, sorry I didn't explain it clear enough.
Using the EA client, you can set the cloud options for the repository you are connected to.
So every EA client that makes changes to a diagram in that repository will automatically update the cache for that repository.
So when there is no change, there is also no need to update the cache.
And thus still no need for the worker process nor any PCS token.

Pages: 1 2 [3] 4 5