これは実際にはVBScriptと書いてあります。論理クラスモデルを調べ、そのクラス名がユースケースシナリオステップで使用されている場合は、コンテキスト参照を追加します。
function linkDomainClassesWithUseCases(dictionary,regExp,usecases)
Session.Output usecases.Count & " use cases found"
dim usecase as EA.Element
'loop de use cases
for each usecase in usecases
Repository.WriteOutput "Link to Logical Data Model", "Processing use case: " & usecase.Name, 0
'first remove all automatic traces
removeAllAutomaticTraces usecase
'get all dependencies left
dim dependencies
set dependencies = getDependencies(usecase)
dim scenario as EA.Scenario
'loop scenarios
for each scenario in usecase.Scenarios
dim scenarioStep as EA.ScenarioStep
for each scenarioStep in scenario.Steps
'first remove any additional terms in the uses field
scenarioStep.Uses = removeAddionalUses(dependencies, scenarioStep.Uses)
dim matches
set matches = regExp.Execute(scenarioStep.Name)
dim classesToMatch
set classesToMatch = getClassesToMatchDictionary(matches, dictionary)
dim classToMatch as EA.Element
for each classToMatch in classesToMatch.Items
Session.Output "scenarioStep.Uses before " & scenarioStep.Uses
if not instr(scenarioStep.Uses,"LDM-" & classToMatch.Name) > 0 then
if len(scenarioStep.Uses) > 0 then
'add a space if needed
scenarioStep.Uses = scenarioStep.Uses & " "
end if
'add the name of the class
scenarioStep.Uses = scenarioStep.Uses & "LDM-" & classToMatch.Name
end if
'create the dependency between the use case and the Logical Data Model class
linkElementsWithAutomaticTrace usecase, classToMatch
Session.Output "adding link between " & usecase.Name & " and Logical Data Model class " & classToMatch.Name & " because of step " & scenario.Name & "." & scenarioStep.Name
next
'save scenario step
scenarioStep.Update
scenario.Update
next
next
next
end function
function linkElementsWithAutomaticTrace(sourceElement, TargetElement)
dim trace as EA.Connector
set trace = sourceElement.Connectors.AddNew("","trace")
trace.Alias = "automatic"
trace.SupplierID = TargetElement.ElementID
trace.Update
end function
:ここ
は、実際のリンクを行い、その部分です