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
| Quintiq file version 2.0
| #parent: #root
| Method Generate
| {
| TextBody:
| [*
| DomainModel::DomainStream()->( dm )
| {
| gp := this.TG_UIObject().TG_TestGenerator().TG_GlobalParameter();
|
| m := select( dm, QuillModules, qm, qm.Name() = gp.TestModuleName() );
| m.SelectForEdit();
|
| if( this.GenerateAllowed() )
| {
| objecttypename := this.TG_UIObject().CreatedName();
| name := gp.ObjectAttributePrefix() + this.CreatedName();
|
| objdef := select( dm, ObjectDefinitions.Elements, o, o.Name() = objecttypename );
| alreadyexists := exists( objdef, Attributes, attr, attr.Name() = name );
|
| description := ''; // TODO
| accessibility := 'Protected'; // TODO
|
| // Create as attributes, even for Constraint and KPI
| CG_CodeGenerator::CreateUpdateAttribute( gp.TestModuleName(),
| objecttypename,
| name,
| this.ValueType(),
| description,
| accessibility );
|
| // do not re-create/update if the attribute has been created previously, as the implementation detail may be lost.
| if( not alreadyexists )
| {
| // Getter
| name := this.CreatedName();
| body := this.GetGetterBody();
| description := this.GetGetterSetterDescription();
| accessibility := 'Public'; // TODO
|
| CG_CodeGenerator::CreateMethod( gp.TestModuleName(),
| objecttypename,
| name,
| this.ValueType(),
| false,
| body,
| description,
| accessibility,
| NamedValueTree::Create() );
|
| // Setter
| name := this.CreatedName();
| body := this.GetSetterBody();
| description := this.GetGetterSetterDescription();
| accessibility := ifexpr( this.IsReadOnly() or this.IsDeclarative(), 'Protected', 'Public' ); // TODO
|
| cg := CG_CodeGenerator::Construct();
| cg.CreateMethodArgument( 'value',
| this.ValueType(),
| false,
| false,
| false,
| false );
|
| cg_nvt := LibInt_MessageAccessor::CreateEmptyMessage();
| LibInt_MessageAccessor::SetBodyAsObject( cg_nvt, cg );
|
| CG_CodeGenerator::CreateMethod( gp.TestModuleName(),
| objecttypename,
| name,
| objecttypename,
| false,
| body,
| description,
| accessibility,
| cg_nvt );
| }
|
| this.IsCreated( true );
| }
| }
| *]
| }
|
|