/**
 * This class provides functionality to show pdf on popup.
 *
 * @author gunjan1790
 * @version 1.0
 * @since 04/24/2012
 */
public class ShowPdfServlet extends HttpServlet {

  // Logger
  private static final OppeLog OPPE_LOG = OppeLogFactory.getLog(ShowPdfServlet.class);

  @SuppressWarnings("compatibility:-9099354871663016415")
  private static final long serialVersionUID = 1L;

  /**
   * Inititalizer of servlet
   *
   * @param config - configuration
   * @throws ServletException - error
   */
  public void init(ServletConfig config) throws ServletException {
    super.init(config);
  }

  /**
   * This method handles response of showing pdf servlet.
   *
   * @param request - instance of HttpServletRequest
   * @param response - instance of HttpServletResponse
   * @throws ServletException - error
   * @throws IOException - error
   */
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String preview = request.getParameter(PREVIEW_REPORT_PARAMETER);
    String sampleReportParam = request.getParameter(SAMPLE_REPORT_PARAM);
    if (null != sampleReportParam) {
      String sampleReportPath = "";
      if (sampleReportParam.equalsIgnoreCase(ReportServiceConstant.PROVIDER_SUMMARY)) {
        sampleReportPath =
            WL_HOME_PATH + RESOURCES_PATH + ReportServiceConstant.PROVIDER_SUMMARY_SAMPLE_FILE;
        showSampleReport(sampleReportPath, request, response);
      } else if (sampleReportParam.equalsIgnoreCase(ReportServiceConstant.COMPARATIVE_SUMMARY)) {
        sampleReportPath =
            WL_HOME_PATH + RESOURCES_PATH + ReportServiceConstant.COMPARITIVE_SUMMARY_SAMPLE_FILE;
        showSampleReport(sampleReportPath, request, response);
      } else if (sampleReportParam.equalsIgnoreCase(ReportServiceConstant.EXECUTIVE_SUMMARY)) {
        sampleReportPath =
            WL_HOME_PATH + RESOURCES_PATH + ReportServiceConstant.EXECUTIVE_SUMMARY_SAMPLE_FILE;
        showSampleReport(sampleReportPath, request, response);
      }
    } else if (null != preview && STR_TRUE.equals(preview)) {
      // report generation using OracleBI
      ServletOutputStream output = null;
      byte[] rawBinaryFile = null;
      Map<String, String> parameterMap = null;
      PublicReportServicePortClient client = null;
      FileStream fileStream = null;
      try {

        if (null != request.getSession().getAttribute(REPORTS_PARAMETERS_MAP)) {
          parameterMap =
              (Map<String, String>) request.getSession().getAttribute(REPORTS_PARAMETERS_MAP);
          //                    request.getSession().removeAttribute(REPORTS_PARAMETERS_MAP);
        }

        if (null != parameterMap && parameterMap.containsKey("REPORT_PATH")) {
          client = new PublicReportServicePortClient();
          fileStream = client.generateReport(parameterMap);
          rawBinaryFile = fileStream.getFileContent();
        }

        if (null != rawBinaryFile) {

          // Init servlet response.
          response.reset();
          response.setContentType("application/pdf");
          response.setContentLength(rawBinaryFile.length);
          response.setHeader(
              "Content-disposition", "inline; filename=\"" + fileStream.getFileName() + ".pdf\"");
          response.setHeader("Expires", "0");
          response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
          //                  response.setHeader("Transfer-Encoding", "identity");
          output = response.getOutputStream();

          output.write(rawBinaryFile, 0, rawBinaryFile.length);

          // Finalize task.
          output.flush();
        }
      } catch (Exception exception) {
        OPPE_LOG.error("ERROR.SHOW_PDF.ERROR", exception);
      } finally {

        // Gently close streams.
        close((Closeable) output);
      }
    }
  }
  /**
   * This method will open the sample report pdf.
   *
   * @param reportFilePath - full path of the sample report to be shown.
   * @param request - instance of HttpServletRequest
   * @param response - instance of HttpServletResponse
   * @throws ServletException - error
   * @throws IOException - error
   */
  private static void showSampleReport(
      String reportFilePath, HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    if (null != request.getSession().getAttribute(ReportServiceConstant.VIEW_SAMPLE_REPORT)
        && request
            .getSession()
            .getAttribute(ReportServiceConstant.VIEW_SAMPLE_REPORT)
            .toString()
            .equalsIgnoreCase("Y")) {
      ServletOutputStream output = null;
      try {

        FileInputStream fis = new FileInputStream(reportFilePath);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        byte[] buf = new byte[256];
        try {
          for (int readNum; (readNum = fis.read(buf)) != -1; ) {
            baos.write(buf, 0, readNum); // no doubt here is 0
            // Writes len bytes from the specified byte array starting at offset off to this byte
            // array output stream.
          }

        } catch (IOException ex) {
          ex.printStackTrace();
        }

        if (null != baos) {

          // Init servlet response.
          response.reset();
          response.setContentType("application/pdf");
          response.setContentLength(baos.size());
          response.setHeader("Content-disposition", "inline; filename=\"" + reportFilePath);
          response.setHeader("Expires", "0");
          response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
          //                  response.setHeader("Transfer-Encoding", "identity");
          output = response.getOutputStream();

          output.write(baos.toByteArray(), 0, baos.size());

          // Finalize task.
          output.flush();
        }
      } catch (Exception exception) {
        OPPE_LOG.error("ERROR.SHOW_PDF.ERROR", exception);
      } finally {

        // Gently close streams.
        close((Closeable) output);
      }
    }
  }
  /**
   * This method is used to close the stream.
   *
   * @param resource - resource to be closed
   */
  private static void close(Closeable resource) {
    if (resource != null) {
      try {
        resource.close();
      } catch (IOException ioException) {

        // Do your thing with the exception. Print it, log it or mail it.
        OPPE_LOG.error("ERROR.SHOW_PDF.CLOSE.ERROR", ioException);
      }
    }
  }
}
/**
 * This calss is Backing Bean for OPPE MetricsList Page and FPPE Metrics List Page
 *
 * @author hariom1466
 * @version 1.0
 * @since 12/15/2011
 */
public class OppeMetricsBackingBean extends BaseSupport {

  private static final OppeLog OPPE_LOG = OppeLogFactory.getLog(OppeMetricsBackingBean.class);
  // Variables for diffrent sortings
  private static final String MET_ID_ASC =
      " ORDER BY SUBSTR(ID,1,3)ASC,TO_NUMBER(TRANSLATE(ID, 'CAUPS', ' ' ) )ASC";
  private static final String MET_ID_DESC =
      "  ORDER BY SUBSTR(ID,1,3)DESC,TO_NUMBER(TRANSLATE(ID, 'CAUPS', ' ' ) )DESC";
  private static final String NAME_ASC = "ORDER BY UPPER(NAME) ASC";
  private static final String NAME_DESC = "ORDER BY UPPER(NAME) DESC";
  private static final String COMP_ASC = "ORDER BY UPPER(AREA_NAME) ASC";
  private static final String COMP_DESC = "ORDER BY UPPER(AREA_NAME) DESC";
  private static final String DEL_PRIV_ASC = "ORDER BY UPPER(DELINEATED_PRIVILEGES_NAME) ASC";
  private static final String DEL_PRIV_DESC = "ORDER BY UPPER(DELINEATED_PRIVILEGES_NAME) DESC";
  private static final String STA_ASC = "ORDER BY STATUS_NAME ASC";
  private static final String STA_DESC = "ORDER BY STATUS_NAME DESC";

  // variables for UI components
  private RichInputText metricIdUI;
  private RichInputText metricNameUI;
  private RichSelectOneChoice delineatedPrivilegesChoiceUI;
  private RichSelectOneChoice statusChoiceUI;
  private RichOutputLabel alertHeaderUI;
  private RichCommandLink nextLinkUI;
  private RichCommandLink previousLinkUI;
  private RichOutputText rangeBeginUI;
  private RichOutputText totalCountUI;

  // variable for total number of records
  private Long totalRowCount;

  // varible for sort order
  private String sortOrder = OPPEMETRIC_DEFAULT_SORT;
  private Long evaluationTypeId;
  private Long rangeBegin = PAGINATION_RANGE_BEGIN_VALUE;
  private Long rangeEnd = rangeBegin + FETCH_SIZE - 1;
  private List<String> categoryIdList;
  private String delPrivValue;

  // varible for pagination Link disable attribute
  private boolean isLinkEnabled;
  private List<SelectItem> selectList;
  private Long totalMetricsCount;
  private boolean goClick;
  private Boolean isNoMetric;
  private boolean totalRecord;
  private boolean checkMetricSearch;
  private boolean checkForResetCount = false;

  /** This method initializes some variables before page load. */
  public void initialize() {
    try {
      checkMetricSearch = true;
      rangeBegin = PAGINATION_RANGE_BEGIN_VALUE;
      rangeEnd = rangeBegin + FETCH_SIZE - 1;
      sortOrder = OPPEMETRIC_DEFAULT_SORT;
      evaluationTypeId = (Long) getValueFromSessionParam(EVALUATION_TYPE_ID);
      categoryIdList = new ArrayList<String>();
      OppeMetricsDTO oppeMetricsDto = new OppeMetricsDTO();
      oppeMetricsDto.setEvaluationType(evaluationTypeId);
      oppeMetricsDto.setRangeBegin(rangeBegin);
      oppeMetricsDto.setRangeEnd(rangeEnd);
      oppeMetricsDto.setInstitutionId(
          Long.valueOf(getValueFromSessionParam(PARAMETER_INSTITUTION_ID).toString()));
      oppeMetricsDto.setSortBy(OPPEMETRIC_DEFAULT_SORT);
      Map parameterMap = new HashMap();
      parameterMap.put(OPPEMETRIC_DTO, oppeMetricsDto);
      parameterMap.put(IS_METRIC_SEARCH, true);
      executeBinding(GET_OPPE_METRICDATA, parameterMap);
      Long totalCount = (Long) executeBinding(GET_OPPE_METRIC_COUNT);
      if (totalCount == null) {
        showGenericError();
      } else {
        totalMetricsCount = totalCount;
        isLinkEnabled = false;
        if (totalCount <= FETCH_SIZE) {
          rangeEnd = totalCount;
          isLinkEnabled = true;
        } else {
          checkForResetCount = true;
        }
        if (totalCount == 0) {
          rangeBegin = 0L;
        }
      }
      totalRecord = true;
      goClick = false;
      checkMetricSearch = false;
      OPPE_LOG.debug("METRICS.INITIALIZE_DEBUG");
    } catch (Exception exception) {
      OPPE_LOG.error("DATABASE_RETRIEVE_ERROR", exception);
      showGenericError();
    }
  }

  /**
   * This method is action listener for select privileges drop down
   *
   * @param valueChangeEvent - object of ValueChangeEvent
   */
  public void selectPrivilegesListener(ValueChangeEvent valueChangeEvent) {
    try {
      String newValue = String.valueOf(valueChangeEvent.getNewValue());
      if (categoryIdList.contains(newValue) && newValue != CAPMETRIC_LIST_DROPDOWN_SELECT) {
        RichSelectOneChoice privilegeSelectOneChoice =
            (RichSelectOneChoice) findComponentInRoot(DEL_PRIV_UICOMP);
        FacesMessage message = new FacesMessage();
        message.setDetail(getValue("#{CommonResourceText['CATEGORY_NOT_CHOOSEN']}"));
        message.setSeverity(FacesMessage.SEVERITY_ERROR);

        // Reset resource area to default value
        FacesContext.getCurrentInstance()
            .addMessage(
                privilegeSelectOneChoice.getClientId(FacesContext.getCurrentInstance()), message);
        privilegeSelectOneChoice.setValue(0);
        privilegeSelectOneChoice.setValid(false);
        AdfFacesContext.getCurrentInstance().addPartialTarget(privilegeSelectOneChoice);
      }
      OPPE_LOG.debug("METRICS.VALUE_CHANE_EVENT_DEBUG");
    } catch (Exception exception) {
      OPPE_LOG.error("DATABASE_RETRIEVE_ERROR", exception);
      showGenericError();
    }
  }

  /**
   * This method gives the list for Delineated Privilege DropDown in UI
   *
   * @return List - SelectItem (for Delineated Privilege DropDown)
   */
  public List<SelectItem> getSelectList() {

    try {
      Long institutionId =
          Long.valueOf(getValueFromSessionParam(PARAMETER_INSTITUTION_ID).toString());
      if (selectList == null || selectList.isEmpty()) {
        selectList = new ArrayList<SelectItem>();
        LinkedHashMap<String, String> categoryPrivilegesMap =
            (LinkedHashMap<String, String>)
                executeBinding(GET_PRIVILEGE_TYPES, INSTITUTION_ID, institutionId);
        if (categoryPrivilegesMap == null) {
          showGenericError();
        }
        Iterator<Map.Entry<String, String>> entries = categoryPrivilegesMap.entrySet().iterator();
        Map.Entry<String, String> entry;
        while (entries.hasNext()) {
          entry = entries.next();
          selectList.add(new SelectItem(entry.getKey(), entry.getValue()));
          if (entry.getValue().contains(HYPHENS)) {
            categoryIdList.add(entry.getKey());
          }
        }
      }
      OPPE_LOG.debug("METRICS.GET_PRIVILEGES_LIST_DEBUG");
    } catch (Exception exception) {
      OPPE_LOG.error("DATABASE_RETRIEVE_ERROR", exception);
      showGenericError();
    }
    return selectList;
  }

  /**
   * This method returns the record on the basis of search criteria.
   *
   * @return EmptyString - empty string
   */
  public String metricSearch() {
    try {
      alertHeaderUI.setVisible(false);
      checkMetricSearch = true;
      if (!(statusChoiceUI.getValue() == null
          && metricIdUI.getValue() == null
          && metricNameUI.getValue() == null
          && delPrivValue == null
          && goClick)) {
        OppeMetricsDTO oppeMetricsDto = new OppeMetricsDTO();
        rangeBegin = PAGINATION_RANGE_BEGIN_VALUE;
        rangeEnd = rangeBegin + FETCH_SIZE - 1;
        oppeMetricsDto = setFilterCriteria(oppeMetricsDto);
        Map parameterMap = new HashMap();
        parameterMap.put(OPPEMETRIC_DTO, oppeMetricsDto);
        parameterMap.put(IS_METRIC_SEARCH, true);
        executeBinding(GET_OPPE_METRICDATA, parameterMap);
        Long totalCount = (Long) executeBinding(GET_OPPE_METRIC_COUNT);
        if (totalCount == null) {
          showGenericError();
        }
        totalRecord = true;
        if (totalCount == 0) {
          rangeBegin = 0L;
          totalRecord = false;
        }
        if (totalCount <= FETCH_SIZE) {
          getNextLinkUI().setDisabled(true);
          rangeEnd = totalCount;
        } else {
          getNextLinkUI().setDisabled(false);
        }
        getPreviousLinkUI().setDisabled(true);
        OPPE_LOG.debug("METRICS.METRIC_SEARCH_DEBUG");
      } else {
        alertHeaderUI.setVisible(true);
        goClick = false;
      }
      checkMetricSearch = false;
    } catch (Exception exeception) {
      OPPE_LOG.error("DATABASE_RETRIEVE_ERROR", exeception);
      showGenericError();
    }
    return EMPTY_STRING;
  }

  /**
   * This method renders the nextUI set of records
   *
   * @return EmptyString - empty string
   */
  public String onNextClick() {

    try {
      rangeBegin = Long.valueOf(rangeBeginUI.getValue().toString()) + FETCH_SIZE;
      totalRowCount = Long.valueOf(totalCountUI.getValue().toString().trim());
      rangeEnd = rangeBegin + FETCH_SIZE - 1;
      if (rangeEnd >= totalRowCount) {
        rangeEnd = totalRowCount;
        nextLinkUI.setDisabled(true);
      }
      previousLinkUI.setDisabled(false);
      OppeMetricsDTO oppeMetricsDto = new OppeMetricsDTO();
      oppeMetricsDto = setFilterCriteria(oppeMetricsDto);
      Map parameterMap = new HashMap();
      parameterMap.put(OPPEMETRIC_DTO, oppeMetricsDto);
      parameterMap.put(IS_METRIC_SEARCH, false);
      executeBinding(GET_OPPE_METRICDATA, parameterMap);
      OPPE_LOG.debug("METRICS.NEXT_CLICK_DEBUG");
    } catch (Exception exception) {
      OPPE_LOG.error("DATABASE_RETRIEVE_ERROR", exception);
      showGenericError();
    }
    return EMPTY_STRING;
  }

  /**
   * This method render the previousUI set of records
   *
   * @return EmptyString - empty string
   */
  public String onPreviousClick() {
    try {

      rangeBegin = Long.valueOf(rangeBeginUI.getValue().toString()) - FETCH_SIZE;
      rangeEnd = rangeBegin + FETCH_SIZE - 1;
      totalRowCount = Long.valueOf(totalCountUI.getValue().toString().trim());
      if (rangeBegin <= 1) {
        previousLinkUI.setDisabled(true);
      }
      nextLinkUI.setDisabled(false);
      OppeMetricsDTO oppeMetricsDto = new OppeMetricsDTO();
      oppeMetricsDto = setFilterCriteria(oppeMetricsDto);
      Map parameterMap = new HashMap();
      parameterMap.put(OPPEMETRIC_DTO, oppeMetricsDto);
      parameterMap.put(IS_METRIC_SEARCH, false);
      executeBinding(GET_OPPE_METRICDATA, parameterMap);
      OPPE_LOG.debug("METRICS.PREVIOUS_CLICK_DEBUG");
    } catch (Exception exception) {
      OPPE_LOG.error("DATABASE_RETRIEVE_ERROR", exception);
      showGenericError();
    }
    return EMPTY_STRING;
  }

  /**
   * This method navigate selection MetricScreen.
   *
   * @param actionEvent - instance of ActionEvent
   */
  public void handleMetricIdActionEvent(ActionEvent actionEvent) {
    try {
      Long editMetricId = (Long) actionEvent.getComponent().getAttributes().get(EDIT_METRIC_ID);
      Long editPrivilegeId =
          (Long) actionEvent.getComponent().getAttributes().get("privilegeIdForSelectMetric");
      setValueToSessionParam(EDIT_METRIC_ID, editMetricId);
      setValueToSessionParam("privilegeIdForSelectMetric", editPrivilegeId);
    } catch (Exception exception) {
      OPPE_LOG.error("DATABASE_RETRIEVE_ERROR", exception);
      showGenericError();
    }
  }

  /**
   * This method reset the values of all filter criteria in UI
   *
   * @return EMPTY_STRING - empty string
   */
  public String resetValue() {
    try {
      metricIdUI.setValue(EMPTY_STRING);
      metricNameUI.setValue(EMPTY_STRING);
      statusChoiceUI.setValue(0);
      delineatedPrivilegesChoiceUI.setValue(0);
      initialize();
      if (checkForResetCount) {
        nextLinkUI.setDisabled(false);
      }
      OPPE_LOG.debug("METRICS.RESET_VALUES_DEBUG");
    } catch (Exception exception) {
      OPPE_LOG.error("DATABASE_RETRIEVE_ERROR", exception);
      showGenericError();
    }
    return EMPTY_STRING;
  }

  /**
   * This Function sort the records on the given criteria
   *
   * @return EMPTY_STRING - empty string
   */
  public String sortByChoice() {
    try {
      hideGenericError();
      OppeMetricsDTO oppeMetricsDto = new OppeMetricsDTO();
      oppeMetricsDto = setFilterCriteria(oppeMetricsDto);
      Map parameterMap = new HashMap();
      parameterMap.put(OPPEMETRIC_DTO, oppeMetricsDto);
      parameterMap.put(IS_METRIC_SEARCH, false);
      executeBinding(GET_OPPE_METRICDATA, parameterMap);
      OPPE_LOG.debug("DEBUG_SORT_BY_CHOICE");
    } catch (Exception exception) {
      OPPE_LOG.error("ERROR.GET.CAP.METRICS.SORT", exception);
      showGenericError();
    }
    return EMPTY_STRING;
  }

  /**
   * This method sets the filter criteria in OppeMetricsDTO
   *
   * @param oppeMetricsDto - instance of OppeMetricsDTO
   * @return oppeMetricsDto - instance of OppeMetricsDTO
   */
  private OppeMetricsDTO setFilterCriteria(OppeMetricsDTO oppeMetricsDto) {
    if (checkMetricSearch && statusChoiceUI != null && metricIdUI != null && metricNameUI != null) {
      statusChoiceUI.setValue(
          statusChoiceUI.getValue() != null
                  && (statusChoiceUI.getValue().toString().length() == 0
                      || statusChoiceUI.getValue().toString().equals(SELECT_ALL))
              ? null
              : statusChoiceUI.getValue());
      setdelPrivValue(
          getdelPrivValue() != null
                  && (getdelPrivValue().toString().length() == 0
                      || getdelPrivValue().equals(SELECT_ALL))
              ? null
              : getdelPrivValue());
      metricIdUI.setValue(
          metricIdUI.getValue() != null && metricIdUI.getValue().toString().trim().length() == 0
              ? null
              : metricIdUI.getValue());
      metricNameUI.setValue(
          metricNameUI.getValue() != null && metricNameUI.getValue().toString().trim().length() == 0
              ? null
              : metricNameUI.getValue());
      if (statusChoiceUI.getValue() != null) {
        oppeMetricsDto.setStatusId(Long.valueOf(statusChoiceUI.getValue().toString()));
      }
      if (delPrivValue != null) {
        oppeMetricsDto.setDelineatedPrivilegeId(Long.valueOf(delPrivValue));
      }
      if (metricIdUI.getValue() != null) {
        oppeMetricsDto.setMetricId(
            PERCENT + metricIdUI.getValue().toString().toUpperCase() + PERCENT);
      }
      if (metricNameUI.getValue() != null) {
        oppeMetricsDto.setMetricsName(
            PERCENT + metricNameUI.getValue().toString().toUpperCase() + PERCENT);
      }
    }

    oppeMetricsDto.setRangeBegin(rangeBegin);
    oppeMetricsDto.setRangeEnd(rangeEnd);
    oppeMetricsDto.setSortBy(getSortOrder());
    oppeMetricsDto.setEvaluationType(getEvaluationTypeId());
    oppeMetricsDto.setInstitutionId(
        Long.valueOf(getValueFromSessionParam(PARAMETER_INSTITUTION_ID).toString()));
    OPPE_LOG.debug("METRICS.SET_FILTER_CRITERIA_DEBUG");
    return oppeMetricsDto;
  }

  /** @param rangeBeginUI - instance of RichOutputText */
  public void setRangeBeginUI(RichOutputText rangeBeginUI) {
    this.rangeBeginUI = rangeBeginUI;
  }

  /** @return rangeBeginUI - instance of RichOutputText */
  public RichOutputText getRangeBeginUI() {
    return rangeBeginUI;
  }

  /** @param totalCountUI - instance of RichOutputText */
  public void setTotalCountUI(RichOutputText totalCountUI) {
    this.totalCountUI = totalCountUI;
  }

  /** @return totalCountUI - instance of RichOutputText */
  public RichOutputText getTotalCountUI() {
    return totalCountUI;
  }

  /** @param sortOrder - sort order from user */
  public void setSortOrder(String sortOrder) {
    this.sortOrder = sortOrder;
  }

  /** @return sortOrder - instance of String */
  public String getSortOrder() {
    return sortOrder;
  }

  /** @param rangeBegin - instance of Long */
  public void setRangeBegin(Long rangeBegin) {
    this.rangeBegin = rangeBegin;
  }

  /** @return rangeBegin - instance of Long */
  public Long getRangeBegin() {
    return rangeBegin;
  }

  /** @param rangeEnd - instance of Long */
  public void setRangeEnd(Long rangeEnd) {
    this.rangeEnd = rangeEnd;
  }

  /** @return rangeEnd - instance of Long */
  public Long getRangeEnd() {
    return rangeEnd;
  }

  /** @return MET_ID_ASC - instance of String */
  public String getSortByMetricIDAsc() {
    return MET_ID_ASC;
  }

  /** @return MET_ID_DESC - instance of String */
  public String getSortByMetricIDDesc() {
    return MET_ID_DESC;
  }

  /** @return COMP_ASC - instance of String */
  public String getSortByCompetencyAsc() {
    return COMP_ASC;
  }

  /** @return COMP_DESC - instance of String */
  public String getSortByCompetencyDesc() {
    return COMP_DESC;
  }

  /** @return DEL_PRIV_ASC - instance of String */
  public String getSortByDelineatedPrivilegesAsc() {
    return DEL_PRIV_ASC;
  }

  /** @return DEL_PRIV_DESC - instance of String */
  public String getSortByDelineatedPrivilegesDesc() {
    return DEL_PRIV_DESC;
  }

  /** @param totalRowCount - instance of Long */
  public void setTotalRowCount(Long totalRowCount) {
    this.totalRowCount = totalRowCount;
  }

  /** @return totalRowCount - instance of Long */
  public Long getTotalRowCount() {
    return totalRowCount;
  }

  /** @return NAME_ASC - instance of String */
  public String getSortByNameAsc() {
    return NAME_ASC;
  }

  /** @return NAME_DESC - instance of String */
  public String getSortByNameDesc() {
    return NAME_DESC;
  }

  /** @return STA_ASC - instance of String */
  public String getSortByStatusAsc() {
    return STA_ASC;
  }

  /** @return STA_DESC - instance of String */
  public String getSortByStatusDesc() {
    return STA_DESC;
  }

  /** @param evaluationTypeId - instance of Long */
  public void setEvaluationTypeId(Long evaluationTypeId) {
    this.evaluationTypeId = evaluationTypeId;
  }

  /** @return evaluationTypeId - instance of Long */
  public Long getEvaluationTypeId() {
    return evaluationTypeId;
  }

  /** @param delPrivValue - instance of String */
  public void setdelPrivValue(String delPrivValue) {
    this.delPrivValue = delPrivValue;
  }

  /** @return delPrivValue - instance of String */
  public String getdelPrivValue() {
    return delPrivValue;
  }

  /** @param totalMetricsCount - instance of Long */
  public void setTotalMetricsCount(Long totalMetricsCount) {
    this.totalMetricsCount = totalMetricsCount;
  }

  /** @return totalMetricsCount - instance of Long */
  public Long getTotalMetricsCount() {
    return totalMetricsCount;
  }

  /** @param metricIdUI - instance of RichInputText */
  public void setMetricIdUI(RichInputText metricIdUI) {
    this.metricIdUI = metricIdUI;
  }

  /** @return metricIdUI - instance of RichInputText */
  public RichInputText getMetricIdUI() {
    return metricIdUI;
  }

  /** @param metricNameUI - instance of RichInputText */
  public void setMetricNameUI(RichInputText metricNameUI) {
    this.metricNameUI = metricNameUI;
  }

  /** @return metricNameUI - instance of RichInputText */
  public RichInputText getMetricNameUI() {
    return metricNameUI;
  }

  /** @param statusChoiceUI - instance of RichSelectOneChoice */
  public void setStatusChoiceUI(RichSelectOneChoice statusChoiceUI) {
    this.statusChoiceUI = statusChoiceUI;
  }

  /** @return statusChoiceUI - instance of RichSelectOneChoice */
  public RichSelectOneChoice getStatusChoiceUI() {
    return statusChoiceUI;
  }

  /** @param alertHeaderUI - instance of RichOutputLabel */
  public void setAlertHeaderUI(RichOutputLabel alertHeaderUI) {
    this.alertHeaderUI = alertHeaderUI;
  }

  /** @return alertHeaderUI - instance of RichOutputLabel */
  public RichOutputLabel getAlertHeaderUI() {
    return alertHeaderUI;
  }

  /** @param nextLinkUI - instance of RichCommandLink */
  public void setNextLinkUI(RichCommandLink nextLinkUI) {
    this.nextLinkUI = nextLinkUI;
  }

  /** @return nextLinkUI - instance of RichCommandLink */
  public RichCommandLink getNextLinkUI() {
    return nextLinkUI;
  }

  /** @param previousLinkUI - instance of RichCommandLink */
  public void setPreviousLinkUI(RichCommandLink previousLinkUI) {
    this.previousLinkUI = previousLinkUI;
  }

  /** @return previousLinkUI - instance of RichCommandLink */
  public RichCommandLink getPreviousLinkUI() {
    return previousLinkUI;
  }

  /** @param isLinkEnabled - instance of boolean */
  public void setIsLinkEnabled(boolean isLinkEnabled) {
    this.isLinkEnabled = isLinkEnabled;
  }

  /** @return isLinkEnabled - instance of boolean */
  public boolean isIsLinkEnabled() {
    return isLinkEnabled;
  }

  /** @param delineatedPrivilegesChoiceUI - instance of RichSelectOneChoice */
  public void setDelineatedPrivilegesChoiceUI(RichSelectOneChoice delineatedPrivilegesChoiceUI) {
    this.delineatedPrivilegesChoiceUI = delineatedPrivilegesChoiceUI;
  }

  /** @return delineatedPrivilegesChoiceUI - instance of RichSelectOneChoice */
  public RichSelectOneChoice getDelineatedPrivilegesChoiceUI() {
    return delineatedPrivilegesChoiceUI;
  }

  /** @param goClick - instance of boolean */
  public void setGoClick(boolean goClick) {
    this.goClick = goClick;
  }

  /** @return goClick - instance of boolean */
  public boolean isGoClick() {
    return goClick;
  }

  /** @param isNoMetric - instance of Boolean */
  public void setIsNoMetric(Boolean isNoMetric) {
    this.isNoMetric = isNoMetric;
  }

  /** @return isNoMetric - instance of Boolean */
  public Boolean getIsNoMetric() {
    if (totalMetricsCount == 0) {
      isNoMetric = true;
    } else {
      isNoMetric = false;
    }
    return isNoMetric;
  }

  /** @param totalRecord - instance of boolean */
  public void setTotalRecord(boolean totalRecord) {
    this.totalRecord = totalRecord;
  }

  /** @return totalRecord - instance of boolean */
  public boolean isTotalRecord() {
    return totalRecord;
  }
}