Esempio n. 1
0
  public static List<SelectItem> getFilterSelectItems(
      String viewObject,
      String valueName,
      String captionName,
      boolean isEmptyRowExists,
      Object valueEmpty,
      String captionEmpty,
      String dataControlName) {

    // ApplicationModule mod = ADFUtils.getApplicationModuleForDataControl(dataControlName);
    AppModuleImpl mod = (AppModuleImpl) ADFUtils.getBindingApplicationModule();
    ViewObject vo = mod.findViewObject(viewObject);
    List<SelectItem> rc = new ArrayList<SelectItem>();
    vo.reset();
    if (isEmptyRowExists) {
      rc.add(new SelectItem(valueEmpty, captionEmpty));
    }
    while (vo.hasNext()) {
      Row rowItem = vo.next();
      Object valueItem = rowItem.getAttribute(valueName);
      String captionItem = (String) rowItem.getAttribute(captionName);
      rc.add(new SelectItem(valueItem, captionItem));
    }

    return rc;
  }
  /**
   * 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 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;
  }