init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,494 @@
|
|||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// REKURZÍV! //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
template GenerateMidasBaseSetLoadEntityCore(MClass, offset, entityname, readername)
|
||||
// [MClass.name] mezői
|
||||
[setVar("counter", [offset])]
|
||||
[loop (MClass -> MAttribute where [MAttribute.name] != [MClass.name])]
|
||||
if (reader.IsDBNull([counter]) == false)
|
||||
{
|
||||
[entityname].[MAttribute.name] = [GenerateReaderRead([MAttribute.type], [counter], [readername])];
|
||||
}
|
||||
else
|
||||
{
|
||||
[entityname].[MAttribute.name] = [GetCSharpDefaultValueOfAttribute([MAttribute])]; // Attribútum
|
||||
}
|
||||
[setVar("counter", incr([counter]))]
|
||||
[end loop]
|
||||
[/* Asszociacios mezok */]
|
||||
[loop (MClass -> Role as StartRole -> MAssociation as CurrentAssoc -> MAssociationEnd as EndRole -> MClass as PartnerClass where (([StartRole.id] != [EndRole.id]) and GetStereoType([PartnerClass]) == "Entity"))]
|
||||
[if (HasAssociationClass([CurrentAssoc]) == "")]
|
||||
[if ([EndRole.multiplicity] == "1" or [EndRole.multiplicity] == "0..1")]
|
||||
if ([readername].IsDBNull([counter]) == false)
|
||||
{
|
||||
[entityname].[ConvertRoleToName([EndRole])] = [GenerateReaderRead("ID", [counter], [readername])]; // Asszociációs mező
|
||||
}
|
||||
else
|
||||
{
|
||||
[entityname].[ConvertRoleToName([EndRole])] = [GetCSharpDefaultValueOfType("ID")];
|
||||
}
|
||||
[setVar("counter", incr([counter]))]
|
||||
[end if]
|
||||
[end if]
|
||||
[end loop]
|
||||
[/* Ha az entitas asszociacios osztaly, akkor ilyenek is vannak */]
|
||||
[loop (MClass -> MAssociation as CurrentAssoc -> MAssociationEnd as StartRole -> MClass as StartClass where (GetStereoType([StartClass]) == "Entity"))]
|
||||
[loop (CurrentAssoc -> MAssociationEnd as EndRole -> MClass as EndClass where([StartRole.id] < [EndRole.id] and GetStereoType([EndClass]) == "Entity" ))]
|
||||
[entityname].[ConvertRoleToName([StartRole])] = [GenerateReaderRead("ID", [counter], [readername])]; // Asszociációs mező
|
||||
[setVar("counter", incr([counter]))]
|
||||
[entityname].[ConvertRoleToName([EndRole])] = [GenerateReaderRead("ID", [counter], [readername])]; // Asszociációs mező
|
||||
[setVar("counter", incr([counter]))]
|
||||
[end loop]
|
||||
[end loop]
|
||||
[if (GetBaseClassName([MClass], [""]) != [""] )]
|
||||
[loop (MClass -> SuperClass as BASECLASS)]
|
||||
[GenerateMidasBaseSetLoadEntityCore([BASECLASS], [counter], [entityname], [readername])][break]
|
||||
[end loop]
|
||||
[else]
|
||||
|
||||
[entityname].Serial = [GenerateReaderRead("Integer", [counter], [readername])];
|
||||
[end if]
|
||||
end template
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// REKURZÍV! //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
template GenerateMidasFieldListWithBaseClassFields(MClass)
|
||||
[loop (MClass->MAttribute)]
|
||||
"[ConvertNameToSQLTableName([MClass.name])].[ConvertNameToSQLColumnName([MAttribute.name])], " +
|
||||
[end loop]
|
||||
[loop (MClass -> Role as StartRole -> MAssociation as CurrentAssoc -> MAssociationEnd as EndRole -> MClass as PartnerClass where (([StartRole.id] != [EndRole.id]) and GetStereoType([PartnerClass]) == "Entity"))]
|
||||
[if (HasAssociationClass([CurrentAssoc]) == "")]
|
||||
[if ([EndRole.multiplicity] == "1")]
|
||||
"[ConvertNameToSQLTableName([MClass.name])].[ConvertNameToSQLColumnName(ConvertRoleToName([EndRole]))], " + // Kötelező asszociációs kapcsolómező
|
||||
[else]
|
||||
[if ([EndRole.multiplicity] == "0..1")]
|
||||
[if (([StartRole.multiplicity] == "1..*") or ([StartRole.multiplicity] == "*") or ([StartRole.multiplicity] == "0..*"))]
|
||||
"[ConvertNameToSQLTableName([MClass.name])].[ConvertNameToSQLColumnName(ConvertRoleToName([EndRole]))], " + // Opcionális asszociációs kapcsolómező
|
||||
[else]
|
||||
[if ([StartRole.multiplicity] == "1")]
|
||||
"[ConvertNameToSQLTableName([PartnerClass.name])].ID as [ConvertNameToSQLColumnName(ConvertRoleToName([EndRole]))], " + // a masik tablaban van a kapcsolomezo
|
||||
[else]
|
||||
"[ConvertNameToSQLTableName(ConvertAssociationRolesToSwitchTableName([EndRole],[StartRole]))].[ConvertNameToSQLColumnName(ConvertRoleToName([EndRole]))], " + // kapcsolotabla van
|
||||
[end if]
|
||||
[end if]
|
||||
[end if]
|
||||
[end if]
|
||||
[end if]
|
||||
[end loop]
|
||||
[loop (MClass -> MAssociation as CurrentAssoc -> MAssociationEnd as StartRole -> MClass as StartClass where (GetStereoType([StartClass]) == "Entity"))]
|
||||
[loop (CurrentAssoc -> MAssociationEnd as EndRole -> MClass as EndClass where([StartRole.id] < [EndRole.id] and GetStereoType([EndClass]) == "Entity" ))]
|
||||
"[ConvertNameToSQLTableName([MClass.name])].[ConvertNameToSQLColumnName(ConvertRoleToName([StartRole]))], " + // Asszociációs mező
|
||||
"[ConvertNameToSQLTableName([MClass.name])].[ConvertNameToSQLColumnName(ConvertRoleToName([EndRole]))], " + // Asszociációs mező
|
||||
[end loop]
|
||||
[end loop]
|
||||
[if (IsMasterEntity([MClass]) == "false")]
|
||||
[loop (MClass -> SuperClass as BASECLASS)]
|
||||
[GenerateMidasFieldListWithBaseClassFields([BASECLASS])][break]
|
||||
[end loop]
|
||||
[else]
|
||||
"[ConvertNameToSQLTableName([MClass.name])].SERIAL " +
|
||||
[end if]
|
||||
end template
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
proc GenerateMidasTableListCore(MClass, tables)
|
||||
loop (MClass -> Role as StartRole -> MAssociation as CurrentAssoc -> MAssociationEnd as EndRole -> MClass as PartnerClass where (([StartRole.id] != [EndRole.id]) and GetStereoType([PartnerClass]) == "Entity"))
|
||||
if (HasAssociationClass([CurrentAssoc]) == "")
|
||||
if ([EndRole.multiplicity] == "0..1")
|
||||
if (([StartRole.multiplicity] == "1..*") or ([StartRole.multiplicity] == "*") or ([StartRole.multiplicity] == "0..*"))
|
||||
else
|
||||
if ([StartRole.multiplicity] == "1")
|
||||
[tables] = AddDistinctValueToTokenSet([tables], [PartnerClass.name]);
|
||||
//info = "\n>>>>>>>>>>>>>" [tables] "<<<<<<<<<<<<<<<\n";
|
||||
else
|
||||
[tables] = AddDistinctValueToTokenSet([tables], ConvertAssociationRolesToSwitchTableName([EndRole],[StartRole]));
|
||||
//info = "\n>>>>>>>>>>>>>" [tables] "<<<<<<<<<<<<<<<\n";
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end loop
|
||||
return [tables];
|
||||
end proc
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
proc GenerateMidasTableList(MClass)
|
||||
local tables = "";
|
||||
[tables] = GenerateMidasTableListCore([MClass], [tables]);
|
||||
if (IsMasterEntity([MClass]) == "false")
|
||||
loop (MClass -> SuperClass as BASECLASS)
|
||||
[tables] = GenerateMidasTableListCore([BASECLASS], [tables]);
|
||||
break;
|
||||
end loop
|
||||
end if
|
||||
|
||||
return [tables];
|
||||
end proc
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// REKURZÍV! //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
template GenerateMidasBaseSetLoaderWhereClause(MClass)
|
||||
[loop (MClass -> Role as StartRole -> MAssociation as CurrentAssoc -> MAssociationEnd as EndRole -> MClass as PartnerClass where (([StartRole.id] != [EndRole.id]) and GetStereoType([PartnerClass]) == "Entity"))]
|
||||
[if (HasAssociationClass([CurrentAssoc]) == "")]
|
||||
[if ([EndRole.multiplicity] == "0..1")]
|
||||
[if (([StartRole.multiplicity] == "1..*") or ([StartRole.multiplicity] == "*") or ([StartRole.multiplicity] == "0..*"))]
|
||||
[else]
|
||||
[if ([StartRole.multiplicity] == "1")]
|
||||
"([ConvertNameToSQLTableName([PartnerClass.name])].[ConvertNameToSQLColumnName(ConvertRoleToName([StartRole]))] = [ConvertNameToSQLTableName([MClass.name])].ID) and " + // a masik tablaban van a kapcsolomezo
|
||||
[else]
|
||||
"([ConvertNameToSQLTableName(ConvertAssociationRolesToSwitchTableName([EndRole],[StartRole]))].[ConvertNameToSQLColumnName(ConvertRoleToName([StartRole]))] = [ConvertNameToSQLTableName([MClass.name])].ID) and " + // kapcsolotabla van
|
||||
[end if]
|
||||
[end if]
|
||||
[end if]
|
||||
[end if]
|
||||
[end loop]
|
||||
[if (IsMasterEntity([MClass]) == "false")]
|
||||
[loop (MClass -> SuperClass as BASECLASS)]
|
||||
[GenerateMidasBaseSetLoaderWhereClause([BASECLASS])][break]
|
||||
[end loop]
|
||||
[end if]
|
||||
end template
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// REKURZÍV! //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
template GenerateJoins(MClass as current, MClass as master)
|
||||
[loop (current -> Role as StartRole -> MAssociation as CurrentAssoc -> MAssociationEnd as EndRole -> MClass as PartnerClass where (([StartRole.id] != [EndRole.id]) and GetStereoType([PartnerClass]) == "Entity"))]
|
||||
[if (HasAssociationClass([CurrentAssoc]) == "")]
|
||||
[if ([EndRole.multiplicity] == "0..1")]
|
||||
[if (([StartRole.multiplicity] == "1..*") or ([StartRole.multiplicity] == "*") or ([StartRole.multiplicity] == "0..*"))]
|
||||
[else]
|
||||
[if ([StartRole.multiplicity] == "1")]
|
||||
"left join [ConvertNameToSQLTableName([PartnerClass.name])] on [ConvertNameToSQLTableName([PartnerClass.name])].[ConvertNameToSQLColumnName(ConvertRoleToName([StartRole]))] = [ConvertNameToSQLTableName([master.name])].ID " + // a masik tablaban van a kapcsolomezo
|
||||
[else]
|
||||
"left join [ConvertNameToSQLTableName(ConvertAssociationRolesToSwitchTableName([EndRole],[StartRole]))] on [ConvertNameToSQLTableName(ConvertAssociationRolesToSwitchTableName([EndRole],[StartRole]))].[ConvertNameToSQLColumnName(ConvertRoleToName([StartRole]))] = [ConvertNameToSQLTableName([master.name])].ID " + // kapcsolotabla van
|
||||
[end if]
|
||||
[end if]
|
||||
[end if]
|
||||
[end if]
|
||||
[end loop]
|
||||
[if (IsMasterEntity([current]) == "false")]
|
||||
[loop (current -> SuperClass as BASECLASS)]
|
||||
[GenerateJoins([BASECLASS], [master])][break]
|
||||
[end loop]
|
||||
[end if]
|
||||
end template
|
||||
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
template GenerateLoadMidasBaseSet(MClass)
|
||||
#region Load entity base set
|
||||
[GenerateCommandGetterProperty("LoadMidasBaseSet")]
|
||||
|
||||
private [GetCSharpSQLCommandType()] [GenerateCommandCreatorName("LoadMidasBaseSet")]()
|
||||
{
|
||||
[GetCSharpSQLCommandType()] result = new [GetCSharpSQLCommandType()]();
|
||||
result.CommandType = CommandType.Text;
|
||||
result.CommandText =
|
||||
"select " +
|
||||
"[ConvertNameToSQLTableName([MClass.name])].ID, " +
|
||||
[GenerateMidasFieldListWithBaseClassFields([MClass])]
|
||||
"from " +
|
||||
[if (IsMasterEntity([MClass]) == "true")]
|
||||
"[ConvertNameToSQLTableName([MClass.name])] " +
|
||||
[else]
|
||||
"[GenerateSuperClassTableList([MClass])] " +
|
||||
[end if]
|
||||
[GenerateJoins([MClass], [MClass])]
|
||||
"where " +
|
||||
[if (IsMasterEntity([MClass]) == "true")]
|
||||
"[ConvertNameToSQLTableName([MClass.name])].SERIAL >= 0" +
|
||||
[else]
|
||||
[SDA_GetSuperClassSelectFilter([MClass])] +
|
||||
[end if]
|
||||
"and rownum < 1000";
|
||||
[/*
|
||||
// a partnertablak meg a kapcsolotablak
|
||||
[loop (Instances -> TokenSet(GenerateMidasTableList([MClass])))]
|
||||
"[ConvertNameToSQLTableName([TokenSet.line])], " +
|
||||
[end loop]
|
||||
|
||||
"where " +
|
||||
[GenerateMidasBaseSetLoaderWhereClause([MClass])]
|
||||
[if (IsMasterEntity([MClass]) == "true")]
|
||||
"[ConvertNameToSQLTableName([MClass.name])].SERIAL >= 0";
|
||||
[else]
|
||||
[SDA_GetSuperClassSelectFilter([MClass])];
|
||||
[end if]
|
||||
*/]
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="collection">Az adatbázisból felhozott entitásokat tartalmazó lista</param>
|
||||
public bool LoadMidasBaseSet([MClass.name]Collection collection)
|
||||
{
|
||||
[GetCSharpSQLDataReaderType()] reader = null;
|
||||
[GetCSharpSQLCommandType()] command = this.[ConvertNameToCommandName("LoadMidasBaseSet")];
|
||||
[GenerateCommandInit("command")]
|
||||
|
||||
// Hajrá!
|
||||
using (reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
[MClass.name] entity = [MClass.name].GiveAnInstance();
|
||||
entity.ID = [GenerateReaderRead("ID", 0, "reader")];
|
||||
[GenerateMidasBaseSetLoadEntityCore([MClass], 1, "entity", "reader")]
|
||||
collection.AddEntity(entity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
end template
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
proc GenerateMidasSave(buildername, attributename, type)
|
||||
switch (ToLower([type]))
|
||||
case "integer": return [buildername] ".Append(" [attributename] ".ToString());";
|
||||
case "string": return [buildername] ".Append(this.HtmlEncode(" [attributename] "));";
|
||||
case "datetime": return [buildername] ".Append(this.DateTimeToMidasString(" [attributename] "));";
|
||||
case "boolean": return [buildername] ".Append(" [attributename] ".ToString());";
|
||||
case "char": //return [buildername] ".Append(this.HtmlEncode(" [attributename] ".ToString()));";
|
||||
return [buildername] ".Append(this.HtmlEncode(" [attributename] "));";
|
||||
case "double": return [buildername] ".Append(" [attributename] ".ToString());";
|
||||
case "float": return [buildername] ".Append(" [attributename] ".ToString());";
|
||||
case "id": return [buildername] ".Append("[attributename] " != " GetCSharpDefaultValueOfType("ID") " ? " [attributename] ".ToString() : \"\");";
|
||||
case "dictionaryitem": return [buildername] ".Append(" [attributename] ".ToString()); /* XXX DictionaryItem */ ";
|
||||
case "binary": return "if (" [attributename] " != null) { " [buildername] ".Append(System.Convert.ToBase64String(" [attributename] ")); }";
|
||||
end switch
|
||||
return "/* ERROR Ismeretlen típus: " [type] " */";
|
||||
end proc
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
template GenerateMidasSupport(MClass)
|
||||
[/*
|
||||
#region Midas támogatás
|
||||
[if (IsMasterEntity([MClass]) == "true")]
|
||||
public [MClass.name]Collection MidasBaseSet
|
||||
[else]
|
||||
public new [MClass.name]Collection MidasBaseSet
|
||||
[end if]
|
||||
{
|
||||
get
|
||||
{
|
||||
[MClass.name]Collection result = [MClass.name]Collection.GiveAnInstance();
|
||||
this.m_DA.LoadMidasBaseSet(result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public override string FieldsToDelphiTClientDataSetXML(int parentid, bool needid, string nameprefix)
|
||||
{
|
||||
System.Text.StringBuilder builder = new System.Text.StringBuilder();
|
||||
[if (IsMasterEntity([MClass]) == "false")]
|
||||
builder.Append(base.FieldsToDelphiTClientDataSetXML(parentid, needid, nameprefix));
|
||||
[else]
|
||||
if (needid == true)
|
||||
{
|
||||
builder.Append("SELECTED=\\"");
|
||||
builder.Append("False");
|
||||
builder.Append("\\" ");
|
||||
builder.Append("ID=\\"");
|
||||
[GenerateMidasSave("builder", "this.ID", "ID")]
|
||||
builder.Append("\\" ");
|
||||
builder.Append("ParentID=\\"");
|
||||
[GenerateMidasSave("builder", "parentid", "ID")]
|
||||
builder.Append("\\" ");
|
||||
builder.Append("Serial=\\"");
|
||||
[GenerateMidasSave("builder", "this.Serial", "Integer")]
|
||||
builder.Append("\\" ");
|
||||
}
|
||||
[end if]
|
||||
|
||||
[loop (MClass -> MAttribute)]
|
||||
builder.Append(nameprefix + "[MAttribute.name]=\\"");
|
||||
[GenerateMidasSave("builder", "this.m_" [MAttribute.name], [MAttribute.type])]
|
||||
builder.Append("\\" ");
|
||||
[if ([MAttribute.type] == "DictionaryItem")]
|
||||
builder.Append(nameprefix + "[MAttribute.name]_DNAME=\\"");
|
||||
if (this.[MAttribute.name] != [GetCSharpDefaultValueOfType("ID")])
|
||||
{
|
||||
//SDA.[ProjectName].Entities.[MAttribute.defaultValue] temp = SDA.[ProjectName].Entities.[MAttribute.defaultValue].GiveAnInstance();
|
||||
//temp.LoadByID(this.[MAttribute.name]);
|
||||
//SDA.[ProjectName].Entities.[MAttribute.defaultValue] temp = (SDA.[ProjectName].Entities.[MAttribute.defaultValue])SDAServer.Instance.GetEntityFromCache(this.[MAttribute.name]);
|
||||
SDA.[ProjectName].Entities.DictionaryItemBase temp = (SDA.[ProjectName].Entities.DictionaryItemBase)SDAServer.Instance.GetEntityFromCache(this.[MAttribute.name]);
|
||||
if (temp == null)
|
||||
{
|
||||
temp = SDA.[ProjectName].Entities.[MAttribute.defaultValue].GiveAnInstance();
|
||||
temp.LoadByID(this.[MAttribute.name]);
|
||||
SDAServer.Instance.AddEntityToCache(temp);
|
||||
}
|
||||
[GenerateMidasSave("builder", "temp.Name", "string")]
|
||||
}
|
||||
builder.Append("\\" ");
|
||||
[end if]
|
||||
[end loop]
|
||||
[loop (MClass -> Role as StartRole -> MAssociation as CurrentAssoc -> MAssociationEnd as EndRole -> MClass as PartnerClass where (([StartRole.id] != [EndRole.id]) and GetStereoType([PartnerClass]) == "Entity"))]
|
||||
[if (HasAssociationClass([CurrentAssoc]) == "")]
|
||||
[if (([PartnerClass.name] != [MClass.name]) or ([PartnerClass.name] == [MClass.name] and [MClass.name] != DefineRoleName([EndRole])))]
|
||||
[if ([EndRole.multiplicity] == "1")]
|
||||
builder.Append("[ConvertRoleToName([EndRole])]=\\"");
|
||||
[GenerateMidasSave("builder", "this.m_" ConvertRoleToName([EndRole]), "ID")]
|
||||
builder.Append("\\" ");
|
||||
[end if]
|
||||
[if ([EndRole.multiplicity] == "0..1")]
|
||||
builder.Append(nameprefix + "[ConvertRoleToName([EndRole])]=\\"");
|
||||
[GenerateMidasSave("builder", "this.m_" ConvertRoleToName([EndRole]), "ID")]
|
||||
builder.Append("\\" ");
|
||||
[end if]
|
||||
[end if]
|
||||
[end if]
|
||||
[end loop]
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
//public override string MetainfoToDelphiTClientDataSetXML()
|
||||
//{
|
||||
// return this.MetainfoToDelphiTClientDataSetXML(true);
|
||||
//}
|
||||
|
||||
public override string MetainfoToDelphiTClientDataSetXML(bool needid, string nameprefix)
|
||||
{
|
||||
System.Text.StringBuilder builder = new System.Text.StringBuilder();
|
||||
[if (IsMasterEntity([MClass]) == "false")]
|
||||
builder.Append(base.MetainfoToDelphiTClientDataSetXML(needid, nameprefix));
|
||||
[else]
|
||||
if (needid == true)
|
||||
{
|
||||
builder.Append("<FIELD attrname=\\"SELECTED\\" fieldtype=\\"boolean\\"/>");
|
||||
builder.Append("<FIELD attrname=\\"ID\\" fieldtype=\\"i4\\"/>");
|
||||
builder.Append("<FIELD attrname=\\"ParentID\\" fieldtype=\\"i4\\"/>");
|
||||
builder.Append("<FIELD attrname=\\"Serial\\" fieldtype=\\"i4\\"/>");
|
||||
}
|
||||
[end if]
|
||||
[loop (MClass -> MAttribute)]
|
||||
builder.Append("<FIELD attrname=\\"");
|
||||
builder.Append(nameprefix + "[MAttribute.name]");
|
||||
builder.Append("\\" fieldtype=\\"");
|
||||
builder.Append("[GetMidasType([MAttribute.type])]");
|
||||
builder.Append("\\" WIDTH=\\"");
|
||||
builder.Append("[GetAttributeLength([MAttribute])]");
|
||||
builder.Append("\\"/>");
|
||||
[if ([MAttribute.type] == "DictionaryItem")]
|
||||
builder.Append("<FIELD attrname=\\"");
|
||||
builder.Append(nameprefix + "[MAttribute.name]_DNAME");
|
||||
builder.Append("\\" fieldtype=\\"string\\"");
|
||||
builder.Append(" WIDTH=\\"200\\"/>");
|
||||
[end if]
|
||||
[end loop]
|
||||
[loop (MClass -> Role as StartRole -> MAssociation as CurrentAssoc -> MAssociationEnd as EndRole -> MClass as PartnerClass where (([StartRole.id] != [EndRole.id]) and GetStereoType([PartnerClass]) == "Entity"))]
|
||||
[if (HasAssociationClass([CurrentAssoc]) == "")]
|
||||
[if ([EndRole.multiplicity] == "1" or [EndRole.multiplicity] == "0..1")]
|
||||
[if (([PartnerClass.name] != [MClass.name]) or ([PartnerClass.name] == [MClass.name] and [MClass.name] != DefineRoleName([EndRole])))]
|
||||
builder.Append("<FIELD attrname=\\"");
|
||||
builder.Append(nameprefix + "[ConvertRoleToName([EndRole])]");
|
||||
builder.Append("\\" fieldtype=\\"");
|
||||
builder.Append("[GetMidasType("ID")]");
|
||||
builder.Append("\\"/>");
|
||||
[end if]
|
||||
[end if]
|
||||
[end if]
|
||||
[end loop]
|
||||
return builder.ToString();
|
||||
}
|
||||
[if (IsMasterEntity([MClass]) == "true")]
|
||||
public static string GetDatapacketMetainfo(string prefix)
|
||||
[else]
|
||||
public static new string GetDatapacketMetainfo(string prefix)
|
||||
[end if]
|
||||
{
|
||||
return m_DatapacketMetaInfo.Replace("{PREFIX}", prefix);
|
||||
}
|
||||
|
||||
[if (IsMasterEntity([MClass]) == "true")]
|
||||
public static string GetDatapacketMetainfo()
|
||||
[else]
|
||||
public static new string GetDatapacketMetainfo()
|
||||
[end if]
|
||||
{
|
||||
return GetDatapacketMetainfo("");
|
||||
}
|
||||
|
||||
private static readonly string m_DatapacketMetaInfo =
|
||||
@"<FIELD attrname=""{PREFIX}ID"" fieldtype=""i4""/>
|
||||
<FIELD attrname=""{PREFIX}Serial"" fieldtype=""i4""/>
|
||||
[GenerateDataPacketMetadataAttributes([MClass], "{PREFIX}")]
|
||||
[GenerateDataPacketMetadataAssociations([MClass], "{PREFIX}")]";
|
||||
|
||||
#endregion
|
||||
*/]
|
||||
end template
|
||||
|
||||
|
||||
//***************************************************************************//
|
||||
// Megjegyzés? //
|
||||
// //
|
||||
// VALÓSZÍNŰLEG MÁR ELAVULT, ÉS NEM HASZNÁLT! //
|
||||
//***************************************************************************//
|
||||
proc GetMidasType(type)
|
||||
switch(ToLower([type]))
|
||||
case "integer": return "i4";
|
||||
case "string": return "string";
|
||||
case "boolean": return "boolean";
|
||||
case "float": return "r8"; // XXX
|
||||
case "char": return "string"; // XXX
|
||||
case "datetime": return "dateTime";
|
||||
case "id": return "i4";
|
||||
case "binary": return "bin.hex\"\" SUBTYPE=\"\"Binary";
|
||||
case "dictionaryitem": return "i4";
|
||||
end switch
|
||||
return "object /* ERROR Ismeretlen tipus: " [type] " */";
|
||||
end proc
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue