使用javascript在enterprise architect中创建批处理标记

使用javascript在enterprise architect中创建批处理标记,javascript,enterprise-architect,requirements,Javascript,Enterprise Architect,Requirements,我创建了一个EA项目,其中包含一系列需求,需要导入到Redmine中。我们希望使用一种工具,而不是手工操作 这个工具需要为同步数据使用一些特定的标记,所以我需要为每个需求创建五个标记,而我不能为每个需求创建五个标记,因为我已经有数百个了 我已经开始检查javascript脚本,在一个示例中,我注意到一个类似的函数: /** * Sets the specified TaggedValue on the provided element. If the provided element does

我创建了一个EA项目,其中包含一系列需求,需要导入到Redmine中。我们希望使用一种工具,而不是手工操作 这个工具需要为同步数据使用一些特定的标记,所以我需要为每个需求创建五个标记,而我不能为每个需求创建五个标记,因为我已经有数百个了

我已经开始检查javascript脚本,在一个示例中,我注意到一个类似的函数:

/**
 * Sets the specified TaggedValue on the provided element. If the provided element does not already
 * contain a TaggedValue with the specified name, a new TaggedValue is created with the requested
 * name and value. If a TaggedValue already exists with the specified name then action to take is
 * determined by the replaceExisting variable. If replaceExisting is set to true, the existing value
 * is replaced with the specified value, if not, a new TaggedValue is created with the new value.
 *
 * @param[in] theElement (EA.Element) The element to set the TaggedValue value on
 * @param[in] taggedValueName (String) The name of the TaggedValue to set
 * @param[in] taggedValueValue (variant) The value of the TaggedValue to set
 * @param[in] replaceExisting (boolean) If a TaggedValue of the same name already exists, specifies 
 * whether to replace it, or create a new TaggedValue.
 */
function TVSetElementTaggedValue( theElement /* : EA.Element */, taggedValueName /* : String */, taggedValueValue /* : variant */, replaceExisting /* : boolean */ ) /* : void */
{
    if ( theElement != null && taggedValueName.length > 0 )
    {
        var taggedValue as EA.TaggedValue;
        taggedValue = null;

        // If replace existing was specified then attempt to get a tagged value from the element
        // with the provided name
        if ( replaceExisting )
            taggedValue = theElement.TaggedValues.GetByName( taggedValueName );

        if ( taggedValue == null )
        {
            taggedValue = theElement.TaggedValues.AddNew( taggedValueName, taggedValueValue );
        }
        else
        {
            taggedValue.Value = taggedValueValue;
        }

        taggedValue.Update();
    }
}
我需要做的是如何检索存储在特定包中的需求列表,以及如何循环它们以应用此功能

任何帮助都将不胜感激。

基本上:

for e in myPackage.elements:
    if e.type == 9: #code for Requirement
        print(e.name)
        for t in e.taggedValues:
            print(t.name, t.value, t.notes)
将列出包的元素及其所有标记值

这是Python,但翻译成其他语言并不困难