public boolean executeActivityRowLock() {
   boolean lock = true;
   ViewObjectImpl vo = this.getXxntcCsCalendarActivitiesEOVO2Update();
   Row row = vo.getCurrentRow();
   try {
     row.lock();
   } catch (Exception e) {
     lock = false;
     _logger.warning("Activity: " + row.getAttribute("ActivityId") + " record is locked");
   }
   return lock;
 }
  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;
    }
  }
  /** 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 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;
    }
  }
  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: 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;
  }
 public void beforeRollback(TransactionEvent TransactionEvent) {
   if (this.isExecuted()) {
     ViewRowImpl currentRow = (ViewRowImpl) this.getCurrentRow();
     if (currentRow != null) {
       byte newRowState = currentRow.getNewRowState();
       if (newRowState != Row.STATUS_INITIALIZED && newRowState != Row.STATUS_NEW) {
         currentRowKey = currentRow.getKey();
         int rangeIndexOfCurrentRow = this.getRangeIndexOf(currentRow);
         currentRowIndexInRange = rangeIndexOfCurrentRow;
       }
     }
   }
   super.beforeRollback(TransactionEvent);
 }
  /** 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;
  }
 /**
  * Overridden framework method.
  *
  * <p>The framework gives us a chance to clean up any resources related to the datasource when a
  * query collection is done being used.
  */
 protected void releaseUserDataForCollection(Object qc, Object rs) {
   /*
    * Ignore the ResultSet passed in since we've created our own.
    * Fetch the ResultSet from the User-Data context instead
    */
   ResultSet userDataRS = getResultSet(qc);
   if (userDataRS != null) {
     try {
       userDataRS.close();
     } catch (SQLException s) {
       /* Ignore */
     }
   }
   super.releaseUserDataForCollection(qc, rs);
 }
  public void afterRollback(TransactionEvent TransactionEvent) {
    super.afterRollback(TransactionEvent);
    if (currentRowKey != null) {
      _logger.info("STARTING CURRENT ROW RESET");
      this.executeQuery();
      Key k = new Key(currentRowKey.getAttributeValues());
      Row[] found = this.findByKey(k, 1);
      if (found != null && found.length == 1) {
        Row r = this.getRow(k);
        this.setCurrentRow(r);
        if (currentRowIndexInRange >= 0) {
          this.scrollRangeTo(r, currentRowIndexInRange);
        }
      }

      _logger.info("FINISHING CURRENT ROW RESET");
    }
    currentRowKey = null;
  }
  /** 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;
  }
 /**
  * Overridden framework method.
  *
  * <p>Executed when the framework needs to issue the database query for the query collection based
  * on this view object. One view object can produce many related result sets, each potentially the
  * result of different bind variable values. If the rowset in query is involved in a
  * framework-coordinated master/detail viewlink, then the params array will contain one or more
  * framework-supplied bind parameters. If there are any user-supplied bind parameter values, they
  * will *PRECEED* the framework-supplied bind variable values in the params array, and the number
  * of user parameters will be indicated by the value of the numUserParams argument.
  */
 protected void executeQueryForCollection(Object qc, Object[] params, int numUserParams) {
   storeNewResultSet(qc, retrieveRefCursor(qc, params));
   super.executeQueryForCollection(qc, params, numUserParams);
 }