}
final int id = tempId;
Utils.processPersistable(new Persistable.Transaction() {
public TransactionResult runQuery(EntityManager em) throws Exception {
Report report = em.getReference(Report.class, id);
if (!PersistenceUtils.isExistingComponent(report.getComponent(), report.getSubcomponent())) {
errors.add("This report has incorrect component or subcomponent, please update it before reporting.");
return TransactionResult.ROLLBACK;
}
Integer issuezillaId = report.getIssueId();
if ((issuezillaId == null) || (issuezillaId.intValue() == 0)) {
report.preloadSubmitCollection(em);
List<Submit> submts = report.getSubmitCollection();
TreeSet<Submit> ts = new TreeSet<Submit>(IssuezillaRedirect.this);
ts.addAll(submts);
Submit last = ts.last();
AuthToken token = null;
try {
token = getUserAuthToken(last.getLogfileId());
} catch (IOException ioe) {
LOG.log(Level.SEVERE, "Unable to open source file", ioe);
}
String message = "This issue was reported manually by " + principal.getName() +".\n";
message += "It already has " + report.getDuplicates(em) + " duplicates \n";
new IZInsertion(last, token, principal.getName(), message).startForceInsert(em);
}
return TransactionResult.COMMIT;
}
});