Esempio n. 1
0
  /**
   * *************************************************************************************** find
   * the css path from the database. Use commented code to find css path from properties file
   *
   * @return String
   *     ****************************************************************************************
   */
  public String getCssPath(String inputGroupName) {
    String cssLocation = null;
    MeasurementGroupStyleDao dao = SpringUtils.getBean(MeasurementGroupStyleDao.class);
    MeasurementCSSLocationDao cssDao = SpringUtils.getBean(MeasurementCSSLocationDao.class);
    List<MeasurementGroupStyle> styles = dao.findByGroupName(inputGroupName);
    for (MeasurementGroupStyle style : styles) {
      MeasurementCSSLocation location = cssDao.find(style.getCssId());
      String place = "StreamStyleSheet.do?cssfilename="; // Streams by default

      // Use the following commented code in place of the above line to allow the
      // option of using the oscarMeasurement_css property to form the css path.
      // If using this code, also uncomment the line in oscar.login.Startup.java
      // that checks and sets that property.
      /*
       * String downloadMethod = OscarProperties.getInstance().getProperty("oscarMeasurement_css_download_method");
       * String place = "";
       * if (downloadMethod == null || !(downloadMethod.equalsIgnoreCase("stream"))) {
       *    place = OscarProperties.getInstance().getProperty("oscarMeasurement_css");
       *    if(!place.endsWith("/"))
       *       place = new StringBuilder(place).insert(place.length(),"/").toString();
       * } else {
       *    place = "StreamStyleSheet.do?cssfilename=";
       * }
       */
      if (location != null) {
        cssLocation = place + location.getLocation();
      }
    }
    return cssLocation;
  }
Esempio n. 2
0
  /**
   * *************************************************************************************** find
   * the css name from the database
   *
   * @return String
   *     ****************************************************************************************
   */
  public String getCssName(String inputGroupName) {
    String cssName = null;

    MeasurementGroupStyleDao dao = SpringUtils.getBean(MeasurementGroupStyleDao.class);
    MeasurementCSSLocationDao cssDao = SpringUtils.getBean(MeasurementCSSLocationDao.class);
    List<MeasurementGroupStyle> styles = dao.findByGroupName(inputGroupName);
    for (MeasurementGroupStyle style : styles) {
      MeasurementCSSLocation location = cssDao.find(style.getCssId());

      if (location != null) {
        cssName = location.getLocation();
      }
    }
    return cssName;
  }