Package de.willuhn.util

Examples of de.willuhn.util.ApplicationException


          monitor.setStatusText("Backup erstellt");
          monitor.setPercentComplete(100);
        }
        catch (Exception e)
        {
          throw new ApplicationException(e.getMessage());
        }
        finally
        {
          if (writer != null)
          {
View Full Code Here


        this.setTermin(new Date());
    }
    catch (RemoteException e)
    {
      Logger.error("error while checking order",e);
      throw new ApplicationException(i18n.tr("Fehler beim Pr�fen des Auftrages."));
    }
  }
View Full Code Here

  protected void updateCheck() throws ApplicationException
  {
    try
    {
      if (!whileStore && ausgefuehrt())
        throw new ApplicationException(i18n.tr("Auftrag wurde bereits ausgef�hrt und kann daher nicht mehr ge�ndert werden."));
    }
    catch (RemoteException e)
    {
      Logger.error("error while checking transfer",e);
      throw new ApplicationException(i18n.tr("Fehler beim Pr�fen des Auftrags."));
    }
    super.updateCheck();
  }
View Full Code Here

  {
    super.insertCheck();

    try {
      if (getSequenceType() == null)
        throw new ApplicationException(i18n.tr("Bitte w�hlen Sie den Sequenz-Typ aus"));
     
      if (this.getType() == null)
        this.setType(SepaLastType.DEFAULT);
    }
    catch (RemoteException e)
    {
      Logger.error("error while checking foreign ueberweisung",e);
      throw new ApplicationException(i18n.tr("Fehler beim Pr�fen des SEPA-Auftrages."));
    }
  }
View Full Code Here

   */
  protected void paint(Composite parent) throws Exception
  {

    if (this.transfer.ausgefuehrt())
      throw new ApplicationException(i18n.tr("Der Auftrag wurde bereits ausgef�hrt"));

    SimpleContainer container = new SimpleContainer(parent);

    container.addInput(this.getUseExisting());
    container.addInput(this.getExistingList());
    container.addSeparator();
    container.addInput(this.getKonto());
    container.addInput(this.getBezeichnung());

    final CheckboxInput delBox = new CheckboxInput(this.delete.booleanValue());
    container.addCheckbox(delBox,i18n.tr("Einzelauftr�ge nach �bernahme in den Sammel-Auftrag l�schen"));

    final LabelInput comment = new LabelInput("");
    comment.setColor(Color.ERROR);
    container.addLabelPair("",comment);

    ButtonArea b = new ButtonArea();
    b.addButton(i18n.tr("�bernehmen"), new Action()
    {
      public void handleAction(Object context) throws ApplicationException
      {
        try
        {
          delete = (Boolean) delBox.getValue();
          boolean use = ((Boolean) getUseExisting().getValue()).booleanValue();

          if (use)
          {
            // Wir verwenden einen existierenden Auftrag
            transfer = (SammelTransfer) getExistingList().getValue();
            if (transfer == null)
            {
              comment.setValue(i18n.tr("Bitte w�hlen Sie einen Auftrag aus."));
              return;
            }
          }
          else
          {
            // Wir erstellen einen neuen Auftrag
            // Checken, ob Konto ausgewaehlt wurde
            Konto konto = (Konto) getKonto().getValue();
            if (konto == null)
            {
              comment.setValue(i18n.tr("Bitte w�hlen Sie ein Konto aus."));
              return;
            }
            transfer.setKonto(konto);

            // Checken, ob Bezeichnung eingegeben wurde
            String text = (String) getBezeichnung().getValue();
            if (text == null || text.length() == 0)
            {
              comment.setValue(i18n.tr("Bitte geben Sie eine Bezeichnung ein."));
              return;
            }
            transfer.setBezeichnung(text);
            transfer.setTermin(new Date());
          }
        }
        catch (RemoteException e)
        {
          Logger.error("error while checking transfer",e);
          throw new ApplicationException(i18n.tr("Fehler beim Pr�fen des Auftrages"));
        }
        close();
      }
    },null,false,"ok.png");
    b.addButton(i18n.tr("Abbrechen"), new Action()
View Full Code Here

   * @throws ApplicationException
   */
  public List<SepaSammelLastschrift> merge(List<SepaLastschrift> lastschriften) throws ApplicationException
  {
    if (lastschriften == null || lastschriften.size() == 0)
      throw new ApplicationException(i18n.tr("Bitte w�hlen Sie einen oder mehrere Auftr�ge aus"));
   
    List<SepaSammelLastschrift> result = new ArrayList<SepaSammelLastschrift>();
    SepaSammelLastschrift tx = null;
   
    try
    {
      HBCIDBService service = Settings.getDBService();
      Map<String,SepaSammelLastschrift> map = new HashMap<String,SepaSammelLastschrift>();
      boolean inDb = false;
      ////////////////////////////////////////
      // 1. Iterieren ueber die Auftraege, um herauszufinden, wieviele Sammel-Auftraege es werden
      for (SepaLastschrift l:lastschriften)
      {
        inDb |= !l.isNewObject();
        String key = this.createKey(l);
        SepaSammelLastschrift s = map.get(key);
        if (s == null)
        {
          s = (SepaSammelLastschrift) service.createObject(SepaSammelLastschrift.class,null);
          s.setKonto(l.getKonto());
          s.setBezeichnung(i18n.tr("{0} {1} vom {2}",l.getSequenceType().getDescription(),l.getType().getDescription(), HBCI.LONGDATEFORMAT.format(new Date())));
          s.setSequenceType(l.getSequenceType());
          s.setType(l.getType());
          s.setTargetDate(l.getTargetDate());
          map.put(key,s);
        }
      }
     
      // Abfrage anzeigen, ob die Einzelauftraege geloescht werden sollen
      // a) wenn mindestens einer in der DB existierte
      // b) oder mehr als ein Sammelauftrag entsteht.
      boolean delete = false;
      int count = map.size();
      if (count > 1 || inDb)
      {
        SepaLastschriftMergeDialog dialog = new SepaLastschriftMergeDialog(SepaLastschriftMergeDialog.POSITION_CENTER,count,inDb);
        Object o = dialog.open();
        if (o != null)
          delete = ((Boolean)o).booleanValue();
      }
     
      // OK, wir duerfen weiter machen. Erstmal die Sammelauftraege anlegen
      Iterator<SepaSammelLastschrift> list = map.values().iterator();
      while (list.hasNext())
      {
        SepaSammelLastschrift s = list.next();
       
        if (tx == null)
        {
          tx = s;
          tx.transactionBegin();
        }
       
        s.store();
        Application.getMessagingFactory().sendMessage(new ImportMessage(s));
        result.add(s);
      }
     
      // jetzt iterieren wir nochmal ueber die Einzelauftraege und ordnen sie den
      // Sammelauftraegen zu
      for (SepaLastschrift l:lastschriften)
      {
        String key = this.createKey(l);
        SepaSammelLastschrift s = map.get(key);
       
       
        if (s == null) // WTF?
        {
          Logger.error("unable to find sepa transfer for key " + key);
          continue;
        }
       
        SepaSammelLastBuchung b = s.createBuchung();
        b.setBetrag(l.getBetrag());
        b.setCreditorId(l.getCreditorId());
        b.setEndtoEndId(l.getEndtoEndId());
        b.setGegenkontoBLZ(l.getGegenkontoBLZ());
        b.setGegenkontoName(l.getGegenkontoName());
        b.setGegenkontoNummer(l.getGegenkontoNummer());
        b.setMandateId(l.getMandateId());
        b.setSignatureDate(l.getSignatureDate());
        b.setZweck(l.getZweck());
        b.store();
        Application.getMessagingFactory().sendMessage(new ImportMessage(b));
        Application.getMessagingFactory().sendMessage(new ObjectChangedMessage(s));
       
        if (delete && !l.isNewObject())
        {
          l.delete();
          Application.getMessagingFactory().sendMessage(new ObjectDeletedMessage(l));
        }
      }
     
      tx.transactionCommit();
     
      return result;
    }
    catch (Exception e)
    {
      if (tx != null)
      {
        try
        {
          tx.transactionRollback();
        }
        catch (Exception e2)
        {
          Logger.error("unable to rollback transaction",e);
        }
      }
     
      if (e instanceof OperationCanceledException)
        throw (OperationCanceledException) e;
     
      if (e instanceof ApplicationException)
        throw (ApplicationException) e;
     
      Logger.error("error while merging jobs",e);
      throw new ApplicationException(i18n.tr("Zusammenfassen der Lastschriften fehlgeschlagen: {0}",e.getMessage()));
    }
  }
View Full Code Here

      if (e instanceof ApplicationException)
        throw (ApplicationException) e;

      Logger.error("error while disabling account",e);
      throw new ApplicationException(i18n.tr("Fehler beim Deaktivieren des Kontos"));
    }
  }
View Full Code Here

      // Ist nur ein einzelner, dann machen wir ein Array draus
      data = new Umsatz[]{(Umsatz)data};
    }

    if (!(data instanceof Umsatz[]))
      throw new ApplicationException(i18n.tr("Bitte w�hlen Sie mindestens einen Umsatz aus"));

    try
    {
      Date startDate = null;
      Date endDate   = null;

      // Gruppieren der Umsaetze nach Konto
      Umsatz[] all = (Umsatz[]) data;
      Map<String,List<Umsatz>> groups = new HashMap<String,List<Umsatz>>();
     
      for (Umsatz u:all)
      {
        // Wir ermitteln bei der Gelegenheit das Maximal- und Minimal-Datum
        Date date = u.getDatum();
        if (date != null)
        {
          if (startDate == null || date.before(startDate)) startDate = date;
          if (endDate   == null || date.after(endDate))    endDate = date;
        }

        Konto k = u.getKonto();
        List<Umsatz> list = groups.get(k.getID());
        if (list == null)
        {
          list = new LinkedList<Umsatz>();
          groups.put(k.getID(),list);
        }
        list.add(u);
      }
     
     
      //////////////////////////////////////////////////////////////////////////
      // Header mit dem Zeitraum
      GridPrint grid = new GridPrint("l:d:g");

      grid.add(new TextPrint(i18n.tr("Zeitraum: {0} - {1}",HBCI.DATEFORMAT.format(startDate),HBCI.DATEFORMAT.format(endDate)),fontTinyBold));
      grid.add(new LineBreakPrint(fontTitle));
      //////////////////////////////////////////////////////////////////////////

      DefaultGridLook look = new DefaultGridLook();
      look.setHeaderBackground(new RGB(220,220,220));
     
      LineBorder border = new LineBorder(new RGB(100,100,100));
      border.setGapSize(3);
      look.setCellBorder(border);
     
      GridPrint table = new GridPrint("l:p:n, l:d:n, l:p:g, r:p:n, r:p:n",look);
      table.addHeader(new NoBreakPrint(new TextPrint(i18n.tr("Valuta/Datum"),fontTinyBold)));
      table.addHeader(new TextPrint(i18n.tr("Gegenkonto"),fontTinyBold));
      table.addHeader(new TextPrint(i18n.tr("Verwendungszweck"),fontTinyBold));
      table.addHeader(new TextPrint(i18n.tr("Betrag"),fontTinyBold));
      table.addHeader(new TextPrint(i18n.tr("Saldo"),fontTinyBold));

      // Iteration pro Konto
      Iterator<String> konten = groups.keySet().iterator();
     
      while (konten.hasNext())
      {
        String id = konten.next();
        List<Umsatz> umsaetze = groups.get(id);
       
        // Header mit dem Konto
        Konto k = (Konto) Settings.getDBService().createObject(Konto.class,id);
        table.add(new TextPrint(k.getLongName(),fontTinyBold),GridPrint.REMAINDER);
       
       
        // Liste der Umsaetze im Konto
        for (Umsatz u:umsaetze)
        {
          String usage = VerwendungszweckUtil.toString(u,"\n");
          StringBuffer sb = new StringBuffer();
          {
            String name = u.getGegenkontoName();
            if (name != null && name.length() > 0)
              sb.append(name + "\n");
           
            String kto = u.getGegenkontoNummer();
            String blz = u.getGegenkontoBLZ();
            if (kto != null && kto.length() > 0 && blz != null && blz.length() > 0)
            {
              String gi = HBCIProperties.getNameForBank(blz);
              if (gi != null && gi.length() > 0)
                sb.append(i18n.tr("Kto. {0}, {1}",kto,gi));
              else
                sb.append(i18n.tr("Kto. {0}, BLZ {1}",kto,blz));
            }
          }

          TextStyle typeHaben = new TextStyle().font(fontTiny).foreground(new RGB(0,0,0));
          TextStyle typeSoll = new TextStyle().font(fontTiny).foreground(new RGB(200,0,0));

          table.add(new TextPrint(HBCI.DATEFORMAT.format(u.getValuta()) + "\n" + HBCI.DATEFORMAT.format(u.getDatum()),fontTiny));
          table.add(new TextPrint(sb.toString(),fontTiny));
          table.add(new TextPrint(notNull(usage),fontTiny));
          table.add(new NoBreakPrint(new TextPrint(HBCI.DECIMALFORMAT.format(u.getBetrag()) + " " + k.getWaehrung(),u.getBetrag() >= 0 ? typeHaben : typeSoll)));
          table.add(new NoBreakPrint(new TextPrint(HBCI.DECIMALFORMAT.format(u.getSaldo()) + " " + k.getWaehrung(),fontTiny)));
        }
      }
      grid.add(table);
     
      return grid;
    }
    catch (RemoteException re)
    {
      Logger.error("unable to print data",re);
      throw new ApplicationException(i18n.tr("Druck fehlgeschlagen: {0}",re.getMessage()));
    }
  }
View Full Code Here

  public void handleAction(Object context) throws ApplicationException
  {
    I18N i18n = Application.getPluginLoader().getPlugin(HBCI.class).getResources().getI18N();

    if (context == null || (!(context instanceof SammelTransfer) && !(context instanceof SammelTransfer[])))
      throw new ApplicationException(i18n.tr("Bitte w�hlen Sie mindestens einen Sammel-Auftrag aus"));

    try
    {
      SammelTransfer[] list = null;
      if (context instanceof SammelTransfer)
View Full Code Here

  public void handleAction(Object context) throws ApplicationException
  {
    Object export = this.data != null ? this.data : context;
   
    if (export == null)
      throw new ApplicationException(i18n.tr("Bitte w�hlen Sie die zu exportierenden Daten aus"));

    Object[] objects = null;
   
    if (export instanceof Object[])
      objects = (Object[]) export;
    else
      objects = new Object[]{export};

    try
    {
      ExportDialog d = new ExportDialog(objects, type);
      d.open();
    }
    catch (OperationCanceledException oce)
    {
      Logger.info(oce.getMessage());
      return;
    }
    catch (ApplicationException ae)
    {
      throw ae;
    }
    catch (Exception e)
    {
      Logger.error("export failed",e);
      throw new ApplicationException(i18n.tr("Export fehlgeschlagen: {0}",e.getMessage()),e);
    }
  }
View Full Code Here

TOP

Related Classes of de.willuhn.util.ApplicationException

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.