Réserver une Démo
Pré. Proc.

The AddNew Function

The AddNew() function is used widely across the API to add new objects to a Collection. In all cases you must provide a Name and Type argument, but what these arguments are used for depends on the actual collection being accessed. For example, when adding a new element to the Elements collection, the 'Type' string can be either a basic UML element type or a fully qualified element type (stereotype) defined by a profile, such as SysML::Requirement differentiated from a standard requirement.

AddNew Attribute Arguments

This table provides guidance in specifying the AddNew arguments for each of the object attributes.

Attribute

Arguments

See also

AttributeConstraints

Name - The name of the constraint.

Type - The constraint type

Attributes

Name - The name of the attribute.

Type - The attribute type.

AttributesEx

Name - The name of the attribute.

Type - The attribute type.

AttributeTags

Name - The fully-qualified name, or plain text.

Type - The value of the Tagged Value.

Authors

Name - The author name.

Type - The author role.

Clients

Name - The client name.

Type - The client role.

ConnectorConstraints

Name - The name of the constraint.

Type - The constraint type.

ConnectorConveyedItems

Name - The GUID of an element.

Type - Not used.

Note: This does not return an object.

Connectors

Name - The name of the connector.

Type - The connector type (for example 'Realization').

ConnectorTags

Name - The fully-qualified name, or plain text.

Type - The value of the Tagged Value.

Constraints

Name - The name of the constraint.

Type - The constraint type.

ConstraintsEx

Name - The name of the constraint.

Type - The constraint type.

CustomProperties

You cannot create these.

DataTypes

Name - The datatype name.

Type - The datatype type.

DiagramLinks

Name - Not used.

Type - The style string (such as 'l=200;r=400;t=200;b=600;')

(You might prefer to leave the Type empty and use the Functions on this interface for size, colors and so on).

DiagramObjects

Name - This can either be an empty string, or it can specify the initial Left, Right, Top and Bottom values for the new DiagramObject. For example:

     diagram.DiagramObjects.AddNew("l=200;r=400;t=200;b=600;", "")

Note: Top and Bottom values should be specified here as positive numbers, but will be set in the repository as negative values.

Type - Unused.

Diagrams

Name - The name of the diagram.

Type - This can be either a standard UML metaclass type (such as 'Class' or 'UseCase') or a fully-qualified metatype defined by an MDG Technology (such as 'BPMN2.0::BusinessProcess' or 'SysML1.4::Block').

Efforts

Name - The name of the effort.

Type - The effort type.

Elements

Name - The name of the new element. If the repository has an auto-name counter defined for the element type being created, pass an empty string to use the auto-name counter instead.

Type - Can be either a standard UML metaclass type (such as 'Class' or 'UseCase') or a fully-qualified metatype defined by an MDG Technology (such as 'BPMN2.0::BusinessProcess' or 'SysML1.4::Block').

Files

Name - The full pathname of the file.

Type - The file type (such as 'Local File' or 'Web Address').

Issues

Name - The name of the issue.

Type - The problem type, (such as 'Issue' or 'Defect')

MethodPostConditions

Name - The name of the constraint.

Type - The constraint type

MethodPreconditions

Name - The name of the constraint.

Type - The constraint type.

Methods

Name - The name of the method.

Type - The return value of the method.

MethodsEx

Name - The name of the method.

Type - The return value of the method.

MethodTags

Name - The fully-qualified name, or plain text.

Type - The value of the Tagged Value.

Metrics

Name - The name of the metric.

Type - The metric type.

Models

Name - The name of the model.

Type - Unused.

Packages

Name - The name of the Package.

Type - Unused.

Parameters

Name - The parameter name.

Type - The parameter type.

ParamTags

Name - The fully-qualified name or plain text.

Type - The value of the Tagged Value.

Partitions

Name - The partition name.

Type - The partition note.

ProjectIssues

Name - The name of the issue.

Type - The issue type (such as 'Request', 'Defect', or 'Release')

ProjectResources

Name - The resource name.

Type - The resource role.

ProjectRole

Name - The role name.

Type - Not used.

PropertyTypes

Name - The tag name.

Type - The description (limited to 50 characters).

Requirements

Name - The name of the requirement.

Type - The requirement type.

RequirementsEx

Name - The name of the requirement.

Type - The requirement type.

Resources

Name - The resource name.

Type - The resource role.

Risks

Name - The name of the risk.

Type - The risk type.

ScenarioExtension

Name - The extension name.

Type - The scenario type

ScenarioStep

Name - The step name.

Type - The ScenarioStep type value.

Scenarios

Name - The name of the scenario.

Type - The scenario type.

Stereotypes

Name - The stereotype name.

Type - The element this applies to.

Note: You can only support multiple elements from within a Profile.

Tasks

Name - The task name.

Type - The task type.

TemplateBindings

Name - The formal name of the binding.

Type - The actual name of the binding or element GUID.

TemplateParameters

Name - The parameter name.

Type - The parameter type

Terms

Name - The term name.

Type - The term type.

Tests

Name - The name of the test.

Type - The test type.

Transitions

Name - The transition name.

Type - The transition value.