Exemplo n.º 1
0
 public void delete(Session session) {
   if (getGroupRoles() != null) {
     for (GroupRole gr : getGroupRoles()) {
       gr.delete(session);
     }
   }
   if (getGroupMemberships() != null) {
     List<GroupMembership> list = new ArrayList<>(getGroupMemberships());
     for (GroupMembership gm : list) {
       gm.delete(session);
       session.flush();
     }
   }
   Organisation org = getOrganisation();
   if (org != null) {
     if (org.getGroups() != null) {
       org.getGroups().remove(this);
     }
   }
   for (GroupInWebsite giw : GroupInWebsite.findByGroup(this, session)) {
     session.delete(giw);
   }
   session.delete(this);
 }
Exemplo n.º 2
0
 /**
  * Find any GroupInWebsite records for this group. This is a fairly inefficient call, so you
  * should probably cache results if it will be called repeatedly
  *
  * @param session
  * @return
  */
 public List<GroupInWebsite> groupInWebsites(Session session) {
   return GroupInWebsite.findByGroup(this, SessionManager.session());
 }