Package de.willuhn.datasource.serialize

Examples of de.willuhn.datasource.serialize.Writer


      /**
       * @see de.willuhn.jameica.system.BackgroundTask#run(de.willuhn.util.ProgressMonitor)
       */
      public void run(ProgressMonitor monitor) throws ApplicationException
      {
        Writer writer = null;
        try
        {
          Logger.info("creating xml backup to " + file.getAbsolutePath());

          writer = new XmlWriter(new BufferedOutputStream(new FileOutputStream(file)));

          monitor.setStatusText(i18n.tr("Speichere Turnus-Informationen"));
          backup(TurnusImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

         
          monitor.setStatusText(i18n.tr("Speichere Umsatz-Kategorien"));
          backupTree(UmsatzTypImpl.class,writer,monitor);
          monitor.addPercentComplete(5);


          monitor.setStatusText(i18n.tr("Speichere Adressbuch"));
          backup(HibiscusAddressImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere Konten und Systemnachrichten"));
          backup(KontoImpl.class,writer,monitor);
          backup(NachrichtImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere Ums�tze"));
          backup(UmsatzImpl.class,writer,monitor);
          monitor.addPercentComplete(20);
         
          monitor.setStatusText(i18n.tr("Speichere Dauerauftr�ge"));
          backup(DauerauftragImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere SEPA-Dauerauftr�ge"));
          backup(SepaDauerauftragImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere Lastschriften"));
          backup(LastschriftImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere �berweisungen"));
          backup(UeberweisungImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere SEPA-�berweisungen"));
          backup(AuslandsUeberweisungImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere SEPA-Lastschriften"));
          backup(SepaLastschriftImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere Sammel-Lastschriften"));
          backup(SammelLastschriftImpl.class,writer,monitor);
          backup(SammelLastBuchungImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere Sammel-�berweisungen"));
          backup(SammelUeberweisungImpl.class,writer,monitor);
          backup(SammelUeberweisungBuchungImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere SEPA-Sammellastschriften"));
          backup(SepaSammelLastschriftImpl.class,writer,monitor);
          backup(SepaSammelLastBuchungImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere SEPA-Sammel�berweisungen"));
          backup(SepaSammelUeberweisungImpl.class,writer,monitor);
          backup(SepaSammelUeberweisungBuchungImpl.class,writer,monitor);
          monitor.addPercentComplete(5);

          monitor.setStatusText(i18n.tr("Speichere Properties"));
          backup(DBPropertyImpl.class,writer,monitor);
          monitor.addPercentComplete(10);

          monitor.setStatusText(i18n.tr("Speichere Reminder"));
          backup(DBReminderImpl.class,writer,monitor);
          monitor.addPercentComplete(2);

          // Die Protokolle zum Schluss.
          monitor.setStatusText(i18n.tr("Speichere Protokolle"));
          backup(ProtokollImpl.class,writer,monitor);
          monitor.addPercentComplete(20);
         
          // Die Versionstabelle wird nicht mit kopiert
         
          monitor.setStatus(ProgressMonitor.STATUS_DONE);
          monitor.setStatusText("Backup erstellt");
          monitor.setPercentComplete(100);
        }
        catch (Exception e)
        {
          throw new ApplicationException(e.getMessage());
        }
        finally
        {
          if (writer != null)
          {
            try
            {
              writer.close();
              Logger.info("backup created");
            }
            catch (Exception e) {/*useless*/}
          }
        }
View Full Code Here


  /**
   * @see de.willuhn.jameica.hbci.io.Exporter#doExport(java.lang.Object[], de.willuhn.jameica.hbci.io.IOFormat, java.io.OutputStream, de.willuhn.util.ProgressMonitor)
   */
  public void doExport(Object[] objects, IOFormat format,OutputStream os, final ProgressMonitor monitor) throws RemoteException, ApplicationException
  {
    Writer writer = null;

    try
    {
      double factor = 1;
      if (monitor != null)
      {
        factor = ((double)(100 - monitor.getPercentComplete())) / objects.length;
        monitor.setStatusText(i18n.tr("Exportiere Daten"));
      }

      writer = new XmlWriter(os);
      for (int i=0;i<objects.length;++i)
      {
        if (monitor != nullmonitor.setPercentComplete((int)((i) * factor));
        Object name = BeanUtil.toString(objects[i]);
        if (name != null && monitor != null)
          monitor.log(i18n.tr("Speichere Datensatz {0}",name.toString()));
        writer.write((GenericObject)objects[i]);
      }
    }
    catch (IOException e)
    {
      Logger.error("unable to write xml file",e);
      throw new ApplicationException(i18n.tr("Fehler beim Export der Daten. " + e.getMessage()));
    }
    finally
    {
      if (monitor != null)
      {
        monitor.setStatusText(i18n.tr("Schliesse Export-Datei"));
      }
      try
      {
        if (writer != null)
          writer.close();
      }
      catch (Exception e) {/*useless*/}
    }
  }
View Full Code Here

TOP

Related Classes of de.willuhn.datasource.serialize.Writer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.