[comment encoding = UTF-8 /] [** * The documentation of the module interfacesGenerator. */] [module ImplsGenerator('http://www.eclipse.org/uml2/3.0.0/UML')] [query public getStereotypeValue(arg0 : Element, stereotype : String, value : String) : String = invoke('hl7template.api.generator.UmlServices', 'getStereotypeValue(org.eclipse.uml2.uml.Element, java.lang.String, java.lang.String)', Sequence{arg0, stereotype, value})/] [query public hasStereotype(arg0 : Element, stereotype : String) : Boolean = invoke('hl7template.api.generator.UmlServices', 'hasStereotype(org.eclipse.uml2.uml.Element, java.lang.String)', Sequence{arg0, stereotype})/] [** * The documentation of the template generateInterface. * @param aClass */] [template public generateImpl(aClass : Class)] [comment @main/] [if (aClass.name<>'DocumentRoot')] [file (aClass.getOriginalClassName() + 'ProcessorImpl.java', false, 'UTF-8')] package net.ihe.gazelle.hl7templates.impl; import org.decor.art.model.*; import org.decor.art.utils.*; import net.ihe.gazelle.hl7templates.api.*; import org.decor.art.model.DataSetConcept.Implementation; import org.decor.art.model.DataSetConcept.ValueSet; import javax.xml.namespace.QName; import java.util.List; import net.ihe.gazelle.hl7templates.utils.DefaultImplProvider; import net.ihe.gazelle.hl7templates.utils.Processor; public abstract class [aClass.getOriginalClassName()/]ProcessorImpl implements [aClass.getOriginalClassName()/]Processor { @Override public void process([aClass.getOriginalClassName()/] t, DefaultImplProvider defaultImplProvider) { if (t != null){ [for (attr : Property | aClass.attribute->sortedBy(name))] [if (attr.type.name<>'EFeatureMapEntry')] this.process[attr.name.toUpperFirst()/][attr.addSs()/]([attr.generateListSelection()/]); [/if] [/for] } } } [/file] [/if] [/template] [template public generateListSelection(prop : Property) post (trim())] [if (prop.hasStereotype('EReference') and prop.getStereotypeValue('EReference', 'isTransient')=true)] [prop.owner.oclAsType(Class).name/]Util.get[prop.name.upperFirst()/]s(t) [else] t.get[prop.name.upperFirst()/]() [/if] [/template] [template public upperFirst(st : String) post (trim())] [if (st.contains('_'))] [st.replace('_', '').toUpperFirst()/] [else] [st.toUpperFirst()/] [/if] [/template] [template public addSs(prop : Property) post (trim())] [if (prop.upperBound()=-1)] s [/if] [/template] [template public getListOfName(prop : Property) post (trim())] [if (prop.upperBound()=-1)] List<[prop.type.getOriginalClassName()/]> [else] [prop.type.getOriginalClassName()/] [/if] [/template] [template public getOriginalClassName(prop : NamedElement) post (trim())] [let var : String = _getOriginalClassName(prop)] [if (var='ArbitraryProperty')] ArbitraryPropertyType [elseif (var='Example1')] Example [elseif (var='Authority')] AuthorityType [elseif (var='Designation1')] Designation [elseif (var='ValueSet1')] ValueSet [elseif (var='Issue1')] Issue [elseif (var='Transaction1')] Transaction [elseif (var='SelfReferenceTemplateId')] String [elseif (var='DataSetTimeStampPrecision')] String [else] [var/] [/if] [/let] [/template] [template public _getOriginalClassName(aTE : NamedElement) post (trim())] [if (aTE.oclIsKindOf(Class))] [if (aTE.oclAsType(Class)._package.name='DECOR')] [aTE.oclAsType(Class).name.replace('Type', '')/] [/if] [elseif (aTE.oclIsKindOf(Enumeration))] [aTE.name/] [elseif (aTE.oclIsKindOf(DataType))] String [else] [aTE.name/] [/if] [/template]