/**
   * @see net.metaship.generic.Manager#update(ValueObject)
   * @ejb.interface-method
   * @ejb.transaction type="Required"
   */
  public void update(ValueObject valueObject) throws LocalException {
    checkValueObjectInstance(valueObject);

    SpecialRateValue value = (SpecialRateValue) valueObject;
    SpecialRateLocal local = null;
    try {
      SpecialRateLocalHome home = SpecialRateUtil.getLocalHome();
      local = home.findByPrimaryKey(value.getPrimaryKey());
      local.setSpecialRateValue(value);

    } catch (Exception e) {
      throw new LocalException("An Error occured while updating object: " + valueObject + "!!", e);
    }
  }
  /**
   * Copy the specified tariffPK's with all line items to new tariffs with the given validity Can
   * handle Tariff PK's or TariffLine PK's if TariffLinePK's are handed over onlly the handed ones
   * are copied
   *
   * @param tariffPKs
   * @param newDurationFrom
   * @param newDurationTo
   * @return
   * @throws LocalException
   * @throws NamingException
   * @throws FinderException
   * @ejb.interface-method
   * @ejb.transaction type="Required"
   */
  public List copy(java.util.List tariffPKs, java.util.Date durationFrom, java.util.Date durationTo)
      throws LocalException, FinderException, NamingException {
    if (log.isInfoEnabled())
      log.info(">copy " + " List" + tariffPKs + " Date " + durationFrom + " Date " + durationTo);

    if (tariffPKs.size() < 1) return new ArrayList();

    List pks = null;
    List copiedTariffs = new ArrayList();
    Hashtable pKs = new Hashtable();
    if (tariffPKs.get(0) instanceof SpecialRateLinePK) {
      for (int i = 0, n = tariffPKs.size(); i < n; i++) {
        SpecialRateLineLocal ttll =
            ((SpecialRateLineLocal)
                SpecialRateLineUtil.getLocalHome()
                    .findByPrimaryKey((SpecialRateLinePK) tariffPKs.get(i)));
        SpecialRatePK ttpk = new SpecialRatePK(new Long(ttll.getSpecialRateId()));
        SpecialRateValue ttl = null;
        if (!pKs.contains(ttpk)) {
          ttl =
              SpecialRateUtil.getLocalHome()
                  .findByPrimaryKey(ttpk)
                  .plainCopy(false, durationFrom, durationTo);
          pKs.put(ttpk, ttl);
          copiedTariffs.add(ttl);
        }
        ttl = (SpecialRateValue) pKs.get(ttpk);
        ttll.copyInto(ttl.getPrimaryKey());
      }

    } else {
      pks = tariffPKs;
      copiedTariffs = copyTariffPK(pks, durationFrom, durationTo);
    }
    return copiedTariffs;
  }