if (this.findReportTemplate(reportType, user, company)==null) {
try {
String tplContents = this.getStdReportTemplate(reportType);
if (!tplContents.equals("")) {
logger.debug("Creating report-template "+reportType.getId()+" for company "+company.getId());
ReportTemplate reportTemplate = new ReportTemplate();
reportTemplate.setCompany(company);
reportTemplate.setOwner(user);
reportTemplate.setGroup(user.getMainGroup());
String name = company.getName1();
if ((name==null) || (name.trim().equals("")))
name=reportType.getId();
reportTemplate.setName(name);
reportTemplate.setContents(tplContents);
reportTemplate.setReadOther(true);
reportTemplate.setLastChangeUser(user);
reportTemplate.setReportType(reportType);
this.createDataset(reportTemplate,user,user.getMainGroup(),company);
}
} catch (Exception e) {
logger.warn("Could not create standard-report-template",e);
}