How to automate adding Tagged Value Types and editing of templates in Enterprise Architect [closed] - enterprise-architect

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I am trying to automate the following tasks in Enterprise Architect:
Add new tagged Value types
2. Make certain changes to DDL Templates (e.g add system versioning to a table by replacing the DDL Create Table Template for MySQL with another template, that contains a "With System Versioning" clause)
Is there a way to achieve this via scripting (https://sparxsystems.com/enterprise_architect_user_guide/15.0/automation/automation_interface.html), by writing an Add In (https://sparxsystems.com/enterprise_architect_user_guide/15.1/automation/addins_2.html) or by using MDG Technologies (https://sparxsystems.com.au/enterprise_architect_user_guide/14.0/modeling_tools/mdgtechnologies_2.html) for Enterprise Architect?
Thank you in advance for all comments, answers and ideas!

Adding tagged value types is definitely possible.
I use this code in my Model wrapper
This is C#, but the translation to any other supported language such as VBScript is trivial.
public void addTaggedValueType(string tagName, string tagDescription, string tagDetail)
{
global::EA.PropertyType taggedValueType = (global::EA.PropertyType)this.wrappedModel.PropertyTypes.AddNew(tagName, "");
taggedValueType.Description = tagDescription;
taggedValueType.Detail = tagDetail;
taggedValueType.Update();
}
I don't think the API has a feature to update DDL templates directly, but you can deploy those with an MDG.
And you can include an MDG into your add-in. See this add-in class for an example
Normally tagged value types are also distributed in an MDG and not created directly by an add-in.

Related

Catalyst FormFu DBIC error - using dot notation in a resultset [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 29 days ago.
Improve this question
I've inherited a Perl Catalyst application that I'm trying to port to a new server. The application uses FormFu with the HTML::FormFu::Model::DBIC module used to load data from a result set.
I have a DBIx table, say MyTable, with an auto-generated Result implementation and a custom ResultSet implementation. In the custom ResultSet implementation there are some subroutines, e.g. sub my_sub, that return filtered subsets of data.
In a FormFu YAML file, the following will fetch all the records from MyTable:
elements:
- type: Select
model_config:
resultset: MyTable
This is equivalent to fetching, in a Controller, $schema->resultset('MyTable'). This executes correctly on both the old server and the new server.
On the old server, I can use dot notation to call the subroutine to fetch the subset of records it returns like so:
elements:
- type: Select
model_config:
resultset: MyTable.my_sub
This is equivalent to fetching in a Controller, $schema->resultset('MyTable')->my_sub. This executes correctly on the old server. On the new server, in FormFu, this throws the error:
Can't find source for MyTable.my_sub at /[...]/HTML/FormFu/Model/DBIC.pm
I've added debugging to the FormFu DBIC.pm module to see if it's doing anything special. The code it calls is $schema->resultset($rs_name); where rs_name is the name given in the resultset parameter, "MyTable.my_sub", and $schema is of type Moose::Meta::Class::__ANON__::SERIAL, which I assume is some kind of wrapper. Within a Catalyst controller, a schema is of type myapp::Schema.
What am I missing? Is there some configuration option I need to set? Some module I need to install? I can't find any documentation or examples that show a FormFu resultset with dot notation, yet on the old server it works.
When I attempted to add logging to the working DBIC.pm file, I discovered that the developer from whom I inherited this application symlinked the module's DBIC.pm file to a custom DBIC.pm file in his own home folder with the extended functionality.

Filter by method attribute in Doxygen

I am new to Doxygen but I want to use it for a technical documentation for our team.
The background: We have several services in .NET which are going to be called from a JAVA backend through RPC.
Therefore it is quite useful to have those services documented for the JAVA guys.
Using the Doxywizard did help in the first place, but it created a huge overflow of data, which I want to filter, but have no clue how to.
What I want to achieve is, that Doxygen ONLY will use methods, which does have a specific attribute.
For example:
[RpcMethod(id: "GetNumDemo", description: "A demo method")]
public async Task<int> GetNumDemo(JavaDTO dtoObject, int randNum)
I want to have the method within the documentation found by Doxygen since it has the RpcMethod attribute and also cause it have a JavaDTO object, I want to have this class documented as well.
But I am overwhelmed with it ... do you guys can help me? ... at least with a hint within the Doxygen documentation.
Read through the documentation and goodled

When should I use a Scala class and when to use Scala object in IDE? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I have seen many cases where we can create a Scala project with only Scala object file and have our code inside it without the need of having a Scala class file.
I am currently working in a project where the Developer has written the code in the Scala object file (which acts as an object) instead of writing in a class file. To be more precise here is the screen shot of my IDE which shows that the code is written in an object file.
I want to know significance of writing a code in a Scala class and object file. What is the ideal scenario to use them?
There is a similar post available here which shows only the difference between a class and an object however I want to know when should I consider to use a Scala class and when to use a Scala object?
Use class when you want to create the same data structure multiple times with difference values. For example, a class could represent a row of data in a database application, or a client request in a web server.
Use object when you only need a single copy of the data structure in your program. For example, the command line for a program, or a data cache.
Classes can have short lifetimes, so use them for data that comes and goes. Objects always last until the program completes, so use them for data that needs to be available permanently.
It is reasonably straightforward to convert an object into a class, so start with an object unless you know that you are going to need multiple instances of the data.
If you just want to group similar functions or data (in a namespace), put it in an object.
If you want are writing code for a software library, use classes that can be created and deleted as required.
Note that this applies to top-level objects. An object can also be used as a class member or as a local value, but in this case it operates like a class in that it can have multiple instances and may have a limited lifetime.
An object is something that you can only have one in your program. It's most of the time used to contain functions or objects that don't change much. It's the equivalent of static in other languages
For instance:
object StringUtils {
val LF = "\n"
def toUpperCase(str: String) = str.toUpperCase()
}
// usage
StringUtils.toUpperCase("foo")
On the other hand, a class is something you can create with new. You can have several instances of a class in your program
class StringContainer(str: String) {
def toUpperCase() = new StringContainer(str.toUppercase())
}
// usage
val myString = new StringContainer("foo")
myString.toUpperCase()
For more detailed examples you can look at the scala documentation:
https://docs.scala-lang.org/tour/classes.html
https://docs.scala-lang.org/tour/singleton-objects.html
https://docs.scala-lang.org/tour/case-classes.html

Enterprise Architect: Change diagram type (MetaType) by script

i have to change the diagram type of a lot of diagrams within my Enterprise Architect model. The change can be made manually using following option (that works as expected):
Select diagram - Diagram - Advanced - Change Type...
As I have to change a lot of diagrams I have created a script which searches for all concerned diagrams and change the type automatically. I wrote already a lot of JScript EA scripts for changing some modeling elements. Unfortunately, this feature seems not be available over the scripting interface.
I have to change the "MetaType" of the the diagram object. But this is read-only (see http://www.sparxsystems.com/enterprise_architect_user_guide/12/automation_and_scripting/diagram2.html). Therefore, I got an error.
var currentDiagram as EA.Diagram
currentDiagram = theDiagram
currentDiagram.MetaType = MY_DIAGRAM_METATYPE // ERROR
In the next step I searched for appropriate functionalities in the Repository interface (http://www.sparxsystems.com/enterprise_architect_user_guide/12/automation_and_scripting/repository3.html) and in the project interface. But I found nothing appropiate.
I am using Enterprise Architect 12.0.1215 and I used JScript.
Has anyone already tried this by script?
Have I missed something?
Is there another approach to achieve the diagram type change by script?
Thanks in advance!
You have to do that in two steps (if you change to different MDG diagram types). E.g. to change a Class diagram to a BPMN2.0::BPEL you first change Diagram_Type from Logical to Analysis. Additionally you need to add MDGDgm=BPMN2.0::BPEL; to StyleEx. In case your old diagram is from another MDG you need to modify the existing MDGDgm attribute in StyleEx.
As Uffe noted, the diagram type in the API is r/o. So if you need to change that you would need to do something like
Repository.Execute("UPDATE t_diagram SET Diagram_Type='Analysis' WHERE Diagram_ID=<theId>")
where <theId> would be the correct diagram ID.

Compile error when setting class in VBA [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I copied code from here but I'm getting an error when trying to run the code.
The problem would be in:
Public NextItem As New queueItem
and the error message is:
user-defined type not defined
Is my VBA version not right to do this or am I doing something wrong?
You probably mean this link? The one you provided has the alternative implementation (with arrays, not with references).
I got it to work for me. Steps:
Right click on the VBA project file name, and go to Insert-> Class Module:
Click F4. The Properties window appears. Then go to the class Name and change it to Queue:
Copy and Paste the Queue Class code you found at the web site. Repeat the previous and this step for the QueueItem class (i.e., insert a Class Module, name it QueueItem and copy the code inside that class module).
This time, insert a Module using the same process (not a Class Module, but rather a simple Module). You do not need to give your module a name, Module1 will be OK.
Copy the Sub TestQueue() inside the module and run it. It should work. If you use Option Explicit on your module, you will get an error that element is undefined. So we need to define it: Dim element as Variant, under the first few Dim statements of the subroutine. Then it should run.
The above worked for me, let me know if I can be more precise, or send the file to you.