[template public generateSqlType(aClass : Class)]
"""
Using query
PrimitiveType Name: [getDslPrimitiveType(aClass).name /]
Its Stereotype Name: [getDslStereoType(aClass).name /]
getDslStereoTypea: "[getDslStereoTypea(aClass) /]"
[getDslStereoType(aClass).eContents()->at(2).oclAsType(Property).name /]:::::::: "[getDslStereoType(aClass).eContents()->at(2).oclAsType(Property) /]"
[getDslStereoType(aClass).eContents() /]
Iterating all over the class dependencies
[for (aDependency : Dependency | aClass.clientDependency) ]
aDependency: [aDependency /]
[for (aSupplier : NamedElement | aDependency.supplier) ]
aSupplier [aSupplier /]
[for (aPrimitiveType : PrimitiveType | aSupplier->filter(PrimitiveType)) ]
aPrimitiveType [aPrimitiveType /]
[for (aStereoType : Stereotype | aPrimitiveType.getAppliedStereotypes()) ]
aStereoType [aStereoType /]
aStereoType.name [aStereoType.name /]
[/for]
[/for]
[/for]
[/for]
[let aPrimitiveType : PrimitiveType = aClass.clientDependency->asSequence()->first().supplier->filter(PrimitiveType)->asSequence()->first() ]
[let aStereoType : Stereotype = aPrimitiveType.getAppliedStereotypes()->asSequence()->first() ]
PrimitiveType NamedElement: [aPrimitiveType.name /] StereoType: [aStereoType.name /]
[if (aStereoType.name.equalsIgnoreCase('SqlDataType')) ]
############
[if (aClass.oclAsType(Class).hasStereotype('PythonDataType'))]
############
[/if]
[if (aClass.hasStereotype('SqlDataType'))]
############
[/if]
[/if][/let][/let]
"""
My desire is to not need to evaluate the type of the DSL I use so
stricly as follows:
[if (aClass.name.equalsIgnoreCase('String'))]
VARCHAR(1024)
[elseif (aClass.name.equalsIgnoreCase('Integer'))]
INTEGER(10)
[elseif (aClass.name.equalsIgnoreCase('BigInteger'))]
INTEGER(10)
[elseif (aClass.name.equalsIgnoreCase('Float'))]
FLOAT(10)
[elseif (aClass.name.equalsIgnoreCase('Date'))]
DATE
[/if]
[/template]
# xxxxType: Integer
# 1
# 1.2
xxxxType """
Using query
PrimitiveType Name: Int
Its Stereotype Name: SqlDataType
getDslStereoTypea: ""
instanceClassName::::::: "org.eclipse.uml2.uml.internal.impl.PropertyImpl@741b3bc3 (name: instanceClassName, visibility: <unset>) (isLeaf: false) (isStatic: false) (isOrdered: false, isUnique: true, isReadOnly: false) (aggregation: none, isDerived: false, isDerivedUnion: false, isID: false)"
org.eclipse.uml2.uml.internal.impl.PropertyImpl@3efe7086 (name: base_PrimitiveType, visibility: <unset>) (isLeaf: false) (isStatic: false) (isOrdered: false, isUnique: true, isReadOnly: false) (aggregation: none, isDerived: false, isDerivedUnion: false, isID: false)org.eclipse.uml2.uml.internal.impl.PropertyImpl@741b3bc3 (name: instanceClassName, visibility: <unset>) (isLeaf: false) (isStatic: false) (isOrdered: false, isUnique: true, isReadOnly: false) (aggregation: none, isDerived: false, isDerivedUnion: false, isID: false)
Iterating all over the class dependencies
aDependency: org.eclipse.uml2.uml.internal.impl.RealizationImpl@3f792b9b (name: <unset>, visibility: <unset>)
aSupplier org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@58a55449 (name: Int, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false)
aPrimitiveType org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@58a55449 (name: Int, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false)
aStereoType org.eclipse.uml2.uml.internal.impl.StereotypeImpl@62e70ea3 (name: SqlDataType, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false) (isActive: false)
aStereoType.name SqlDataType
PrimitiveType NamedElement: Int StereoType: SqlDataType
############
"""
INTEGER(10)
instanceClassName::::::: "org.eclipse.uml2.uml.internal.impl.PropertyImpl@741b3bc3 (name: instanceClassName, visibility: <unset>) (isLeaf: false) (isStatic: false) (isOrdered: false, isUnique: true, isReadOnly: false) (aggregation: none, isDerived: false, isDerivedUnion: false, isID: false)"
]]>