}
} else {
templatePaths = getTemplatePaths();
}
GenericExporter exporter = new GenericExporter(getConfiguration(), getOutputDirectory()) {
@Override
protected void exportPOJO(Map map, POJOClass element) {
if (element.getShortName().equals(System.getProperty("appfuse.entity"))) {
super.exportPOJO(map, element);
}
}
@Override
protected String resolveFilename(POJOClass element) {
String filename = super.resolveFilename(element);
String packageLocation = getPackageNameForFile(element).replace(".", "/");
String pojoName = System.getProperty("entity");
if (pojoName == null) {
pojoName = System.getProperty("appfuse.entity");
}
// A dot in the entity name means the person is specifying the package.
if (pojoName.contains(".")) {
packageLocation = pojoName.substring(0, pojoName.indexOf(".model"));
packageLocation = packageLocation.replace(".", "/");
}
if (packageLocation.endsWith("model") && packageLocation.indexOf('/') > -1) {
packageLocation = packageLocation.substring(0, packageLocation.lastIndexOf('/'));
}
filename = filename.replace("{basepkg-name}", packageLocation);
return filename;
}
};
exporter.setProperties((Properties) getProperties().clone());
exporter.setTemplatePath(templatePaths);
exporter.setTemplateName(template);
exporter.setFilePattern(pattern);
exporter.setArtifactCollector(getArtifactCollector());
exporter.getProperties().put("data", new DataHelper());
exporter.getProperties().put("util", new StringUtils());
return exporter;
}