Beispiel #1
0
  /**
   * Dumps the parsing errors into a text file.
   *
   * @param filename the file name into which the error will be dumped.
   * @throws Exception if any exception.
   */
  protected void dumpErrors(String filename) throws Exception {
    String outputFolder = getTempFolder() + OUTPUT_FOLDER;
    File f = new File(outputFolder);
    if (!f.exists() && !f.mkdir()) {
      throw new Exception("Can not create the output folder!"); // $NON-NLS-1$
    }
    filename = outputFolder + filename;

    if (design == null) return;
    PrintWriter writer = new PrintWriter(new FileOutputStream(filename));
    List errors = design.getAllErrors();
    ErrorDetail ex = null;
    for (int i = 0; i < errors.size(); i++) {
      ex = (ErrorDetail) errors.get(i);
      writer.print(design.getFileName());
      writer.println(ex);
    }
    writer.close();
  }
Beispiel #2
0
  /**
   * Writes the document to the internal output stream.
   *
   * @throws Exception
   */
  protected void serializeDocument(boolean enableExternalDataMart) throws Exception {
    ReportDesignHandle beforeSerializedDesignHandle = designHandle;
    os = new ByteArrayOutputStream();

    ReportDesignSerializer visitor = new ReportDesignSerializer();
    designHandle.getModule().apply(visitor);

    design = visitor.getTarget();
    designHandle = (ReportDesignHandle) design.getHandle(design);

    if (enableExternalDataMart) {
      design.prepareToSave();
      DesignWriter writer = (DesignWriter) design.getWriter();
      DesignWriterUtil.enableExternalDataMarts(writer);
      writer.write(os);
      design.onSave();

    } else designHandle.serialize(os);

    this.beforeSerializedDesignHandle = beforeSerializedDesignHandle;
  }
Beispiel #3
0
  private void removeExtensionStyles(ReportDesign design) {

    ContainerSlot styles = design.getSlot(ReportDesign.STYLE_SLOT);
    styles.clear();
    // if ( styles != null )
    // {
    // for ( int i = 0; i < styles.getCount( ); i++ )
    // {
    // styles.remove( i );
    // }
    // }
  }
Beispiel #4
0
 /**
  * Prints out all semantic errors stored in the error list during parsing the design file.
  *
  * @param design report design
  */
 protected void printSemanticError(ReportDesign design) {
   if (design != null) printErrorList(design.getAllErrors());
 }