public DataElement findDataElementByCdeId(int cdeId, float version)
      throws DataElementNotFoundException, Exception {
    DataElementsViewRowImpl deRow = null;
    DataElement de = null;
    String deIdseq = null;

    ViewObject vw = this.getDataElementsView();
    vw.setWhereClause(" CDE_ID= " + cdeId + " AND VERSION=" + version);
    vw.executeQuery();

    /**
     * Removed since HistoricalCdeIdsView not used as Public id id not an Alternate name if
     * (vw.first() == null) { ViewObject view1 = this.getHistoricalCdeIdsView();
     * view1.setWhereClause( "to_char(to_number(ltrim(substr(name,1,7)))) = '" + cdeId + "' AND
     * version= " + version);
     *
     * <p>if (view1.first() != null) { HistoricalCdeIdsViewRowImpl desRow =
     * (HistoricalCdeIdsViewRowImpl) view1.first(); deIdseq = desRow.getDeIdseq(); de =
     * this.getDataElements(deIdseq); } else { throw new DataElementNotFoundException( "Data element
     * with CDE ID= " + cdeId + " and version= " + version + " does not exist in the database. "); }
     * } else { deRow = (DataElementsViewRowImpl) vw.first(); de = new
     * BC4JDataElementTransferObject(deRow); }
     */
    deRow = (DataElementsViewRowImpl) vw.first();
    de = new BC4JDataElementTransferObject(deRow);
    return de;
  }
Ejemplo n.º 2
0
  /**
   * Gets the names of the contexts that use this data element. The names of the contexts are are
   * comma separated.
   */
  public String getUsingContexts() throws Exception {
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();
    String usingContext = "";
    StringBuffer sbuf = new StringBuffer("");

    try {
      oracle.jbo.ViewObject desView =
          getViewObject().getApplicationModule().findViewObject("DesignationsView");

      /*ViewObjectImpl desView1 = (DesignationsViewImpl)
      bc4jUtil.cloneViewObject(desView);*/
      desView.setWhereClause("AC_IDSEQ='" + getDeIdseq() + "' and DETL_NAME = 'USED_BY'");
      desView.executeQuery();

      DesignationsViewRowImpl desRow;
      String desContext;
      boolean multipleUsedBys = false;

      while (desView.hasNext()) {
        desRow = (DesignationsViewRowImpl) desView.next();
        desContext = (String) desRow.getContextsRow().getAttribute("Name");

        if (!multipleUsedBys) {
          sbuf.append(desContext);
          multipleUsedBys = true;
        } else {
          sbuf.append(" , " + desContext);
        }
      }
    } catch (Exception e) {
      throw e;
    }

    return sbuf.toString();
  }
  public List getFormUsagesForADataElement(Object aDeIdseq) throws Exception {
    List results = new ArrayList(29);
    Row[] queryResults;
    FormUsagesForACdeViewRowImpl usageRow;

    ViewObject view = this.getFormUsagesForACdeView();
    view.setWhereClause("DE_IDSEQ = '" + aDeIdseq + "'");
    view.executeQuery();

    while (view.hasNext()) {
      usageRow = (FormUsagesForACdeViewRowImpl) view.next();
      results.add(new BC4JDataElementFormUsageTO(usageRow));
    }
    return results;
  }
  public List getAllCDEVersions(int cdeId) throws DataElementNotFoundException, Exception {
    List deList = new ArrayList();
    DataElementsViewRowImpl deRow = null;
    ViewObject vw = this.getDataElementsView();
    vw.setWhereClause(" CDE_ID= " + cdeId);
    vw.executeQuery();

    while (vw.hasNext()) {
      deRow = (DataElementsViewRowImpl) vw.next();
      BC4JDataElementTransferObject bc4jDE = new BC4JDataElementTransferObject(deRow);
      deList.add(bc4jDE);
      // add classification to CDE
      Vector cscVector = getClassificationSchemes(bc4jDE.getDeIdseq());
      bc4jDE.setClassifications(new ArrayList(cscVector));
    }
    return deList;
  }
  public List getFormUsagesForADataElement(Object aDeIdseq, PageIterator pgIter) throws Exception {
    List results = new ArrayList(29);
    Row[] queryResults;
    FormUsagesForACdeViewRowImpl usageRow;

    ViewObject view = this.getFormUsagesForACdeView();
    view.setWhereClause("DE_IDSEQ = '" + aDeIdseq + "'");
    view.executeQuery();
    pgIter.setScrollableObject(view);
    queryResults = (Row[]) pgIter.getRowsInRange();

    for (int i = 0; i < queryResults.length; i++) {
      usageRow = (FormUsagesForACdeViewRowImpl) queryResults[i];
      results.add(new BC4JDataElementFormUsageTO(usageRow));
    }

    return results;
  }
  /** Custom Method: Valid Values Author: Ram Chilukuri */
  public ViewObject getMyValidValuesView(Object aVdIdseq) throws Exception {
    ViewObject view = null;
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();

    try {
      view = getValidValuesView();
      // order by display_order, UPPER(PermissibleValues.VALUE)
      view.setOrderByClause(" display_order, UPPER(VALUE) ");
      // view.setMaxFetchSize(1500);
      // view = (VDValidValuesViewImpl)bc4jUtil.cloneViewObject(view);
      view.setWhereClause(" VD_IDSEQ = '" + aVdIdseq + "'");
      view.executeQuery();
    } catch (Exception e) {
      throw e;
    }

    return view;
  }
Ejemplo n.º 7
0
  public List getDesignations() {
    List designations = new ArrayList(9);
    NCIBC4JUtil bc4jUtil = new NCIBC4JUtil();

    try {
      oracle.jbo.ViewObject desView =
          getViewObject().getApplicationModule().findViewObject("DesignationsView");

      /*ViewObjectImpl desView1 = (DesignationsViewImpl)
      bc4jUtil.cloneViewObject(desView);*/
      desView.setWhereClause("AC_IDSEQ='" + getDeIdseq() + "'");
      desView.executeQuery();

      while (desView.hasNext()) {
        designations.add(
            new BC4JDesignationTransferObject((DesignationsViewRowImpl) desView.next()));
      }
    } catch (Exception e) {
      log.error("Error in getDesignations(): ", e);
    }

    return designations;
  }