/** Custom Method: Valid Values */
  public List getValidValues(Object aVdIdseq) throws Exception {
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();
    // Vector rows = new Vector();
    List rows = null;
    try {
      ViewObject view = getValidValuesView();
      ViewObjectImpl view1 = (ValidValuesViewImpl) bc4jUtil.cloneViewObject(view);
      view1.setWhereClause(" VD_IDSEQ = '" + aVdIdseq + "'");

      view1.setOrderByClause(" display_order, UPPER(VALUE) ");

      // view1.setOrderByClause(" UPPER(VALUE) ");
      // view1.setForwardOnly(true);
      view1.executeQuery();
      rows = new ArrayList(view1.getRowCount());

      while (view1.hasNext()) {
        // rows.add(new ValidValuesValueObject((ValidValuesViewRowImpl) view1.next()));
        ValidValuesViewRowImpl vvImpl = (ValidValuesViewRowImpl) view1.next();
        ValidValue vv = new ValidValueTransferObject();
        vv.setVdIdseq(vvImpl.getVdIdseq().trim());
        // for 4.0 ShortMeaning is replaced with Long Name and Description with PreferredDefinition
        vv.setDescription(vvImpl.getPreferredDefinition());
        vv.setShortMeaning(vvImpl.getLongName());
        vv.setShortMeaningDescription(vvImpl.getMeaningDescription());
        vv.setShortMeaningValue(vvImpl.getValue());
        vv.setVpIdseq(vvImpl.getVpIdseq().trim());
        vv.setVmId(new Integer(vvImpl.getVmId().intValue()));
        vv.setVmVersion(new Float(vvImpl.getVersion().floatValue()));
        vv.setBeginDate(
            (vvImpl.getBeginDate() != null)
                ? ((Date) vvImpl.getBeginDate().dateValue()).toString()
                : "");
        vv.setEndDate(
            (vvImpl.getEndDate() != null)
                ? ((Date) vvImpl.getEndDate().dateValue()).toString()
                : "");
        vv.setContext(vvImpl.getName());
        vv.setWorkflowstatus(vvImpl.getAslName());
        String cdrIdseq = vvImpl.getCondrIdseq();
        if (cdrIdseq != null) {
          ConceptDerivationRule rule = new ConceptDerivationRuleTransferObject();
          rule.setIdseq(cdrIdseq.trim());
          vv.setConceptDerivationRule(rule);
        }
        rows.add(vv);
      }
    } catch (Exception e) {
      throw e;
    }

    return rows;
  }
  /** Custom Method: Gets a data element row */
  private DataElementsViewRowImpl getDataElementRow(Object key) throws Exception {
    DataElementsViewImpl view = null;
    DataElementsViewRowImpl dataElementsViewRowImpl = null;
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();

    try {
      view = getDataElementsView();

      ViewObjectImpl view1 = (DataElementsViewImpl) bc4jUtil.cloneViewObject(view);
      view1.setWhereClause(" DE_IDSEQ = '" + key + "'");
      view1.executeQuery();
      dataElementsViewRowImpl =
          (DataElementsViewRowImpl) bc4jUtil.getRow(view1); // view1 is row iterator

      return dataElementsViewRowImpl;
    } catch (Exception e) {
      throw e;
    }
  }
  private AdministeredComponentsViewRowImpl getAdminComponentRow(Object key) throws Exception {
    AdministeredComponentsViewImpl view = null;
    AdministeredComponentsViewRowImpl acViewRowImpl = null;
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();

    try {
      view = getAdministeredComponentsView();

      ViewObjectImpl view1 = (AdministeredComponentsViewImpl) bc4jUtil.cloneViewObject(view);
      view1.setWhereClause(" AC_IDSEQ = '" + key + "'");
      view1.executeQuery();
      acViewRowImpl =
          (AdministeredComponentsViewRowImpl) bc4jUtil.getRow(view1); // view1 is row iterator

      return acViewRowImpl;
    } catch (Exception e) {
      throw e;
    }
  }
  private ValueDomainsViewRowImpl getValueDomainRow(Object key) throws Exception {
    ValueDomainsViewImpl view = null;
    ValueDomainsViewRowImpl valueDomainsViewRowImpl = null;
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();

    try {
      view = getValueDomainsView();

      ViewObjectImpl view1 = (ValueDomainsViewImpl) bc4jUtil.cloneViewObject(view);
      view1.setWhereClause(" VD_IDSEQ = '" + key + "'");
      view1.executeQuery();
      valueDomainsViewRowImpl =
          (ValueDomainsViewRowImpl) bc4jUtil.getRow(view1); // view1 is row iterator

      return valueDomainsViewRowImpl;
    } catch (Exception e) {
      throw e;
    }
  }
  /** Custom Method: Classification Schemes */
  public Vector getClassificationSchemes(Object aDeIdseq) throws Exception {
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();
    Vector rows = new Vector();

    try {
      ViewObject view = getClassificationsView();
      ViewObjectImpl view1 = (ClassificationsViewImpl) bc4jUtil.cloneViewObject(view);
      view1.setWhereClause(" AC_IDSEQ = '" + aDeIdseq + "'");
      view1.executeQuery();
      rows = new Vector(view1.getRowCount());

      while (view1.hasNext()) {
        rows.addElement(
            new BC4JClassificationsTransferObject((ClassificationsViewRowImpl) view1.next()));
      }
    } catch (Exception e) {
      throw e;
    }

    return rows;
  }
  public List getReferenceDocs() {
    List refDocs = new ArrayList(9);
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();

    try {
      oracle.jbo.ViewObject rdView =
          getViewObject().getApplicationModule().findViewObject("ReferenceDocumentsView");

      ViewObjectImpl rdView1 = (ReferenceDocumentsViewImpl) bc4jUtil.cloneViewObject(rdView);
      rdView1.setWhereClause("AC_IDSEQ='" + getDeIdseq() + "'");
      rdView1.executeQuery();

      while (rdView1.hasNext()) {
        refDocs.add(new ReferenceDocValueObject((ReferenceDocumentsViewRowImpl) rdView1.next()));
      }
    } // end try
    catch (Exception e) {
      log.error("Error in getReferenceDocs(): ", e);
    }

    return refDocs;
  }
  /** Custom Method: Classification Schemes Author: Ram Chilukuri */
  public Vector getClassificationSchemes(Object aDeIdseq, PageIterator pgIter) throws Exception {
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();
    Vector rows = new Vector();
    Row[] queryResults;

    try {
      ViewObject view = getClassificationsView();
      ViewObjectImpl view1 = (ClassificationsViewImpl) bc4jUtil.cloneViewObject(view);
      view1.setWhereClause(" AC_IDSEQ = '" + aDeIdseq + "'");
      view1.executeQuery();
      pgIter.setScrollableObject(view1);
      queryResults = (Row[]) pgIter.getRowsInRange();
      rows = new Vector(queryResults.length);

      for (int i = 0; i < queryResults.length; i++) {
        rows.addElement(
            new BC4JClassificationsTransferObject((ClassificationsViewRowImpl) queryResults[i]));
      }
    } catch (Exception e) {
      throw e;
    }

    return rows;
  }