public ValueObject getNewEmptyModel() {
   ValueObject val = super.getNewEmptyModel();
   if (val == null) {
     val = new FacilityValue();
     val.getClientValueObjectProxy().setNew();
   }
   return val;
 }
 /*
  * (non-Javadoc)
  *
  * @see net.metaship.swing.generic.ServerService#delete(net.metaship.generic.ValueObject)
  */
 public void delete(ValueObject vo) throws Exception {
   try {
     log.info("FacilityService deleting vo");
     getRemoteManager().delete(vo.getPK());
     vo.getClientValueObjectProxy().markForDeletion();
   } catch (LocalException e) {
     log.debug("Exception caught:", e);
     throw new RemoteException("LocalException while deleting!", e);
   }
 }
  /**
   * @ejb.interface-method
   * @ejb.transaction type="Required"
   */
  public ValueObject fill(ValueObject valueObject) throws LocalException {
    List list = new CompressedSerializedList();
    ValueObject returnValue = null;
    try {
      if (valueObject instanceof SpecialRateValue) {
        SpecialRateValue object = new SpecialRateValue((SpecialRateValue) valueObject);

        if (object.getId() == null) {
          throw new LocalException("Could not fill object, because primary key is null: " + object);
        }
        SpecialRateLineManagerLocal srlm =
            (SpecialRateLineManagerLocal) SpecialRateLineManagerUtil.getLocalHome().create();
        Collection col =
            SpecialRateLineUtil.getLocalHome().findBySpecialRateId(object.getId().longValue());
        for (Iterator iter = col.iterator(); iter.hasNext(); ) {
          SpecialRateLineLocal element = (SpecialRateLineLocal) iter.next();
          list.add(srlm.fill(element.getSpecialRateLineValue()));
        }
        object.fillSpecialRateLines(list);
        returnValue = object;

      } else {
        // others
        throw new LocalException(
            "Tried to fill an Unsupported valueObject-type: " + valueObject.getClass());
      }
    } catch (NamingException e) {
      throw new LocalException("NamingException while filling: " + valueObject, e);
    } catch (FinderException e) {
      throw new LocalException("FinderException while filling: " + valueObject, e);
    } catch (CreateException e) {
      throw new LocalException("FinderException while filling: " + valueObject, e);
    }
    return returnValue;
  }
 private void fillFields(ValueObject valueObject) {
   setTitle(valueObject);
   if (!valueObject.getClientValueObjectProxy().isNew()) {
     idTextField.setText(((BargeTariffValue) valueObject).getId().toString());
     durationFromTextField.setDate(
         new java.sql.Date(((BargeTariffValue) valueObject).getDurationFrom().getTime()));
     durationToTextField.setDate(
         new java.sql.Date(((BargeTariffValue) valueObject).getDurationTo().getTime()));
     importCheckBox.setSelected(((BargeTariffValue) valueObject).getIsImport());
     vendor.setText(((BargeTariffValue) valueObject).getVendorName());
     facility.setText(((BargeTariffValue) valueObject).getFacilityName());
     currency.setSelectedCurrencyId(model.getCurrencyId());
     currency.setEnabled(false);
   }
   copyButton.setEnabled(!model.getClientValueObjectProxy().isNew());
   valueObject.getClientValueObjectProxy().setChanged(false);
 }
 /*
  * (non-Javadoc)
  *
  * @see net.metaship.swing.generic.ServerService#update(net.metaship.generic.ValueObject)
  */
 protected void update(ValueObject valueObject) throws Exception {
   super.update(valueObject);
   try {
     if (valueObject != null && valueObject instanceof Address) {
       Address address = (Address) findByPrimaryKey(valueObject.getPK());
       ((Address) valueObject).setZipcode(address.getZipcode());
       ((Address) valueObject).setLatitude(address.getLatitude());
       ((Address) valueObject).setLongitude(address.getLongitude());
     }
   } catch (Exception e) {
     log.warn(e);
   }
 }
 /**
  * @return null if no confirmation is needed or a String with the message to display in the
  *     confirmation dialog
  */
 public String deleteRequiresConfirmation(ValueObject vo) {
   // VERSION_TOGGLE Facility.warnOnCascadeDelete Start ----------
   if (ResourceUtil.getBoolean("Facility.warnOnCascadeDelete")) {
     try {
       if (getFacilityManager().otherDataDependsOnFacility(vo.getPK())) {
         return "Warning: Deletion of this facility will delete its service "
             + "area entries and other dependent data! Continue?";
       }
     } catch (Exception e) {
       log.error("Exception while checking otherDataDependsOnFacility: ", e);
     }
   }
   // VERSION_TOGGLE Facility.warnOnCascadeDelete End ----------
   return null;
 }
 /**
  * Constructor CurrencyDetailFrame.
  *
  * @param valueObject
  */
 public BargeTariffDetailFrame(ValueObject valueObject) {
   super(valueObject);
   this.setResizable(true);
   log.debug("Value Object is a " + valueObject.getClass().getName());
   this.model = (BargeTariffValue) valueObject;
   setTitle(valueObject);
   log.info("after setTitle");
   initComponents();
   log.debug("after initComponents");
   fillFields(valueObject);
   log.debug("after fillFields");
   postInit();
   log.debug("after postInit");
   this.setBounds(100, 100, 520, 350);
   log.debug("Constructor end");
 }
 /**
  * method checkValueObjectInstance
  *
  * @param valueObject
  */
 private void checkValueObjectInstance(ValueObject valueObject) {
   if (!(valueObject instanceof SpecialRateValue)) {
     throw new IllegalArgumentException(
         "Tried to handle an " + valueObject.getClass() + " instead of an SpecialRateValue!");
   }
 }
 /** @param valueObject */
 private void setTitle(ValueObject valueObject) {
   setTitle("Barge Tariff: ", valueObject.toString(), "New Barge Tariff");
 }
 /**
  * @param vo
  * @param user
  * @throws RemoteException
  * @throws Exception
  */
 public void delete(ValueObject vo, String user) throws RemoteException, Exception {
   getFacilityManager().delete(vo.getPK(), user);
 }
 /*
  * (non-Javadoc)
  *
  * @see net.metaship.swing.generic.ContextTableModel#getNewEmptyModel()
  */
 public ValueObject getNewEmptyModel() {
   ValueObject val = new CurrencyValue();
   val.getClientValueObjectProxy().setNew();
   return val;
 }