Package org.jboss.portal.identity.db

Examples of org.jboss.portal.identity.db.HibernateRoleImpl


      HibernateUserImpl ui = (HibernateUserImpl)user;
      Set roles = ui.getRoles();
      Set copy = new HashSet();
      for (Iterator iterator = roles.iterator(); iterator.hasNext();)
      {
         HibernateRoleImpl role = (HibernateRoleImpl)iterator.next();
         copy.add(role);
      }

      return Collections.unmodifiableSet(copy);
   }
View Full Code Here


      {
         throw new IllegalArgumentException("Role is not a HibernateRoleImpl role");
      }

      // We return an immutable set to avoid modifications
      HibernateRoleImpl ri = (HibernateRoleImpl)role;
      Set users = ri.getUsers();
      Set copy = new HashSet();
      for (Iterator iterator = users.iterator(); iterator.hasNext();)
      {
         HibernateUserImpl user = (HibernateUserImpl)iterator.next();
         copy.add(user);
View Full Code Here

         {
            Session session = getCurrentSession();
            Criteria criteria = session.createCriteria(HibernateRoleImpl.class);
            criteria.add(Restrictions.naturalId().set("name", name));
            criteria.setCacheable(true);
            HibernateRoleImpl role = (HibernateRoleImpl)criteria.uniqueResult();
            if (role == null)
            {
               throw new IdentityException("No such role " + name);
            }
            return role;
View Full Code Here

      if (id instanceof Long)
      {
         try
         {
            Session session = getCurrentSession();
            HibernateRoleImpl role = (HibernateRoleImpl)session.get(HibernateRoleImpl.class, (Long)id);
            if (role == null)
            {
               throw new IdentityException("No role found for " + id);
            }
            return role;
View Full Code Here

   {
      if (name != null)
      {
         try
         {
            HibernateRoleImpl role = new HibernateRoleImpl(name, displayName);
            Session session = getCurrentSession();
            session.save(role);

            fireRoleCreatedEvent(role.getId(), role.getName());

            return role;
         }
         catch (HibernateException e)
         {
View Full Code Here

      if (id instanceof Long)
      {
         try
         {
            Session session = getCurrentSession();
            HibernateRoleImpl role = (HibernateRoleImpl)session.load(HibernateRoleImpl.class, (Long)id);
            Iterator users = role.getUsers().iterator();
            while (users.hasNext())
            {
               HibernateUserImpl user = (HibernateUserImpl)users.next();
               user.getRoles().remove(role);
            }

            String name = role.getName();

            session.delete(role);
            session.flush();

            fireRoleDestroyedEvent(id, name);
View Full Code Here

TOP

Related Classes of org.jboss.portal.identity.db.HibernateRoleImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.