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
@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 QueueException("Content " + contentId + " is already queued");
} else { if ("218".equals(rcode) || "9999".equals(rcode)) { throw new TransientSubmissionException("Create Class not successful. Message: " + ((CharacterData) (root.getElementsByTagName("rmessage").item(0).getFirstChild())).getData() .trim() .getData().trim()); } else { throw new SubmissionException("Create Class not successful. Message: " + ((CharacterData) (root.getElementsByTagName("rmessage").item(0).getFirstChild())).getData() .trim()
log.warn("Failed to find gradebook for site: "+ e.getMessage()); } catch (TransientSubmissionException e) { log.error(e.getMessage()); } catch (SubmissionException e) { log.warn("SubmissionException error. " + e.getMessage());
public static Map callTurnitinReturnMap(String apiURL, Map<String,Object> parameters, String secretKey, int timeout, Proxy proxy) throws TransientSubmissionException, SubmissionException { XMLTranscoder xmlt = new XMLTranscoder(); try (InputStream inputStream = callTurnitinReturnInputStream(apiURL, parameters, secretKey, timeout, proxy, false)) { Map togo = xmlt.decode(IOUtils.toString(inputStream)); log.debug("Turnitin Result Payload: " + togo); return togo; } catch (Exception t) { // Could be 'java.lang.IllegalArgumentException: xml cannot be null or empty' from IO errors throw new TransientSubmissionException ("Cannot parse Turnitin response. Assuming call was unsuccessful", t); } }
M_log.warn(" BaseAssignmentSubmissionEdit postAttachment: Unable to add content to Content Review queue: " + qe.getMessage());
public void doAssignments() { log.info("About to update all turnitin assignments"); List<ContentReviewItem> items = crqs.getAllContentReviewItemsGroupedBySiteAndTask(getProviderId()); for (ContentReviewItem item : items) { try { updateAssignment(item.getSiteId(), item.getTaskId()); } catch (SubmissionException e) { log.error(e.getMessage(), e); } } }
private ContentReviewService getSelectedProvider() { if (defaultProvider < 0) { throw new ContentReviewProviderException("No Default Content Review Provider"); } Optional<Site> currentSite = getCurrentSite(); if (currentSite.isPresent()) { if (log.isDebugEnabled()) log.debug("In Location:" + currentSite.get().getReference()); final String overrideProvider = currentSite.get().getProperties().getProperty("contentreview.provider"); if (StringUtils.isNotEmpty(overrideProvider) && enabledProviders.stream().anyMatch(p -> p.intValue() == Math.abs(overrideProvider.hashCode()))) { return providers.stream().filter(crs -> crs.getProviderId().intValue() == Math.abs(overrideProvider.hashCode())).collect(Collectors.toList()).get(0); } } return providers.stream().filter(crs -> crs.getProviderId().intValue() == defaultProvider).collect(Collectors.toList()).get(0); }
throw new QueueException("Content " + contentId + " has not been queued previously"); throw new ReportException("Report not available: " + item.getStatus());
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();
public static Document callTurnitinReturnDocument(String apiURL, Map<String,Object> parameters, String secretKey, int timeout, Proxy proxy, boolean isMultipart) throws TransientSubmissionException, SubmissionException { InputStream inputStream = callTurnitinReturnInputStream(apiURL, parameters, secretKey, timeout, proxy, isMultipart); BufferedReader in; in = new BufferedReader(new InputStreamReader(inputStream)); Document document = null; try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder parser = documentBuilderFactory.newDocumentBuilder(); document = parser.parse(new org.xml.sax.InputSource(in)); } catch (ParserConfigurationException pce){ log.error("parser configuration error: " + pce.getMessage()); throw new TransientSubmissionException ("Parser configuration error", pce); } catch (Exception t) { throw new TransientSubmissionException ("Cannot parse Turnitin response. Assuming call was unsuccessful", t); } if (log.isDebugEnabled()) { log.debug(" Result from call: " + Xml.writeDocumentToString(document)); } return document; }
M_log.warn(" getReviewScore(ContentResource) Unable to queue content with content review service: " + qe.getMessage());
throw new QueueException("Content " + contentId + " has not been queued previously"); throw new ReportException("Report not available: " + item.getStatus()); throw new ReportException("Error getting data from response");
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); } }
throw new TransientSubmissionException("Error logging in to turnitin: " + message);
throw new QueueException("Content " + contentId + " has not been queued previously"); throw new ReportException("Report not available: " + item.getStatus());
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() : "")); } }
throw new QueueException("Content " + contentId + " has not been queued previously"); 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());