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 - Mike Hatch

Pages: [1]
1
Suggestions and Requests / Allow Common Table Expressions in custom search
« on: February 27, 2015, 10:36:34 am »
When defining a custom search using SQL, it would be useful to be able to use a Common Table Expression (CTE) when using SQL Server.  Currently the tool does not throw an error, but does not execute a statement that begins with a CTE.  Here is an example  query that would build a path to the current object by using a recursive CTE to find the Parents of the object.

Code: [Select]
;With Hierarchy (Object_ID,Name,ParentID,Path)
AS
(
--Anchor query defines the first non-recursive query
SELECT p.Object_ID,p.Name,p.ParentID, CAST(p.Name AS varchar(max)) as Path
FROM t_object p
LEFT JOIN t_object t
ON t.ParentID = p.Object_ID
WHERE p.ParentID = 0
UNION ALL
--Recursive query
SELECT t2.Object_ID,t2.Name,t2.ParentID, CAST(h.Path + '->' + t2.Name AS varchar(max))
FROM Hierarchy h
INNER JOIN t_object t2
ON t2.ParentID = h.Object_ID
)
--output query using the CTE defined above
SELECT distinct Object_ID, Name,ParentID, Path
FROM Hierarchy where ParentID <> 0
OPTION (MAXRECURSION 0)

2
General Board / Icon Shape Scripts for Database and SaaS Solutions
« on: August 06, 2015, 07:36:46 am »
For anyone that would like to use them, here are a couple of Shape Scripts for decorating stereotypes 'SaaS' and 'Database' respectively (or whatever stereotypes you with to use them on).  

To use these:
1. Go to Project, Settings, UML Types (in EA v12)
2. Select the stereotype you wish to decorate in the list
3. Select 'Shape Script' under 'Override Appearance'
4. Click the 'Assign' button (may be 'Edit' if shape script already assigned).
5. Paste the appropriate script code into the edit box.

For SaaS:
Code: [Select]
decoration CloudNE
{
      orientation = "NE";
      noshadow = true;
      startcloudpath(5,3,0.5);
      SetFillColor(255,255,255);
      ellipse(-90,20,100,120);
      endpath();
      fillandstrokepath();
}

For Database:
Code: [Select]
decoration DatabaseNE
{
      orientation = "NE";
      noshadow = true;
      //move the shape a little down and left to it sits
      //just left the default component icon
      setorigin("NE", -25, 1);
      //fill white
      SetFillColor(255,255,255);
      //set starting cursor point
      moveto(0, 25);
      startpath();
      lineto(0, 100); //left vertical line
      bezierto(0, 125, 100, 120, 100, 100); //Bottom arc
      lineto(100, 25); //right vertical line
      bezierto(100, 0, 0, 0, 0, 25); //Top arc
      //finish the main shape so it fills in
      endpath();
      fillandstrokepath();
      bezierto(0, 50, 100, 50, 100, 25); //Middle arc
}

Note: If you want the main shape to maintain its default color, you may have to (re)select 'Default' under the Fill options.

3
Is there a source for the theme colors that is accessible from the scripting object model?  DiagramObject.Style and DiagramLink.Style include color values if set by the user, but contain "-1" if set to the default, which is dependent on the color theme selected under View -> Visual Styles, Visual Appearance, Diagram.  

Components, for example, have a pink default color in v11 and 12.  Where could I figure out what this color is set to from a script?

4
Are there any plans to enhance the scripting capabilities to support the full complement of browser-based scripting utilities and javascript libraries?  For example, I would like to be able to use jQuery to support async loading of other assets and calls out to REST services from within a Sparx script.  

This does not seem to be possible today because within the scripting environment, not all of the DOM objects are accessible.  The setTimeout function, for example, normally a method on the window object in a browser environment, is not available.

I tried loading IE through automation do do this
Code: [Select]
var window = new ActiveXObject("InternetExplorer.Application");, but not all of the methods are available.  Nor do I think it would end up working well to marshall all of the events and data across the automation boundary.

Pages: [1]