Map properties = prepareSubstitutions(getTemplateData(), namer.getSubstitutions());
Map properties = prepareSubstitutions(getTemplateData(), namer.getSubstitutions(), namer.getPorts());
public void writeObjects(DataOutputStream file, NameManipulator namer, boolean export)	throws IOException{	// do not generate template data if not is export mode	// but write expand block	if (!export)	{				final String nl = "\n";		final String comma = ", ";		final String quote = "\"";		final String macro = "  "+DBResolver.MACRO+"(";		final String ending = ")"+nl;			 	// write comment	 	if (getTemplateData().getComment()!=null)	 		file.writeBytes(nl+getTemplateData().getComment());				// expand start		file.writeBytes(nl+DBResolver.EXPAND+"(\""+getTemplateData().getTemplate().getId()+"\""+						comma + 							StringUtils.quoteIfMacro(getTemplateData().getName())						 + ") {"+nl);			// macros (properties)		Map macros = getTemplateData().getProperties();		Iterator i = getTemplateData().getPropertiesV().iterator();		while (i.hasNext())		{			String name = i.next().toString();			file.writeBytes(macro + name + comma + quote + StringUtils.removeQuotes(macros.get(name).toString()) + quote + ending);		}					// export end		file.writeBytes("}"+nl);		return;	}			 //	 	 // export (generate, flatten) DB option	 //	 String templateName = namer.getResolvedName(getName());	 // new ports	 Map ports = preparePorts(getTemplateData().getTemplate().getGroup(), namer.getSubstitutions());	 // new macros	 Map properties = prepareSubstitutions(getTemplateData(), namer.getSubstitutions());	 // new removedPrefix	 String removedPrefix = namer.getRemovedPrefix();	 	 // new addedPrefix	 String addedPrefix = null;/*	//	// no adding !!! anyway I noticed added prefix is not reset (to be checked, if this code is used someday)...	//	 	 if (getParent()==null)	 	addedPrefix = namer.getAddedPrefix();	 else	 {	 	// resolve parent group name - this is then addedPrefix	 	// there is a secial case: removedPrefix is 'parentName:", but parentName is 'parentName'	 	String parentName = ((Group)getParent()).getAbsoluteName();		if (parentName.equals(namer.getRemovedPrefix()+Constants.GROUP_SEPARATOR))			addedPrefix = namer.getResolvedName(parentName+Constants.GROUP_SEPARATOR);		else	 		addedPrefix = namer.getResolvedName(parentName);		int len = addedPrefix.length();	 	if (len==0)	 		addedPrefix = null;	 	else if (addedPrefix.charAt(len-1)!=Constants.GROUP_SEPARATOR)	 		addedPrefix = addedPrefix + Constants.GROUP_SEPARATOR;	 }*/	 	 NameManipulator newNamer = new DefaultNamer(namer.getFile(), removedPrefix, addedPrefix, properties, ports);	 file.writeBytes("\n# expand(\""+getTemplateData().getTemplate().getFileName()+"\", "+templateName+")\n");	 Group currentRoot = Group.getRoot();	 try	 {	 	Group.setRoot(getTemplateData().getTemplate().getGroup());	 	getTemplateData().getTemplate().getGroup().writeObjects(file, newNamer, export);	 }	 finally	 {	 	Group.setRoot(currentRoot);		 }	 file.writeBytes("\n# end("+templateName+")\n");	 }