init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
354
Tools/CodeGeneration/Templates/Server/MetaModel/BaseClasses.tdl
Normal file
354
Tools/CodeGeneration/Templates/Server/MetaModel/BaseClasses.tdl
Normal file
|
@ -0,0 +1,354 @@
|
|||
template GenerateBaseClasses()
|
||||
abstract class MetaElementBase : IMetaDataBase
|
||||
{
|
||||
readonly string _id;
|
||||
readonly Guid _guid;
|
||||
readonly TagedValueCollection _tagedValues;
|
||||
|
||||
public string ID { get { return _id; } }
|
||||
|
||||
public Guid GUID { get { return _guid; } }
|
||||
|
||||
public TagedValueCollection TagedValues { get { return _tagedValues; } }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
protected MetaElementBase(int id, string guid)
|
||||
{
|
||||
_id = id.ToString(CultureInfo.InvariantCulture);
|
||||
_guid = new Guid(guid);
|
||||
_tagedValues = new TagedValueCollection();
|
||||
Name = Description = "";
|
||||
}
|
||||
}
|
||||
|
||||
sealed class MetaPaletteLink : IMetaPaletteLink
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
|
||||
public MetaPaletteCollection PartnerPalettes { get; private set; }
|
||||
|
||||
public IMetaPalette OwnerPalette { get; private set; }
|
||||
|
||||
public IMetaPaletteAssociation Association { get; private set; }
|
||||
|
||||
void SelectChildPalettes(IMetaPalette curentPalette)
|
||||
{
|
||||
foreach (IMetaPalette child in curentPalette.InheritedMetaPalettes.Values)
|
||||
{
|
||||
PartnerPalettes.Add(child.Name, child);
|
||||
SelectChildPalettes(child);
|
||||
}
|
||||
}
|
||||
|
||||
public MetaPaletteLink(IMetaPaletteRole targetRole, IMetaPalette ownerPalette)
|
||||
{
|
||||
OwnerPalette = ownerPalette;
|
||||
Association = targetRole.Association;
|
||||
IMetaPalette endMetaPalette = targetRole.OwnerMetaPalette;
|
||||
IMetaPalette startMetaPalette = targetRole.Association.AssociatedRoles.Values
|
||||
.First(startRole => startRole.ID != targetRole.ID)
|
||||
.OwnerMetaPalette;
|
||||
// név beállítása
|
||||
if (startMetaPalette == OwnerPalette) // sima link, megyezik az asszociációval
|
||||
{
|
||||
Name = string.IsNullOrEmpty(targetRole.Name) ?
|
||||
endMetaPalette.Name : // nincs role definiálva
|
||||
targetRole.Name; // van role definiálva
|
||||
}
|
||||
else // ez a link egy asszociációs osztály szemszögéből látja az asszociációt
|
||||
{
|
||||
Name = string.IsNullOrEmpty(targetRole.Name) ?
|
||||
endMetaPalette.Name + OwnerPalette.Name : // nincs role definiálva
|
||||
targetRole.Name + OwnerPalette.Name; // van role definiálva
|
||||
}
|
||||
// elkészítem a partner paletták listáját
|
||||
PartnerPalettes = new MetaPaletteCollection { { targetRole.OwnerMetaPalette.Name, targetRole.OwnerMetaPalette } };
|
||||
SelectChildPalettes(targetRole.OwnerMetaPalette);
|
||||
// normál asszociációs link
|
||||
if( OwnerPalette != startMetaPalette || Association.AssociationMetaPalette == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
PartnerPalettes.Add(Association.AssociationMetaPalette.Name, Association.AssociationMetaPalette);
|
||||
SelectChildPalettes(Association.AssociationMetaPalette);
|
||||
}
|
||||
}
|
||||
|
||||
sealed class MetaPalette : MetaElementBase, IMetaPalette
|
||||
{
|
||||
public string DBTableName { get; set; }
|
||||
|
||||
// ReSharper disable once MemberCanBePrivate.Local
|
||||
internal string BaseMetaPaletteName { get; set; }
|
||||
|
||||
readonly Lazy<IMetaPalette> _baseMetaPalette;
|
||||
|
||||
IMetaPalette GetBaseMetaPalette()
|
||||
{
|
||||
IMetaPalette baseMetaPalette;
|
||||
if (BaseMetaPaletteName != null &&
|
||||
_palettes.TryGetValue(BaseMetaPaletteName, out baseMetaPalette))
|
||||
{
|
||||
return baseMetaPalette;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IMetaPalette BaseMetaPalette { get { return BaseMetaPaletteName == null ? null : _baseMetaPalette.Value; } }
|
||||
|
||||
// ReSharper disable once MemberCanBePrivate.Local
|
||||
internal string AssociationID { get; set; }
|
||||
|
||||
readonly Lazy<IMetaPaletteAssociation> _association;
|
||||
|
||||
IMetaPaletteAssociation GetAssociation()
|
||||
{
|
||||
IMetaPaletteAssociation association;
|
||||
if (AssociationID != null &&
|
||||
_associations.TryGetValue(AssociationID, out association))
|
||||
{
|
||||
return association;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IMetaPaletteAssociation Association { get { return AssociationID == null ? null : _association.Value; } }
|
||||
|
||||
readonly Lazy<MetaPaletteCollection> _inheritedMetaPalettes;
|
||||
|
||||
MetaPaletteCollection GetInheritedMetaPalettes()
|
||||
{
|
||||
var inheritedMetaPalettes = new MetaPaletteCollection();
|
||||
foreach (IMetaPalette palette in
|
||||
_palettes.Values
|
||||
.Where(p => p.BaseMetaPalette == this))
|
||||
{
|
||||
inheritedMetaPalettes.Add(palette.Name, palette);
|
||||
}
|
||||
return inheritedMetaPalettes;
|
||||
}
|
||||
|
||||
public MetaPaletteCollection InheritedMetaPalettes { get { return _inheritedMetaPalettes.Value; } }
|
||||
|
||||
readonly Lazy<MetaPaletteFieldCollection> _fields;
|
||||
|
||||
MetaPaletteFieldCollection GetAttributes()
|
||||
{
|
||||
var fields = new MetaPaletteFieldCollection();
|
||||
foreach (IMetaPaletteField field in
|
||||
_attributes.Values
|
||||
.Where(f => f.OwnerMetaPalette == this))
|
||||
{
|
||||
fields.Add(field.Name, field);
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
|
||||
public MetaPaletteFieldCollection Attributes { get { return _fields.Value; } }
|
||||
|
||||
readonly Lazy<MetaPaletteFieldCollection> _allFields;
|
||||
|
||||
MetaPaletteFieldCollection GetAllAttributes()
|
||||
{
|
||||
var allFields = new MetaPaletteFieldCollection();
|
||||
for (IMetaPalette current = this; current != null; current = current.BaseMetaPalette)
|
||||
{
|
||||
foreach (IMetaPaletteField field in current.Attributes.Values)
|
||||
{
|
||||
allFields.Add(field.Name, field);
|
||||
}
|
||||
}
|
||||
return allFields;
|
||||
}
|
||||
|
||||
public MetaPaletteFieldCollection AllAttributes { get { return _allFields.Value; } }
|
||||
|
||||
readonly Lazy<MetaPaletteLinkCollection> _links;
|
||||
|
||||
MetaPaletteLinkCollection GetLinks()
|
||||
{
|
||||
var links = new MetaPaletteLinkCollection();
|
||||
for (IMetaPalette current = this; current != null; current = current.BaseMetaPalette)
|
||||
{
|
||||
// ReSharper disable once AccessToModifiedClosure
|
||||
foreach (MetaPaletteLink mpl in
|
||||
current.Roles.Values
|
||||
.Select(startRole => new MetaPaletteLink(
|
||||
startRole.Association.AssociatedRoles.Values.First(endRole => startRole.ID != endRole.ID),
|
||||
current)))
|
||||
{
|
||||
links.Add(mpl.Name, mpl);
|
||||
}
|
||||
if (current.Association == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// ReSharper disable once AccessToModifiedClosure
|
||||
foreach (MetaPaletteLink mpl in
|
||||
current.Association.AssociatedRoles.Values
|
||||
.Select(role => new MetaPaletteLink(role, current)))
|
||||
{
|
||||
links.Add(mpl.Name, mpl);
|
||||
}
|
||||
}
|
||||
return links;
|
||||
}
|
||||
|
||||
public MetaPaletteLinkCollection Links { get { return _links.Value; } }
|
||||
|
||||
readonly Lazy<MetaPaletteRoleCollection> _connectedRoles;
|
||||
|
||||
MetaPaletteRoleCollection GetRoles()
|
||||
{
|
||||
var connectedRoles = new MetaPaletteRoleCollection();
|
||||
foreach (IMetaPaletteRole role in
|
||||
_roles.Values
|
||||
.Where(r => r.OwnerMetaPalette == this))
|
||||
{
|
||||
connectedRoles.Add(role.ID, role);
|
||||
}
|
||||
return connectedRoles;
|
||||
}
|
||||
|
||||
// ReSharper disable once MemberHidesStaticFromOuterClass
|
||||
public MetaPaletteRoleCollection Roles { get { return _connectedRoles.Value; } }
|
||||
|
||||
public MetaPalette(int id, string guid)
|
||||
: base(id, guid)
|
||||
{
|
||||
_baseMetaPalette = new Lazy<IMetaPalette>(GetBaseMetaPalette);
|
||||
_association = new Lazy<IMetaPaletteAssociation>(GetAssociation);
|
||||
_inheritedMetaPalettes = new Lazy<MetaPaletteCollection>(GetInheritedMetaPalettes);
|
||||
_fields = new Lazy<MetaPaletteFieldCollection>(GetAttributes);
|
||||
_allFields = new Lazy<MetaPaletteFieldCollection>(GetAllAttributes);
|
||||
_links = new Lazy<MetaPaletteLinkCollection>(GetLinks);
|
||||
_connectedRoles = new Lazy<MetaPaletteRoleCollection>(GetRoles);
|
||||
}
|
||||
}
|
||||
|
||||
sealed class MetaPaletteField : MetaElementBase, IMetaPaletteField
|
||||
{
|
||||
public AttributeType Type { get; set; }
|
||||
|
||||
public string DBFieldName { get; set; }
|
||||
|
||||
// ReSharper disable once MemberCanBePrivate.Local
|
||||
internal string OwnerMetaPaletteName { get; set; }
|
||||
|
||||
readonly Lazy<IMetaPalette> _ownerMetaPalette;
|
||||
|
||||
IMetaPalette GetOwnerMetaPalette()
|
||||
{
|
||||
IMetaPalette ownerMetaPalette;
|
||||
if (OwnerMetaPaletteName != null &&
|
||||
_palettes.TryGetValue(OwnerMetaPaletteName, out ownerMetaPalette))
|
||||
{
|
||||
return ownerMetaPalette;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IMetaPalette OwnerMetaPalette { get { return OwnerMetaPaletteName == null ? null : _ownerMetaPalette.Value; } }
|
||||
|
||||
public MetaPaletteField(int id, string guid)
|
||||
: base(id, guid)
|
||||
{
|
||||
_ownerMetaPalette = new Lazy<IMetaPalette>(GetOwnerMetaPalette);
|
||||
}
|
||||
}
|
||||
|
||||
sealed class MetaPaletteRole : MetaElementBase, IMetaPaletteRole
|
||||
{
|
||||
public string Multiplicity { get; set; }
|
||||
|
||||
// ReSharper disable once MemberCanBePrivate.Local
|
||||
internal string OwnerMetaPaletteName { get; set; }
|
||||
|
||||
readonly Lazy<IMetaPalette> _ownerMetaPalette;
|
||||
|
||||
IMetaPalette GetOwnerMetaPalette()
|
||||
{
|
||||
IMetaPalette ownerMetaPalette;
|
||||
if (OwnerMetaPaletteName != null &&
|
||||
_palettes.TryGetValue(OwnerMetaPaletteName, out ownerMetaPalette))
|
||||
{
|
||||
return ownerMetaPalette;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IMetaPalette OwnerMetaPalette { get { return OwnerMetaPaletteName == null ? null : _ownerMetaPalette.Value; } }
|
||||
|
||||
// ReSharper disable once MemberCanBePrivate.Local
|
||||
internal string MetaPaletteAssociationName { get; set; }
|
||||
|
||||
readonly Lazy<IMetaPaletteAssociation> _association;
|
||||
|
||||
IMetaPaletteAssociation GetAssociation()
|
||||
{
|
||||
IMetaPaletteAssociation association;
|
||||
if (MetaPaletteAssociationName != null &&
|
||||
_associations.TryGetValue(MetaPaletteAssociationName, out association))
|
||||
{
|
||||
return association;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IMetaPaletteAssociation Association { get { return MetaPaletteAssociationName == null ? null : _association.Value; } }
|
||||
|
||||
public MetaPaletteRole(int id, string guid)
|
||||
: base(id, guid)
|
||||
{
|
||||
_ownerMetaPalette = new Lazy<IMetaPalette>(GetOwnerMetaPalette);
|
||||
_association = new Lazy<IMetaPaletteAssociation>(GetAssociation);
|
||||
}
|
||||
}
|
||||
|
||||
sealed class MetaPaletteAssociation : MetaElementBase, IMetaPaletteAssociation
|
||||
{
|
||||
// ReSharper disable once MemberCanBePrivate.Local
|
||||
internal string AssociationMetaPaletteName { get; set; }
|
||||
|
||||
readonly Lazy<IMetaPalette> _associationMetaPalette;
|
||||
|
||||
IMetaPalette GetAssociationMetaPalette()
|
||||
{
|
||||
IMetaPalette associationMetaPalette;
|
||||
if (AssociationMetaPaletteName != null &&
|
||||
_palettes.TryGetValue(AssociationMetaPaletteName, out associationMetaPalette))
|
||||
{
|
||||
return associationMetaPalette;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IMetaPalette AssociationMetaPalette { get { return AssociationMetaPaletteName == null ? null : _associationMetaPalette.Value; } }
|
||||
|
||||
readonly Lazy<MetaPaletteRoleCollection> _associatedMetaPaletteRoles;
|
||||
|
||||
MetaPaletteRoleCollection GetAssociatedRoles()
|
||||
{
|
||||
var associatedMetaPaletteRoles = new MetaPaletteRoleCollection();
|
||||
foreach (IMetaPaletteRole role in
|
||||
_roles.Values
|
||||
.Where(r => r.Association == this))
|
||||
{
|
||||
associatedMetaPaletteRoles.Add(role.ID, role);
|
||||
}
|
||||
return associatedMetaPaletteRoles;
|
||||
}
|
||||
|
||||
public MetaPaletteRoleCollection AssociatedRoles { get { return _associatedMetaPaletteRoles.Value; } }
|
||||
|
||||
public MetaPaletteAssociation(int id, string guid)
|
||||
: base(id, guid)
|
||||
{
|
||||
_associationMetaPalette = new Lazy<IMetaPalette>(GetAssociationMetaPalette);
|
||||
_associatedMetaPaletteRoles = new Lazy<MetaPaletteRoleCollection>(GetAssociatedRoles);
|
||||
}
|
||||
}
|
||||
end template
|
|
@ -0,0 +1,250 @@
|
|||
//***************************************************************************//
|
||||
// Legenerálja a metamodell teljes forráskódját. //
|
||||
//***************************************************************************//
|
||||
template GenerateMetaModel()
|
||||
[BOM]using System;
|
||||
using SDA.Framework.MetaPaletteShema;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SDA.[ProjectName].MetaPaletteShema
|
||||
{
|
||||
public sealed class [ProjectName]MetaPaletteStructure : AbstractMetaPaletteStructure
|
||||
{
|
||||
#region Base classes
|
||||
|
||||
[GenerateBaseClasses()]
|
||||
|
||||
#endregion Base classes
|
||||
|
||||
#region Static variables
|
||||
|
||||
[loop (Instances -> MClass Where( GetStereoType([MClass]) == "Entity" ))]
|
||||
[GenerateMetaPalette([MClass])]
|
||||
[GenerateMetaPaletteField([MClass])]
|
||||
[GenerateMetaPaletteRole([MClass])]
|
||||
[GenerateMetaPaletteAssociation([MClass])]
|
||||
[end loop]
|
||||
|
||||
static readonly MetaPaletteCollection _palettes = new MetaPaletteCollection();
|
||||
static readonly MetaPaletteFieldCollection _attributes = new MetaPaletteFieldCollection();
|
||||
static readonly MetaPaletteRoleCollection _roles = new MetaPaletteRoleCollection();
|
||||
static readonly MetaPaletteAssociationCollection _associations = new MetaPaletteAssociationCollection();
|
||||
|
||||
#endregion Static variables
|
||||
|
||||
static [ProjectName]MetaPaletteStructure()
|
||||
{
|
||||
IMetaPalette palette;
|
||||
IMetaPaletteField field;
|
||||
IMetaPaletteRole role;
|
||||
IMetaPaletteAssociation association;
|
||||
foreach (var value in
|
||||
typeof([ProjectName]MetaPaletteStructure)
|
||||
.GetFields(BindingFlags.Static|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.DeclaredOnly)
|
||||
.Select(f => f.GetValue(null)))
|
||||
{
|
||||
if ((palette = value as IMetaPalette) != null)
|
||||
{
|
||||
_palettes.Add(palette.Name, palette);
|
||||
}
|
||||
if ((field = value as IMetaPaletteField) != null)
|
||||
{
|
||||
_attributes.Add(field.ID, field);
|
||||
}
|
||||
if ((role = value as IMetaPaletteRole) != null)
|
||||
{
|
||||
_roles.Add(role.ID, role);
|
||||
}
|
||||
if ((association = value as IMetaPaletteAssociation) != null)
|
||||
{
|
||||
_associations.Add(association.ID, association);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Abstract members
|
||||
|
||||
public override MetaPaletteCollection Palettes { get { return _palettes; } }
|
||||
|
||||
public override MetaPaletteFieldCollection Attributes { get { return _attributes; } }
|
||||
|
||||
public override MetaPaletteRoleCollection AssociationRoles { get { return _roles; } }
|
||||
|
||||
public override MetaPaletteAssociationCollection Associations { get { return _associations; } }
|
||||
|
||||
#endregion Abstract members
|
||||
}
|
||||
}
|
||||
end template
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Egy listat keszit a dictionaryitemekrol //
|
||||
//***************************************************************************//
|
||||
template DictionaryItemList()
|
||||
[loop (Instances -> MClass)]
|
||||
[if (IsEntity([MClass]) == "True")]
|
||||
[if (IsProtectedDictionaryItem([MClass]) == "True")]
|
||||
[GetEntityName([MClass])];[ConvertNameToSQLTableScript(GetEntityName([MClass]))];[IsProtectedDictionaryItem([MClass])];[GetPackage([MClass])]
|
||||
[end if]
|
||||
[end if]
|
||||
[end loop]
|
||||
end template
|
||||
|
||||
|
||||
template GenerateMetaPalette(MClass)
|
||||
public static readonly IMetaPalette [MClass.name] = new MetaPalette([MClass.id], "[split([MClass.guid], "_", 1)]")
|
||||
{
|
||||
Name = @"[MClass.name]",
|
||||
[if ([MClass.description]!="")]
|
||||
Description = "[replace([MClass.description],"\"","\\\"")]",
|
||||
[end if]
|
||||
[setVar("hastag", "")]
|
||||
[loop (MClass -> TaggedValue)]
|
||||
[if ([hastag]=="")]
|
||||
TagedValues =
|
||||
{
|
||||
[setVar("hastag", "X")]
|
||||
[end if]
|
||||
{ @"[TaggedValue.tag]", @"[TaggedValue.value]" },
|
||||
[end loop]
|
||||
[if ([hastag]!="")]
|
||||
},
|
||||
[end if]
|
||||
DBTableName = @"[ConvertNameToSQLTableName([MClass.name])]",
|
||||
[setVar("scn","")]
|
||||
[loop (MClass -> SuperClass as sc)]
|
||||
[setVar("scn",[sc.name])]
|
||||
[end loop]
|
||||
[if ([scn]!="")]
|
||||
BaseMetaPaletteName = @"[scn]",
|
||||
[end if]
|
||||
[setVar("associd", "")]
|
||||
[loop (MClass -> MAssociation as assoc )]
|
||||
[setVar("associd", [assoc.id])]
|
||||
[end loop]
|
||||
[if ([associd]!="")]
|
||||
AssociationID = "[associd]",
|
||||
[end if]
|
||||
};
|
||||
end template
|
||||
|
||||
|
||||
template GenerateMetaPaletteField(MClass)
|
||||
[loop (MClass -> MAttribute)]
|
||||
internal static readonly IMetaPaletteField Attribute[MAttribute.id] = new MetaPaletteField([MAttribute.id], "[split([MAttribute.guid], "_", 1)]")
|
||||
{
|
||||
OwnerMetaPaletteName = @"[MClass.name]",
|
||||
Name = @"[MAttribute.name]",
|
||||
Type = AttributeType.[MAttribute.type],
|
||||
[if ([MAttribute.description]!="")]
|
||||
Description = "[replace([MAttribute.description],"\"","\\\"")]",
|
||||
[end if]
|
||||
[setVar("hastag", "")]
|
||||
[loop (MAttribute -> TaggedValue)]
|
||||
[if ([hastag]=="")]
|
||||
TagedValues =
|
||||
{
|
||||
[setVar("hastag", "X")]
|
||||
[end if]
|
||||
{ @"[TaggedValue.tag]", @"[TaggedValue.value]" },
|
||||
[end loop]
|
||||
[if ([MAttribute.type]=="DictionaryItem")]
|
||||
[if ([hastag]=="")]
|
||||
TagedValues =
|
||||
{
|
||||
[setVar("hastag", "X")]
|
||||
[end if]
|
||||
{ @"DictionaryItemType", @"[MAttribute.defaultValue]" },
|
||||
[else]
|
||||
[if ([MAttribute.defaultValue]!="")]
|
||||
[if ([hastag]=="")]
|
||||
TagedValues =
|
||||
{
|
||||
[setVar("hastag", "X")]
|
||||
[end if]
|
||||
{ @"_DefaultValue_", @"[replace([MAttribute.defaultValue],"\"","\"\"")]" },
|
||||
[end if]
|
||||
[end if]
|
||||
[if (GetStereoTypeForAttribute([MAttribute])=="DisplayName")]
|
||||
[if ([hastag]=="")]
|
||||
TagedValues =
|
||||
{
|
||||
[setVar("hastag", "X")]
|
||||
[end if]
|
||||
{ @"_DisplayName_", @"true" },
|
||||
[end if]
|
||||
[if ([hastag]!="")]
|
||||
},
|
||||
[end if]
|
||||
DBFieldName = @"[ConvertNameToSQLColumnName([MAttribute.name])]",
|
||||
};
|
||||
[end loop]
|
||||
end template
|
||||
|
||||
|
||||
template GenerateMetaPaletteRole(MClass)
|
||||
[loop (MClass -> Role as StartRole -> MAssociation -> MAssociationEnd as EndRole -> MClass as EndClass Where( ( GetStereoType([EndClass]) == "Entity" ) and ( [StartRole.id] != [EndRole.id] ) ))]
|
||||
internal static readonly IMetaPaletteRole Role[StartRole.id] = new MetaPaletteRole([StartRole.id], "[split([StartRole.guid], "_", 1)]")
|
||||
{
|
||||
OwnerMetaPaletteName = @"[MClass.name]",
|
||||
[if ([StartRole.name]!="")]
|
||||
Name = @"[StartRole.name]",
|
||||
[end if]
|
||||
[if ([StartRole.description]!="")]
|
||||
Description = "[replace([StartRole.description],"\"","\\\"")]",
|
||||
[end if]
|
||||
[setVar("hastag", "")]
|
||||
[loop (StartRole -> TaggedValue)]
|
||||
[if ([hastag]=="")]
|
||||
TagedValues =
|
||||
{
|
||||
[setVar("hastag", "X")]
|
||||
[end if]
|
||||
{ @"[TaggedValue.tag]", @"[TaggedValue.value]" },
|
||||
[end loop]
|
||||
[if ([hastag]!="")]
|
||||
},
|
||||
[end if]
|
||||
Multiplicity = "[StartRole.multiplicity]",
|
||||
MetaPaletteAssociationName = "[MAssociation.id]",
|
||||
};
|
||||
[end loop]
|
||||
end template
|
||||
|
||||
|
||||
template GenerateMetaPaletteAssociation(MClass)
|
||||
[loop (MClass -> Role as StartRole -> MAssociation -> MAssociationEnd as EndRole -> MClass as EndClass Where( ( GetStereoType([EndClass]) == "Entity" ) and ( [StartRole.id] < [EndRole.id] ) ) )]
|
||||
internal static readonly IMetaPaletteAssociation Association[MAssociation.id] = new MetaPaletteAssociation([MAssociation.id], "[split([MAssociation.guid], "_", 1)]")
|
||||
{
|
||||
[if ([MAssociation.name]!="")]
|
||||
Name = @"[MAssociation.name]",
|
||||
[end if]
|
||||
[if ([MAssociation.description]!="")]
|
||||
Description = "[replace([MAssociation.description],"\"","\\\"")]",
|
||||
[end if]
|
||||
[setVar("hastag", "")]
|
||||
[loop (MAssociation -> TaggedValue)]
|
||||
[if ([hastag]=="")]
|
||||
TagedValues =
|
||||
{
|
||||
[setVar("hastag", "X")]
|
||||
[end if]
|
||||
{ @"[TaggedValue.tag]", @"[TaggedValue.value]" },
|
||||
[end loop]
|
||||
[if ([hastag]!="")]
|
||||
},
|
||||
[end if]
|
||||
[setVar("assocclassname","")]
|
||||
[loop (MAssociation -> AssociationClass)]
|
||||
[setVar("assocclassname",[AssociationClass.name])]
|
||||
[end loop]
|
||||
[if ([assocclassname]!="")]
|
||||
AssociationMetaPaletteName = @"[assocclassname]",
|
||||
[end if]
|
||||
};
|
||||
[end loop]
|
||||
end template
|
Loading…
Add table
Add a link
Reference in a new issue