blob: 30e6d6eb7728df349b319223ef9559cf3b6e4020 [file] [log] [blame]
module JWT2STPIM; -- Module Template
create OUT : stpmodel from IN : jwt;
--Helper, der einen Boolean-Weet zurückgibt, je nachdem ob das Guard auf dem er aufgerufen wird
--eine Subspezifikation enthält
helper context jwt!"model::processes::Guard" def: containsSubspecification():Boolean=
if self.detailedSpecification.subSpecification->isEmpty()
then
false
else
true
endif;
--Fehler im JWT-Metamodell, da Reihenfolge der Guardverknüpfungen nicht beibehalten werden
--helper def: guardSpecsToString(s : Set(jwt!"model::processes::GuardSpecification"), str : String) : String =
-- s -> iterate(e; res : String = ''| if not e.subSpecification->isEmpty() then
-- res + thisModule.guardSpecsToString(e.subSpecification.asSet(),' ' + e.subSpecificationConnector.toString()+' ')
-- else
-- res + str + e.attribute + ' ' + e.operation.toString() + ' ' + e.value.toString()
-- endif);
--rule, die die Überführung einer Action im JWT in einen Step im StpIM beschreibt.
--Dabei wird der Action ein Property NodeType angehängt, dass sie als solche ausweist (Zur Unterscheidung von
-- anderen Knoten).
--Functions werden einfach als Property abgebildet, da es keine passende Entsprechung im StpIM gibt.
--Subfunctions fallen weg, da nur schwer abzubilden und bisher nicht genutzt.
rule Action2Step {
from input : jwt!"model::processes::Action"
to
output : stpmodel!Step (
name <- input.name,
sourceTransitions <- input.out,
targetTransitions <- input.in,
serviceModel <-if not input.executedBy.oclIsUndefined() then
input.executedBy
else
OclUndefined
endif,
--Die Daten werden zu ServiceBindings und hier angehängt
stepbindings <- input.inputs -> union(input.outputs),
-- Properties anhängen
properties <- output.properties.append(stringtopropertymapentry1),
properties <- output.properties.append(stringtopropertymapentry2),
properties <- output.properties.append(stringtopropertymapentry3),
properties <- output.properties.append(stringtopropertymapentry4),
properties <- output.properties.append(stringtopropertymapentry5)
),
--Knotentyp auf Action setzen
property1 : stpmodel!BasicProperty(
key <- 'NodeType',
value <- 'Action'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'NodeType',
value <- property1
),
--Function wird als Property gemapt
property2 : stpmodel!BasicProperty(
key <- 'function',
value <- if input.realizes.oclIsUndefined() then
OclUndefined
else
input.realizes.name
endif
),
stringtopropertymapentry2 : stpmodel!StringToPropertyMapEntry(
key <- 'function',
value <- property2
),
property3 : stpmodel!BasicProperty(
key <- 'targetexecutiontime',
value <- if input.targetexecutiontime.oclIsUndefined() then
OclUndefined
else
input.targetexecutiontime.toString()
endif
),
stringtopropertymapentry3 : stpmodel!StringToPropertyMapEntry(
key <- 'targetexecutiontime',
value <- property3
),
property4 : stpmodel!BasicProperty(
key <- 'role',
value <- if input.performedBy.oclIsUndefined() then
OclUndefined
else
input.performedBy.name
endif
),
stringtopropertymapentry4 : stpmodel!StringToPropertyMapEntry(
key <- 'role',
value <- property4
),
property5 : stpmodel!BasicProperty(
key <- 'organisationunit',
value <- if not input.performedBy.oclIsUndefined() then
if not input.performedBy.performedBy.oclIsUndefined() then
input.performedBy.performedBy.asSequence()->first()
else
OclUndefined
endif
else
OclUndefined
endif
),
stringtopropertymapentry5 : stpmodel!StringToPropertyMapEntry(
key <- 'organisationunit',
value <- property5
)
}
--rule die Activity Edge ohne Guard in eine Transition umsetzt.
--Falls die ActivityEdge zu einer StructuredActivityNode führt oder von einer solchen kommt, wird als nächster/vorheriger Knoten
--der erste (Initial Node) bzw letzte (Final Node) der Structured Activity Node gesetzt.
--Im Fall einer Activity Link Node wird analog verfahren. Activity Link Node entfällt dabei im Zielmodell.
rule ActivityEdge2Transition{
from input : jwt!"model::processes::ActivityEdge"
(input.guard.oclIsUndefined()) --Abprüfen ob die Transition über ein Guard verfügt
--Dient zur Unterscheidung von Transition und TransitionUnderCondition
to output : stpmodel!Transition (
--Falls die Transition von einer Structured Activity Node kommt
source <- if input.source.oclIsTypeOf(jwt!"model::processes::StructuredActivityNode") then
input.source.nodes->select (
e | e.oclIsTypeOf(jwt!"model::processes::FinalNode")).first()
else
-- Falls die Transition von einer Activity Link Node kommt
if input.source.oclIsTypeOf(jwt!"model::processes::ActivityLinkNode") then
input.source.linksto.nodes->select (
e | e.oclIsTypeOf(jwt!"model::processes::FinalNode")).first()
--Sonst
else
input.source
endif
endif,
--Falls die Transition zu einer Structured Activity Node führt
target <- if input.target.oclIsTypeOf(jwt!"model::processes::StructuredActivityNode") then
input.target.nodes->select (
e | e.oclIsTypeOf(jwt!"model::processes::InitialNode")).first()
else
--Falls die Transition zu einer Activity Link Node führt
if input.target.oclIsTypeOf(jwt!"model::processes::ActivityLinkNode") then
input.target.linksto.nodes->select (
e | e.oclIsTypeOf(jwt!"model::processes::InitialNode")).first()
--Sonst
else
input.target
endif
endif
)
}
--rule die Activity Edge mit Guard in eine TransitionUnderCondition umsetzt.
--Für Erklärung zu StructuredActivityNode/ActivityLink Node siehe ActivityEdge2Transition
--Short Description u. Textual Description des Guards werden als Properties an die Transition angehängt.
rule ActivityEdge2TransitionUnderCondition{
from input : jwt!"model::processes::ActivityEdge"
(not input.guard.oclIsUndefined()) --Abprüfen ob die Transition über ein Guard verfügt
--Dient zur Unterscheidung von Transition und TransitionUnderCondition
to output : stpmodel!TransitionUnderCondition (
--Falls die Transition von einer Structured Activity Node kommt
source <- if input.source.oclIsTypeOf(jwt!"model::processes::StructuredActivityNode") then
input.source.nodes->select (
e | e.oclIsTypeOf(jwt!"model::processes::FinalNode")).first()
else
-- Falls die Transition von einer Activity Link Node kommt
if input.source.oclIsTypeOf(jwt!"model::processes::ActivityLinkNode") then
input.source.linksto.nodes->select (
e | e.oclIsTypeOf(jwt!"model::processes::FinalNode")).first()
--Sonst
else
input.source
endif
endif,
--Falls die Transition zu einer Structured Activity Node führt
target <- if input.target.oclIsTypeOf(jwt!"model::processes::StructuredActivityNode") then
input.target.nodes->select (
e | e.oclIsTypeOf(jwt!"model::processes::InitialNode")).first()
else
--Falls die Transition zu einer Activity Link Node führt
if input.target.oclIsTypeOf(jwt!"model::processes::ActivityLinkNode") then
input.target.linksto.nodes->select (
e | e.oclIsTypeOf(jwt!"model::processes::InitialNode")).first()
--Sonst
else
input.target
endif
endif,
--Guard wird zu Condition und hier angehängt
condition <- input.guard,
--Properties anhängen
properties <- output.properties.append(stringtopropertymapentry1),
properties <- output.properties.append(stringtopropertymapentry2)
),
property1 : stpmodel!BasicProperty(
key <- 'shortdescription',
value <- input.guard.shortdescription
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'shortdescription',
value <- property1
),
property2 : stpmodel!BasicProperty(
key <- 'textualdescription',
value <- input.guard.textualdescription
),
stringtopropertymapentry2 : stpmodel!StringToPropertyMapEntry(
key <- 'textualdescription',
value <- property2
)
}
--rule die Activity in einen Process umsetzt.
rule Activity2Process{
from input : jwt!"model::processes::Activity"
to output : stpmodel!Process (
name <- input.name,
steps <- input.nodes,
transitions <- input.edges,
--Proprties anhängen.
properties <- output.properties.append(stringtopropertymapentry1)
),
property1 : stpmodel!BasicProperty(
key <- 'TotalExecutionTime',
value <- input.totalexecutiontime.toString()
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'TotalExecutionTime',
value <- property1
)
}
--rule die ein Guard ohne Subspecifiction in eine PropertyCondition umsetzt.
-- Problem: Operator als String statt Zeichen (z.B. GREATER statt >)
rule Guard2Condition{
from input : jwt!"model::processes::Guard" (not input.containsSubspecification())
to output : stpmodel!PropertyCondition (
propertyName <- input.detailedSpecification.attribute,
operator <- input.detailedSpecification.operation.toString(),
propertyValue <- input.detailedSpecification.value
)
}
--rule die ein Guard mit Subspecifiction in eine ExpressionCondition umsetzt.
--GuardSpecsToString nicht in Verwendung, siehe oben Helper!
rule Guard2ExpressionCondition{
from input : jwt!"model::processes::Guard" (input.containsSubspecification())
to output : stpmodel!ExpressionCondition (
expression <- input.shortdescription
--thisModule.guardSpecsToString(input.detailedSpecification.subSpecification.asSet(), '')
)
}
--rule die eine InitialNode in einen Step mit entsprechndem NodeType Property umsetzt.
rule InitialNode2Step{
from input : jwt!"model::processes::InitialNode"
to output : stpmodel!Step (
-- Falls kein Name definiert -> setze Name auf Initial Node
name <- if input.name.oclIsUndefined() then
'Initial Node'
else
input.name
endif,
sourceTransitions <- input.out,
targetTransitions <- input.in,
properties <- output.properties.append(stringtopropertymapentry1)
),
property1 : stpmodel!BasicProperty(
key <- 'NodeType',
value <- 'Initial Node'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'NodeType',
value <- property1
)
}
--rule die eine FinalNode in einen Step mit entsprechndem NodeType Property umsetzt.
rule FinalNode2Step{
from input : jwt!"model::processes::FinalNode"
to output : stpmodel!Step (
-- Falls kein Name definiert -> setze Name auf Initial Node
name <- if input.name.oclIsUndefined() then
'Final Node'
else
input.name
endif,
sourceTransitions <- input.out,
targetTransitions <- input.in,
properties <- output.properties.append(stringtopropertymapentry1)
),
property1 : stpmodel!BasicProperty(
key <- 'NodeType',
value <- 'Final Node'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'NodeType',
value <- property1
)
}
--rule die eine Role in einen Owner umsetzt.
--Problematisch, da Owner im StpIM keine Atribute hat.
--Und auch nicht vom Typ ConfigurableElement ist.
rule Role2Owner{
from input : jwt!"model::organisations::Role"
to output : stpmodel!Owner (
-- Da Role im JWT an Action(entspricht Step) hängt, Owner im StpIM aber an Service(entspricht Application)
-- muss bei den Services die über owns mit Owner verbunden sind entsprechend verfahren werden
--Verfahren: wähle von allen Applications diejenigen, die mit einer Action verbunden sind, die mit der übergebenen
-- Role verbunden ist. (Die Verbindung Action -> Application ist nur von Action-Seite nachvolziehbar)
owns <- jwt!"model::application::Application".allInstances()
-> select(f | jwt!"model::processes::Action".allInstances()->exists (
e | e.performedBy = input and e.executedBy = f ))
--Es gibt für Owner momentan keine Attribute im StpIM -> Attribut von Step
--name <- input.name
)--,
-- Wenn Owner (geplant?) vom Typ ConfigurableElement wäre könnte man so Organisation anhängen.
--Allerdings nur eine. Wenn man hier wirklich mehrere anhängen wolllte -> ähnlich verfahren wie bei
--Service Binding mit Parameter
-- property1 : stpmodel!BasicProperty(
-- key <- 'Organisation',
-- value <- input.performedBy.asSequence()->first()
-- ),
-- stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
-- key <- 'Oragnisation',
-- value <- property1
-- )
}
--rule die eine Application in einen Service umsetzt. Dabei wird ein zusätzliches Property erstellt,
--das festlegt, ob es sich um einen Webservice handelt. Für WebserviceApplication siehe Regel weiter unten.
rule Application2Service{
-- Es muss festgestellt werden, ob es sich um eine Application (keine WebServiceApplication) handelt,
--sonst wird eine WebServiceApplication doppelt gematcht. Siehe Regel weiter unten.
from input : jwt!"model::application::Application" (input.oclIsTypeOf(jwt!"model::application::Application"))
to output : stpmodel!Service
(
serviceName <- input.name,
serviceType <- if not input.type.oclIsUndefined()
then input.type.name
else OclUndefined
endif,
--Alle ServiceBindings( Data im JWT) anhängen, die mit einer Action verbunden waren,
--die von der Application (input) ausgeführt wird
bindings <- jwt!"model::data::Data".allInstances()
-> select(f | jwt!"model::processes::Action".allInstances()->exists (
e | e.executedBy = input and ((e.inputs ->union(e.outputs)).includes(f)) )),
--Properties anhängen
properties <- output.properties.append(stringtopropertymapentry1),
properties <- output.properties.append(stringtopropertymapentry2),
properties <- output.properties.append(stringtopropertymapentry3),
properties <- output.properties.append(stringtopropertymapentry4),
properties <- output.properties.append(stringtopropertymapentry5)
),
property1 : stpmodel!BasicProperty(
key <- 'IsWebServiceApplication',
value <- 'False'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'IsWebServiceApplication',
value <- property1
),
property2 : stpmodel!BasicProperty(
key <- 'jarArchive',
value <- input.jarArchive
),
stringtopropertymapentry2 : stpmodel!StringToPropertyMapEntry(
key <- 'jarArchive',
value <- property2
),
property3 : stpmodel!BasicProperty(
key <- 'javaClass',
value <- input.javaClass
),
stringtopropertymapentry3 : stpmodel!StringToPropertyMapEntry(
key <- 'javaClass',
value <- property3
),
property4 : stpmodel!BasicProperty(
key <- 'method',
value <- input.jarArchive
),
stringtopropertymapentry4 : stpmodel!StringToPropertyMapEntry(
key <- 'method',
value <- property4
),
property5 : stpmodel!BasicProperty(
key <- 'applicationtype',
value <- if input.type.oclIsUndefined() then
OclUndefined
else
input.type.name
endif
),
stringtopropertymapentry5 : stpmodel!StringToPropertyMapEntry(
key <- 'applicationtype',
value <- property5
)
}
--rule die eine WebServiceApplication in einen Service umsetzt. Dabei wird ein zusätzliches Property erstellt,
--das festlegt, ob es sich um einen Webservice handelt.
rule WebServiceApplication2Service{
from input : jwt!"model::application::WebServiceApplication"
to output : stpmodel!Service
(
serviceName <- input.name,
serviceType <- if not input.type.oclIsUndefined()
then input.type.name
else OclUndefined
endif,
--Alle ServiceBindings( Data im JWT) anhängen, die mit einer Action verbunden waren,
--die von der Application (input) ausgeführt wird
bindings <- jwt!"model::data::Data".allInstances()
-> select(f | jwt!"model::processes::Action".allInstances()->exists (
e | e.executedBy = input and (e.inputs ->union(e.outputs).includes(f)) )),
--Properties anhängen
properties <- output.properties.append(stringtopropertymapentry1),
properties <- output.properties.append(stringtopropertymapentry2),
properties <- output.properties.append(stringtopropertymapentry3),
properties <- output.properties.append(stringtopropertymapentry4),
properties <- output.properties.append(stringtopropertymapentry5),
properties <- output.properties.append(stringtopropertymapentry6)
),
property1 : stpmodel!BasicProperty(
key <- 'IsWebServiceApplication',
value <- 'True'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'IsWebServiceApplication',
value <- property1
),
property2 : stpmodel!BasicProperty(
key <- 'jarArchive',
value <- input.jarArchive
),
stringtopropertymapentry2 : stpmodel!StringToPropertyMapEntry(
key <- 'jarArchive',
value <- property2
),
property3 : stpmodel!BasicProperty(
key <- 'javaClass',
value <- input.javaClass
),
stringtopropertymapentry3 : stpmodel!StringToPropertyMapEntry(
key <- 'javaClass',
value <- property3
),
property4 : stpmodel!BasicProperty(
key <- 'method',
value <- input.jarArchive
),
stringtopropertymapentry4 : stpmodel!StringToPropertyMapEntry(
key <- 'method',
value <- property4
),
property5 : stpmodel!BasicProperty(
key <- 'Operation',
value <- input.Interface
),
stringtopropertymapentry5 : stpmodel!StringToPropertyMapEntry(
key <- 'Operation',
value <- property5
),
property6 : stpmodel!BasicProperty(
key <- 'Interface',
value <- input.Interface
),
stringtopropertymapentry6 : stpmodel!StringToPropertyMapEntry(
key <- 'Interface',
value <- property6
)
}
--rule die Data ohne Parameter in ein ServiceBinding umsetzt.
--So werden keine leeren Listen mit Parametern und Mappings erzeugt.
rule Data2ServiceBinding{
--Überprüfen, ob Parameter vorhanden sind, wenn ja wird die Rule weiter unten angewandt
from input : jwt!"model::data::Data" ( input.parameters->isEmpty())
to output : stpmodel!ServiceBinding (
name <- input.name,
properties <- output.properties.append(stringtopropertymapentry1),
properties <- output.properties.append(stringtopropertymapentry2)
-- Ursprünglich für Parameter/Mappings vorgesehener Code
--Erzeugt für Parameter/Mappings einzelne Properties
-- properties <- output.properties->union(input.parameters),
-- properties <- output.properties->union( jwt!"model::data::DataMapping".allInstances()->select(
-- e | jwt!"model::processes::Action".allInstances() -> exists(
-- f | (f.inputs.asSet()->includes(input) or f.outputs.asSet()->includes(input)) and
-- f.mappings.includes(e) ) and (input.parameters.includes(e.parameter) or
-- input.parameters.includes(e.boundParameter)) ))
),
property1 : stpmodel!BasicProperty(
key <- 'DataType',
value <- if input.dataType.oclIsUndefined() then
OclUndefined
else
input.dataType.name
endif
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'DataType',
value <- property1
),
property2 : stpmodel!BasicProperty(
key <- 'InformationType',
value <- if input.informationType.oclIsUndefined() then
OclUndefined
else
input.informationType.name
endif
),
stringtopropertymapentry2 : stpmodel!StringToPropertyMapEntry(
key <- 'InformationType',
value <- property2
)
}
--rule die Data mit Parametern in ein ServiceBinding umsetzt.
--Es werden Listen (MapProperties) für die Parameter / Mappings erstellt.
rule Data2ServiceBindingParameters{
from input : jwt!"model::data::Data" (not input.parameters->isEmpty())
to output : stpmodel!ServiceBinding (
name <- input.name,
--Properties anhängen
properties <- output.properties.append(stringtopropertymapentry1),
properties <- output.properties.append(stringtopropertymapentry2),
properties <- output.properties.append(stringtopropertymapentry3),
properties <- output.properties.append(stringtopropertymapentry4),
properties <- output.properties.append(stringtopropertymapentry5)
),
property1 : stpmodel!BasicProperty(
key <- 'DataType',
value <- if input.dataType.oclIsUndefined() then
OclUndefined
else
input.dataType.name
endif
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'DataType',
value <- property1
),
property2 : stpmodel!BasicProperty(
key <- 'InformationType',
value <- if input.informationType.oclIsUndefined() then
OclUndefined
else
input.informationType.name
endif
),
stringtopropertymapentry2 : stpmodel!StringToPropertyMapEntry(
key <- 'InformationType',
value <- property2
),
--Das hier ist ein Map Property -> an dieses können wiederum weitere Properties angehängt werden.
property3 : stpmodel!MapProperty(
key <- 'Input Parameters',
--Alle Input Parameter anhängen
value <- input.parameters->select(e| e.oclIsTypeOf(jwt!"model::data::InputParameter"))
),
stringtopropertymapentry3 : stpmodel!StringToPropertyMapEntry(
key <- 'Input Parameters',
value <- property3
),
--Das hier ist ein Map Property -> an dieses können wiederum weitere Properties angehängt werden.
property4 : stpmodel!MapProperty(
key <- 'Output Parameters',
--Alle Output Parameter anhängen
value <- input.parameters->select(e| e.oclIsTypeOf(jwt!"model::data::OutputParameter"))
),
stringtopropertymapentry4 : stpmodel!StringToPropertyMapEntry(
key <- 'Output Parameters',
value <- property4
),
--Das hier ist ein Map Property -> an dieses können wiederum weitere Properties angehängt werden.
property5 : stpmodel!MapProperty(
key <- 'Mappings',
--Alle Mappings auswählen, die mit der entsprechenden Action verknüpft sind,
-- und die Parameter enthalte, die auch in Data (input) vorkommen.
value <- jwt!"model::data::DataMapping".allInstances()->select(
e | jwt!"model::processes::Action".allInstances() -> exists(
f | (f.inputs.asSet()->includes(input) or f.outputs.asSet()->includes(input)) and
f.mappings.includes(e) ) and (input.parameters.includes(e.parameter) or
input.parameters.includes(e.boundParameter)) )
),
stringtopropertymapentry5 : stpmodel!StringToPropertyMapEntry(
key <- 'Mappings',
value <- property5
)
}
--rule die MergeNode in einen Step mit entsprchendem NodeType Property umsetzt.
--Ein-und ausgehende Transitionen werden bereits durch die ActivityEdge2Transition Rule bearbeitet,
--und brauchen hier nicht extra gemapt werden.
rule MergeNode2Step{
from input : jwt!"model::processes::MergeNode"
to output : stpmodel!Step (
name <- input.name,
properties <- output.properties.append(stringtopropertymapentry1)
),
property1 : stpmodel!BasicProperty(
key <- 'NodeType',
value <- 'Merge Node'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'NodeType',
value <- property1
)
}
--rule die ForkNode in einen Step mit entsprchendem NodeType Property umsetzt.
--Ein-und ausgehende Transitionen werden bereits durch die ActivityEdge2Transition Rule bearbeitet,
--und brauchen hier nicht extra gemapt werden.
rule ForkNode2Step{
from input : jwt!"model::processes::ForkNode"
to output : stpmodel!Step (
name <- input.name,
properties <- output.properties.append(stringtopropertymapentry1)
),
property1 : stpmodel!BasicProperty(
key <- 'NodeType',
value <- 'Fork Node'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'NodeType',
value <- property1
)
}
--rule die DecisionNode in einen Step mit entsprchendem NodeType Property umsetzt.
--Ein-und ausgehende Transitionen werden bereits durch die ActivityEdge2Transition Rule bearbeitet,
--und brauchen hier nicht extra gemapt werden.
rule DecisionNode2Step{
from input : jwt!"model::processes::DecisionNode"
to output : stpmodel!Step (
name <- input.name,
properties <- output.properties.append(stringtopropertymapentry1)
),
property1 : stpmodel!BasicProperty(
key <- 'NodeType',
value <- 'Decision Node'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'NodeType',
value <- property1
)
}
--rule die JoinNode in einen Step mit entsprchendem NodeType Property umsetzt.
--Ein-und ausgehende Transitionen werden bereits durch die ActivityEdge2Transition Rule bearbeitet,
--und brauchen hier nicht extra gemapt werden.
rule JoinNode2Step{
from input : jwt!"model::processes::JoinNode"
to output : stpmodel!Step (
name <- input.name,
properties <- output.properties.append(stringtopropertymapentry1)
),
property1 : stpmodel!BasicProperty(
key <- 'NodeType',
value <- 'Join Node'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'NodeType',
value <- property1
)
}
--rule die StructuredActivityNode in einen Process umsetzt.
rule StructuredActivityNode2Process{
from input : jwt!"model::processes::StructuredActivityNode"
to output : stpmodel!Process (
steps <- input.nodes,
transitions <- input.edges,
name <- input.name
)
}
--Rule, die ursprünglich ApplicationType in ServiceClassification umsetzen sollte.
--Da aber ServiceClassification keine Attribute enthält (StpIM nicht fertig) verworfen.
--rule ApplicationType2ServiceClassification{
-- from input : jwt!"model::application::ApplicationType"
-- to output : stpmodel!ServiceClassification (
-- name <- input.name
--)
--}
--rule die Event in einen Step mit entsprechendem Node Type und einem Observavle Attribute umsetzt.
rule Event2Step{
from input : jwt!"model::events::Event"
to output : stpmodel!Step (
name <- input.name,
properties <- output.properties.append(stringtopropertymapentry1),
observableAttributes <- output.observableAttributes.append(obsAttribute)
),
property1 : stpmodel!BasicProperty(
key <- 'NodeType',
value <- 'Event'
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'NodeType',
value <- property1
),
--Soo viel Sinn macht das hier bis jetz nicht...
obsAttribute : stpmodel!ObservableAttribute(
name <- input.name
)
}
--rule die einen Parameter in ein Property und das dazugehörige StringToPropertyMapEntry umsetzt.
rule Parameter2Property{
from input : jwt!"model::data::Parameter"
to output : stpmodel!StringToPropertyMapEntry (
key <-'Parameter: '+ input.name,
value <- property1
),
property1 : stpmodel!BasicProperty(
key <- 'Parameter: '+ input.name,
value <- input.value
)
}
--rule die ein DataMapping in ein Property und das dazugehörige StringToPropertyMapEntry umsetzt.
rule DataMapping2Property{
from input : jwt!"model::data::DataMapping"
to output : stpmodel!StringToPropertyMapEntry (
key <-'Mapping: '+ input.name,
value <- property1
),
property1 : stpmodel!BasicProperty(
key <-'Mapping: '+ input.name,
value <- input.parameter.name + ' -> ' + input.boundParameter.name
)
}
--rule die Model in JWT in das stpim-Wurzelelement StpIM umsetzt.
--Zusätzlich werden die ProcessCollection und die ServiceCollection erstellt, die alle Processes / Services
-- im StpIM enthalten.
rule Model2StpIm{
from input : jwt!"model::core::Model"
to output : stpmodel!StpIntermediateModel (
serviceCollection <- servicecoll,
processCollection <- processcoll,
properties <- output.properties.append(stringtopropertymapentry1),
properties <- output.properties.append(stringtopropertymapentry2),
properties <- output.properties.append(stringtopropertymapentry3),
properties <- output.properties.append(stringtopropertymapentry4)
),
property1 : stpmodel!BasicProperty(
key <- 'author',
value <- input.author
),
stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
key <- 'author',
value <- property1
),
property2 : stpmodel!BasicProperty(
key <- 'version',
value <- input.version
),
stringtopropertymapentry2 : stpmodel!StringToPropertyMapEntry(
key <- 'version',
value <- property2
),
property3 : stpmodel!BasicProperty(
key <- 'description',
value <- input.description
),
stringtopropertymapentry3 : stpmodel!StringToPropertyMapEntry(
key <- 'description',
value <- property3
),
property4 : stpmodel!BasicProperty(
key <- 'fileversion',
value <- input.fileversion
),
stringtopropertymapentry4 : stpmodel!StringToPropertyMapEntry(
key <- 'fileversion',
value <- property4
),
--ServiceCollection erzegen
servicecoll : stpmodel!ServiceCollection(
services <- jwt!"model::application::Application".allInstances()
),
--ProcessCollection erzeugen, Structured Activity Nodes werden ebenfalls zu Prozessen und müssen deswegen berücksichtift werden.
processcoll : stpmodel!ProcessCollection(
processes <- jwt!"model::processes::Activity".allInstances()->union(jwt!"model::processes::StructuredActivityNode".allInstances())
)
}
--rule, die ursprünglich ActivityLinkNode in einen Step überführen sollte.
--Nicht mehr verwendet.
--rule ActivityLinkNode2Step{
-- from input : jwt!"model::processes::ActivityLinkNode"
-- to output : stpmodel!Step (
-- name <- if input.name.oclIsUndefined() then
-- 'ActivityLink Node'
-- else
-- input.name
-- endif,
-- properties <- output.properties.append(stringtopropertymapentry1)
-- ),
-- property1 : stpmodel!BasicProperty(
-- key <- 'NodeType',
-- value <- 'ActivityLink Node'
-- ),
-- stringtopropertymapentry1 : stpmodel!StringToPropertyMapEntry(
-- key <- 'NodeType',
-- value <- property1
-- ),
-- linkToActivity : stpmodel!Transition(
-- source <- output,
-- target <- input.linksto.nodes->select (
-- e | e.oclIsTypeOf(jwt!"model::processes::InitialNode")).first()
-- )
--}
--data mapping