protected void performAction(Node[] node) {

    try {

      List<ClearingItem> clearingList = getClearingItems();
      log.info("found " + clearingList.size() + " clearing items.");

      for (ClearingItem item : clearingList) {
        ClearingPrintTO to = new ClearingPrintTO();
        to.setMessage(ClearingPrintTO.resolveMessage(item));
        to.setCreated(to.getCreated());
      }

      List<PropertyDescriptor> props = new ArrayList<PropertyDescriptor>();
      PropertyDescriptor pd =
          new PropertyDescriptor("created", ClearingItem.class, "getCreated", null);
      pd.setDisplayName("Datum");
      props.add(pd);

      pd = new PropertyDescriptor("message", ClearingItem.class);
      pd.setDisplayName("Klärfall");
      props.add(pd);

      byte[] bytes = export("Klärfallliste", clearingList, props);
      log.info("received " + bytes.length + " bytes");

      log.info("going to print");

      ReportServiceBean reportService = new ReportServiceBean();
      reportService.print("default", bytes, DocumentTypes.APPLICATION_PDF.toString());

      //            print("default", bytes, DocumentTypes.APPLICATION_PDF.toString());
      log.info("printing on default");

    } catch (Throwable ex) {
      ExceptionAnnotator.annotate(ex);
    }
  }
  public void print(String printer, byte[] bytes, String type) throws ReportException {
    try {

      PrintService printService;
      DocPrintJob job;
      DocFlavor fl;
      Doc doc;

      DocAttributeSet das = new HashDocAttributeSet();
      Object printObject;
      if (type == null || type.length() == 0) {
        fl = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printObject = bytes;
      } else if (type.equals(DocumentTypes.APPLICATION_PDF.toString())) {
        fl = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printObject = bytes;
      } else if (type.equals(DocumentTypes.TEXT_XML.toString())) {
        fl = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printObject = bytes;
      } else {
        log.info("Unknown type: " + type);
        fl = DocFlavor.INPUT_STREAM.AUTOSENSE;
        printObject = new ByteArrayInputStream(bytes);
      }

      if (printer != null && printer.equals(NO_PRINTER)) {
        log.info("Won't print. Printer: " + printer);
        return;
      }
      if (printer == null || printer.length() == 0 || printer.equals(DEFAULT_PRINTER)) {

        printService = PrintServiceLookup.lookupDefaultPrintService();

      } else {
        try {
          printService = getNamedPrintService(fl, printer);
        } catch (Exception ex) {
          log.log(Level.INFO, ex.getMessage(), ex);
          throw new IllegalArgumentException("Printer cannot be selected");
        }
      }

      if (printService == null) {
        log.info("printer not found: " + printer);
        throw new ReportException(ReportExceptionKey.PRINT_FAILED, printer);
      }

      doc = new SimpleDoc(printObject, fl, das);
      job = printService.createPrintJob();
      PrintJobWatcher watcher = null;

      if (fl instanceof DocFlavor.INPUT_STREAM) {
        watcher = new PrintJobWatcher(job);
      }

      job.print(doc, null);

      if (watcher != null) {
        watcher.waitForDone();
        ((InputStream) printObject).close();
      }

    } catch (PrintException ex) {
      log.log(Level.INFO, ex.getMessage(), ex);
      throw new ReportException(ReportExceptionKey.PRINT_FAILED, printer);
    } catch (Throwable ex) {
      log.log(Level.INFO, ex.getMessage(), ex);
      throw new ReportException(ReportExceptionKey.PRINT_FAILED, printer);
    }
  }