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

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


  @Override
  public void addAchievementToUser(Achievement achievement, UserWrapper userWrapper)
  {
    if (get(achievement, userWrapper) == null)
    {
      UserAchievement userAchievement = ao.create(UserAchievement.class);
      userAchievement.setUserWrapper(userWrapper);
      userAchievement.setAchievement(achievement);
      userAchievement.setCreatedOn(new Date());
      userAchievement.save();
    }
  }
View Full Code Here


    UserWrapper userWrapper = userWrapperDaoService.create("user", null);
    final Achievement achievement = referencableDaoService.create("Achivement1");
    userAchievementDaoService.addAchievementToUser(achievement, userWrapper);

    final List<Achievement> newAchievements = referencableDaoService.getUserNewAchievements(userWrapper);
    final UserAchievement userAchievement = userAchievementDaoService.get(newAchievements.get(0), userWrapper);

    assertThat(newAchievements.size(), is(1));
    assertThat(userAchievement.isNotified(), is(false));
  }
View Full Code Here

    Achievement achievement = createAchievement("Achievement", Difficulty.BRONZE);

    daoService.addAchievementToUser(achievement, userWrapper);
    entityManager.flushAll();

    UserAchievement userAchievement = daoService.get(achievement, userWrapper);
    assertNotNull(userAchievement);
    assertEquals(achievement, userAchievement.getAchievement());
    assertEquals(userWrapper, userAchievement.getUserWrapper());
  }
View Full Code Here

    entityManager.flushAll();

    final List<UserAchievement> lastEarnedAchievements = daoService.last(3);

    assertEquals(lastEarnedAchievements.size(), 3);
    final UserAchievement lastEarnedAchievement = lastEarnedAchievements.get(0);
    assertEquals(lastEarnedAchievement.getUserWrapper(), patrick);
    assertEquals(lastEarnedAchievement.getAchievement(), silverAchievement);

    final UserAchievement penultimateAchievement = lastEarnedAchievements.get(1);
    assertEquals(penultimateAchievement.getUserWrapper(), bob);
    assertEquals(penultimateAchievement.getAchievement(), bronzeAchievement1);
  }
View Full Code Here

    return achievementDaoService.all();
  }

  public UserAchievement updateNotification(int achievementId, UserWrapper userWrapper, boolean notified)
  {
    UserAchievement userAchievement = userAchievementDaoService.get(achievementId, userWrapper.getID());
    userAchievement.setNotified(notified);
    userAchievement.save();

    return userAchievement;
  }
View Full Code Here

TOP

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

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.