Esempio n. 1
0
  /**
   * @param locale
   * @param olatResource
   * @param shortTitle
   * @param olatResourceDetail
   * @param repositoryRef
   * @param type
   * @param exportDirectory
   * @param anonymizerCallback callback that should be used to anonymize the user names or NULL if
   *     row counter should be used (only for type 2 and 3)
   * @return
   */
  public boolean selectAndExportResults(
      final QTIExportFormatter qef,
      final Long olatResource,
      final String shortTitle,
      final String olatResourceDetail,
      final Long repositoryRef,
      final File exportDirectory,
      final String charset,
      final String fileNameSuffix) {
    boolean resultsFoundAndExported = false;
    final List results =
        qtiResultService.selectResults(
            olatResource, olatResourceDetail, repositoryRef, qef.getType());
    if (results.size() > 0) {
      final QTIResult res0 = (QTIResult) results.get(0);

      final QTIObjectTreeBuilder qotb =
          new QTIObjectTreeBuilder(new Long(res0.getResultSet().getRepositoryRef()));

      final List qtiItemObjectList = qotb.getQTIItemObjectList();
      qef.setQTIItemObjectList(qtiItemObjectList);
      if (results.size() > 0) {
        createContentOfExportFile(results, qtiItemObjectList, qef);
        writeContentToFile(shortTitle, exportDirectory, charset, qef, fileNameSuffix);
        resultsFoundAndExported = true;
      }
    }
    return resultsFoundAndExported;
  }
Esempio n. 2
0
  /**
   * @param qef
   * @param results
   * @param qtiItemObjectList
   * @param shortTitle
   * @param exportDirectory
   * @param charset
   * @param fileNameSuffix
   * @return
   */
  public String exportResults(
      final QTIExportFormatter qef,
      final List results,
      final List qtiItemObjectList,
      final String shortTitle,
      final File exportDirectory,
      final String charset,
      final String fileNameSuffix) {
    String targetFileName = null;

    qef.setQTIItemObjectList(qtiItemObjectList);
    if (results.size() > 0) {
      createContentOfExportFile(results, qtiItemObjectList, qef);
      targetFileName =
          writeContentToFile(shortTitle, exportDirectory, charset, qef, fileNameSuffix);
    }
    return targetFileName;
  }