Package org.exoplatform.services.organization

Examples of org.exoplatform.services.organization.UserProfile


      OrganizationService orgService = getApplicationComponent(OrganizationService.class);
      LocaleConfig localeConfig = localeConfigService.getLocaleConfig(userPortalConfig_.getPortalConfig().getLocale());
      String user = context.getRemoteUser();
      if (user != null)
      {
         UserProfile userProfile = orgService.getUserProfileHandler().findUserProfileByName(user);
         if (userProfile != null)
         {
            portalLanguage = userProfile.getUserInfoMap().get("user.language");
         }
         else
         {
            if (log.isWarnEnabled())
               log.warn("Could not load user profile for " + user + ". Using default portal locale.");
View Full Code Here


        if (preferencesPortletContext == null) {
            return null;
        }

        // get the user profile cached in the prc during the start of the request
        UserProfile userProfile = (UserProfile) prc.getAttribute(UserProfileLifecycle.USER_PROFILE_ATTRIBUTE_NAME);

        // client context
        AbstractClientContext clientContext;
        Cookie[] cookies = servletRequest.getCookies();
        if (cookies != null) {
View Full Code Here

    @SuppressWarnings("deprecation")
    public void setUserProfile(String user) throws Exception {
        if (user == null)
            return;
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        UserProfile userProfile = service.getUserProfileHandler().findUserProfileByName(user);
        if (userProfile == null) {
            userProfile = service.getUserProfileHandler().createUserProfileInstance();
            userProfile.setUserName(user);
        }

        if (userProfile.getUserInfoMap() == null)
            return;
        for (UIComponent set : getChildren()) {
            UIFormInputSet inputSet = (UIFormInputSet) set;
            for (UIComponent uiComp : inputSet.getChildren()) {
                UIFormStringInput uiInput = (UIFormStringInput) uiComp;
                uiInput.setValue(userProfile.getAttribute(uiInput.getName()));
            }
        }
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    public void save(OrganizationService service, String user, boolean isnewUser) throws Exception {

        UserProfileHandler hanlder = service.getUserProfileHandler();
        UserProfile userProfile = hanlder.findUserProfileByName(user);

        if (userProfile == null) {
            userProfile = hanlder.createUserProfileInstance();
            userProfile.setUserName(user);
        }

        for (UIComponent set : getChildren()) {
            UIFormInputSet inputSet = (UIFormInputSet) set;
            for (UIComponent uiComp : inputSet.getChildren()) {
                UIFormStringInput uiInput = (UIFormStringInput) uiComp;
                // if(uiInput.getValue() == null || uiInput.getValue().length() < 1)
                // continue;
                userProfile.getUserInfoMap().put(uiInput.getName(), uiInput.getValue());
            }
        }

        hanlder.saveUserProfile(userProfile, true);
View Full Code Here

   public void postSave(User user, boolean isNew) throws Exception
   {
      ExoContainer pcontainer = ExoContainerContext.getCurrentContainer();
      OrganizationService service =
         (OrganizationService)pcontainer.getComponentInstanceOfType(OrganizationService.class);
      UserProfile up = service.getUserProfileHandler().createUserProfileInstance();
      up.setUserName(user.getUserName());
      service.getUserProfileHandler().saveUserProfile(up, false);
      if (config_ == null)
         return;
      if (isNew && !config_.isIgnoreUser(user.getUserName()))
      {
View Full Code Here

   /**
    * Create user with profile.
    */
   protected void createUserProfile(String userName) throws Exception
   {
      UserProfile up = upHandler.createUserProfileInstance(userName);
      up.setAttribute("key1", "value1");
      up.setAttribute("key2", "value2");
      upHandler.saveUserProfile(up, true);
   }
View Full Code Here

   /**
    * {@inheritDoc}
    */
   public UserProfile findUserProfileByName(String userName) throws Exception
   {
      UserProfile profile = getFromCache(userName);
      if (profile != null)
      {
         return profile;
      }

View Full Code Here

            catch (PathNotFoundException e)
            {
               continue;
            }

            UserProfile profile = readProfile(userName, profileNode);
            if (profile != null)
            {
               profiles.add(profile);
            }
         }
View Full Code Here

      catch (PathNotFoundException e)
      {
         return null;
      }

      UserProfile profile = readProfile(userName, profileNode);

      if (broadcast)
      {
         preDelete(profile, broadcast);
      }
View Full Code Here

    * @param oldUserNode
    *         the node where user properties are stored (from old structure)
    */
   void migrateProfile(Node oldUserNode) throws Exception
   {
      UserProfile userProfile = new UserProfileImpl(oldUserNode.getName());

      Node attrNode = null;
      try
      {
         attrNode = oldUserNode.getNode(JCROrganizationServiceImpl.JOS_PROFILE + "/" + MigrationTool.JOS_ATTRIBUTES);
      }
      catch (PathNotFoundException e)
      {
         return;
      }
      PropertyIterator props = attrNode.getProperties();

      while (props.hasNext())
      {
         Property prop = props.nextProperty();

         // ignore system properties
         if (!(prop.getName()).startsWith("jcr:") && !(prop.getName()).startsWith("exo:")
            && !(prop.getName()).startsWith("jos:"))
         {
            userProfile.setAttribute(prop.getName(), prop.getString());
         }
      }

      if (findUserProfileByName(userProfile.getUserName()) != null)
      {
         removeUserProfile(userProfile.getUserName(), false);
      }

      saveUserProfile(userProfile, false);
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.organization.UserProfile

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.