##
## This version of the cartridge is based on FuGE v1 cartridge but it is intended to be used for extensions where FuGE is imported rather than included in the schema
## 1. Ensure that andromda.xml is setup to parse only the extension and not FuGE:
## FuGE
## GelML
## 2. Set namespace property in andromda.xml e.g. http://www.psidev.info/gelml/1.0
## 3. Alter the namespace defintion below (line 16) xmlns:gelml to the name of your namespace (this must be the root package name in UML in lower case)
##
##
##Uncomment for local FuGE
##
#foreach ($type in $types)
#set ($typeName = "${type.fullyQualifiedName}Type")
${type.getDocumentation("").replaceAll("\n"," ").replaceAll("","").replaceAll("
","")}
#if ($type.generalization)
#set($superName = $type.generalization.fullyQualifiedName)
#set($sNamespace = $superName.substring(0,$superName.indexOf(".")).toLowerCase())
#end
#set( $doSeq = true)
#if ($type.associationEnds)
#foreach ($associationEnd in $type.associationEnds)
#set ($otherEnd = $associationEnd.otherEnd)
#if ($otherEnd.navigable && ($otherEnd.type.isEnumeration()==false) && ($otherEnd.hasExactStereotype("AbstractAssociation") == false))
#if ($doSeq)
#set ($doSeq = false)
#end
#if($otherEnd.composition && ($otherEnd.hasExactStereotype("MapAssocToElement") == true) )##For these cases, the association name is required in the schema
${otherEnd.association.getDocumentation("").replaceAll("\n"," ").replaceAll("","").replaceAll("
","")}
#set($otherName = $otherEnd.type.fullyQualifiedName)
#set($oNamespace = $otherName.substring(0,$otherName.indexOf(".")).toLowerCase())
#elseif($otherEnd.composition && ($otherEnd.hasExactStereotype("MapAssocToElement") ==false) )##For these cases, the association name is not required in the schema
#set($otherName = $otherEnd.type.fullyQualifiedName)
#set($oNamespace = $otherName.substring(0,$otherName.indexOf(".")).toLowerCase())
##Note: Need to put another elseif in here to account for not composite and show element or not...??
#elseif(($otherEnd.composition==false) && ($otherEnd.hasExactStereotype("MapAssocToElement") ==true) )##This is for cases, for example where there are parallel assocaitions to the same object, or the association name is needed to qualify the referenced object
##made a change to this part to simply a reference to elements e.g. rather than <_genericProtocol> It is now <_genericProtocol GenericProtocol_ref = ""/>
${otherEnd.association.getDocumentation("").replaceAll("\n"," ").replaceAll("","").replaceAll("
","")}
#elseif(($otherEnd.composition==false) && $otherEnd.isMany()==true)##This is for the case of a many end on the association end... in these cases we do the same as above...
##made a change to this part to simply a reference to elements e.g. rather than <_genericProtocol> It is now <_genericProtocol GenericProtocol_ref = ""/>
${otherEnd.association.getDocumentation("").replaceAll("\n"," ").replaceAll("","").replaceAll("
","")}
#end
#end
#end
#foreach ($attribute in $type.attributes)
#if ($attribute.hasExactStereotype("XmlAttribute")==false)
#end
#end
#if (!$doSeq)
#set ($doSeq = true)
#end
#end
#foreach ($attribute in $type.attributes)
#if(!($attribute.name == "id") && ($attribute.hasExactStereotype("XmlAttribute")==true))
#if($attribute.type.isEnumeration())
#if($attribute.required)
#else
#end
#set($enumValues = $attribute.type.getAttributes())
#foreach($enum in $enumValues)
#end
#elseif($attribute.name == "storage")
${attribute.getDocumentation("").replaceAll("\n"," ").replaceAll("","").replaceAll("
","")}
#else
#if($attribute.required)
#else
#end
${attribute.getDocumentation("").replaceAll("\n"," ").replaceAll("","").replaceAll("
","")}
#end
#end##end of if for attribute "id"
#end##end of for loop for all attributes
#foreach ($associationEnd in $type.associationEnds) ##Need to run this loop again to create an attribute for any association ends with one cardinality,
#set ($otherEnd = $associationEnd.otherEnd)
#if(($otherEnd.composition==false) && $otherEnd.isMany()==false && ($otherEnd.hasExactStereotype("AbstractAssociation") == false) && $otherEnd.navigable && ($otherEnd.hasExactStereotype("MapAssocToElement") == false))##This is for the case of a many end on the association end... in these cases we do the same as above...
#if($otherEnd.minOccurs == "1")##Note there is an error here... this is not working correctly...
#else
#end
${otherEnd.association.getDocumentation("")}
#end
#end
#if ($type.generalization)
#end
#end
#foreach ($element in $types)
#set ($typeName = "${element.fullyQualifiedName}Type")
#set($elementName = $element.fullyQualifiedName)
#set($eNamespace = $elementName.substring(0,$elementName.indexOf(".")).toLowerCase())
#if ($element.generalization)
#set($superName = $element.generalization.fullyQualifiedName)
#set($sNamespace = $superName.substring(0,$superName.indexOf(".")).toLowerCase())
#else
#end
#end