try { throw new ReportException(); } catch(ReportException e){ // handle it }
/** * Access all AssignmentSubmission objects - known to us (not from external providers). * * @return A list of AssignmentSubmission objects. */ protected List getSubmissions(String context) { List<AssignmentSubmission> submissions = m_submissionStorage.getAll(context); //get all the review scores if (contentReviewService != null) { try { List<ContentReviewItem> reports = contentReviewService.getReportList(null, context); if (reports != null && reports.size() > 0) { updateSubmissionList(submissions, reports); } } catch (QueueException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SubmissionException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ReportException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return submissions; } // getAssignmentSubmissions
public int getReviewScore(String contentId, String assignmentRef, String userId) throws QueueException, ReportException, Exception { Optional<ContentReviewItem> optionalItem = crqs.getQueuedItem(getProviderId(), contentId); if(optionalItem.isPresent()) { return optionalItem.get().getReviewScore(); }else { throw new ReportException("Could not find content item: " + contentId); } }
JasperPrint jasperPrint = JasperFillManager.fillReport(report, params, dataSource != null ? new JRMapArrayDataSource( dataSource) : new JREmptyDataSource()); ByteArrayOutputStream out = new ByteArrayOutputStream(); @SuppressWarnings("rawtypes") Exporter exporter; switch (format) { case PDF: exporter = new JRPdfExporter(); exporter.setExporterOutput(new SimpleWriterExporterOutput(out)); break; case CSV: exporter = new JRCsvExporter(); exporter.setExporterOutput(new SimpleWriterExporterOutput(out)); break; case XLSX: exporter = new JRXlsxExporter(); exporter.setExporterOutput(new SimpleWriterExporterOutput(out)); break; case HTML: exporter = new HtmlExporter(); exporter.setExporterOutput(new SimpleWriterExporterOutput(out)); break; default: throw new ReportException("Unknown export format"); } exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.exportReport();
private void checkContentItemStatus(String contentId) throws ReportException { ContentReviewItem item = getContentReviewItemByContentId(contentId); if(item == null || !ContentReviewConstants.CONTENT_REVIEW_SUBMITTED_REPORT_AVAILABLE_CODE.equals(item.getStatus())) { throw new ReportException("Report status: " + (item != null ? item.getStatus() : "")); } }
@Override public int getReviewScore(String contentId, String assignmentRef, String userId) throws QueueException, ReportException, Exception { Optional<ContentReviewItem> matchingItem = getItemByContentId(contentId); if (!matchingItem.isPresent()) { log.debug("Content {} has not been queued previously", contentId); throw new QueueException("Content " + contentId + " has not been queued previously"); } ContentReviewItem item = matchingItem.get(); if (item.getStatus().compareTo(ContentReviewConstants.CONTENT_REVIEW_SUBMITTED_REPORT_AVAILABLE_CODE) != 0) { log.debug("Report not available: {}", item.getStatus()); throw new ReportException("Report not available: " + item.getStatus()); } return item.getReviewScore().intValue(); }
throw new ReportException("Report not available: " + item.getStatus()); throw new ReportException("Error getting data from response");
throw new ReportException("Report not available: " + item.getStatus());
throw new ReportException("Url was null or contentId wasn't correct: " + contentId);
throw new ReportException("Report not available: " + item.getStatus());
if (item.getStatus().compareTo(ContentReviewConstants.CONTENT_REVIEW_SUBMITTED_REPORT_AVAILABLE_CODE) != 0) { log.debug("Report not available: " + item.getStatus()); throw new ReportException("Report not available: " + item.getStatus());