Why does the Classifier of an embedded RequiredInterface on a Component instance in Enterprise Architect changes after it is being renamed? - enterprise-architect

I observed a behaviour in Enterprise Architect while working with Components and RequiredInterfaces that I cannot explain and am looking for an explanation.
Here is the case:
I have an Interface Interface1-a6a8ab9f-11f4-4277-a2dc-dd4948ffc36d (see figure 1).
I have a Component Component1-234e39eb-78b2-4484-b48a-8c0c52490673 with an ProvidedInterface that links to/is classified by Interface1-a6a8ab9f-11f4-4277-a2dc-dd4948ffc36d (see figure 2, 9). The Classifier of the ProvidedInterface references the Object_ID 18298 of the Interface Interface1-a6a8ab9f-11f4-4277-a2dc-dd4948ffc36d (see figure 3).
Now when I instantiate the Component along with its ProvidedInterface the Classifier of the newly instantiated ProvidedInterface links to the Object_ID 18299 of the ProvidedInterface as seen in figure 2 (see figure 4). I added a screenshot (see figure 7, 8) that shows, how I created the instance.
Unexplainable behaviour
So far, so good. However, when I rename the instantiated ProvidedInterface (and even rename it back to its original name) via the Element Properties dialogue, the Classifier of the instantiated ProvidedInterface magically changes from 18299 to the Object_ID 18298 of the original Interface (see figure 5 and 6).
The same behaviour occurs when renaming the original Interface in the UI or via API/script (but not when renaming other attributes such as the Alias).
function main()
{
var element AS EA.Element;
element = Repository.GetElementByGuid('{75BB908D-9B1A-4258-8748-9D2E51DCB8FB}');
Session.Output("element " + element.Name);
var originalName = element.Name;
element.Name = "Schnittenfittich";
element.Update();
element.Refresh();
Session.Output("element " + element.Name);
element.Name = originalName;
element.Update();
element.Refresh();
Session.Output("element " + element.Name);
}
main();
Question
Why does the Classifier id change by renaming the ProvidedInterface name (or its classifying Interface?
Notes
There are further inconsistencies on instantiated ProvidedInterfaces such as the ea_guid being displayed as the ea_guid of the original ProvidedInterface and having that guid being persisted in the PDATA3 attribute of t_object. I am not sure if and how this has to do with it.
EA version being used is v14.1.1429
Database is JET/EAP
This behaviour does not occur in EA v12.5 #Oracle
Figure 1: Details of Interface
Figure 2: Component and ProvidedInterface
Figure 3: Details of ProvidedInterface
Figure 4: Details of instantiated ProvidedInterface
Figure 5: ProvidedInterface with new Name
Figure 6: New Classifier on instantiated ProvidedInterface
Figure 7: Creation of instantiated Component and ProvidedInterface
Figure 8: Instantiated Provided Interface has Classifier
Figure 9: Selecting classifier for Provided Interface

Well, EA is strange in many respects. Here's what I created:
The component #2066 containing the PI #2068 and the interface #2070 were created first. Then I assigned (dbl-click) the classifier #2070 to the PI #2068.
Next I created a new instance of component #2066 which got the id #2071 (you see it's classified with the first #2066). The embedded RI #2072 has the classifier #2068 which is the PI of the original component. It does not assign the classifier that one got (#2070) but from where it was copied.
So: your assumption that the instance's RI is also classified the same as its origin is wrong. It's classified with its parent RI (like the component is with its parent).
Next: renaming th RI. I just used the properties window to rename:
and that results in
huuuu? What's this. Not only both now have the same classifier (#2070 the interface). Now both RIs are renamed?!
Now, if that isn't a bug I don't know. Will it be fixed? I don't know either but my guess would be: not too soon.
Some more testing. I added a new interface abc and in the IR-dbl-click dialog entered plainly "abc". This did set the classifier in the database to #0 while the name "abc" was kept. (Using the properties dialog had the same effect). Using the ellipsis to choose abc in contrast did set the proper classifier ID. You can't choose that from the properties window, though. Ah, I forgot: it's EA.
Further when changing the RI name of the parent component this also changed the name of the RI of the instance.
To say this is weird is more than an understatement.
Feel free to send bug reports to Sparx. But it's probably better to have a beer and think for some other solution.

Related

Update parameters promoted to a mask inSimulink

So I am working on constructing a mask for a CAN unpack system. It's a basic mask with 2 promoted parameters and a browse button. The promoted parameters are the "CANdb" file field and the drop down menu, "MsgList", that follows it.
The basic mask it self works. I'm able to browse for a CAN ".dbc" file and its path is available in the promoted field, and even the drop down menu works where I'm able to select a message from those available in the ".dbc" file. But this is about all the functionality I'm getting.
My observation was that this problem is in 2 different parts. I'll try to explain them individually.
The first is with the "CANdb" promoted parameter. While on the outside it appears as though the parameter is changing (it changes in the mask), internally nothing changes: when i peak under the mask, there is no change on the values of the CANUnpack Block that i am using. Then CANUnpack block itself does update when I double click to open it. The new DBC and message list shows up but only on the block.
The second issue was with The list of messages, that is also promoted to the mask is also not updating. The list from the previous DBC file remains there, and does not change even if i run the simulation, update the model or refresh the block. When i close and reopen the model, it updates then.
These observations lead me to believe that i need to add some kind of code to update the mask, but i don not know what this code will be. I though that the issue may have to do with the fact that the value needs to propagate from the mask to the block and then updated all the parameters so maybe that prevents or hinders an update.
For this i then removed the promoted parameter for the DCB file and linked the browse button directly to the block parameter. The only difference this made is that the name of the new DBC file shows up on the CAN unpack block. Nothing else changes. Not even the messages of the "MsgList" till I double click to open the block. And as usual, the message list on the mask remains unchanged.
I am adding some images and the code for my browse button below to aid with trouble shooting. Thanks in advance.
pp = Simulink.Mask.get('NXP_CAN_Unpack/Subsystem/CANUnpack2');
p = pp.getParameter("CANdbFile");
[fName,pName] = uigetfile("*.dbc");
p.Value = [pName,fName] ;
Mask for system
Inside Mask
Block Parameters for CANUNpack

Connection shape script shows GUID not a name of reference element

In my MDG technology I have a my own type of connection "MyConn" extended of InformationFlow. "MyConn" has tag "ServiceRef" which is linked via tagged value to another MDG element «MyService».
When I use in "MyConn" shape script the construction
print(" -> ");
print("#TAG:ServiceRef#");
the shape depicts GUID of "MyService", not a "Name", as I experienced in other cases (for element, not connections).
Is there a way to show name of referenced element, not a GUID ? Sparx 13.5
That's obviously a(nother) bug in EA. It's still broken in 15.1. You might report that (or use your time for something more useful). Eventually post the question on Sparx' forum and one of the nice Sparxian (KP if any) will have an idea.
Since shape script is so limited the only way around would be to use an add-in call to decipher the name from the GUID, just like
print("#yourAddin:decipherGUID#");
You would need to implement that decipherGUID operation in your add-in. If you desperately need that be aware that for each connector to be rendered EA will call that add-in. That can easily drop performance to non-usability.

Sparx Enterprise Architect DocumentGenerator does not honour TaggedValues on Stereotype or values from SetProjectConstants and ReplaceField

maybe someone can help me on this. I am trying to generate a document via the DocumentGenerator interface. All in all this works well, except that the DocumentGenerator does not replace the Report Constants with actual values (which are defined on the report package stereotype.
This is the general flow of the document creation code (which generally works):
var gen = Repository.CreateDocumentGenerator();
gen.SetProjectConstant("ReportName", "My Project");
gen.NewDocument(string.Empty);
gen.ReplaceField("ReportName", "My Project");
gen.InsertCoverPageDocument(tags[REPORT_COVERPAGE]);
gen.InsertBreak(DocumentBreak.breakPage);
gen.InsertTOCDocument(tags[REPORT_TOC]);
gen.InsertBreak(DocumentBreak.breakPage);
gen.DocumentPackage((int)nativeId, 0, template);
gen.SaveDocument(fileName, DocumentType.dtDOCX);
I tried ReplaceField and SetProjectConstant both and one at a time before and after calls to NewDocument/InsertCoverPageDocument:
Strangely there is one constant that is being replaced: ReportSummary.
When I run the document generator via "F8" all constants are being replaced correctly.
Other project constants are being replaced correctly.
I can reproduce the behaviour on EA v14.1.1429 and v12.0.1215.
Does someone have a hint for further troubleshooting? Thanks in advance!
========== UPDATE ==========
When I use ReplaceField at the end (before the actual call to SaveDocument the following Report Constants get replaced: {ReportTitle} and {ReportName}
I discovered some workaround: when I manually remove the predefined {Report~} constants from the template and re-add them as Project Constants, their values get replaced correctly.
I will examine this further and give an update as
I did some further investigation on this and came to the following conclusion and workaround (as I have received no comments or answers on this):
I deleted all references to ReportConstants in my EA templates and replaced them by ProjectConstants with the same name.
In my code where I want to generate the documentation I (re)set all ProjectConstants with the actual values via SetProjectConstant and additionally added a call to ReplaceField to replace the constants with the actual values.
The previous mentioned calls are inserted directly before the call to SaveDocument document.
tags.ForEach(t =>
{
if (string.IsNullOrWhiteSpace(t.Key)) return;
generator.SetProjectConstant(t.Key, t.Value);
generator.ReplaceField(t.Key, t.Value);
});
generator.SaveDocument(fileName, DocumentType.dtDOCX);
If someone comes up with a better resonse or explanation for the behaviour I am happy to accept this as answer.
I have also found that when you call ReplaceField on these project constants in a CoverPage template, the formatting defined in the template is overwritten. It seems that some of the SetProjectConstant calls actually set the values as you would expect, and the rest do not.. hence the need to call both sets of APIs.

How to show to the user that a file is attached to an element

We are currently using a stereotype with an attached shape script to show that files are linked to an element
However, going this route means that our users cannot use another stereotype, or it will overwrite (Even if multiple stereotypes can be applied, only one will be shown and only one shape script will be applied)
I tried using the "A" icon for when a linked document has been created for an element by modifying the style property of the element, but setting MDoc=1 without a linked document will not show the icon.
What would be an effective way of showing there are files linked to a document without using stereotypes(if any)?
You are out of luck here. The Link to Element Feature on Notes works for many things, but not for the related files.
In case you could link <<files>> stereotyped Notes to the elements and run a batch script that looks into the Related/Files and fills them in the Notes. Basically that would be something like:
for dia in all diagrams:
for diaobj in dia.diagramobjects:
obj = rep.GetElementByID(diaObj.ElementID)
if obj.Type == "Note" and obj.Stereotype == "files":
con = obj.connectors.getAt(0) # assume there's only one connected
ident = con.clientId
if ident == obj.ElementId: ident = obj.sourceId
fObj = rep.GetElementByID(ident) # element connected to the note
# parse fObj's files and write them as string to obj's Note attribute

Magento layer navigation wrong product count

Problem : Product count is not correct on Layered Navigation in List Page for all attribute but category product counts are fine.
Magento Version : 1.7.0.2
I have removed all override of catalog file and folder and also uploaded magento core catalog file to check that is it problem of core file but Still i am not getting issue.
Example :
Manufacturer
Manufacture 1 (90)
Manufacture 2 (82)
Manufacture 3 (223)
But when i click on Manufacture 1 there will be 3 products.
One thing i found, in below mentioned code if I change Mage::getSingleton('catalog/layer'); to Mage::getModel('catalog/layer'); than product count is fine but product are not display according to filter.
app/code/core/Mage/Catalog/Block/Layer/View.php
Line no - 149
public function getLayer()
{
return Mage::getSingleton('catalog/layer');
}
I appreciate for any help.
Thanks in advance.
That's wrong to change layer singleton to the model. If it helps for you it means you break layer somewhere in your custom code... So this seems to be a problem in your local code. But first did you try to do reindex? Please start with reindexing product flat data and attributes. Then try to debug. Counts for attributes are calculated here: app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Attribute.php:83 in method getCount(). Try to catch select object and review what actually it selects. xDebug is very useful for cases like this. If you don't use it then you can do in specified method just before return smth like
$a = (string) $select;
die($a);
Then you would have counts select and you can analyze it. Good luck!