Package org.jboss.portal.identity.info

Examples of org.jboss.portal.identity.info.PropertyInfo


         throw new IllegalArgumentException("Property name need to have value");
      }

      HibernateUserImpl dbUser = processUser(user);

      PropertyInfo pi = getProfileInfo().getPropertyInfo(propertyName);

      if (pi == null)
      {
         throw new IdentityException("Cannot find profile information about property: " + propertyName);
      }
View Full Code Here


      }

      HibernateUserImpl dbUser = processUser(user);


      PropertyInfo pi = getProfileInfo().getPropertyInfo(propertyName);

      if (pi == null)
      {
         throw new IdentityException("Cannot find profile information about property: " + propertyName);
      }
      else if (!pi.getAccessMode().equals(PropertyInfo.ACCESS_MODE_READ_WRITE))
      {
         throw new IdentityException("Property is not allowed for write access: " + propertyName);
      }

      if (propertyValue != null && !pi.getType().equals(propertyValue.getClass().getName()))
      {
         throw new IdentityException("Wrong property type. Must be: " + pi.getType() + "; and found: " + propertyValue.getClass().getName());
      }

      //if value is null reset property

      if (propertyValue != null)
View Full Code Here

   public Object getProperty(User user, String propertyName) throws IdentityException, IllegalArgumentException
   {
      if (log.isDebugEnabled()) log.debug("getProperty: " + propertyName);
      try
      {
         PropertyInfo property = getProfileInfo().getPropertyInfo(propertyName);
         if (property == null)
         {
            throw new IdentityException("Such property name is not supported: " + propertyName);
         }

         if (user instanceof CachedUserImpl)
         {
            user = obtainUser(user);
         }

         if (property.isMappedLDAP() && isLDAPSupported() && user instanceof LDAPUserImpl)
         {
            log.debug("Delegating to LDAP module");

            return getLDAPModule().getProperty(user, propertyName);
         }
         else if (property.isMappedDB())
         {
            log.debug("Delegating to DB module");
            return getDBModule().getProperty(user, propertyName);
         }
         throw new IdentityException("Cannot process property - incorrect profile or module configuration");
View Full Code Here

   public void setProperty(User user, String name, Object propertyValue) throws IdentityException, IllegalArgumentException
   {
      if (log.isDebugEnabled()) log.debug("setProperty: " + name + "/" + propertyValue);
      try
      {
         PropertyInfo property = getProfileInfo().getPropertyInfo(name);
         if (property == null)
         {
            throw new IdentityException("Such property name is not supported: " + name);
         }

         if (user instanceof CachedUserImpl)
         {
            user = obtainUser(user);
         }

         if (property.isMappedLDAP() && isLDAPSupported() && user instanceof LDAPUserImpl)
         {
            log.debug("Delegating to LDAP module");
            getLDAPModule().setProperty(user, name, propertyValue);
            return;
         }
         else if (property.isMappedDB())
         {
            log.debug("Delegating to DB module");

            getDBModule().setProperty(user, name, propertyValue);
            fireUserProfileChangedEvent(user.getId(), user.getUserName(), name, propertyValue);
View Full Code Here

         {
            throw new IdentityException("Failed to close LDAP connection", e);
         }
      }

      PropertyInfo pi = getProfileInfo().getPropertyInfo(propertyName);


      if (propertyValue != null && !pi.getType().equals(propertyValue.getClass().getName()))
      {
         log.error("Error on processing property:" + propertyName);
         log.error("Wrong property type retreived from LDAP. Should be: " + pi.getType() + "; and found: " + propertyValue.getClass().getName());
      }

      return propertyValue;

   }
View Full Code Here

         throw new IllegalArgumentException("This UserProfileModule implementation support only LDAPUserImpl objects");
      }

      String attributeName = resolveAttributeName(propertyName);

      PropertyInfo pi = getProfileInfo().getPropertyInfo(propertyName);

      if (pi.getAccessMode().equals(PropertyInfo.ACCESS_MODE_READ_ONLY))
      {
         throw new IdentityException("Property has read only access - cannot set: " + propertyName);
      }

      if (property != null && !pi.getType().equals(property.getClass().getName()))
      {
         throw new IdentityException("Wrong property type. Must be: " + pi.getType() + "; and found: " + property.getClass().getName());
      }


      //TODO: check the type and log.info that this can only be a String if not such
      //String propertyValue = property.toString();
View Full Code Here

            Attribute attr = attrs.get(attrName);

            if (attr != null)
            {
               propertyMap.put(name,attr.get());
               PropertyInfo pi = getProfileInfo().getPropertyInfo(name);
               if (attr.get() != null && !pi.getType().equals(attr.get().getClass().getName()))
               {
                  log.error("Error on processing property:" + name);
                  log.error("Wrong property type retreived from LDAP. Should be: " + pi.getType() + "; and found: " + attr.get().getClass().getName());
               }
            }
            else
            {
               log.error("No such attribute ('" + attrName + "') in entry: " + ldapUser.getDn());
View Full Code Here

   private String resolveAttributeName(String propertyName) throws IdentityException
   {
      //return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_USER_PROFILE_MAPPINGS, propertyName);

      PropertyInfo pi = getProfileInfo().getPropertyInfo(propertyName);

      if (pi == null)
      {
         throw new IdentityException("Cannot find profile information about property: " + propertyName);
      }

      String mapping = pi.getMappingLDAPValue();
      if (mapping == null)
      {
         throw new IdentityException("This property is not mapped as LDAP attribute: " + propertyName);
      }
      return mapping;
View Full Code Here

      Map mappings = new HashMap();
      for (Iterator iterator = keys.iterator(); iterator.hasNext();)
      {
         String key = (String)iterator.next();
         PropertyInfo prop = (PropertyInfo)infos.get(key);
         if (prop.isMappedLDAP())
         {
            mappings.put(prop.getName(), prop.getMappingLDAPValue());
         }
      }
      return mappings;
   }
View Full Code Here

         Map meta = profile.getProperties();
         for (Iterator iterator = meta.keySet().iterator(); iterator.hasNext();)
         {
            String name = (String)iterator.next();
            PropertyMetaData property = (PropertyMetaData)meta.get(name);
            PropertyInfo pi = new PropertyInfoSupport(property);
            properties.put(pi.getName(), pi);
         }
      }
      catch (IdentityException e)
      {
         throw new IdentityException("PrifileInfo creation error: ", e);
View Full Code Here

TOP

Related Classes of org.jboss.portal.identity.info.PropertyInfo

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.