Package com.metrictracker.model

Examples of com.metrictracker.model.MetricValue


      Iterator<MetricValue> metricValues = dao.listByProperty("metricKey", metric.getKey()).iterator();
      StringBuffer sb = new StringBuffer("");
    sb.append("Metric Name: " + metric.getName());
    sb.append(System.getProperty("line.separator"));
    while (metricValues.hasNext()) {
       MetricValue metricValue = metricValues.next();
       sb.append(metricValue.getTimeFrame());
       sb.append("\t");
       sb.append(metricValue.getValue());
       sb.append(System.getProperty("line.separator"));
    }
    
        return sb.toString();
    }
View Full Code Here


          String value = parameters.get("value");
          String timeFrame = parameters.get("timeFrame");
         
          Metric metric = getMetric();
         
          MetricValue metricValue = new MetricValue();
          metricValue.setMetric(metric);
          metricValue.setTimeFrame(Date.valueOf(timeFrame));
          metricValue.setMetricValue(Long.valueOf(value));
         
          ofy.put(metricValue);
        getResponse().setStatus(Status.SUCCESS_CREATED)
           
    } catch (IOException e) {
View Full Code Here

    MetricValueDao valueDao = new MetricValueDao();
    MetricGoalDao goalDao = new MetricGoalDao();
    List<MetricGoal> metricGoals = goalDao.listByProperty("metricKey", metric.getKey());
    Iterator<MetricValue> values =  valueDao.listByProperty("metricKey", metric.getKey()).iterator();
    while (values.hasNext()) {
      MetricValue value = values.next();
      for (int i=0; i< metricGoals.size(); i++) {
        String isGoalMet = "N";
        MetricGoal goal = metricGoals.get(i);
        if (value.getTimeFrame().after(goal.getEffectivityDate()) &&
            value.getTimeFrame().before(goal.getExpirationDate())) {
          if (goal.getGoalType().equals(MetricGoal.HIGHISBETTER) && goal.getGoal() <= value.getValue()) {
            isGoalMet = "Y";
          }
          else if (goal.getGoalType().equals(MetricGoal.LOWISBETTER) && goal.getGoal() >= value.getValue()) {
            isGoalMet = "Y";
          }
        }
        sb.append(value.getTimeFrame());
        sb.append("\t");
        sb.append(value.getValue());
        sb.append("\t\t");
        sb.append(goal.getName());
        sb.append("\t\t");
        sb.append(goal.getGoal());
        sb.append("\t\t");
        sb.append(isGoalMet);
        sb.append("\t\t");
        sb.append(MessageFormat.format("{0,number,#.##%}", value.getValue() / goal.getGoal()));
        sb.append(System.getProperty("line.separator"));
      }
    }
    return sb.toString();
  }
View Full Code Here

    while (values.hasNext()) {

      j++;
      log.log(Level.WARNING, "value #" + j);
     
      MetricValue value = values.next();
      for (int i=0; i< metricGoals.size(); i++) {
        String isGoalMet = "N";
        MetricGoal goal = metricGoals.get(i);
        if (value.getTimeFrame().after(goal.getEffectivityDate()) &&
            value.getTimeFrame().before(goal.getExpirationDate())) {
          if (goal.getGoalType().equals(MetricGoal.HIGHISBETTER) && goal.getGoal() <= value.getValue()) {
            isGoalMet = "Y";
          }
          else if (goal.getGoalType().equals(MetricGoal.LOWISBETTER) && goal.getGoal() >= value.getValue()) {
            isGoalMet = "Y";
          }
        }
       
       
        try {
         
          log.log(Level.WARNING, "timeframe: " + value.getTimeFrame());
          log.log(Level.WARNING, "value: " + value.getValue());
          log.log(Level.WARNING, "goal name: " + goal.getName());
          log.log(Level.WARNING, "isGoalMet: " + isGoalMet);
          log.log(Level.WARNING, "percent to goal: " + MessageFormat.format("{0,number,#.##%}", value.getValue() / goal.getGoal()));
         
          TableRow row = new TableRow();
          row.addCell(new TableCell(new TextValue(value.getTimeFrame().toString())));
          row.addCell(new TableCell(new NumberValue(value.getValue())));
          row.addCell(new TableCell(new TextValue(goal.getName())));
          row.addCell(new TableCell(new TextValue(isGoalMet)));
          row.addCell(new TableCell(new TextValue(MessageFormat.format("{0,number,#.##%}", value.getValue() / goal.getGoal()))));
         
          data.addRow(row);
          } catch (TypeMismatchException e) {
          ExceptionManager.logException(log, e);
          return null;
View Full Code Here

TOP

Related Classes of com.metrictracker.model.MetricValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.