Package com.metrictracker.model

Examples of com.metrictracker.model.Metric


  private static final Logger log = Logger.getLogger(ManageMetricGoal.class.getName());
 
    @Get
    public String rep() {
   
      Metric metric = getMetric();
     
      MetricGoalDao dao = new MetricGoalDao();
      Iterator<MetricGoal> metricGoals = dao.listByProperty("metricKey", metric.getKey()).iterator();
     
    StringBuffer sb = new StringBuffer("");
    sb.append("Metric Name: " + metric.getName());
    sb.append(System.getProperty("line.separator"));
    sb.append("Goal Name\t");
    sb.append("Goal Type\t");
    sb.append("Effective\t\t\t");
    sb.append("Expiration\t\t\t");
View Full Code Here


   
    @Post("form:xml|json")
    public void acceptRepresentation(Representation entity) throws ResourceException {
     
      Objectify ofy = ObjectifyService.begin();
      Metric metric = getMetric();

    try {
      HashMap<String, String> parameters = getParameters(entity);
 
          MetricGoal metricGoal = new MetricGoal();
View Full Code Here

  private static final Logger log = Logger.getLogger(ManageMetricValue.class.getName());
 
    @Get
    public String represent() {
      Metric metric = getMetric();  
      MetricValueDao dao = new MetricValueDao();
      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");
View Full Code Here

    try {
      HashMap<String, String> parameters = getParameters(entity);
          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));
View Full Code Here

  private static final Logger log = Logger.getLogger(ManageMetric.class.getName());
 
  @Get
  public String represent() {
    Metric metric = getMetric();
    StringBuffer sb = new StringBuffer("");
    sb.append("Metric Name: " + metric.getName());
    sb.append(System.getProperty("line.separator"));
    sb.append("Metric Date\t\t\t");
    sb.append("Metric Value\t");
    sb.append("Goal Name\t");
    sb.append("Goal Value\t");
    sb.append("Goal Met?\t");
    sb.append("% to Goal\t");
    sb.append(System.getProperty("line.separator"));
    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);
View Full Code Here

  public void acceptRepresentation(Representation entity) throws ResourceException {

    Objectify ofy = ObjectifyService.begin();
    try {
      HashMap<String, String> parameters = getParameters(entity);
      Metric metric = new Metric (parameters.get("metricName"));
      MetricDao metricDao = new MetricDao();
      metricDao.put(metric);
      ofy.put(metric);
      getResponse().setStatus(Status.SUCCESS_CREATED)
    } catch (UnsupportedEncodingException e) {
View Full Code Here

  }

  @Delete
  public Representation delete() {
    MetricDao dao = new MetricDao();
    Metric metric = getMetric();

    MetricValueDao valueDao = new MetricValueDao();
    List<MetricValue> metricValues = valueDao.listByProperty("metricKey", metric.getKey());
    valueDao.deleteAll(metricValues);

    MetricGoalDao goalDao = new MetricGoalDao();
    List<MetricGoal> metricGoals = goalDao.listByProperty("metricKey", metric.getKey());
    goalDao.deleteAll(metricGoals);

    dao.delete(metric);
    return null;
  }
View Full Code Here

    MetricDao metricDao = new MetricDao();
    String metricName = null;
    metricName = (String) request.getParameter("metricName");
    metricName = "foo";
    Metric metric = metricDao.getMetric(metricName);
   
    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();
    int j=0;
    while (values.hasNext()) {

      j++;
      log.log(Level.WARNING, "value #" + j);
View Full Code Here

TOP

Related Classes of com.metrictracker.model.Metric

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.