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

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


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

    VersionStatistic versionStatistic = null;
    if (statisticRef != null)
    {
      versionStatistic = getOrCreate(projectKey, version, statisticRef, userWrapper);
      versionStatistic.setValue(value);
      versionStatistic.save();
    }

    return versionStatistic;
  }
View Full Code Here


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

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

    return versionStatistic;
  }

  private VersionStatistic create(String projectKey, String version, StatisticRef statisticRef, UserWrapper userWrapper)
  {
    VersionStatistic versionStatistic = ao.create(getClazz(), new DBParam("KEY", KeyableUtils.buildKey(projectKey, version, statisticRef, userWrapper)));
    versionStatistic.setProjectKey(projectKey);
    versionStatistic.setVersion(version);
    versionStatistic.setStatisticRef(statisticRef);
    versionStatistic.setUserWrapper(userWrapper);
    versionStatistic.save();

    return versionStatistic;
  }
View Full Code Here

    int value = 1;
    final String projectKey = "PKEY";
    final String version = "1.0";
    daoService.createOrUpdate(userWrapper, projectKey, version, statRef, value);
    VersionStatistic versionStatistic = daoService.get(userWrapper, projectKey, version, statRef);
    assertNotNull(versionStatistic);
    assertEquals(value, versionStatistic.getValue());
  }
View Full Code Here

    int value = 2;
    final String projectKey = "PKEY";
    final String version = "1.0";
    daoService.createOrUpdate(userWrapper, projectKey, version, statRef, 1);
    daoService.createOrUpdate(userWrapper, projectKey, version, statRef, value);
    VersionStatistic versionStatistic = daoService.get(userWrapper, projectKey, version, statRef);
    assertNotNull(versionStatistic);
    assertEquals(value, versionStatistic.getValue());
  }
View Full Code Here

TOP

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

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.