Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uaaltools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
universAAL
uaaltools
Commits
6375fe75
Commit
6375fe75
authored
12 years ago
by
Ståle Walderhaug
Browse files
Options
Downloads
Patches
Plain Diff
Added import of associated classes' objecttypes
parent
d5039dd8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
transformations/org.universaal.tools.transformationcommand/transformations/serviceModelUML2Java.m2t
+23
-12
23 additions, 12 deletions
...formationcommand/transformations/serviceModelUML2Java.m2t
with
23 additions
and
12 deletions
transformations/org.universaal.tools.transformationcommand/transformations/serviceModelUML2Java.m2t
+
23
−
12
View file @
6375fe75
...
...
@@ -94,27 +94,38 @@ import org.universAAL.middleware.api.annotation.Outputs;
import org.universAAL.middleware.api.annotation.ServiceOperation;
import org.universAAL.middleware.api.annotation.UniversAALService;'
//dynamic imports. Must get the service that is implemented as well as the classes that are used as properties
//get realization class
String realizationService = self.clientDependency.first().supplier.first().qualifiedName.substringAfter("::").replace("::", ".")
'\nimport ' realizationService ';'
//get the realization class' ownedattributes' type
//dynamic imports. Must import the service that is implemented as well as the classes that are used as properties
var propertyImportHash: Hashtable
self.clientDependency.first().supplier->forEach( prop : uml.Property) {
propertyImportHash.put(prop.name, prop)
}
//get the realization class' properties
//assuming that the interface realizes at least one ontology service class.
//get realization class
var serviceClass: uml.Class
serviceClass = self.clientDependency.first().supplier.first()
//set the ontologyClass name
ontologyClass = serviceClass.name
//get the name of the realizationService and format it for import
String realizationService = serviceClass.qualifiedName.substringAfter("::").replace("::", ".")
'\nimport ' realizationService ';'
//get the serviceclass' ownedattributes' type
serviceClass->forEach( prop : uml.Property) {
propertyImportHash.put(prop.name, prop)
//stdout.println("Found property on serviceClass: " + prop.name + ":" + prop.type)
}
//import the superclasses
while (!serviceClass.general.isEmpty()) {
serviceClass.ownedElement->forEach(prop: uml.Property){
propertyImportHash.put(prop.name, prop)
//if property is an objecttype (class), import its property types as well
if (prop.type.oclIsTypeOf(uml.Class)) {
prop.type.ownedElement->forEach(subProp: uml.Property) {
propertyImportHash.put(subProp.name,subProp)
//stdout.println("SubProperty: " + subProp.name + " inserted")
}
}
}
serviceClass = serviceClass.general.first()
}
...
...
@@ -122,7 +133,7 @@ import org.universAAL.middleware.api.annotation.UniversAALService;'
//print the import statements
propertyImportHash->forEach(prop : uml.Property) {
if (!prop.type==null) {
if (prop.type.oclIsTypeOf(uml.Class)) {
if (prop.type.oclIsTypeOf(uml.Class)
|| prop.type.oclIsTypeOf(uml.Enumeration)
) {
'\nimport ' prop.type.getFullPackageName() ';'
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment