Package com.metrictracker.model

Examples of com.metrictracker.model.MetricGoal


    sb.append("Effective\t\t\t");
    sb.append("Expiration\t\t\t");
    sb.append("Goal");
    sb.append(System.getProperty("line.separator"));
    while (metricGoals.hasNext()) {
       MetricGoal metricGoal = metricGoals.next();
       sb.append(metricGoal.getName());
       sb.append("\t");
       sb.append(metricGoal.getGoalType());
       sb.append("\t");
       sb.append(metricGoal.getEffectivityDate());
       sb.append("\t");
       sb.append(metricGoal.getExpirationDate());
       sb.append("\t");
       sb.append(metricGoal.getGoal());
       sb.append(System.getProperty("line.separator"));
    }
    
        return sb.toString();
    }
View Full Code Here


      Metric metric = getMetric();

    try {
      HashMap<String, String> parameters = getParameters(entity);
 
          MetricGoal metricGoal = new MetricGoal();
          metricGoal.setMetric(metric);
          metricGoal.setGoalType(parameters.get("goalType"));
          metricGoal.setGoal(Float.valueOf(parameters.get("goal")));
          metricGoal.setEffectivityDate(Date.valueOf(parameters.get("effectivityDate")));
          metricGoal.setExpirationDate(Date.valueOf(parameters.get("expirationDate")));
          metricGoal.setName(parameters.get("goalName"));
         
          ofy.put(metricGoal);
        getResponse().setStatus(Status.SUCCESS_CREATED)
           
    } catch (IOException e) {
View Full Code Here

    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

      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.MetricGoal

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.