return group;
}
+ /**
+ *
+ * @param groupId
+ * @param userId
+ * @return
+ */
public boolean addToGroup(long groupId, long userId) {
if (!isInGroup(groupId, userId)) {
UserGroup userGroup = new UserGroup();
return false;
}
+ /**
+ *
+ * @param groupId
+ * @param userId
+ * @return
+ */
public boolean removeFromGroup(long groupId, long userId) {
Query q = em.createNamedQuery("UserGroup.findByGroupIdUserId");
q.setParameter("groupId", groupId);
return true;
}
+ /**
+ *
+ * @param groupId
+ * @param userId
+ * @return
+ */
public boolean isInGroup(long groupId, long userId) {
Query q = em.createNamedQuery("UserGroup.findByGroupIdUserId");
q.setParameter("groupId", groupId);
return user;
}
+ /**
+ *
+ * @param id
+ * @return
+ */
public User findUser(long id) {
return em.find(User.class, id);
}
+ /**
+ *
+ * @param userId
+ */
public void deleteUser(long userId) {
User user = findUser(userId);
if (user != null) {