Examples of HibernateIdentityObject


Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

                                                               IdentityObject fromIdentity,
                                                               IdentityObject toIdentity,
                                                               IdentityObjectRelationshipType relationshipType) throws IdentityException
   {

      HibernateIdentityObject hio1 = safeGet(ctx, fromIdentity);
      HibernateIdentityObject hio2 = safeGet(ctx, toIdentity);

      org.hibernate.Query query = null;

      if (relationshipType == null)
      {
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

                                                               IdentityObjectRelationshipType type,
                                                               boolean parent,
                                                               boolean named,
                                                               String name) throws IdentityException
   {
      HibernateIdentityObject hio = safeGet(ctx, identity);


      Criteria criteria = getHibernateEntityManager(ctx).getSession().createCriteria(HibernateIdentityObjectRelationship.class);

      if (type != null)
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

   public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException
   {

      Set<String> names;

      HibernateIdentityObject hibernateObject = safeGet(ctx, identity);

      HibernateEntityManager em = getHibernateEntityManager(ctx);

      checkControls(controls);
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

   }

   public IdentityObjectAttribute getAttribute(IdentityStoreInvocationContext ctx, IdentityObject identity, String name) throws IdentityException
   {
      HibernateIdentityObject hibernateObject = safeGet(ctx, identity);

      Set<HibernateIdentityObjectAttribute> storeAttributes =  hibernateObject.getAttributes();
      Map<String, IdentityObjectAttribute> result = new HashMap<String, IdentityObjectAttribute>();

      // Remap the names
      for (HibernateIdentityObjectAttribute attribute : storeAttributes)
      {
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

   }

   public Map<String, IdentityObjectAttribute> getAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity) throws IdentityException
   {

      HibernateIdentityObject hibernateObject = safeGet(ctx, identity);

      Set<HibernateIdentityObjectAttribute> storeAttributes =  hibernateObject.getAttributes();
      Map<String, IdentityObjectAttribute> result = new HashMap<String, IdentityObjectAttribute>();
     
      // Remap the names
      for (HibernateIdentityObjectAttribute attribute : storeAttributes)
      {
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

            }
         }
      }


      HibernateIdentityObject hibernateObject = safeGet(ctx, identity);

      for (String name : mappedAttributes.keySet())
      {
         IdentityObjectAttribute attribute = mappedAttributes.get(name);

         IdentityObjectAttributeMetaData amd = mdMap.get(attribute.getName());

         // Default to text
         String type = amd != null ? amd.getType() : IdentityObjectAttributeMetaData.TEXT_TYPE;

         for (HibernateIdentityObjectAttribute storeAttribute : hibernateObject.getAttributes())
         {
            if (storeAttribute.getName().equals(name))
            {
               if (storeAttribute instanceof HibernateIdentityObjectTextAttribute)
               {
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

               }
            }
         }
      }

      HibernateIdentityObject hibernateObject = safeGet(ctx, identity);

      for (String name : mappedAttributes.keySet())
      {
         IdentityObjectAttribute attribute = mappedAttributes.get(name);

         IdentityObjectAttributeMetaData amd = mdMap.get(attribute.getName());

         // Default to text
         String type = amd != null ? amd.getType() : IdentityObjectAttributeMetaData.TEXT_TYPE;

         HibernateIdentityObjectAttribute hibernateAttribute = null;

         for (HibernateIdentityObjectAttribute storeAttribute : hibernateObject.getAttributes())
         {
            if (storeAttribute.getName().equals(name))
            {
               hibernateAttribute = storeAttribute;
               break;
            }
         }

         if (hibernateAttribute != null)
         {
            if (hibernateAttribute instanceof HibernateIdentityObjectTextAttribute)
               {
                  if (!type.equals(IdentityObjectAttributeMetaData.TEXT_TYPE))
                  {
                     throw new IdentityException("Wrong attribute mapping. Attribute persisted as text is mapped with: "
                     + type + ". Attribute name: " + name);
                  }


                  Set<String> mergedValues = new HashSet<String>(hibernateAttribute.getValues());
                  for (Object value : attribute.getValues())
                  {
                     mergedValues.add(value.toString());
                  }

                  ((HibernateIdentityObjectTextAttribute)hibernateAttribute).setValues(mergedValues);
               }
               else if (hibernateAttribute instanceof HibernateIdentityObjectBinaryAttribute)
               {

                  if (!type.equals(IdentityObjectAttributeMetaData.BINARY_TYPE))
                  {
                     throw new IdentityException("Wrong attribute mapping. Attribute persisted as binary is mapped with: "
                     + type + ". Attribute name: " + name);
                  }

                  Set<byte[]> mergedValues = new HashSet<byte[]>(hibernateAttribute.getValues());
                  for (Object value : attribute.getValues())
                  {
                     mergedValues.add((byte[])value);
                  }

                  ((HibernateIdentityObjectBinaryAttribute)hibernateAttribute).setValues(mergedValues);
               }
               else
               {
                  throw new IdentityException("Internal identity store error");
               }
               break;

         }
         else
         {
            if (type.equals(IdentityObjectAttributeMetaData.TEXT_TYPE))
            {
               Set<String> values = new HashSet<String>();

               for (Object value: attribute.getValues())
               {
                  values.add(value.toString());
               }
               hibernateAttribute = new HibernateIdentityObjectTextAttribute(hibernateObject, name, values);
            }
            else if (type.equals(IdentityObjectAttributeMetaData.BINARY_TYPE))
            {
               Set<byte[]> values = new HashSet<byte[]>();

               for (Object value: attribute.getValues())
               {
                  values.add((byte[])value);
               }
               hibernateAttribute = new HibernateIdentityObjectBinaryAttribute(hibernateObject, name, values);
            }


            hibernateObject.getAttributes().add(hibernateAttribute);

         }
      }
   }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

            }
         }

      }

      HibernateIdentityObject hibernateObject = safeGet(ctx, identity);

      for (String attr : mappedAttributes)
      {
         hibernateObject.removeAttribute(attr);
      }
   }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

      if (credential == null)
      {
         throw new IllegalArgumentException();
      }

      HibernateIdentityObject hibernateObject = safeGet(ctx, identityObject);

      if (supportedFeatures.isCredentialSupported(hibernateObject.getIdentityType(),credential.getType()))
      {

         HibernateIdentityObjectCredential hibernateCredential = hibernateObject.getCredentials().get(credential.getType().getName());

         if (hibernateCredential == null)
         {
            return false;
         }
View Full Code Here

Examples of org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject

      if (credential == null)
      {
         throw new IllegalArgumentException();
      }

      HibernateIdentityObject hibernateObject = safeGet(ctx, identityObject);

      HibernateEntityManager em = getHibernateEntityManager(ctx);

      if (supportedFeatures.isCredentialSupported(hibernateObject.getIdentityType(),credential.getType()))
      {

         HibernateIdentityObjectCredentialType hibernateCredentialType = getHibernateIdentityObjectCredentialType(ctx, credential.getType());

         if (hibernateCredentialType == null)
         {
            throw new IllegalStateException("Credential type not present in this store: " + credential.getType().getName());
         }

         HibernateIdentityObjectCredential hibernateCredential = new HibernateIdentityObjectCredential();
         hibernateCredential.setIdentityObject(hibernateObject);
         hibernateCredential.setType(hibernateCredentialType);

         Object value = null;

         // Handle generic impl

         if (credential.getEncodedValue() != null)
         {
            value = credential.getEncodedValue();
         }
         else
         {
            //TODO: support for empty password should be configurable
            value = credential.getValue();
         }

         if (value instanceof String)
         {
            hibernateCredential.setTextValue(value.toString());
         }
         else if (value instanceof byte[])
         {
            hibernateCredential.setBinaryValue((byte[])value);
         }
         else
         {
            throw new IdentityException("Not supported credential value: " + value.getClass());
         }

         em.persist(hibernateCredential);

         hibernateObject.addCredential(hibernateCredential);

      }
      else
      {
         throw new IdentityException("CredentialType not supported for a given IdentityObjectType");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.