/** Creates a new copy of the current Data Transfer Object */
  public Go_mdt_hcps cloneObject() throws ims.dto.Exception {
    Go_mdt_hcps cloneObject = new Go_mdt_hcps(Connection);

    if (Filter != null) cloneObject.Filter = Filter.cloneObject();

    if (lastGetFilter != null) cloneObject.lastGetFilter = lastGetFilter.cloneObject();
    else cloneObject.lastGetFilter = null;

    for (int x = 0; x < DataCollection.count(); x++) {
      int index = cloneObject.DataCollection.add();

      cloneObject.DataCollection.get(index).Go_mdt_hcps_id = DataCollection.get(x).Go_mdt_hcps_id;
      cloneObject.DataCollection.get(index).Pkey = DataCollection.get(x).Pkey;
      cloneObject.DataCollection.get(index).Rdat = DataCollection.get(x).Rdat;
      cloneObject.DataCollection.get(index).Rtim = DataCollection.get(x).Rtim;
      cloneObject.DataCollection.get(index).Rhcp = DataCollection.get(x).Rhcp;
      cloneObject.DataCollection.get(index).Rusr = DataCollection.get(x).Rusr;
      cloneObject.DataCollection.get(index).Udat = DataCollection.get(x).Udat;
      cloneObject.DataCollection.get(index).Utim = DataCollection.get(x).Utim;
      cloneObject.DataCollection.get(index).Uhcp = DataCollection.get(x).Uhcp;
      cloneObject.DataCollection.get(index).Uusr = DataCollection.get(x).Uusr;
      cloneObject.DataCollection.get(index).Cdat = DataCollection.get(x).Cdat;
      cloneObject.DataCollection.get(index).Ctim = DataCollection.get(x).Ctim;
      cloneObject.DataCollection.get(index).Modu = DataCollection.get(x).Modu;
      cloneObject.DataCollection.get(index).Ccs_epid = DataCollection.get(x).Ccs_epid;
      cloneObject.DataCollection.get(index).Actind = DataCollection.get(x).Actind;
      cloneObject.DataCollection.get(index).Tstp = DataCollection.get(x).Tstp;
      cloneObject.DataCollection.get(index).Session_id = DataCollection.get(x).Session_id;
      cloneObject.DataCollection.get(index).Sessiond_id = DataCollection.get(x).Sessiond_id;

      for (int iSeqno = 0; iSeqno < DataCollection.get(x).SeqnoCollection.count(); iSeqno++) {
        int rIndex = cloneObject.DataCollection.get(index).SeqnoCollection.add();

        cloneObject.DataCollection.get(index).SeqnoCollection.get(rIndex).Seqno =
            DataCollection.get(x).SeqnoCollection.get(iSeqno).Seqno;
        cloneObject.DataCollection.get(index).SeqnoCollection.get(rIndex).Attattended =
            DataCollection.get(x).SeqnoCollection.get(iSeqno).Attattended;
        cloneObject.DataCollection.get(index).SeqnoCollection.get(rIndex).Attdeclined =
            DataCollection.get(x).SeqnoCollection.get(iSeqno).Attdeclined;
        cloneObject.DataCollection.get(index).SeqnoCollection.get(rIndex).Attconfirmed =
            DataCollection.get(x).SeqnoCollection.get(iSeqno).Attconfirmed;
        cloneObject.DataCollection.get(index).SeqnoCollection.get(rIndex).Methodinformed =
            DataCollection.get(x).SeqnoCollection.get(iSeqno).Methodinformed;
        cloneObject.DataCollection.get(index).SeqnoCollection.get(rIndex).Dateinformed =
            DataCollection.get(x).SeqnoCollection.get(iSeqno).Dateinformed;
        cloneObject.DataCollection.get(index).SeqnoCollection.get(rIndex).Hcp_txt =
            DataCollection.get(x).SeqnoCollection.get(iSeqno).Hcp_txt;
        cloneObject.DataCollection.get(index).SeqnoCollection.get(rIndex).Hcp_id =
            DataCollection.get(x).SeqnoCollection.get(iSeqno).Hcp_id;
        cloneObject.DataCollection.get(index).SeqnoCollection.get(rIndex).Ct_ext_flag =
            DataCollection.get(x).SeqnoCollection.get(iSeqno).Ct_ext_flag;
      }
    }

    return cloneObject;
  }
  /**
   * Returns one record using the specified filter. If the result returned is not null an error
   * occured.
   */
  public ims.dto.Result getLast() {
    DataCollection.clear();

    ims.dto.Result reLoginResult = Connection.reLogin();
    if (reLoginResult != null)
      return new ims.dto.Result(reLoginResult.getMessage(), "DTO.Client.Go_mdt_hcps.Get");

    ims.dto.Result result = Connection.getLast(serviceName, encodeNASFilter());
    if (result != null) return result;

    lastGetFilter = Filter.cloneObject();
    decodeNASMessageWithRepeatingGroups();

    return null;
  }
    public Go_mdt_hcpsFilter cloneObject() {
      Go_mdt_hcpsFilter newFilter = new Go_mdt_hcpsFilter();

      newFilter.Go_mdt_hcps_id = this.Go_mdt_hcps_id;
      newFilter.Pkey = this.Pkey;
      newFilter.Rdat = this.Rdat;
      newFilter.Rtim = this.Rtim;
      newFilter.Rhcp = this.Rhcp;
      newFilter.Rusr = this.Rusr;
      newFilter.Udat = this.Udat;
      newFilter.Utim = this.Utim;
      newFilter.Uhcp = this.Uhcp;
      newFilter.Uusr = this.Uusr;
      newFilter.Cdat = this.Cdat;
      newFilter.Ctim = this.Ctim;
      newFilter.Modu = this.Modu;
      newFilter.Ccs_epid = this.Ccs_epid;
      newFilter.Actind = this.Actind;
      newFilter.Tstp = this.Tstp;
      newFilter.Session_id = this.Session_id;
      newFilter.Sessiond_id = this.Sessiond_id;

      return newFilter;
    }