protected synchronized List getList() throws ApplicationException {
    PreparedStatement preStat = null;
    ResultSet rs = null;
    StringBuffer sqlStat = new StringBuffer();
    List result = new ArrayList();

    synchronized (dbConn) {
      try {
        sqlStat.append(
            "SELECT A.ID, A.CONTACT_LIST_ID, A.OBJECT_TYPE, A.OBJECT_ID, A.RECORD_STATUS, A.UPDATE_COUNT, A.CREATOR_ID, A.CREATE_DATE, A.UPDATER_ID, A.UPDATE_DATE ");
        sqlStat.append("FROM   MTM_CONTACT_LIST_OBJECT_LINK A ");
        sqlStat.append("WHERE  A.RECORD_STATUS = ? ");
        preStat =
            dbConn.prepareStatement(
                sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        this.setPrepareStatement(preStat, 1, GlobalConstant.RECORD_STATUS_ACTIVE);
        rs = preStat.executeQuery();
        while (rs.next()) {
          MtmContactListObjectLink tmpMtmContactListObjectLink = new MtmContactListObjectLink();
          tmpMtmContactListObjectLink.setID(getResultSetInteger(rs, "ID"));
          tmpMtmContactListObjectLink.setContactListID(getResultSetInteger(rs, "CONTACT_LIST_ID"));
          tmpMtmContactListObjectLink.setObjectType(getResultSetString(rs, "OBJECT_TYPE"));
          tmpMtmContactListObjectLink.setObjectID(getResultSetInteger(rs, "OBJECT_ID"));
          tmpMtmContactListObjectLink.setRecordStatus(getResultSetString(rs, "RECORD_STATUS"));
          tmpMtmContactListObjectLink.setUpdateCount(getResultSetInteger(rs, "UPDATE_COUNT"));
          tmpMtmContactListObjectLink.setCreatorID(getResultSetInteger(rs, "CREATOR_ID"));
          tmpMtmContactListObjectLink.setCreateDate(getResultSetTimestamp(rs, "CREATE_DATE"));
          tmpMtmContactListObjectLink.setUpdaterID(getResultSetInteger(rs, "UPDATER_ID"));
          tmpMtmContactListObjectLink.setUpdateDate(getResultSetTimestamp(rs, "UPDATE_DATE"));
          tmpMtmContactListObjectLink.setCreatorName(
              UserInfoFactory.getUserFullName(tmpMtmContactListObjectLink.getCreatorID()));
          tmpMtmContactListObjectLink.setUpdaterName(
              UserInfoFactory.getUserFullName(tmpMtmContactListObjectLink.getUpdaterID()));
          result.add(tmpMtmContactListObjectLink);
        }
        return (result);
      } catch (ApplicationException appEx) {
        throw appEx;
      } catch (SQLException sqle) {
        log.error(sqle, sqle);
        throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString());
      } catch (Exception e) {
        log.error(e, e);
        throw new ApplicationException(ErrorConstant.DB_SELECT_ERROR, e);
      } finally {
        try {
          rs.close();
        } catch (Exception ignore) {
        } finally {
          rs = null;
        }
        try {
          preStat.close();
        } catch (Exception ignore) {
        } finally {
          preStat = null;
        }
      }
    }
  }
  protected synchronized AbstractBaseObject insert(AbstractBaseObject obj)
      throws ApplicationException {
    PreparedStatement preStat = null;
    StringBuffer sqlStat = new StringBuffer();
    MtmWfStepNotificationRule tmpMtmWfStepNotificationRule =
        (MtmWfStepNotificationRule) ((MtmWfStepNotificationRule) obj).clone();

    synchronized (dbConn) {
      try {
        Integer nextID = getNextPrimaryID();
        Timestamp currTime = Utility.getCurrentTimestamp();
        sqlStat.append("INSERT ");
        sqlStat.append(
            "INTO   MTM_WF_STEP_NOTIFY_RULE(ID, WORKFLOW_STEP_ID, NOTIFY_TRIGGER, NOTIFY_AT_FIELD, NOTIFY_AT_AMT, NOTIFY_ACK_METHOD, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE) ");
        sqlStat.append("VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");
        preStat =
            dbConn.prepareStatement(
                sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        setPrepareStatement(preStat, 1, nextID);
        setPrepareStatement(preStat, 2, tmpMtmWfStepNotificationRule.getWorkflowStepID());
        setPrepareStatement(preStat, 3, tmpMtmWfStepNotificationRule.getNotifyTrigger());
        setPrepareStatement(preStat, 4, tmpMtmWfStepNotificationRule.getNotifyAtField());
        setPrepareStatement(preStat, 5, tmpMtmWfStepNotificationRule.getNotifyAtAmt());
        setPrepareStatement(preStat, 6, tmpMtmWfStepNotificationRule.getNotifyAckMethod());
        setPrepareStatement(preStat, 7, GlobalConstant.RECORD_STATUS_ACTIVE);
        setPrepareStatement(preStat, 8, new Integer(0));
        setPrepareStatement(preStat, 9, sessionContainer.getUserRecordID());
        setPrepareStatement(preStat, 10, currTime);
        setPrepareStatement(preStat, 11, sessionContainer.getUserRecordID());
        setPrepareStatement(preStat, 12, currTime);
        preStat.executeUpdate();
        tmpMtmWfStepNotificationRule.setID(nextID);
        tmpMtmWfStepNotificationRule.setCreatorID(sessionContainer.getUserRecordID());
        tmpMtmWfStepNotificationRule.setCreateDate(currTime);
        tmpMtmWfStepNotificationRule.setUpdaterID(sessionContainer.getUserRecordID());
        tmpMtmWfStepNotificationRule.setUpdateDate(currTime);
        tmpMtmWfStepNotificationRule.setUpdateCount(new Integer(0));
        tmpMtmWfStepNotificationRule.setCreatorName(
            UserInfoFactory.getUserFullName(tmpMtmWfStepNotificationRule.getCreatorID()));
        tmpMtmWfStepNotificationRule.setUpdaterName(
            UserInfoFactory.getUserFullName(tmpMtmWfStepNotificationRule.getUpdaterID()));
        return (tmpMtmWfStepNotificationRule);
      } catch (ApplicationException appEx) {
        throw appEx;
      } catch (SQLException sqle) {
        log.error(sqle, sqle);
        throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString());
      } catch (Exception e) {
        log.error(e, e);
        throw new ApplicationException(ErrorConstant.DB_INSERT_ERROR, e);
      } finally {
        try {
          preStat.close();
        } catch (Exception ignore) {
        } finally {
          preStat = null;
        }
      }
    }
  }
  protected synchronized AbstractBaseObject update(AbstractBaseObject obj)
      throws ApplicationException {
    PreparedStatement preStat = null;
    StringBuffer sqlStat = new StringBuffer();
    MtmContactListObjectLink tmpMtmContactListObjectLink =
        (MtmContactListObjectLink) ((MtmContactListObjectLink) obj).clone();

    synchronized (dbConn) {
      try {
        int updateCnt = 0;
        Timestamp currTime = Utility.getCurrentTimestamp();
        sqlStat.append("UPDATE MTM_CONTACT_LIST_OBJECT_LINK ");
        sqlStat.append(
            "SET  CONTACT_LIST_ID=?, OBJECT_TYPE=?, OBJECT_ID=?, UPDATE_COUNT=?, UPDATER_ID=?, UPDATE_DATE=? ");
        sqlStat.append("WHERE  ID=? AND UPDATE_COUNT=? ");
        preStat =
            dbConn.prepareStatement(
                sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        setPrepareStatement(preStat, 1, tmpMtmContactListObjectLink.getContactListID());
        setPrepareStatement(preStat, 2, tmpMtmContactListObjectLink.getObjectType());
        setPrepareStatement(preStat, 3, tmpMtmContactListObjectLink.getObjectID());
        setPrepareStatement(
            preStat, 4, new Integer(tmpMtmContactListObjectLink.getUpdateCount().intValue() + 1));
        setPrepareStatement(preStat, 5, sessionContainer.getUserRecordID());
        setPrepareStatement(preStat, 6, currTime);
        setPrepareStatement(preStat, 7, tmpMtmContactListObjectLink.getID());
        setPrepareStatement(preStat, 8, tmpMtmContactListObjectLink.getUpdateCount());
        updateCnt = preStat.executeUpdate();
        if (updateCnt == 0) {
          throw new ApplicationException(ErrorConstant.DB_CONCURRENT_ERROR);
        } else {
          tmpMtmContactListObjectLink.setUpdaterID(sessionContainer.getUserRecordID());
          tmpMtmContactListObjectLink.setUpdateDate(currTime);
          tmpMtmContactListObjectLink.setUpdateCount(
              new Integer(tmpMtmContactListObjectLink.getUpdateCount().intValue() + 1));
          tmpMtmContactListObjectLink.setCreatorName(
              UserInfoFactory.getUserFullName(tmpMtmContactListObjectLink.getCreatorID()));
          tmpMtmContactListObjectLink.setUpdaterName(
              UserInfoFactory.getUserFullName(tmpMtmContactListObjectLink.getUpdaterID()));
          return (tmpMtmContactListObjectLink);
        }
      } catch (ApplicationException appEx) {
        throw appEx;
      } catch (SQLException sqle) {
        log.error(sqle, sqle);
        throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString());
      } catch (Exception e) {
        log.error(e, e);
        throw new ApplicationException(ErrorConstant.DB_UPDATE_ERROR, e);
      } finally {
        try {
          preStat.close();
        } catch (Exception ignore) {
        } finally {
          preStat = null;
        }
      }
    }
  }
  protected synchronized AbstractBaseObject insert(AbstractBaseObject obj)
      throws ApplicationException {
    PreparedStatement preStat = null;
    StringBuffer sqlStat = new StringBuffer();
    MtmContactListObjectLink tmpMtmContactListObjectLink =
        (MtmContactListObjectLink) ((MtmContactListObjectLink) obj).clone();

    synchronized (dbConn) {
      try {
        Integer nextID = getNextPrimaryID();
        Timestamp currTime = Utility.getCurrentTimestamp();
        sqlStat.append("INSERT ");
        sqlStat.append(
            "INTO   MTM_CONTACT_LIST_OBJECT_LINK(ID, CONTACT_LIST_ID, OBJECT_TYPE, OBJECT_ID, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE) ");
        sqlStat.append("VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");
        preStat =
            dbConn.prepareStatement(
                sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        setPrepareStatement(preStat, 1, nextID);
        setPrepareStatement(preStat, 2, tmpMtmContactListObjectLink.getContactListID());
        setPrepareStatement(preStat, 3, tmpMtmContactListObjectLink.getObjectType());
        setPrepareStatement(preStat, 4, tmpMtmContactListObjectLink.getObjectID());
        setPrepareStatement(preStat, 5, GlobalConstant.RECORD_STATUS_ACTIVE);
        setPrepareStatement(preStat, 6, new Integer(0));
        setPrepareStatement(preStat, 7, sessionContainer.getUserRecordID());
        setPrepareStatement(preStat, 8, currTime);
        setPrepareStatement(preStat, 9, sessionContainer.getUserRecordID());
        setPrepareStatement(preStat, 10, currTime);
        preStat.executeUpdate();
        tmpMtmContactListObjectLink.setID(nextID);
        tmpMtmContactListObjectLink.setCreatorID(sessionContainer.getUserRecordID());
        tmpMtmContactListObjectLink.setCreateDate(currTime);
        tmpMtmContactListObjectLink.setUpdaterID(sessionContainer.getUserRecordID());
        tmpMtmContactListObjectLink.setUpdateDate(currTime);
        tmpMtmContactListObjectLink.setUpdateCount(new Integer(0));
        tmpMtmContactListObjectLink.setCreatorName(
            UserInfoFactory.getUserFullName(tmpMtmContactListObjectLink.getCreatorID()));
        tmpMtmContactListObjectLink.setUpdaterName(
            UserInfoFactory.getUserFullName(tmpMtmContactListObjectLink.getUpdaterID()));
        return (tmpMtmContactListObjectLink);
      } catch (ApplicationException appEx) {
        throw appEx;
      } catch (SQLException sqle) {
        log.error(sqle, sqle);
        throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString());
      } catch (Exception e) {
        log.error(e, e);
        throw new ApplicationException(ErrorConstant.DB_INSERT_ERROR, e);
      } finally {
        try {
          preStat.close();
        } catch (Exception ignore) {
        } finally {
          preStat = null;
        }
      }
    }
  }
  protected synchronized List getList(AbstractSearchForm searchForm) throws ApplicationException {
    PreparedStatement preStat = null;
    PreparedStatement preStatCnt = null;
    ResultSet rs = null;
    ResultSet rsCnt = null;
    StringBuffer sqlStat = new StringBuffer();
    StringBuffer sqlStatCnt = new StringBuffer();
    List result = new ArrayList();
    int totalNumOfRecord = 0;
    int rowLoopCnt = 0;
    int startOffset = TextUtility.parseInteger(searchForm.getCurStartRowNo());
    int pageSize = TextUtility.parseInteger(searchForm.getPageOffset());

    synchronized (dbConn) {
      try {
        sqlStat.append(
            "SELECT A.ID, A.CONTACT_LIST_ID, A.OBJECT_TYPE, A.OBJECT_ID, A.RECORD_STATUS, A.UPDATE_COUNT, A.CREATOR_ID, A.CREATE_DATE, A.UPDATER_ID, A.UPDATE_DATE ");
        sqlStat.append("FROM   MTM_CONTACT_LIST_OBJECT_LINK A ");
        sqlStat.append("WHERE  A.RECORD_STATUS = ? ");

        // Form the WHERE clause for filtering.
        if (searchForm.isSearchable()) {
          String searchField = getSearchColumn(searchForm.getBasicSearchField());
          sqlStat.append("AND  " + searchField + " " + searchForm.getBasicSearchType() + " ? ");
        }

        // format the sql for any 'LIKE' statement contained
        sqlStat = this.getFormattedSQL(sqlStat.toString());

        // Form the ORDER clause for sorting.
        if (searchForm.isSortable()) {
          String sortAttribute = searchForm.getSortAttribute();
          if (sortAttribute.indexOf(".") < 0) {
            sortAttribute = "A." + sortAttribute;
          }
          sqlStat.append("ORDER BY " + sortAttribute + " " + searchForm.getSortOrder());
        }

        // Get total number of record return.
        sqlStatCnt = this.getSelectCountSQL(sqlStat);
        preStatCnt =
            dbConn.prepareStatement(
                sqlStatCnt.toString(),
                ResultSet.TYPE_SCROLL_INSENSITIVE,
                ResultSet.CONCUR_READ_ONLY);
        this.setPrepareStatement(preStatCnt, 1, GlobalConstant.RECORD_STATUS_ACTIVE);
        if (searchForm.isSearchable()) {
          String searchKeyword =
              this.getFormattedKeyword(
                  searchForm.getBasicSearchKeyword(), searchForm.getBasicSearchType());
          this.setPrepareStatement(preStatCnt, 2, searchKeyword);
        }
        rsCnt = preStatCnt.executeQuery();
        if (rsCnt.next()) {
          totalNumOfRecord = rsCnt.getInt(1);
        }
        try {
          rsCnt.close();
        } catch (Exception ignore) {
        } finally {
          rsCnt = null;
        }
        try {
          preStatCnt.close();
        } catch (Exception ignore) {
        } finally {
          preStatCnt = null;
        }

        // Retrieve the result in row basis.
        sqlStat = this.getSelectListSQL(sqlStat, startOffset, pageSize);
        preStat =
            dbConn.prepareStatement(
                sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        this.setPrepareStatement(preStat, 1, GlobalConstant.RECORD_STATUS_ACTIVE);
        if (searchForm.isSearchable()) {
          String searchKeyword =
              this.getFormattedKeyword(
                  searchForm.getBasicSearchKeyword(), searchForm.getBasicSearchType());
          this.setPrepareStatement(preStat, 2, searchKeyword);
        }
        rs = preStat.executeQuery();

        this.positionCursor(rs, startOffset, pageSize);

        while (rs.next() && rowLoopCnt < pageSize) {
          MtmContactListObjectLink tmpMtmContactListObjectLink = new MtmContactListObjectLink();
          tmpMtmContactListObjectLink.setID(getResultSetInteger(rs, "ID"));
          tmpMtmContactListObjectLink.setContactListID(getResultSetInteger(rs, "CONTACT_LIST_ID"));
          tmpMtmContactListObjectLink.setObjectType(getResultSetString(rs, "OBJECT_TYPE"));
          tmpMtmContactListObjectLink.setObjectID(getResultSetInteger(rs, "OBJECT_ID"));
          tmpMtmContactListObjectLink.setRecordStatus(getResultSetString(rs, "RECORD_STATUS"));
          tmpMtmContactListObjectLink.setUpdateCount(getResultSetInteger(rs, "UPDATE_COUNT"));
          tmpMtmContactListObjectLink.setCreatorID(getResultSetInteger(rs, "CREATOR_ID"));
          tmpMtmContactListObjectLink.setCreateDate(getResultSetTimestamp(rs, "CREATE_DATE"));
          tmpMtmContactListObjectLink.setUpdaterID(getResultSetInteger(rs, "UPDATER_ID"));
          tmpMtmContactListObjectLink.setUpdateDate(getResultSetTimestamp(rs, "UPDATE_DATE"));
          tmpMtmContactListObjectLink.setCreatorName(
              UserInfoFactory.getUserFullName(tmpMtmContactListObjectLink.getCreatorID()));
          tmpMtmContactListObjectLink.setUpdaterName(
              UserInfoFactory.getUserFullName(tmpMtmContactListObjectLink.getUpdaterID()));
          tmpMtmContactListObjectLink.setRecordCount(totalNumOfRecord);
          tmpMtmContactListObjectLink.setRowNum(startOffset++);
          ++rowLoopCnt;
          result.add(tmpMtmContactListObjectLink);
        }
        return (result);
      } catch (ApplicationException appEx) {
        throw appEx;
      } catch (SQLException sqle) {
        log.error(sqle, sqle);
        throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString());
      } catch (Exception e) {
        log.error(e, e);
        throw new ApplicationException(ErrorConstant.DB_SELECT_ERROR, e);
      } finally {
        try {
          rs.close();
        } catch (Exception ignore) {
        } finally {
          rs = null;
        }
        try {
          preStat.close();
        } catch (Exception ignore) {
        } finally {
          preStat = null;
        }
        try {
          rsCnt.close();
        } catch (Exception ignore) {
        } finally {
          rsCnt = null;
        }
        try {
          preStatCnt.close();
        } catch (Exception ignore) {
        } finally {
          preStatCnt = null;
        }
      }
    }
  }
  protected synchronized AbstractBaseObject getByID(Integer id) throws ApplicationException {
    PreparedStatement preStat = null;
    ResultSet rs = null;
    StringBuffer sqlStat = new StringBuffer();

    synchronized (dbConn) {
      try {
        sqlStat.append(
            "SELECT A.ID, A.WORKFLOW_STEP_ID, A.ROUTE_SEQ, A.ROUTE_NAME, A.RECORD_STATUS, A.UPDATE_COUNT, A.CREATOR_ID, A.CREATE_DATE, A.UPDATER_ID, A.UPDATE_DATE ");
        sqlStat.append("FROM   WORKFLOW_STEP_ROUTE A ");
        sqlStat.append("WHERE  A.ID = ? AND A.RECORD_STATUS = ? ");
        preStat =
            dbConn.prepareStatement(
                sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        this.setPrepareStatement(preStat, 1, id);
        this.setPrepareStatement(preStat, 2, GlobalConstant.RECORD_STATUS_ACTIVE);
        rs = preStat.executeQuery();
        if (rs.next()) {
          WorkflowStepRoute tmpWorkflowStepRoute = new WorkflowStepRoute();
          tmpWorkflowStepRoute.setID(getResultSetInteger(rs, "ID"));
          tmpWorkflowStepRoute.setWorkflowStepID(getResultSetInteger(rs, "WORKFLOW_STEP_ID"));
          tmpWorkflowStepRoute.setRouteSeq(getResultSetInteger(rs, "ROUTE_SEQ"));
          tmpWorkflowStepRoute.setRouteName(getResultSetString(rs, "ROUTE_NAME"));
          tmpWorkflowStepRoute.setRecordStatus(getResultSetString(rs, "RECORD_STATUS"));
          tmpWorkflowStepRoute.setUpdateCount(getResultSetInteger(rs, "UPDATE_COUNT"));
          tmpWorkflowStepRoute.setCreatorID(getResultSetInteger(rs, "CREATOR_ID"));
          tmpWorkflowStepRoute.setCreateDate(getResultSetTimestamp(rs, "CREATE_DATE"));
          tmpWorkflowStepRoute.setUpdaterID(getResultSetInteger(rs, "UPDATER_ID"));
          tmpWorkflowStepRoute.setUpdateDate(getResultSetTimestamp(rs, "UPDATE_DATE"));
          tmpWorkflowStepRoute.setCreatorName(
              UserInfoFactory.getUserFullName(tmpWorkflowStepRoute.getCreatorID()));
          tmpWorkflowStepRoute.setUpdaterName(
              UserInfoFactory.getUserFullName(tmpWorkflowStepRoute.getUpdaterID()));
          return (tmpWorkflowStepRoute);
        } else {
          throw new ApplicationException(ErrorConstant.DB_RECORD_NOT_FOUND_ERROR);
        }
      } catch (ApplicationException appEx) {
        throw appEx;
      } catch (SQLException sqle) {
        log.error(sqle, sqle);
        throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString());
      } catch (Exception e) {
        log.error(e, e);
        throw new ApplicationException(ErrorConstant.DB_SELECT_ERROR, e);
      } finally {
        try {
          rs.close();
        } catch (Exception ignore) {
        } finally {
          rs = null;
        }
        try {
          preStat.close();
        } catch (Exception ignore) {
        } finally {
          preStat = null;
        }
      }
    }
  }
  /**
   * Gets a list of notification rules with the specified trigger type created for the given
   * workflow step
   *
   * @param workflowStepID The workflow step ID
   * @param notifyTrigger The trigger type
   * @return List of MtmWfStepNotificationRule objects
   * @throws ApplicationException
   * @see com.dcivision.workflow.bean.WorkflowStep
   * @see com.dcivision.workflow.bean.MtmWfStepNotificationRule
   * @see com.dcivision.workflow.bean.MtmWfStepNotificationRule#NOTIFY_TRIGGER_TYPE_ARRIVED
   * @see com.dcivision.workflow.bean.MtmWfStepNotificationRule#NOTIFY_TRIGGER_TYPE_BEFORE_DUE_DATE
   * @see
   *     com.dcivision.workflow.bean.MtmWfStepNotificationRule#NOTIFY_TRIGGER_TYPE_CHECK_OUT_BY_USER
   * @see com.dcivision.workflow.bean.MtmWfStepNotificationRule#NOTIFY_TRIGGER_TYPE_COMPLETED
   * @see
   *     com.dcivision.workflow.bean.MtmWfStepNotificationRule#NOTIFY_TRIGGER_TYPE_COMPLETED_BY_USER
   * @see com.dcivision.workflow.bean.MtmWfStepNotificationRule#NOTIFY_TRIGGER_TYPE_OVER_DUE_DATE
   * @see com.dcivision.workflow.bean.MtmWfStepNotificationRule#NOTIFY_TRIGGER_TYPE_PENDING_FOR
   * @see com.dcivision.workflow.bean.MtmWfStepNotificationRule#NOTIFY_TRIGGER_TYPE_PRIORITY_CHANGED
   * @see com.dcivision.workflow.bean.MtmWfStepNotificationRule#NOTIFY_TRIGGER_TYPE_STOPPED
   */
  public synchronized List getListByWorkflowStepIDAndNotifyTrigger(
      Integer workflowStepID, List notifyTrigger) throws ApplicationException {
    PreparedStatement preStat = null;
    ResultSet rs = null;
    StringBuffer sqlStat = new StringBuffer();
    List result = new ArrayList();
    String tigger = "";

    for (Iterator iter = notifyTrigger.iterator(); iter.hasNext(); ) {
      String element = (String) iter.next();
      if ("".equals(tigger)) {
        tigger = "'" + element + "'";
      } else {
        tigger = tigger + "," + "'" + element + "'";
      }
    }
    synchronized (dbConn) {
      try {
        sqlStat.append(
            "SELECT A.ID, A.WORKFLOW_STEP_ID, A.NOTIFY_TRIGGER, A.NOTIFY_AT_FIELD, A.NOTIFY_AT_AMT, A.NOTIFY_ACK_METHOD, A.RECORD_STATUS, A.UPDATE_COUNT, A.CREATOR_ID, A.CREATE_DATE, A.UPDATER_ID, A.UPDATE_DATE ");
        sqlStat.append("FROM   MTM_WF_STEP_NOTIFY_RULE A ");
        sqlStat.append(
            "WHERE  A.RECORD_STATUS = ? AND A.WORKFLOW_STEP_ID = ? AND A.NOTIFY_TRIGGER in ("
                + tigger
                + ")");
        preStat =
            dbConn.prepareStatement(
                sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        this.setPrepareStatement(preStat, 1, GlobalConstant.RECORD_STATUS_ACTIVE);
        this.setPrepareStatement(preStat, 2, workflowStepID);
        rs = preStat.executeQuery();
        while (rs.next()) {
          MtmWfStepNotificationRule tmpMtmWfStepNotificationRule = new MtmWfStepNotificationRule();
          tmpMtmWfStepNotificationRule.setID(getResultSetInteger(rs, "ID"));
          tmpMtmWfStepNotificationRule.setWorkflowStepID(
              getResultSetInteger(rs, "WORKFLOW_STEP_ID"));
          tmpMtmWfStepNotificationRule.setNotifyTrigger(getResultSetString(rs, "NOTIFY_TRIGGER"));
          tmpMtmWfStepNotificationRule.setNotifyAtField(getResultSetInteger(rs, "NOTIFY_AT_FIELD"));
          tmpMtmWfStepNotificationRule.setNotifyAtAmt(getResultSetInteger(rs, "NOTIFY_AT_AMT"));
          tmpMtmWfStepNotificationRule.setNotifyAckMethod(
              getResultSetString(rs, "NOTIFY_ACK_METHOD"));
          tmpMtmWfStepNotificationRule.setRecordStatus(getResultSetString(rs, "RECORD_STATUS"));
          tmpMtmWfStepNotificationRule.setUpdateCount(getResultSetInteger(rs, "UPDATE_COUNT"));
          tmpMtmWfStepNotificationRule.setCreatorID(getResultSetInteger(rs, "CREATOR_ID"));
          tmpMtmWfStepNotificationRule.setCreateDate(getResultSetTimestamp(rs, "CREATE_DATE"));
          tmpMtmWfStepNotificationRule.setUpdaterID(getResultSetInteger(rs, "UPDATER_ID"));
          tmpMtmWfStepNotificationRule.setUpdateDate(getResultSetTimestamp(rs, "UPDATE_DATE"));
          tmpMtmWfStepNotificationRule.setCreatorName(
              UserInfoFactory.getUserFullName(tmpMtmWfStepNotificationRule.getCreatorID()));
          tmpMtmWfStepNotificationRule.setUpdaterName(
              UserInfoFactory.getUserFullName(tmpMtmWfStepNotificationRule.getUpdaterID()));
          result.add(tmpMtmWfStepNotificationRule);
        }
        return (result);
      } catch (ApplicationException appEx) {
        throw appEx;
      } catch (SQLException sqle) {
        log.error(sqle, sqle);
        throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString());
      } catch (Exception e) {
        log.error(e, e);
        throw new ApplicationException(ErrorConstant.DB_SELECT_ERROR, e);
      } finally {
        try {
          rs.close();
        } catch (Exception ignore) {
        } finally {
          rs = null;
        }
        try {
          preStat.close();
        } catch (Exception ignore) {
        } finally {
          preStat = null;
        }
      }
    }
  }
  protected synchronized AbstractBaseObject update(AbstractBaseObject obj)
      throws ApplicationException {
    PreparedStatement preStat = null;
    StringBuffer sqlStat = new StringBuffer();
    MtmWfStepNotificationRule tmpMtmWfStepNotificationRule =
        (MtmWfStepNotificationRule) ((MtmWfStepNotificationRule) obj).clone();

    synchronized (dbConn) {
      try {
        int updateCnt = 0;
        Timestamp currTime = Utility.getCurrentTimestamp();
        sqlStat.append("UPDATE MTM_WF_STEP_NOTIFY_RULE ");
        sqlStat.append(
            "SET  WORKFLOW_STEP_ID=?, NOTIFY_TRIGGER=?, NOTIFY_AT_FIELD=?, NOTIFY_AT_AMT=?, NOTIFY_ACK_METHOD=?, UPDATE_COUNT=?, UPDATER_ID=?, UPDATE_DATE=? ");
        sqlStat.append("WHERE  ID=? AND UPDATE_COUNT=? ");
        preStat =
            dbConn.prepareStatement(
                sqlStat.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        setPrepareStatement(preStat, 1, tmpMtmWfStepNotificationRule.getWorkflowStepID());
        setPrepareStatement(preStat, 2, tmpMtmWfStepNotificationRule.getNotifyTrigger());
        setPrepareStatement(preStat, 3, tmpMtmWfStepNotificationRule.getNotifyAtField());
        setPrepareStatement(preStat, 4, tmpMtmWfStepNotificationRule.getNotifyAtAmt());
        setPrepareStatement(preStat, 5, tmpMtmWfStepNotificationRule.getNotifyAckMethod());
        setPrepareStatement(
            preStat, 6, new Integer(tmpMtmWfStepNotificationRule.getUpdateCount().intValue() + 1));
        setPrepareStatement(preStat, 7, sessionContainer.getUserRecordID());
        setPrepareStatement(preStat, 8, currTime);
        setPrepareStatement(preStat, 9, tmpMtmWfStepNotificationRule.getID());
        setPrepareStatement(preStat, 10, tmpMtmWfStepNotificationRule.getUpdateCount());
        updateCnt = preStat.executeUpdate();
        if (updateCnt == 0) {
          throw new ApplicationException(ErrorConstant.DB_CONCURRENT_ERROR);
        } else {
          tmpMtmWfStepNotificationRule.setUpdaterID(sessionContainer.getUserRecordID());
          tmpMtmWfStepNotificationRule.setUpdateDate(currTime);
          tmpMtmWfStepNotificationRule.setUpdateCount(
              new Integer(tmpMtmWfStepNotificationRule.getUpdateCount().intValue() + 1));
          tmpMtmWfStepNotificationRule.setCreatorName(
              UserInfoFactory.getUserFullName(tmpMtmWfStepNotificationRule.getCreatorID()));
          tmpMtmWfStepNotificationRule.setUpdaterName(
              UserInfoFactory.getUserFullName(tmpMtmWfStepNotificationRule.getUpdaterID()));
          return (tmpMtmWfStepNotificationRule);
        }
      } catch (ApplicationException appEx) {
        throw appEx;
      } catch (SQLException sqle) {
        log.error(sqle, sqle);
        throw new ApplicationException(ErrorConstant.DB_GENERAL_ERROR, sqle, sqle.toString());
      } catch (Exception e) {
        log.error(e, e);
        throw new ApplicationException(ErrorConstant.DB_UPDATE_ERROR, e);
      } finally {
        try {
          preStat.close();
        } catch (Exception ignore) {
        } finally {
          preStat = null;
        }
      }
    }
  }