@Test public void testPgetUserDetails() { _dbInjecter.injectTreeType("wood", "desc", 0.5); _dbInjecter.injectProject("Project", "Adam", "very n1 project", true, 0, 0); _dbInjecter.injectProjectArticle("wood", "Project", 3.0); _dbInjecter.injectTreeToProject("wood", userName, 1, 900000L, "Project"); _dbInjecter.injectTreeToProject("wood", "Adam", 2, 900000L, "Project"); UserReportData userData = _userService.getUserDetails(userName, true); assertEquals(userName, userData.getUserName()); assertEquals(2, userData.getRank()); assertEquals(1L, userData.getCo2Data().getTreesCount().longValue()); assertEquals("aboutme", userData.getAboutMe()); assertEquals("location", userData.getLocation()); assertEquals("organisation", userData.getOrganisation()); assertEquals("homepage", userData.getHomepage()); assertEquals("edited_user@iplantatree.de", userData.getMail()); assertEquals("JA", userData.getNewsletter()); assertEquals(OrganizationType.COMMERCIAL, userData.getOrganizationType()); assertEquals(Language.ENGLISH, userData.getLang()); }
public UserReportData getUserDetails(String userName, boolean isEditAllowed) { UserReportData userReportData = userRepository.getUserDetails(userName); if (null != userReportData) { userReportData.setCo2Data(co2Repository.getAllTreesAndCo2SavingForUserName(System.currentTimeMillis(), userReportData.getUserName())); userReportData.setRank(calcUserRank(userReportData.getUserName(), userReportData.getCo2Data().getTreesCount())); userReportData.setEditAllowed(isEditAllowed); } return userReportData; }
UserService { public UserReportData getUserDetails(String userName, boolean isEditAllowed) { UserReportData userReportData = userRepository.getUserDetails(userName); if (null != userReportData) { userReportData.setCo2Data(co2Repository.getAllTreesAndCo2SavingForUserName(System.currentTimeMillis(), userReportData.getUserName())); userReportData.setRank(calcUserRank(userReportData.getUserName(), userReportData.getCo2Data().getTreesCount())); userReportData.setEditAllowed(isEditAllowed); } return userReportData; } }
UserService { public UserReportData getUserDetails(String userName, boolean isEditAllowed) { UserReportData userReportData = userRepository.getUserDetails(userName); if (null != userReportData) { userReportData.setCo2Data(co2Repository.getAllTreesAndCo2SavingForUserName(System.currentTimeMillis(), userReportData.getUserName())); userReportData.setRank(calcUserRank(userReportData.getUserName(), userReportData.getCo2Data().getTreesCount())); userReportData.setEditAllowed(isEditAllowed); } return userReportData; }  }
UserService { public UserReportData getUserDetails(String userName, boolean isEditAllowed) { UserReportData userReportData = userRepository.getUserDetails(userName); if (null != userReportData) { userReportData.setCo2Data(co2Repository.getAllTreesAndCo2SavingForUserName(System.currentTimeMillis(), userReportData.getUserName())); userReportData.setRank(calcUserRank(userReportData.getUserName(), userReportData.getCo2Data().getTreesCount())); userReportData.setEditAllowed(isEditAllowed); } return userReportData; }  User createAnonymous(); UserReportData getUserDetails(String userName, boolean isEditAllowed); void editUser(String userName, String toEdit, String newEntry); String uploadUserImage(String userName, MultipartFile file); void registrateUser(UserRegistrationData userRegistrationData); void activateUser(long userId, String key); void createPasswordResetMail(String userName); String verifiyPasswordResetLink(long userId, String key); String resetPasswordForUser(long userId, String key, String password); User anonymizeUser(String userName); }
UserService { public UserReportData getUserDetails(String userName, boolean isEditAllowed) { UserReportData userReportData = userRepository.getUserDetails(userName); if (null != userReportData) { userReportData.setCo2Data(co2Repository.getAllTreesAndCo2SavingForUserName(System.currentTimeMillis(), userReportData.getUserName())); userReportData.setRank(calcUserRank(userReportData.getUserName(), userReportData.getCo2Data().getTreesCount())); userReportData.setEditAllowed(isEditAllowed); } return userReportData; }  User createAnonymous(); UserReportData getUserDetails(String userName, boolean isEditAllowed); void editUser(String userName, String toEdit, String newEntry); String uploadUserImage(String userName, MultipartFile file); void registrateUser(UserRegistrationData userRegistrationData); void activateUser(long userId, String key); void createPasswordResetMail(String userName); String verifiyPasswordResetLink(long userId, String key); String resetPasswordForUser(long userId, String key, String password); User anonymizeUser(String userName);  }