private void checkWhetherSynchIsNeeded(User user, Fields fields) { for (Field field : fields.getFields()) { if (field.getName().contains("goodreadsAccessTokenSecret")) { initiateGoodreadsSynch(user); } else if (field.getName().contains("fbId")) { // todo kick off fb stuff } } }
private void setUpdatedFields(User user, Fields fields) throws Exception { ObjectMapper objectMapper = new ObjectMapper(); for (Field field : fields.getFields()) { BeanUtils.setProperty(user, field.getName(), field.getValue()); } Long currentTime = System.currentTimeMillis(); String targetUserId = user.getId(); String targetUserName = objectMapper.writeValueAsString(fields); String targetUrl = null; Target target = new Target(IdType.USER_ID.toString(), targetUserName, targetUrl); Event followedUSerEvent = new Event(AuditEventType.USER_UPDATED.toString(), target, currentTime, false); auditEventDao.addEvent(targetUserId, followedUSerEvent); }