// template.
for (final Iterator iterator = allMetafacades.iterator(); iterator.hasNext();)
{
final Map templateContext = new LinkedHashMap();
final Object metafacade = iterator.next();
final ModelAccessFacade model = factory.getModel();
for (final Iterator elements = modelElements.getModelElements().iterator(); elements.hasNext();)
{
final ModelElement modelElement = (ModelElement)elements.next();
String variable = modelElement.getVariable();
// - if the variable isn't defined on the <modelElement/>, try
// the <modelElements/>
if (variable == null || variable.trim().length() == 0)
{
variable = modelElements.getVariable();
}
// - only add the metafacade to the template context if the variable
// is defined (which is possible)
if (variable != null && variable.trim().length() > 0)
{
templateContext.put(
variable,
metafacade);
}
// - now we process any property templates (if any 'variable' attributes are defined on one or
// more type's given properties), otherwise we process the single metafacade as usual
if (!this.processPropertyTemplates(
template,
metafacade,
templateContext,
modelElement))
{
this.processWithTemplate(
template,
templateContext,
model.getName(metafacade),
model.getPackageName(metafacade));
}
}
}
}
}