private synchronized void addToAllUsers(User user) throws RepositoryException {
if (!initialised) {
init();
}
Session session = repositoryManager.getSession();
UserInfo userInfo = user.getUserInfo();
Node userNode;
Node allUsers = (Node)session.getItem("/" + USER_STORE + "/" + ALL_USERS);
if (allUsers != null) {
if (allUsers.hasNode(JCREncoder.toJCRFormat(user.getUserId()))) {
userNode = allUsers.getNode(JCREncoder.toJCRFormat(user.getUserId()));
} else {
userNode = allUsers.addNode(JCREncoder.toJCRFormat(user.getUserId()));
}
userNode.setProperty(USER_DISPLAY_NAME, JCREncoder.toJCRFormat(userInfo.getDisplayName()));
userNode.setProperty(USER_EMAIL, JCREncoder.toJCRFormat(userInfo.getEmail()));
userNode.setProperty(USER_REAL_NAME, JCREncoder.toJCRFormat(userInfo.getRealName()));
userNode.setProperty(USER_WEBSITE, JCREncoder.toJCRFormat(userInfo.getWebsite()));
userNode.setProperty(USER_ID, JCREncoder.toJCRFormat(user.getUserId()));
}
session.save();
}