kreta/Tools/CodeGeneration/Templates/Common/ModelDataRetreive.tdl
2024-03-13 00:33:46 +01:00

73 lines
3 KiB
Text

//***************************************************************************//
// Megmondja egy osztályról, hogy entitásból származik-e vagy sem //
// visszatérési értékei [true | false] //
//***************************************************************************//
proc IsMasterEntity(MClass)
loop (MClass -> SuperClass as super)
if ( GetStereoType([super]) == "Entity" )
return "false";
else
return "true";
end if
end loop
return "true";
end proc
//***************************************************************************//
// visszaadja az attribútumhoz megadott taggedvalue értékét //
//***************************************************************************//
proc GetTaggedValueOfAttribute(MAttribute, taggedvaluename)
local taggedvalue = "";
loop (MAttribute -> TaggedValue Where toLower([TaggedValue.tag])==toLower([taggedvaluename]))
[taggedvalue] = [TaggedValue.value];
end loop
return [taggedvalue];
end proc
//***************************************************************************//
// visszaadja a megadott típusnévhez tartozó megadott taggedvalue értékért //
//***************************************************************************//
proc GetTaggedValueOfType(typeName,taggedvalue)
loop (Instances -> MClass Where toLower([MClass.name]) == toLower([typeName]) )
loop (MClass -> TaggedValue Where toLower([TaggedValue.tag]) == toLower([taggedvalue]))
return [TaggedValue.value];
end loop
end loop
end proc
//***************************************************************************//
// Meghatározza, hogy a paraméterként kapott asszociációhoz tartozik-e //
// asszociációs osztály, ha igen akkor az asszociációs osztály azonosítóját //
// adja vissza, egyébként üres sztringet. //
//***************************************************************************//
proc HasAssociationClass(MAssociation as Ass)
loop(Ass -> AssociationClass)
return [AssociationClass.id];
end loop
return "";
end proc
//***************************************************************************//
// Listában adja vissza a modelben definiált tipizált dictionary Item //
// típusokat //
//***************************************************************************//
proc GetDictionaryItemTypes()
if ([DI_CACHEINITIALIZED] == "true")
return [DI_CACHE];
end if
local dictitems = "";
loop (Instances -> MClass Where(GetStereoType([MClass]) == "Entity" ) )
loop( MClass -> MAttribute Where ([MAttribute.type] == "DictionaryItem"))
[dictitems] = AddDistinctValueToTokenSet([dictitems], [MAttribute.defaultValue]);
end loop
end loop
[DI_CACHE] = [dictitems];
[DI_CACHEINITIALIZED] = "true";
return [dictitems];
end proc