public boolean equals(Object obj) {
    if (!(obj instanceof net.metaship.intermodal.transport.ejb.OrderCommodityPK)) {
      return false;
    }

    final net.metaship.intermodal.transport.ejb.OrderCommodityPK pk =
        (net.metaship.intermodal.transport.ejb.OrderCommodityPK) obj;
    boolean eq = true;

    if (obj == null) {
      eq = false;
    } else {
      if (this.id != null) {
        eq &= this.id.equals(pk.getId());
      } else {
        // this.id == null
        eq &= pk.getId() == null;
      }
    }
    return eq;
  }
  /** Change to dependent object... */
  public void stateChanged(ChangeEvent e) {
    Object source = e.getSource();
    while (source instanceof OrderCommodityDetailFrame) {
      // Some order commodity has changed.
      // Try to find it, then update order model

      // Sanity Check
      OrderValue ov = (OrderValue) getModel();
      if (ov == null) {
        break;
      }

      // Which OC ID to find?
      OrderCommodityDetailFrame ocdf = (OrderCommodityDetailFrame) source;
      OrderCommodityValue changedOCV = (OrderCommodityValue) ocdf.getModel();
      OrderCommodityPK ocpk = (OrderCommodityPK) changedOCV.getPK();
      if (ocpk == null) {
        break;
      }
      Long changeOrderCommodityId = ocpk.getId();
      if (changeOrderCommodityId == null || changeOrderCommodityId.longValue() == 0) {
        break;
      }

      // Check OrderValues, find it.
      Collection orderCommodities = ov.getOrderCommodities();
      for (Iterator it = orderCommodities.iterator(); it.hasNext(); ) {
        OrderCommodityValue ocv = (OrderCommodityValue) it.next();
        if (ocv.getId().equals(changeOrderCommodityId)) {
          ocv.setCommodity(changedOCV.getCommodity());
          ocv.setHazardousDetails(changedOCV.getHazardousDetails());
          orderPanel.stateChanged(new ChangeEvent(ocv));
          break;
        }
      }
      break;
    }
    hasChanged();
  }