ArrayList<ColumnFilter> oldColumnFilter = null;
if (id != 0) {
try {
foundReport = this.findById(id);
} catch (CruxException e) {
throw new CruxException(
"Report you are trying to edit does not exists in database",
e);
}
oldDesignList = new ArrayList<ReportDesign>(
foundReport.getDesigns());
oldRowFilter = new ArrayList<RowAliasFilter>(
foundReport.getRowAliasFilters());
oldColumnFilter = new ArrayList<ColumnFilter>(
foundReport.getColumnFilters());
foundReport.getDesigns().clear();
foundReport.getRowAliasFilters().clear();
foundReport.getColumnFilters().clear();
for (ReportDesign design : oldDesignList) {
try {
transaction.begin();
session.delete(design);
transaction.commit();
} catch (JDBCException e) {
transaction.rollback();
throw new CruxException(e.getSQLException()
.getMessage(), e);
}
}
for (RowAliasFilter rowFilter : oldRowFilter) {
try {
transaction.begin();
session.delete(rowFilter);
transaction.commit();
} catch (JDBCException e) {
transaction.rollback();
throw new CruxException(e.getSQLException()
.getMessage(), e);
}
}
for (ColumnFilter columnFilter : oldColumnFilter) {
try {
transaction.begin();
session.delete(columnFilter);
transaction.commit();
} catch (JDBCException e) {
transaction.rollback();
throw new CruxException(e.getSQLException()
.getMessage(), e);
}
}
ArrayList<ReportDesign> newDesignList = new ArrayList<ReportDesign>(