@Override public Long update(JUserDetails domain) { final long userId = Long.parseLong(domain.getId()); Object userKey = profileService.getDao().getPrimaryKey(null, userId); DProfile profile = profileService.getDao().findByPrimaryKey(userId); profile.setDisplayName(domain.getDisplayName()); profile.setEmail(domain.getEmail()); profile.setPhoneNumber(domain.getPhoneNumber()); profileService.update(profile); return userId; }
@Override public JUserDetails get(String parentKeyString, Long userId) { final Object userKey = profileService.getDao().getPrimaryKey(null, userId); Map userDetails = profileService.getDao().queryByAncestorKey(userKey); if (userDetails.isEmpty()) { throw new NotFoundException(); } Iterator<Entry> entries = userDetails.entrySet().iterator(); final JUserDetails body = new JUserDetails(); Entry entry; while (entries.hasNext()) { entry = entries.next(); LOG.debug("merging {}", entry); if (entry.getValue() instanceof DProfile) { ProfileLeaf.CONVERTER.convertDomain((DProfile) entry.getValue(), body); } else if (entry.getValue() instanceof DDonation) { convertDonation((DDonation) entry.getValue(), body); } } return body; }