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

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


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

    ProjectStatistic projectStatistic = null;
    if (statisticRef != null)
    {
      projectStatistic = getOrCreate(projectKey, statisticRef, userWrapper);
      projectStatistic.setValue(value);
      projectStatistic.save();
    }

    return projectStatistic;
  }
View Full Code Here


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

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

    return projectStatistic;
  }

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

    return projectStatistic;
  }
View Full Code Here

    UserWrapper userWrapper = createUserWrapper();

    int value = 1;
    String projectKey = "PKEY";
    daoService.createOrUpdate(userWrapper, projectKey, statRef, value);
    ProjectStatistic projectStatistic = daoService.get(userWrapper, projectKey, statRef);
    assertNotNull(projectStatistic);
    assertEquals(value, projectStatistic.getValue());
  }
View Full Code Here

    int value = 2;
    String projectKey = "PKEY";
    daoService.createOrUpdate(userWrapper, projectKey, statRef, 1);
    daoService.createOrUpdate(userWrapper, projectKey, statRef, value);
    ProjectStatistic projectStatistic = daoService.get(userWrapper, projectKey, statRef);
    assertNotNull(projectStatistic);
    assertEquals(value, projectStatistic.getValue());
  }
View Full Code Here

TOP

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

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.