protected final void oncmbSpecialInterestCategoryValueSet(Object value) {
    java.util.ArrayList listOfValues = this.form.cmbSpecialInterestCategory().getValues();

    if (value == null) {
      if (listOfValues != null && listOfValues.size() > 0) {
        for (int x = 0; x < listOfValues.size(); x++) {
          ims.correspondence.vo.lookups.SpecialInterestType existingInstance =
              (ims.correspondence.vo.lookups.SpecialInterestType) listOfValues.get(x);
          if (!existingInstance.isActive()) {
            bindcmbSpecialInterestCategoryLookup();
            return;
          }
        }
      }
    } else if (value instanceof ims.correspondence.vo.lookups.SpecialInterestType) {
      ims.correspondence.vo.lookups.SpecialInterestType instance =
          (ims.correspondence.vo.lookups.SpecialInterestType) value;

      if (listOfValues != null) {
        if (listOfValues.size() == 0) bindcmbSpecialInterestCategoryLookup();

        for (int x = 0; x < listOfValues.size(); x++) {
          ims.correspondence.vo.lookups.SpecialInterestType existingInstance =
              (ims.correspondence.vo.lookups.SpecialInterestType) listOfValues.get(x);
          if (existingInstance.equals(instance)) return;
        }
      }

      this.form
          .cmbSpecialInterestCategory()
          .newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
    }
  }
 public void populate(
     ims.vo.ValueObjectBeanMap map, ims.emergency.vo.beans.SpecialInterestDetailsVoBean bean) {
   this.id = bean.getId();
   this.version = bean.getVersion();
   this.patient =
       bean.getPatient() == null
           ? null
           : new ims.core.patient.vo.PatientRefVo(
               new Integer(bean.getPatient().getId()), bean.getPatient().getVersion());
   this.episode =
       bean.getEpisode() == null
           ? null
           : new ims.core.admin.vo.EpisodeOfCareRefVo(
               new Integer(bean.getEpisode().getId()), bean.getEpisode().getVersion());
   this.attendance =
       bean.getAttendance() == null
           ? null
           : new ims.core.admin.vo.CareContextRefVo(
               new Integer(bean.getAttendance().getId()), bean.getAttendance().getVersion());
   this.startdatetime =
       bean.getStartDateTime() == null ? null : bean.getStartDateTime().buildDateTime();
   this.completeddatetime =
       bean.getCompletedDateTime() == null ? null : bean.getCompletedDateTime().buildDateTime();
   this.specialinterestcategory =
       bean.getSpecialInterestCategory() == null
           ? null
           : ims.correspondence.vo.lookups.SpecialInterestType.buildLookup(
               bean.getSpecialInterestCategory());
 }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.correspondence.domain.objects.CorrespondenceDetails
   */
  public static ims.correspondence.vo.CorrespondenceDetailsVo insert(
      DomainObjectMap map,
      ims.correspondence.vo.CorrespondenceDetailsVo valueObject,
      ims.correspondence.domain.objects.CorrespondenceDetails domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_CorrespondenceDetails(domainObject.getId());
    valueObject.setIsRIE(domainObject.getIsRIE());

    // If this is a recordedInError record, and the domainObject
    // value isIncludeRecord has not been set, then we return null and
    // not the value object
    if (valueObject.getIsRIE() != null
        && valueObject.getIsRIE().booleanValue() == true
        && !domainObject.isIncludeRecord()) return null;

    // If this is not a recordedInError record, and the domainObject
    // value isIncludeRecord has been set, then we return null and
    // not the value object
    if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false)
        && domainObject.isIncludeRecord()) return null;

    // pasEvent
    if (domainObject.getPasEvent() != null) {
      if (domainObject.getPasEvent()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getPasEvent();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setPasEvent(new ims.core.admin.pas.vo.PASEventRefVo(id, -1));
      } else {
        valueObject.setPasEvent(
            new ims.core.admin.pas.vo.PASEventRefVo(
                domainObject.getPasEvent().getId(), domainObject.getPasEvent().getVersion()));
      }
    }
    // currentStatus
    ims.domain.lookups.LookupInstance instance2 = domainObject.getCurrentStatus();
    if (null != instance2) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance2.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance2.getImage().getImageId(), instance2.getImage().getImagePath());
      }
      color = instance2.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.DocumentStatus voLookup2 =
          new ims.core.vo.lookups.DocumentStatus(
              instance2.getId(), instance2.getText(), instance2.isActive(), null, img, color);
      ims.core.vo.lookups.DocumentStatus parentVoLookup2 = voLookup2;
      ims.domain.lookups.LookupInstance parent2 = instance2.getParent();
      while (parent2 != null) {
        if (parent2.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent2.getImage().getImageId(), parent2.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent2.getColor();
        if (color != null) color.getValue();
        parentVoLookup2.setParent(
            new ims.core.vo.lookups.DocumentStatus(
                parent2.getId(), parent2.getText(), parent2.isActive(), null, img, color));
        parentVoLookup2 = parentVoLookup2.getParent();
        parent2 = parent2.getParent();
      }
      valueObject.setCurrentStatus(voLookup2);
    }
    // CspStatusHistory
    valueObject.setCspStatusHistory(
        ims.correspondence.vo.domain.CorrespondenceStatusHistoryVoAssembler
            .createCorrespondenceStatusHistoryVoCollectionFromCorrespondenceStatusHistory(
                map, domainObject.getCspStatusHistory()));
    // categories
    valueObject.setCategories(
        ims.correspondence.vo.domain.CategoryNotesVoAssembler
            .createCategoryNotesVoCollectionFromCategoryNotes(map, domainObject.getCategories()));
    // recipients
    valueObject.setRecipients(
        ims.correspondence.vo.domain.RecipientVoAssembler.createRecipientVoCollectionFromRecipient(
            map, domainObject.getRecipients()));
    // currentDocument
    valueObject.setCurrentDocument(
        ims.core.vo.domain.DocumentVoAssembler.create(map, domainObject.getCurrentDocument()));
    // signedBy
    valueObject.setSignedBy(
        ims.core.vo.domain.MedicLiteVoAssembler.create(map, domainObject.getSignedBy()));
    // specialInterest
    ims.domain.lookups.LookupInstance instance8 = domainObject.getSpecialInterest();
    if (null != instance8) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance8.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance8.getImage().getImageId(), instance8.getImage().getImagePath());
      }
      color = instance8.getColor();
      if (color != null) color.getValue();

      ims.correspondence.vo.lookups.SpecialInterestType voLookup8 =
          new ims.correspondence.vo.lookups.SpecialInterestType(
              instance8.getId(), instance8.getText(), instance8.isActive(), null, img, color);
      ims.correspondence.vo.lookups.SpecialInterestType parentVoLookup8 = voLookup8;
      ims.domain.lookups.LookupInstance parent8 = instance8.getParent();
      while (parent8 != null) {
        if (parent8.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent8.getImage().getImageId(), parent8.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent8.getColor();
        if (color != null) color.getValue();
        parentVoLookup8.setParent(
            new ims.correspondence.vo.lookups.SpecialInterestType(
                parent8.getId(), parent8.getText(), parent8.isActive(), null, img, color));
        parentVoLookup8 = parentVoLookup8.getParent();
        parent8 = parent8.getParent();
      }
      valueObject.setSpecialInterest(voLookup8);
    }
    // DateOfClinic
    java.util.Date DateOfClinic = domainObject.getDateOfClinic();
    if (null != DateOfClinic) {
      valueObject.setDateOfClinic(new ims.framework.utils.Date(DateOfClinic));
    }
    // AdmissionDate
    java.util.Date AdmissionDate = domainObject.getAdmissionDate();
    if (null != AdmissionDate) {
      valueObject.setAdmissionDate(new ims.framework.utils.Date(AdmissionDate));
    }
    // DischargeDate
    java.util.Date DischargeDate = domainObject.getDischargeDate();
    if (null != DischargeDate) {
      valueObject.setDischargeDate(new ims.framework.utils.Date(DischargeDate));
    }
    // DictatedBy
    valueObject.setDictatedBy(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getDictatedBy()));
    // DictatedByInitials
    valueObject.setDictatedByInitials(domainObject.getDictatedByInitials());
    // TypedBy
    valueObject.setTypedBy(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getTypedBy()));
    // TypedByInitials
    valueObject.setTypedByInitials(domainObject.getTypedByInitials());
    // EnquiriesTo
    valueObject.setEnquiriesTo(
        ims.core.vo.domain.MemberOfStaffLiteVoAssembler.create(map, domainObject.getEnquiriesTo()));
    // WasTypedWithoutCaseNotes
    valueObject.setWasTypedWithoutCaseNotes(domainObject.isWasTypedWithoutCaseNotes());
    return valueObject;
  }