kreta/Tools/CodeGeneration/Templates/UML/UMLReport/ManyMultiplicityCheck.tdl
2024-03-13 00:33:46 +01:00

51 lines
No EOL
1.7 KiB
Text

USES Common/std;
USES Common/Converters;
USES Common/CommonUtil;
USES Common/ModelDataRetreive;
USES Common/StringUtil;
proc main()
Init();
info = "UML check STARTED at \t"time()"\n";
ManyMultiplicityCheck();
info = "UML check STOPPED at \t"time()"\n";
end proc
proc Init()
//Language
setLanguage("SQL");
mkdir([OutputDir]);
// setOutput( [OutputDir] "/" "EntitiesWithoutAttributes.bat" );
end proc
proc ManyMultiplicityCheck()
local many = 0;
local zeromany = 0;
// out = "@echo off\n";
loop (Instances -> MClass as StartClass Where( getStereotype([StartClass]) == "Entity" ) )
loop (StartClass -> Role as StartRole -> MAssociation as Assoc )
loop (Assoc -> MAssociationEnd as EndRole -> MClass as PartnerClass Where ([StartRole.id] < [EndRole.id]) and (getStereotype([PartnerClass])== "Entity") )
if ( [StartRole.multiplicity] == "*" )
[many] = incr([many]);
end if
if ( [StartRole.multiplicity] == "0..*" )
[zeromany] = incr([zeromany]);
end if
if ( [EndRole.multiplicity] == "*" )
[many] = incr([many]);
end if
if ( [EndRole.multiplicity] == "0..*" )
[zeromany] = incr([zeromany]);
end if
// info = "Assoc between [" [StartClass.name] "] [" [PartnerClass.name] "]\n";
// out = "echo between [" [StartClass.name] "] [" [PartnerClass.name] "]\n";
// GenerateEditorNavigation([Assoc.guid]);
end loop
end loop
end loop
// info = "* :" [many] "\n";
// info = "0..* :" [zeromany] "\n";
end proc