2016-05-16 6 views
4

私は現在、輸入者のスクリプトSimple VBA ExcelをBellekensのEAインポーターv4に変更しています。シナリオに文脈参照をプログラムで追加する方法

私はシナリオとシナリオのステップを含むユースケースを正常にインポートしました。プログラムでコンテキスト参照を追加する方法を探しています。

私は現在、ユースケースの[プロパティ]> [ルール]> [シナリオ]> [コンテキスト参照]でマニュアルを追加しています。

APIからこれらのコンテキストリファレンスを追加する方法はありますか?

答えて

3

あなたはそれがコンテキストの参照テーブルに表示ユースケースで俳優を関連付ける場合、私はhttp://sparxsystems.com/forums/smf/index.php?topic=4735.0

Basiclyに答えを見つけました。

項目をプログラム的に作成するには、ユースケースとアクタの間にプログラムでリンクを追加するだけです。

1

これは実際には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 
:ここ

は、実際のリンクを行い、その部分です
関連する問題