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

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

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

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

      this.form
          .cmbFrequency()
          .newRow(instance, instance.getText(), instance.getImage(), instance.getTextColor());
    }
  }
 public IllicitDrugsDetailsVo(ims.core.vo.beans.IllicitDrugsDetailsVoBean bean) {
   this.id = bean.getId();
   this.version = bean.getVersion();
   this.substance =
       bean.getSubstance() == null
           ? null
           : ims.core.vo.lookups.IllicitDrugs.buildLookup(bean.getSubstance());
   this.frequency =
       bean.getFrequency() == null
           ? null
           : ims.core.vo.lookups.MedicationFrequency.buildLookup(bean.getFrequency());
   this.lastused = bean.getLastUsed() == null ? null : bean.getLastUsed().buildPartialDate();
   this.urinetestresult =
       bean.getUrineTestResult() == null
           ? null
           : ims.core.vo.lookups.UrineTestResult.buildLookup(bean.getUrineTestResult());
   this.currentstatus =
       bean.getCurrentStatus() == null
           ? null
           : ims.clinical.vo.lookups.IllicitDrugsCurrentStatus.buildLookup(
               bean.getCurrentStatus());
 }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.core.clinical.domain.objects.Medication
   */
  public static ims.core.vo.MedicationVo insert(
      DomainObjectMap map,
      ims.core.vo.MedicationVo valueObject,
      ims.core.clinical.domain.objects.Medication domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_Medication(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;

    // TaxonomyMap
    valueObject.setTaxonomyMap(
        ims.core.vo.domain.TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            map, domainObject.getTaxonomyMap()));
    // Keywords
    valueObject.setKeywords(
        ims.core.vo.domain.KeywordVoAssembler.createKeywordVoCollectionFromKeyword(
            map, domainObject.getKeywords()));
    // MedicationName
    valueObject.setMedicationName(domainObject.getMedicationName());
    // isActive
    valueObject.setIsActive(domainObject.isIsActive());
    // isControlledDrug
    valueObject.setIsControlledDrug(domainObject.isIsControlledDrug());
    // FrequencyDefault
    ims.domain.lookups.LookupInstance instance6 = domainObject.getFrequencyDefault();
    if (null != instance6) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance6.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance6.getImage().getImageId(), instance6.getImage().getImagePath());
      }
      color = instance6.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.MedicationFrequency voLookup6 =
          new ims.core.vo.lookups.MedicationFrequency(
              instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color);
      ims.core.vo.lookups.MedicationFrequency parentVoLookup6 = voLookup6;
      ims.domain.lookups.LookupInstance parent6 = instance6.getParent();
      while (parent6 != null) {
        if (parent6.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent6.getImage().getImageId(), parent6.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent6.getColor();
        if (color != null) color.getValue();
        parentVoLookup6.setParent(
            new ims.core.vo.lookups.MedicationFrequency(
                parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color));
        parentVoLookup6 = parentVoLookup6.getParent();
        parent6 = parent6.getParent();
      }
      valueObject.setFrequencyDefault(voLookup6);
    }
    // NoOfDaysSupplyDefault
    valueObject.setNoOfDaysSupplyDefault(domainObject.getNoOfDaysSupplyDefault());
    return valueObject;
  }