Package com.madgnome.jira.plugins.jirachievements.data.ao

Examples of com.madgnome.jira.plugins.jirachievements.data.ao.ComponentStatistic


  @Override
  public ComponentStatistic createOrUpdate(UserWrapper userWrapper, String projectKey, String component, StatisticRefEnum statisticRefEnum, int value)
  {
    StatisticRef statisticRef = statisticRefDaoService.get(statisticRefEnum);

    ComponentStatistic componentStatistic = null;
    if (statisticRef != null)
    {
      componentStatistic = getOrCreate(projectKey, component, statisticRef, userWrapper);
      componentStatistic.setValue(value);
      componentStatistic.save();
    }

    return componentStatistic;
  }
View Full Code Here


    return componentStatistics.length != 0 ? componentStatistics[0] : getOrCreate(projectKey, component, statisticRef, userWrapper, 5);
  }

  private ComponentStatistic getOrCreate(String projectKey, String component, StatisticRef statisticRef, UserWrapper userWrapper, int remainingTry)
  {
    ComponentStatistic componentStatistic;
    try
    {
      componentStatistic = create(projectKey, component, statisticRef, userWrapper);
    }
    catch (Exception e)
View Full Code Here

    return componentStatistic;
  }

  private ComponentStatistic create(String projectKey, String component, StatisticRef statisticRef, UserWrapper userWrapper)
  {
    ComponentStatistic componentStatistic = ao.create(getClazz(), new DBParam("KEY", KeyableUtils.buildKey(projectKey, component, statisticRef, userWrapper)));
    componentStatistic.setProjectKey(projectKey);
    componentStatistic.setComponent(component);
    componentStatistic.setStatisticRef(statisticRef);
    componentStatistic.setUserWrapper(userWrapper);
    componentStatistic.save();

    return componentStatistic;
  }
View Full Code Here

    int value = 1;
    final String projectKey = "PKEY";
    final String component = "Config";
    daoService.createOrUpdate(userWrapper, projectKey, component, statRef, value);
    ComponentStatistic componentStatistic = daoService.get(userWrapper, projectKey, component, statRef);
    assertNotNull(componentStatistic);
    assertEquals(value, componentStatistic.getValue());
  }
View Full Code Here

    int value = 2;
    final String projectKey = "PKEY";
    final String comppnent = "Config";
    daoService.createOrUpdate(userWrapper, projectKey, comppnent, statRef, 1);
    daoService.createOrUpdate(userWrapper, projectKey, comppnent, statRef, value);
    ComponentStatistic componentStatistic = daoService.get(userWrapper, projectKey, comppnent, statRef);
    assertNotNull(componentStatistic);
    assertEquals(value, componentStatistic.getValue());
  }
View Full Code Here

TOP

Related Classes of com.madgnome.jira.plugins.jirachievements.data.ao.ComponentStatistic

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.