*/
public int addAdHocReport(int userId, ReportVO reportVO)
{
try {
ReportLocalHome reportHome = EntityHomeFactory.getReportLocalHome();
ReportContentLocalHome reportContentHome = EntityHomeFactory.getReportContentLocalHome();
ReportContentLocal reportContentLocal = null;
ReportContentVO field = null;
int n = 0;
int reportId = 0;
short seqNumber = 0;
Byte sortSeq = null;
Timestamp today = new Timestamp(System.currentTimeMillis());
ReportLocal reportLocal = reportHome.create(today, reportVO.getFrom(), reportVO.getTo(), reportVO.getDescription(), new Integer(userId), null,
reportVO.getModuleId(), reportVO.getName(), ReportConstants.ADHOC_REPORT_CODE, null, this.dataSource);
reportId = reportLocal.getReportId();
ArrayList selectedFields = reportVO.getSelectedFields();
n = selectedFields.size();
for (int i = 0; i < n; i++) {
field = (ReportContentVO) selectedFields.get(i);
reportContentLocal = reportContentHome.create(field.getFieldId(), field.getTableId(), reportId, ++seqNumber, field.getSortOrder(), field
.getSortSeq(), this.dataSource);
}
return reportId;
} catch (Exception e) {
throw new EJBException(e);