Package de.willuhn.jameica.hbci.server

Source Code of de.willuhn.jameica.hbci.server.VersionUtil

/**********************************************************************
* $Source: /cvsroot/hibiscus/hibiscus/src/de/willuhn/jameica/hbci/server/VersionUtil.java,v $
* $Revision: 1.4 $
* $Date: 2011/08/05 11:21:59 $
* $Author: willuhn $
* $Locker:  $
* $State: Exp $
*
* Copyright (c) by willuhn software & services
* All rights reserved
*
**********************************************************************/

package de.willuhn.jameica.hbci.server;

import java.rmi.RemoteException;

import de.willuhn.datasource.rmi.DBIterator;
import de.willuhn.datasource.rmi.DBService;
import de.willuhn.jameica.hbci.HBCI;
import de.willuhn.jameica.hbci.rmi.Version;
import de.willuhn.jameica.system.Application;
import de.willuhn.util.ApplicationException;
import de.willuhn.util.I18N;

/**
* Statische Hilfsklasse zum Auslesen von Versionsnummern.
*/
public class VersionUtil
{
  /**
   * Liefert die Version zum angegebenen Namen.
   * Wenn das Versions-Objekt noch nicht existiert, wird es automatisch erstellt.
   * @param service der Datenbank-Service.
   * @param name Name der Version.
   * @return die Version.
   * @throws RemoteException
   * @throws ApplicationException
   */
  public static Version getVersion(DBService service, String name) throws RemoteException, ApplicationException
  {
    if (name == null || name.length() == 0)
    {
      I18N i18n = Application.getPluginLoader().getPlugin(HBCI.class).getResources().getI18N();
      throw new ApplicationException(i18n.tr("Keine Versionsbezeichnung angegeben"));
    }
    DBIterator list = service.createList(Version.class);
    list.addFilter("name = ?",name);
    if (list.hasNext())
      return (Version) list.next();
   
    // Neue Version erstellen
    Version v = (Version) service.createObject(Version.class,null);
    v.setName(name);
    v.store();
    return v;
  }
}


/*********************************************************************
* $Log: VersionUtil.java,v $
* Revision 1.4  2011/08/05 11:21:59  willuhn
* @N Erster Code fuer eine Umsatz-Preview
* @C Compiler-Warnings
* @N DateFromInput/DateToInput - damit sind die Felder fuer den Zeitraum jetzt ueberall einheitlich
*
* Revision 1.3  2008/05/30 14:23:48  willuhn
* @N Vollautomatisches und versioniertes Speichern der BPD und UPD in der neuen Property-Tabelle
*
**********************************************************************/
TOP

Related Classes of de.willuhn.jameica.hbci.server.VersionUtil

TOP
Copyright © 2018 www.massapi.com. 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.