-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuAtributo.pas
More file actions
101 lines (73 loc) · 2.55 KB
/
uAtributo.pas
File metadata and controls
101 lines (73 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
unit uAtributo;
interface
uses uIXMI, XMLIntf, XMLDoc;
type
TAtributo = class(TInterfacedObject, iXMI)
private
fId: Integer;
fNome: String;
fTipo: String;
fVisibilidade: String;
function getTipo : String;
function getVisibilidade: String;
public
constructor create;
property Id: Integer read fId write fId;
property Nome: String read fNome write fNome;
property Tipo: String read getTipo write fTipo;
property Visibilidade: String read getVisibilidade write fVisibilidade;
function gerarTag(pXML: TXMLDocument): IXMLNode;
end;
implementation
{ TAtributo }
uses System.SysUtils,
uPropriedades;
constructor TAtributo.create;
begin
Self.fTipo := 'String';
Self.fVisibilidade := 'private';
end;
function TAtributo.gerarTag(pXML: TXMLDocument): IXMLNode;
var
nodeElemento, nodeAtributo, nodeTipo, nodeEstrutura: IXMLNode;
begin
nodeElemento := pXML.CreateNode('UML:Attribute', ntElement);
nodeAtributo := pXML.CreateNode('targetScope', ntAttribute);
nodeAtributo.Text := 'instance';
nodeElemento.AttributeNodes.Add(nodeAtributo);
nodeAtributo := pXML.CreateNode('changeability', ntAttribute);
nodeAtributo.Text := 'addOnly';
nodeElemento.AttributeNodes.Add(nodeAtributo);
nodeAtributo := pXML.CreateNode('ownerScope', ntAttribute);
nodeAtributo.Text := 'instance';
nodeElemento.AttributeNodes.Add(nodeAtributo);
nodeAtributo := pXML.CreateNode('isSpecification', ntAttribute);
nodeAtributo.Text := 'false';
nodeElemento.AttributeNodes.Add(nodeAtributo);
nodeAtributo := pXML.CreateNode('visibility', ntAttribute);
nodeAtributo.Text := Self.Visibilidade;
nodeElemento.AttributeNodes.Add(nodeAtributo);
nodeAtributo := pXML.CreateNode('name', ntAttribute);
nodeAtributo.Text := Self.Nome;
nodeElemento.AttributeNodes.Add(nodeAtributo);
nodeAtributo := pXML.CreateNode('xmi.id', ntAttribute);
nodeAtributo.Text := IntToStr(Self.Id);
nodeElemento.AttributeNodes.Add(nodeAtributo);
nodeTipo := pXML.CreateNode('UML:DataType', ntElement);
nodeAtributo := pXML.CreateNode('xmi.idref', ntAttribute);
nodeAtributo.Text := Self.Tipo;
nodeTipo.AttributeNodes.Add(nodeAtributo);
nodeEstrutura := pXML.CreateNode('UML:StructuralFeature.type', ntElement);
nodeElemento.ChildNodes.Add(nodeEstrutura);
nodeEstrutura.ChildNodes.Add(nodeTipo);
Result := nodeElemento;
end;
function TAtributo.getTipo: String;
begin
Result := tipoComponenteParaXMI(FTipo);
end;
function TAtributo.getVisibilidade: String;
begin
Result := visibilidadeComponenteParaXMI(fVisibilidade);
end;
end.