Package org.jboss.identity.idm.common.exception

Examples of org.jboss.identity.idm.common.exception.IdentityException


      {
         hibernateObject = (HibernateIdentityObject)getHibernateSession(ctx).get(HibernateIdentityObject.class, new Long(id));
      }
      catch(Exception e)
      {
         throw new IdentityException("Cannot find IdentityObject with id: " + id, e);
      }

      return hibernateObject;
   }
View Full Code Here


         results = (List<IdentityObject>)q.list();

      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot find IdentityObjects with type '" + identityType.getName() + "'", e);
      }

      if (criteria != null && criteria.isFiltered())
      {
         filterByAttributesValues(results, criteria.getValues());
View Full Code Here


      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot find IdentityObjects", e);
      }

      if (criteria != null && criteria.isFiltered())
      {
         filterByAttributesValues(results, criteria.getValues());
View Full Code Here

      if (!getSupportedFeatures().isRelationshipTypeSupported(fromIO.getIdentityType(), toIO.getIdentityType(), relationshipType))
      {
         if (!isAllowNotDefinedIdentityObjectTypes())
         {
            throw new IdentityException("Relationship not supported. RelationshipType[ " + relationshipType.getName() + " ] " +
               "beetween: [ " + fromIO.getIdentityType().getName() + " ] and [ " + toIO.getIdentityType().getName() + " ]");
         }
      }

      org.hibernate.Query query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE_NAME)
         .setParameter("fromIO", fromIO)
         .setParameter("toIO", toIO)
         .setParameter("typeName", type.getName())
         .setParameter("name", name);

      List results = query.list();

      if (results.size() != 0)
      {
         throw new IdentityException("Relationship already present");
      }

      HibernateIdentityObjectRelationship relationship = null;

      if (name != null)
      {

         HibernateIdentityObjectRelationshipName relationshipName =
            (HibernateIdentityObjectRelationshipName)getHibernateSession(ctx).
               createCriteria(HibernateIdentityObjectRelationshipName.class).add(Restrictions.eq("name", name)).
               uniqueResult();

         if (relationshipName == null)
         {
            throw new IdentityException("Relationship name not present in the store");
         }

         relationship = new HibernateIdentityObjectRelationship(type, fromIO, toIO, relationshipName);
      }
      else
View Full Code Here

               .createCriteria(HibernateIdentityObjectRelationshipName.class).add(Restrictions.eq("name", name))
               .uniqueResult();

         if (relationshipName == null)
         {
            throw new IdentityException("Relationship name not present in the store");
         }

         query = getHibernateSession(ctx).createQuery(QUERY_RELATIONSHIP_BY_FROM_TO_TYPE_NAME)
            .setParameter("fromIO", fromIO)
            .setParameter("toIO", toIO)
            .setParameter("typeName", type.getName())
            .setParameter("name", name);
      }


      List results = query.list();

      if (results == null)
      {
         throw new IdentityException("Relationship already present");
      }

      HibernateIdentityObjectRelationship relationship = (HibernateIdentityObjectRelationship)results.iterator().next();

      fromIO.getFromRelationships().remove(relationship);
View Full Code Here

         HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createCriteria(HibernateIdentityObjectRelationshipName.class)
            .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", realm)).uniqueResult();

         if (hiorn != null)
         {
            throw new IdentityException("Relationship name already exists");
         }

         hiorn = new HibernateIdentityObjectRelationshipName(name, realm);
         getHibernateSession(ctx).persist(hiorn);

      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot create new relationship name: " + name, e);
      }


      return name;
   }
View Full Code Here

         HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createCriteria(HibernateIdentityObjectRelationshipName.class)
            .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(hibernateSession, ctx))).uniqueResult();

         if (hiorn == null)
         {
            throw new IdentityException("Relationship name doesn't exist");
         }

         getHibernateSession(ctx).delete(hiorn);

      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot create new relationship name: " + name, e);
      }


      return name;
   }
View Full Code Here

         names = new HashSet<String>(results);

      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot get relationship names. ", e);
      }

      return names;
   }
View Full Code Here

         names = new HashSet<String>(results);

      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot get relationship names. ", e);
      }

      return names;
   }
View Full Code Here

         HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)hibernateSession.createCriteria(HibernateIdentityObjectRelationshipName.class)
            .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(hibernateSession, ctx))).uniqueResult();

         if (hiorn == null)
         {
            throw new IdentityException("Relationship name doesn't exist");
         }

         return new HashMap<String, String>(hiorn.getProperties());

      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot get relationship name properties: " + name, e);
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.identity.idm.common.exception.IdentityException

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.