Package de.willuhn.datasource.rmi

Examples of de.willuhn.datasource.rmi.DBObject


      {
        // Daten in den Cache laden
        DBIterator list = factory.load();
        while (list.hasNext())
        {
          DBObject o = (DBObject) list.next();
          cache.data.put(o.getID(),o);
          cache.values.add(o);
        }
      }
      caches.put(type,cache);
    }
View Full Code Here


    if (id == null)
      return null;
   
    String s = id.toString();
   
    DBObject value = data.get(s);
   
    if (value == null)
    {
      // Noch nicht im Cache. Vielleicht koennen wir es noch laden
      try
      {
        value = (DBObject) Settings.getDBService().createObject(type,s);
        if (value == null)
          return null;
        data.put(value.getID(),value);
        values.add(value);
      }
      catch (ObjectNotFoundException one)
      {
        // Objekt existiert nicht mehr
View Full Code Here

        throw new ApplicationException(i18n.tr("CSV-Datei enth�lt keine weiteren Daten"));

      int created       = 0;
      int error         = 0;
      int skipped       = 0;
      DBObject object   = null;
      String value      = null;
      List<Column> cols = p.getColumns();
      ImportListener l  = f.getImportListener();

      DBService service = (DBService) Application.getServiceFactory().lookup(HBCI.class,"database");
      do
      {
        monitor.log(i18n.tr("Importiere Zeile {0}",Integer.toString(csv.getLineNumber())));
        monitor.addPercentComplete(1);

        try
        {
          object = service.createObject(f.getType(),null);
         
          // Spalten zuordnen
          Map<String, Object> values = new HashMap<String,Object>();
          for (int i=0;i<line.size();++i)
          {
            Column column = null;
            for (Column c:cols)
            {
              if (c.getColumn() == i)
              {
                column = c;
                break;
              }
            }
           
            if (column == null)
              continue; // Spalte nicht zugeordnet
           
            // Checken, ob in der Spalte was steht
            value = line.get(i);
            if (value == null)
              continue;
            value = value.trim();
            if (value.length() == 0)
              continue;
           
            try
            {
              // Werte zwischenspeichern
              Object prev = values.get(column.getProperty());
              values.put(column.getProperty(),column.getSerializer().unserialize(prev,value));
            }
            catch (Exception e)
            {
              Logger.error("unable to unserialize " + column.getProperty() + " for line " + csv.getLineNumber() + ", value: " + value,e);
              monitor.log("  " + i18n.tr("Ung�ltiger Wert \"{0}\" in Spalte \"{1}\": {2}",value,column.getName(),e.getMessage()));
            }
          }
         
          // beforeSet-Listener ausloesen
          if (l != null)
          {
            ImportEvent e = new ImportEvent();
            e.context = context;
            e.data = values;
            try
            {
              l.beforeSet(e);
            }
            catch (OperationCanceledException oce)
            {
              skipped++;
              String msg = oce.getMessage();
              if (msg != null && msg.length() > 0)
                monitor.log("  " + msg);
              continue;
            }
          }
         

          // Werte in die Bean uebernehmen
          Iterator<String> it = values.keySet().iterator();
          while (it.hasNext())
          {
            String name = it.next();
            Object o = values.get(name);
            try
            {
              BeanUtil.set(object,name,o);
            }
            catch (Exception e)
            {
              Logger.error("unable to apply property " + name + " for line " + csv.getLineNumber() + ", value: " + o,e);
              String[] s = new String[]{value,
                                        name,
                                        e.getMessage()};
              monitor.log("  " + i18n.tr("Ung�ltiger Wert \"{0}\" in Spalte \"{1}\": {2}",s));
            }
          }
         
         
         
         
          if (l != null)
          {
            ImportEvent e = new ImportEvent();
            e.context = context;
            e.data = object;
            try
            {
              l.beforeStore(e);
            }
            catch (OperationCanceledException oce)
            {
              skipped++;
              String msg = oce.getMessage();
              if (msg != null && msg.length() > 0)
                monitor.log("  " + msg);
              continue;
            }
          }
         
          object.store();
          Application.getMessagingFactory().sendMessage(new ImportMessage(object));
          created++;
        }
        catch (Exception e)
        {
View Full Code Here

            // bis zum Ende der DTAUS-Datei genau auf 100% bewegen
            monitor.setPercentComplete((int)((++count) * factor));
            monitor.log(i18n.tr("Importiere Datensatz {0}",c.getNameEmpfaenger()));
          
            // Gewuenschtes Objekt erstellen
            final DBObject skel = service.createObject(((MyIOFormat)format).type,null);
           
            // Mit Daten befuellen lassen
            create(skel,context,c,a);

            success++;
View Full Code Here

      String id = MetaKey.REMINDER_TEMPLATE.get(object);
      if (id == null)
        return;
     
      // Checken, ob wir den Datensatz laden koennen
      DBObject o = Settings.getDBService().createObject(object.getClass(),id);
     
      // Wir versuchen, ihn zu oeffnen
      new Open().handleAction(o);
    }
    catch (ObjectNotFoundException oe)
View Full Code Here

      int created = 0;
      int error   = 0;

      SepaSammelTransfer currentTransfer = null;
     
      DBObject object = null;
      while ((object = (DBObject) reader.read()) != null)
      {
        if (monitor != null)
        {
          monitor.log(i18n.tr("Datensatz {0}", "" + (created+1)));
          if (created > 0 && created % 10 == 0) // nur geschaetzt
            monitor.addPercentComplete(1);
        }

        try
        {
          // Ist noetig, damit die Buchungen die neue ID des Transfers kriegen
          if (object instanceof SepaSammelTransfer)
          {
            currentTransfer = (SepaSammelTransfer) object;
            currentTransfer.setKonto(konto);
          }
          else
          {
            ((SepaSammelTransferBuchung)object).setSammelTransfer(currentTransfer);
          }
         
          object.store();
          created++;
          try
          {
            Application.getMessagingFactory().sendMessage(new ImportMessage(object));
          }
View Full Code Here

        monitor.setStatusText(i18n.tr("Lese Datei ein"));

      int created = 0;
      int error   = 0;

      DBObject object = null;
      while ((object = (DBObject) reader.read()) != null)
      {
        if (monitor != null)
        {
          monitor.log(i18n.tr("Datensatz {0}", "" + (created+1)));
          if (created > 0 && created % 10 == 0) // nur geschaetzt
            monitor.addPercentComplete(1);
        }

        try
        {
          object.store();
          created++;
          try
          {
            Application.getMessagingFactory().sendMessage(new ImportMessage(object));
          }
View Full Code Here

TOP

Related Classes of de.willuhn.datasource.rmi.DBObject

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.