public int compareTo(Object obj, boolean caseInsensitive) {
   if (obj == null) {
     return -1;
   }
   if (caseInsensitive) ; // this is to avoid eclipse warning only.
   if (!(BayConfigForWardViewVo.class.isAssignableFrom(obj.getClass()))) {
     throw new ClassCastException(
         "A BayConfigForWardViewVo object cannot be compared an Object of type "
             + obj.getClass().getName());
   }
   BayConfigForWardViewVo compareObj = (BayConfigForWardViewVo) obj;
   int retVal = 0;
   if (retVal == 0) {
     if (this.getBay() == null && compareObj.getBay() != null) return -1;
     if (this.getBay() != null && compareObj.getBay() == null) return 1;
     if (this.getBay() != null && compareObj.getBay() != null)
       retVal = this.getBay().compareTo(compareObj.getBay());
   }
   return retVal;
 }
  public Object clone() {
    if (this.isBusy) return this;
    this.isBusy = true;

    BayConfigForWardViewVo clone = new BayConfigForWardViewVo(this.id, this.version);

    if (this.bay == null) clone.bay = null;
    else clone.bay = (ims.core.vo.LocationLiteVo) this.bay.clone();
    clone.isactive = this.isactive;
    clone.male = this.male;
    clone.female = this.female;
    clone.paediatric = this.paediatric;
    clone.numofbeds = this.numofbeds;
    clone.numofoccupiedbeds = this.numofoccupiedbeds;
    if (this.openingtime == null) clone.openingtime = null;
    else clone.openingtime = (ims.framework.utils.Time) this.openingtime.clone();
    if (this.closingtime == null) clone.closingtime = null;
    else clone.closingtime = (ims.framework.utils.Time) this.closingtime.clone();
    clone.weekdaysonly = this.weekdaysonly;
    if (this.bayavailabilitystatus == null) clone.bayavailabilitystatus = null;
    else
      clone.bayavailabilitystatus =
          (ims.core.vo.lookups.WardBayStatus) this.bayavailabilitystatus.clone();
    if (this.reopenoutofhours == null) clone.reopenoutofhours = null;
    else
      clone.reopenoutofhours =
          (ims.core.vo.ReopenBayOutOfHoursVoCollection) this.reopenoutofhours.clone();
    if (this.temporarybaygender == null) clone.temporarybaygender = null;
    else clone.temporarybaygender = (ims.core.vo.lookups.Sex) this.temporarybaygender.clone();
    if (this.floorbedspacelayout == null) clone.floorbedspacelayout = null;
    else
      clone.floorbedspacelayout =
          (ims.core.vo.FloorBedSpaceLayoutLiteVo) this.floorbedspacelayout.clone();
    if (this.dependency == null) clone.dependency = null;
    else clone.dependency = (ims.core.vo.lookups.BayDependencyLevel) this.dependency.clone();
    if (this.closingdetails == null) clone.closingdetails = null;
    else
      clone.closingdetails =
          (ims.core.vo.WardBayClosingDetailsVoCollection) this.closingdetails.clone();
    if (this.blockingdetails == null) clone.blockingdetails = null;
    else
      clone.blockingdetails =
          (ims.core.vo.WardBayBlockingDetailsVoCollection) this.blockingdetails.clone();
    clone.isValidated = this.isValidated;

    this.isBusy = false;
    return clone;
  }