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 - deadbird

Pages: [1] 2
1
Automation Interface, Add-Ins and Tools / Re: Scritps in MDG technology
« on: November 03, 2017, 01:30:53 am »
Done, through priority support.

2
Automation Interface, Add-Ins and Tools / Re: Scritps in MDG technology
« on: November 03, 2017, 12:00:28 am »
From what I've found so far (mainly here: http://www.sparxsystems.com/forums/smf/index.php/topic,3848.msg237434.html), I have two choices:
  • modify the XML file each time a new MDG is generated
  • export the scripts separately, in a XML reference file

am I right? if so, that's a pity Sparx hasn't implemented a better behaviour... :-\

3
Automation Interface, Add-Ins and Tools / Scritps in MDG technology
« on: November 02, 2017, 08:52:01 pm »
Hi.

I created a few scritps in my MDG project, in two separate folders (some are regular scripts, some are Project Browser scripts). When I publish my MDG, all the scripts are in a single folder names after the MDG name.

Does anyone know how to avoid that folder fusion/renaming?

Thanks a lot.

4
Found the solution, thanks to you Uffe. Your answer definitely put me on the way. I created a blank template, assigned my stylesheet to it, and used its name in "docGenerator.NewDocument". And it works!

5
Here I don't even use templates, and here's why: discussions have no "ea_guid". Only their attached element can be use as a entry point for a template. And it's not what I want, for some reasons that are too long to explain here ^^

6
The script itself:

Quote
!INC Local Scripts.EAConstants-JScript
!INC EAScriptLib.JScript-XML
 
var DISCUSSION_TEMPLATE = "discussion";
var OUTPUT_FILE = "c:\\temp\\TestDiscussions.rtf";
 
var docGenerator as EA.DocumentGenerator;
var generationSuccess = false;
var saveSuccess = false;
 
var statusOpen = "Ouverte";
var statusClosed = "Close";

var statusPending = "En attente de compléments";
 
function getNodeText(string, xpath) {
       var xmlDOM = XMLParseXML(string);
     
       if (!xmlDOM) {
             ReportFatal("XML fails");
       }
     
       value = XMLGetNodeText(xmlDOM, xpath);
 
       return value;
}
 
function hasDiscussions(element) {
       var currentElement as EA.Element;
       currentElement = element;
     
       result = Repository.SQLQuery("SELECT COUNT(*) AS nbdisc FROM t_document WHERE elementid = '" + currentElement.ElementGUID + "' AND doctype='EDisc'");
     
       return parseInt(getNodeText(result, "EADATA/Dataset_0/Data/Row/nbdisc"));
}
 
function generateDiscussions(element) {
       var currentElement as EA.Element;
       currentElement = element;
     
       var discussionStatus = statusOpen;
     
       //SQL query the discussions for the element
       result = Repository.SQLQuery("SELECT elementid, strcontent, doctype, style FROM t_document WHERE t_document.elementType = 'Post' AND elementid = '" + currentElement.ElementGUID + "' ORDER BY style");
       var xmlDOM = XMLParseXML(result);
       if (!xmlDOM) {
             ReportFatal("XML fails");
       }
     
       array = xmlDOM.selectNodes("EADATA/Dataset_0/Data/*");
       for (var i=0; i<array.length; i++) {
             node = array.nextNode;
             if (node != null) {
                    guid = getNodeText(node.xml, "Row/elementid");
                    str = getNodeText(node.xml, "Row/strcontent");
                    type = getNodeText(node.xml, "Row/doctype");
                    statusXML = getNodeText(node.xml, "Row/style");
                   
                    if (statusXML.indexOf("RS_PEND") != -1) {
                           discussionStatus = statusPending;
                    } else if (statusXML.indexOf("RS_CLSD") != -1)  {
                           discussionStatus = statusClosed;
                    } else {
                           discussionStatus = statusOpen;
                    }
                   
                    if (type == "EDisc") {
                           docGenerator.InsertText("Question: " + str + " - " + discussionStatus + "\n", "Discussion - titre");
                    } else {
                           docGenerator.InsertText("Réponse: " + str + "\n", "Discussion - notes");
                    }
             }
       }
       docGenerator.InsertText("\n\n", "");
}
 
function DumpElements(thePackage) {
       var currentPackage as EA.Package;
       currentPackage = thePackage;
           
       var elementEnumerator = new Enumerator(currentPackage.Elements);
       while (!elementEnumerator.atEnd()) {
             var currentElement as EA.Element;
             currentElement = elementEnumerator.item();
           
             nb = hasDiscussions(currentElement);
             if (nb > 0) {
                    ReportInfo("J'ai trouvé " + nb + " discussions, je génère une doc pour cet élément");
                    docGenerator.InsertText("Element: " + currentElement.Name + "\n", "");
                    docGenerator.InsertText("Type: " + currentElement.Type + "\n", "");
                    generateDiscussions(currentElement);
             }
             elementEnumerator.moveNext();
       }
}
 
function DumpPackage(thePackage) {
       //cast du paramètre en EA.Package pour avoir accès à l'autocomplétion
       var currentPackage as EA.Package;
       currentPackage = thePackage;
     
       // Dump the elements this package contains
       DumpElements(currentPackage);
     
       // Recursively process any child packages
       var childPackageEnumerator = new Enumerator(currentPackage.Packages);
       while (!childPackageEnumerator.atEnd()) {
             var childPackage as EA.Package;
             childPackage = childPackageEnumerator.item();
           
             DumpPackage(childPackage);
           
             childPackageEnumerator.moveNext();
       }
}
 
function parcoursArborescence() {
       //Parcours de tous les objets du modèle, root node par root node
       var modelEnumerator = new Enumerator(Repository.Models);
       while (!modelEnumerator.atEnd())
       {
             var currentModel as EA.Package;
             currentModel = modelEnumerator.item();
           
             // Recursively process this package
             DumpPackage(currentModel);
           
             modelEnumerator.moveNext();
       }
       ReportInfo("Parcours de l'arborescence terminé.");
}
function main() {
       //active la fenetre console
       Repository.EnsureOutputVisible("Script");
 
       Session.Output("Parcours de l'arborescence d'un projet et génération de doc en Javascript");
       Session.Output("----------------------------------------------------------------------------------------");
     
       //création du générateur de doc
       docGenerator = Repository.CreateDocumentGenerator();
       if (docGenerator.SetStyleSheetDocument("GAIO - Feuille de style") == false) {
             ReportWarning("Stylesheet non appliquée :(");
       }
       docGenerator.NewDocument("");
     
       //parcours de l'arborescence
       parcoursArborescence();
     
       //enregistrement du fichier
       saveSuccess = docGenerator.SaveDocument(OUTPUT_FILE, dtRTF);
       if ( saveSuccess )
             ReportInfo( "Documentation complete!" );
       else
             ReportWarning( "Error saving file: " + docGenerator.GetLastError() );
}
 
main();
 
function ReportInfo(message) {
       Session.Output("[INFO] " + message);
}
 
function ReportWarning(message) {
       Session.Output("[WARNING] " + message);
}
 
function ReportFatal(message) {
       Session.Output("[FATAL] " + message);
       Session.Prompt(message, promptOK);
}

7
Hi everyone.

Following my previous posts about discussions, here I am again with another problem, searching for a beacon of light in EA's darkness ^^

Here is the problem. I successfuly created a nice script that runs through all of the Discussions, eventually filtering the status. It generates a functional output. See attached script.

My problem is that I can't apply styles from a custom style sheet.
I load stylesheet using docGenerator.SetStyleSheetDocument("GAIO - Feuille de style") -> it works.
I use  docGenerator.InsertText("a string", "a style from the stylesheet"); -> plain text is inserted, although the style I chose I contained in the stylesheed I successfuly loaded...

Can someone help?

Thanks a lot in advance ;)

8
the more I know about how EA implements Discussions, the more I think it's been coded by a trainee...

10
Hi everyone.

I've been struggling lately with discussions. See http://www.sparxsystems.com/forums/smf/index.php/topic,38373.0.html for more.

My final aim is to create a report of every discussion in the model with a particular status. For example, generate a report containing all of the "Awaiting review" discussions.
And gueww what? There is no way to do this using regular document generations, even using Model Search. Because no, discussions have no ea_guid...

So I'm trying to complete this using scripts. So far, my jscript iterates through the whole model and thus has access to every single element/package. But now, I can't find a way to access these elements/packages' discussions. I've searched through the model (see http://sparxsystems.com/enterprise_architect_user_guide/13.5/automation/reference.html), no luck so far...

Can someone help?

11
General Board / Re: Find discussion status in database
« on: October 19, 2017, 11:47:43 pm »
Phew...just found how to...grab tightly your socks before they get knocked off...

EA stores the status in t_document.style, in XML.

If the discussion is closed, it appends "\n\t<STATUS>RS_CLSD</STATUS>".
If it's awaiting review, it's "\n\t<STATUS>RS_PEND</STATUS>".

I couldn't see it because tuples in pgAdmin are displayed in a single line. Thus everything after the "\n\t" wasn't visible...

I really wish I had a deep talk with Sparx's database "engineer"...

12
General Board / Re: Find discussion status in database
« on: October 19, 2017, 11:25:53 pm »
Hi qwerty, thanks a lot for your helping hand ^^

To create a discussion:
- select any object in Object Browser, for example an Actor (packages can't have Discussions...)
- open discussions Window: Ribbon, "Start" tab, "Windows" button (on the left), "Discussions"
- double-click on "Create new discussion" and input some text.
- right-click on the text to change discussion status (Open, Awaiting review, Closed). These are the statuses I'm searching for in the database.


13
General Board / Find discussion status in database
« on: October 19, 2017, 10:53:25 pm »
Hi.
I'm using EA to generate documents containing all the discussions of a project. To do so, I'm using an SQL model search that retrieves t_objects that have a t_document with t_document.ElementType = 'Post'. So far, so good.

But right now, I'd like to generate this document excluding discussions with status "Closed". I searched deeply in the database and found nothing about this status. t_document, for instance, has no column named "status" or so.

Can someone help?

Thanks a lot ;)

14
Discussions are stored in t_document where t_document.ElementType = 'Post'

15
General Board / View "peoples" in generated document
« on: February 03, 2017, 01:17:12 am »
Hi everyone.

Is there a way to export data from "People" into a generated document? I can't find a way to do so :(

Thanks in advance.

Pages: [1] 2