-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JNG-5840 transform relations - round 1 (#244)
- Loading branch information
Showing
33 changed files
with
1,098 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[src/main/epsilon/**.{eol,etl}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true |
88 changes: 44 additions & 44 deletions
88
judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/equivalentDiscriminated.eol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
operation Any equivalentDiscriminated(transformation : String, id : String, discriminator : String) : Any { | ||
if (self.isUndefined()) { | ||
throw "Transformation called in empty object: " + id + " / " + discriminator + " Transformation: " + transformation; | ||
} | ||
var targetId = id + "/(discriminator/" + discriminator + ")"; | ||
if (self.isUndefined()) { | ||
throw "Transformation called in empty object: " + id + " / " + discriminator + " Transformation: " + transformation; | ||
} | ||
var targetId = id + "/(discriminator/" + discriminator + ")"; | ||
var r = JSL.target.resource; | ||
|
||
// Find the discriminated id in cahe first | ||
var f = __cacheMap.get(targetId); | ||
var f = __cacheMap.get(targetId); | ||
|
||
// Whenit is not found in cache, search from the model and put to cache when found | ||
if (f.isUndefined()) { | ||
f = ecoreUtil.getAllContents(r, false).select(e | e.getId() == targetId).first; | ||
if (f.isDefined()) { | ||
__cacheMap.put(targetId, f); | ||
return f; | ||
} | ||
} | ||
// When the element found, but ID is different, it is missused of discriminated API, error | ||
if (f.isUndefined()) { | ||
f = ecoreUtil.getAllContents(r, false).select(e | e.getId() == targetId).first; | ||
if (f.isDefined()) { | ||
__cacheMap.put(targetId, f); | ||
return f; | ||
} | ||
} | ||
|
||
// When the element found, but ID is different, it is missused of discriminated API, error | ||
if (f.isDefined()) { | ||
if (f.getId() != targetId) { | ||
throw "ID does not match defined in cache: " + f.getId() + " Cache ID: " + targetId; | ||
throw "ID does not match defined in cache: " + f.getId() + " Cache ID: " + targetId; | ||
} | ||
return f; | ||
return f; | ||
} else { | ||
// When no model element with discriminated ID found, call equivalent to create original element or get it | ||
f = self.equivalent(transformation); | ||
// When no model element with discriminated ID found, call equivalent to create original element or get it | ||
f = self.equivalent(transformation); | ||
|
||
if (f.isUndefined()) { | ||
throw "No instance of transformation call: " + id + " / " + discriminator + " Transformation: " + transformation; | ||
} | ||
// When discriminated ID not matches new clone have to be created | ||
if (__originalMap.containsKey(f) and f.getId() != targetId) { | ||
f = ecoreUtil.copy(f); | ||
r.contents.add(f); | ||
if (f.isUndefined()) { | ||
throw "No instance of transformation call: " + id + " / " + discriminator + " Transformation: " + transformation; | ||
} | ||
|
||
// When discriminated ID not matches new clone have to be created | ||
if (__originalMap.containsKey(f) and f.getId() != targetId) { | ||
f = ecoreUtil.copy(f); | ||
r.contents.add(f); | ||
|
||
__cacheMap.put(targetId, f); | ||
// Store traceability links | ||
/* | ||
for (t in transTrace.transformations) { | ||
if (t.source == self and t.rule.name == transformation) { | ||
t.targets.add(f); | ||
} | ||
} */ | ||
__cacheMap.put(targetId, f); | ||
// Store traceability links | ||
/* | ||
for (t in transTrace.transformations) { | ||
if (t.source == self and t.rule.name == transformation) { | ||
t.targets.add(f); | ||
} | ||
} */ | ||
} | ||
f.eResource.setId(f, targetId); | ||
if (not __originalMap.containsKey(f)) { | ||
__originalMap.put(f, targetId); | ||
} | ||
f.eResource.setId(f, targetId); | ||
if (not __originalMap.containsKey(f)) { | ||
__originalMap.put(f, targetId); | ||
} | ||
__cacheMap.put(targetId, f); | ||
return f; | ||
__cacheMap.put(targetId, f); | ||
return f; | ||
} | ||
} | ||
|
||
operation Any equivalentDiscriminated(transformation : String, discriminator : String) : Any { | ||
return self.equivalentDiscriminated(transformation, | ||
"(jsl/" + self.getId() + ")/" + transformation, | ||
discriminator | ||
); | ||
return self.equivalentDiscriminated(transformation, | ||
"(jsl/" + self.getId() + ")/" + transformation, | ||
discriminator | ||
); | ||
} |
32 changes: 16 additions & 16 deletions
32
judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/id.eol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/_importAll.eol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
import "actor/_importActor.eol"; | ||
import "data/_importData.eol"; | ||
import "namespace/_importNamespace.eol"; | ||
import "ui/_importUI.eol"; |
4 changes: 4 additions & 0 deletions
4
judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/actor/_importActor.eol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import "actorAccessDeclaration.eol"; | ||
import "actorDeclaration.eol"; | ||
import "actorGroupDeclaration.eol"; | ||
import "actorLinkDeclaration.eol"; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
10 changes: 2 additions & 8 deletions
10
judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/_importData.eol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
import "actorAccessDeclaration.eol"; | ||
import "actorDeclaration.eol"; | ||
import "actorGroupDeclaration.eol"; | ||
import "actorLinkDeclaration.eol"; | ||
import "dataTypeDeclaration.eol"; | ||
import "modelDeclaration.eol"; | ||
import "entityMemberDeclaration.eol"; | ||
import "enumDeclaration.eol"; | ||
import "enumLiteral.eol"; | ||
import "modifiable.eol"; | ||
import "primitiveDeclaration.eol"; | ||
import "simpleTransferDeclaration.eol"; | ||
import "transferDeclaration.eol"; | ||
import "transferFieldDeclaration.eol"; | ||
import "transferRelationDeclaration.eol"; | ||
import "viewDeclaration.eol"; | ||
import "visibleDeclaration.eol"; | ||
|
14 changes: 14 additions & 0 deletions
14
judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/entityMemberDeclaration.eol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@cached | ||
operation JSL!EntityMemberDeclaration isEager() : Boolean { | ||
return jslUtils.isEager(self); | ||
} | ||
|
||
@cached | ||
operation JSL!EntityMemberDeclaration isCalculated(): Boolean { | ||
return jslUtils.isCalculated(self); | ||
} | ||
|
||
@cached | ||
operation JSL!EntityMemberDeclaration isRequired(): Boolean { | ||
return jslUtils.isRequired(self); | ||
} |
74 changes: 0 additions & 74 deletions
74
judo-tatami-jsl-jsl2ui/src/main/epsilon/operations/jsl/data/modifiable.eol
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.