Пример #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();
  }
Пример #3
0
  public String searchParty() {
    System.out.println(
        "******************"
            + javax.faces.webapp.FacesServlet.class.getProtectionDomain().getCodeSource());

    PartyVOImpl party = util.getViewObject("PartyVO1Iterator");

    String name = (String) party.getCurrentRow().getAttribute("name");
    String branchName = (String) party.getCurrentRow().getAttribute("branchName");

    List<Party> parties = partyService.search(name, branchName);
    if (parties.isEmpty()) {
      showMessage(getName(), "No client found with this name");
      return null;
    }

    ViewObject address = util.getViewObject("PartyAddressIterator");
    Row addressRow = address.createRow();
    addressRow.setAttribute("streetName", "Blackberry Hill Road");
    addressRow.setAttribute("city", "Lexington");
    addressRow.setAttribute("state", "MA");
    addressRow.setAttribute("country", "USA");

    address.insertRow(addressRow);

    return "StayOnTheSamePage";
  }
  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;
  }
  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;
  }
  public Context getContext() {
    try {
      oracle.jbo.ViewObject vdView =
          getViewObject().getApplicationModule().findViewObject("ContextsView");

      vdView.setWhereClause("CONTE_IDSEQ='" + getConteIdseq() + "'");

      Row row = vdView.first();

      Context conte = (Context) new BC4JContextTransferObject((ContextsViewRowImpl) row);

      return conte;
    } // end try
    catch (Exception e) {
      log.error("Error in DataElementsViewRowImpl.getContext(): ", e);

      return null;
    }
  }
Пример #10
0
  public ValueDomain getValueDomain() {
    try {
      oracle.jbo.ViewObject vdView =
          getViewObject().getApplicationModule().findViewObject("ValueDomainsView");

      vdView.setWhereClause("VD_IDSEQ='" + getVdIdseq() + "'");

      Row row = vdView.first();

      ValueDomain vd =
          (ValueDomain) new BC4JValueDomainTransferObject((ValueDomainsViewRowImpl) row);

      return vd;
    } // end try
    catch (Exception e) {
      log.error("Error in DataElementsViewRowImpl.getValueDomain(): ", e);

      return null;
    }
  }
Пример #11
0
  public DataElementConcept getDataElementConcept() {
    try {
      oracle.jbo.ViewObject decView =
          getViewObject().getApplicationModule().findViewObject("DataElementConceptsView");

      decView.setWhereClause("DEC_IDSEQ='" + getDecIdseq() + "'");

      Row row = decView.first();

      DataElementConcept dec =
          (DataElementConcept)
              new BC4JDataElementConceptTransferObject((DataElementConceptsViewRowImpl) row);

      return dec;
    } // end try
    catch (Exception e) {
      log.error("Error in getDataElementConcept(): ", e);

      return null;
    }
  }
Пример #12
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;
  }
Пример #13
0
  public String getRegistrationStatus() {
    String rgStatus = null;

    try {
      oracle.jbo.ViewObject rView =
          getViewObject().getApplicationModule().findViewObject("AcRegistrationsView");

      rView.setWhereClause("AC_IDSEQ='" + getDeIdseq() + "'");

      Row row = rView.first();

      if (row != null) {
        rgStatus = (String) row.getAttribute("RegistrationStatus");
      }

      // String longCDEName = row
    } // end try
    catch (Exception e) {
      log.error("Error in getRegistrationStatus(): ", e);
    }

    return rgStatus;
  }
Пример #14
0
  public String getCDEId() {
    Number cdeId = null;

    try {
      oracle.jbo.ViewObject cdeIdView =
          getViewObject().getApplicationModule().findViewObject("DeCdeIdView");

      cdeIdView.setWhereClause("AC_IDSEQ='" + getDeIdseq() + "'");

      Row row = cdeIdView.first();

      if (row != null) {
        cdeId = (Number) row.getAttribute("MinCdeId");
      }

      return cdeId.toString();
    } // end try
    catch (Exception e) {
      log.error("Error in getCDEId(): ", e);

      return null;
    }
  }
Пример #15
0
  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception exemp) {
      exemp.printStackTrace();
    }

    PanelSgavtraslo panel = new PanelSgavtraslo();
    panel.setBindingContext(
        JUTestFrame.startTestFrame(
            "DataBindings.cpx",
            "AppModuleDataControl1",
            panel,
            panel.getPanelBinding(),
            new Dimension(400, 300)));
    panel.revalidate();

    ViewObject voTraslo =
        panel.panelBinding.findIteratorBinding("SgavtrasloEntSal1Iter").getViewObject();

    System.out.println("whereClause: " + voTraslo.getWhereClause());

    // Michael 19.12.2007 pruebas
    AppModuleImpl am = (AppModuleImpl) panel.panelBinding.getApplication().getApplicationModule();
    SgavestadoentradaslomacViewImpl vo = am.getSgavestadoentradaslomacView1();
    vo.setWhereClauseParam(0, "300000008212");
    vo.executeQuery();
    SgavestadoentradaslomacViewRowImpl vr = (SgavestadoentradaslomacViewRowImpl) vo.first();
    oracle.jbo.domain.Number num = new oracle.jbo.domain.Number(1);

    vr.setUbicacionDestinoMac(num);

    //  Traslo traslo = new Traslo(1, "SLO", am);
    //  traslo.test();
    // TODO 19.12.2007

  }
Пример #16
0
  public String getLongCDEName() {
    String longCDEName = null;

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

      rdView.setWhereClause(
          "AC_IDSEQ='" + getDeIdseq() + "' AND DCTL_NAME = 'Preferred Question Text'");

      Row row = rdView.first();

      if (row != null) {
        longCDEName = (String) row.getAttribute("DocText");
      }

      // String longCDEName = row
    } // end try
    catch (Exception e) {
      log.error("Error in getLongCDEName(): ", e);
    }

    return longCDEName;
  }