Modifying an existing ecore file? - eclipse

I try to do a model-to-model transformation using Epsilon. The target model is UML.
If I validate the output model in Eclipse I get the following error message:
"Element 'Activity test' must be owned, but it has no owner."
So I tried to add a statement to my ETL file that adds owners for my activities.
But:
"Internal error: java.lang.IllegalArgumentException: The feature 'owner' is not a valid changeable feature"
Do I have to modify the UML ecore file in order to make 'owner' changeable? If so, how would I do that?
What exactly should be the owner of an activity? Another model element?
Best regards.

The feature Element.owner (which Activity inherits) is a container reference. In order to set it, you have to set the opposite, which is the containment reference Element.ownedElement. The activity should be contained in your root Package or Model in the feature packagedElements.

Related

Strange behavior of inherited properties of UML Stereotypes in Enterprise Architect

I created a profile (MyProfile) which I import via UML profiles in my EA project. MyProfile has one Stereotype (MyStereotype).
If I apply MyStereotype to a class (MyClass), I cannot see any tags of the Stereotype. I see the tags only after I do "Sync Tagged values and Constrains".
So the first question: Is it possible to "automatically" see the tags of a Stereotype in the class to which Stereotype is applied (right after I do apply or the Stereotype). Or "Sync..." is the only command to "push" the tags to the MyClass?
If I change a name of any Attributes of Stereotype AFTER the import, I cannot see the updated name in the MyClass, even if I do "Sync..." command again, after the change of the attribute name. Of course before the "Sync.." I do "Save as a profile" for the appropriate Profile Package.
So the second question is: Is there a way to update the name of an Attribute in the situation OTHER than delete a reference to a package and Import it again (which seems to be inconvenient and error-prone)?
You don't apply a profile to a class but a model. You apply a stereotype of a profile to a class. The synch is only needed if you altered your profile and want to get the newly added stereotype properties (aka EA tagged values) applied to existing stereotyped elements.
No. Automatic changes are not foreseen. For a good reason: altering a profile means you have a new version. Changes to a profile will give the whole model a (completely) different semantics. It's very touchy to alter a profile. It shall be stable and changes to a profile must go with a migration procedure. Rule of thumb: think first, act later.

Acceleo: The generation failed to generate any file

First of all , I am new to Acceleo and the modeling features of eclipse. What I am trying to do is just to create a simple test file. So for starters, I created a main module:
comment encoding = UTF-8 /]
[module generate('file:/C:/Users/maria/Documents/workspace/org.eclipse.acceleo.module.m2tTransformation/model/PSMMetamodel.ecore')]
[template public generateElement( aServicePSM : ServicePSM)]
[comment #main/]
[file ('test.java', false, 'UTF-8')]
Test
[/file]
[/template]
When i run this I get:
The generation failed to generate any file because there are no model elements that matches at least the type of the first parameter of one of your main templates.
The problem may be caused by a problem with the registration of your metamodel, please see the method named "registerPackages" in the Java launcher of your generator. It could also come from a missing [comment #main/] in the template used as the entry point of the generation.
Also the URI I use is the nsURI attribute value I set to the root of metamodel. I am sure that my input model does contain ServicePSM elements.
What am i doing wrong?
Thanks in advance.
This issue will arise in two cases
You do not have an element of the proper type in your model
The metamodel cannot be resolved
From your message I think we can safely ignore 1. since it seems you have at least one ServicePSM in your model, so we need to address 2.
If you look at your module, you've declared it to generate on metamodel file:/C:/Users/maria/Documents/workspace/org.eclipse.acceleo.module.m2tTransformation/model/PSMMetamodel.ecore. However, EMF rarely, if ever, uses this kind of URIs to refer to its metamodels. If you open your actual model with the text editor (right click > Open With > Text Editor), you can look at the URI that's actually been used to reference the metamodel with the "xmlns" tags at the start.
For example, if I open a model that references OCL elements, I can see xmlns:ocl.ecore="http://www.eclipse.org/ocl/1.1.0/Ecore". You have to make sure you use the same URI in your module file as what you see EMF using in the model file, in this case, it would be http://www.eclipse.org/ocl/1.1.0/Ecore.

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.

Error while passing external variable in an if condition in workflow

I have a workflow containing 3 activities. The external variable that is used throughout the workflow is of type Dictionary which contains only two fields: EmailAddress and PhoneNumber(all strings). This is the screenshot of the workflow
So the scenario is that the activity GetParticipant has an outargument of type Dictionary which I am assigning to an external variable called pax. Using the if condition I am checking if the EmailAddress is provided or not.
My problem is that I am getting an error at the if condition:
Reference required to assembly 'Microsoft.WindowsAzure.Storage, Version=4.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' containing the base class 'Microsoft.WindowsAzure.Storage.Table.TableEntity'. Add one to your project.
The mentioned reference is already added to the project and the workflow also imports it. But the error remains. However giving only True as the condition works. What am I doing wrong?
Its seems some reference issue as i can see one bubble near if condition.
Check for dependency of mentioned Dll, can use nugget manager.
You can do below steps.
Delete reference of dll and import.
Clean solution and add reference and set property copy local true and import the namespace in workflow.
Rebuild the solution.

Add Models and Controllers to Orchard

Does anybody know how to create his own models and controllers in Orchard-based projects? I have an empty project and a pack of screenshots for pages, but I don't know with what to begin. If it is possible, please show an example.
Thanks.
You should start off at the documentation page. There is an 'Extending Orchard' section which walks you through how to create a module, with data access, content parts, and content fields.
Use the command line to generate the module using the code generation module
Documentation here
Then install the Code Generation Extensions from Piotr and follow the instructions on his blog. http://www.szmyd.com.pl/blog/generating-orchard-content-parts-via-command-line
Module adds an Orchard command-line command “codegen part”. It’s
syntax is as follows:
codegen part [/Properties:]
For example:
codegen part Modules.Shop ProductPart /Properties: Name:string,
Price:int
Properties is an optional parameter, so if you’d like to create an
empty part you can just write
codegen part Modules.Shop ProductPart
The command creates a handler, driver, model, record, display and
editor shapes and updates the Placement.info file with default
Content:before placement for your part shape. If you provide
/Properties parameter, the model, record and editor shapes will be
filled with appropriate code accordingly.