Examples of OrganizationService


Examples of org.exoplatform.services.organization.OrganizationService

   {
      if (list == null)
         list = new ArrayList<LocalPath>(5);
      if (id == null)
         return list;
      OrganizationService service = getApplicationComponent(OrganizationService.class);
      Group group = service.getGroupHandler().findGroupById(id);
      if (group == null)
         return list;
      //list.add(0, new LocalPath(group.getId(), group.getGroupName()));
      list.add(0, new LocalPath(group.getId(), group.getLabel()));
      getPath(list, group.getParentId());
View Full Code Here

Examples of org.exoplatform.services.organization.OrganizationService

   {
      public void execute(Event<UIMembershipTypeForm> event) throws Exception
      {
         UIMembershipTypeForm uiForm = event.getSource();
         UIMembershipManagement uiMembershipManagement = uiForm.getParent();
         OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
         String msTypeName = uiForm.getUIStringInput(MEMBERSHIP_TYPE_NAME).getValue();

         MembershipType mt = service.getMembershipTypeHandler().findMembershipType(msTypeName);

         if (uiForm.getMembershipTypeName() == null)
         {
            //For create new membershipType case
            if (mt != null)
            {
               UIApplication uiApp = event.getRequestContext().getUIApplication();
               uiApp.addMessage(new ApplicationMessage("UIMembershipTypeForm.msg.SameName", null));
               return;
            }
            mt = service.getMembershipTypeHandler().createMembershipTypeInstance();
            uiForm.invokeSetBindingBean(mt);
            service.getMembershipTypeHandler().createMembershipType(mt, true);
            uiMembershipManagement.addOptions(mt);
         }
         else
         {
            //For edit a membershipType case
            if (mt == null)
            {
               UIApplication uiApp = event.getRequestContext().getUIApplication();
               uiApp.addMessage(new ApplicationMessage("UIMembershipTypeForm.msg.MembershipNotExist",
                  new String[]{msTypeName}));
            }
            else
            {
               uiForm.invokeSetBindingBean(mt);
               service.getMembershipTypeHandler().saveMembershipType(mt, true);
            }
         }

         uiMembershipManagement.getChild(UIListMembershipType.class).loadData();
         uiForm.getUIStringInput(MEMBERSHIP_TYPE_NAME).setEditable(UIFormStringInput.ENABLE);
View Full Code Here

Examples of org.exoplatform.services.organization.OrganizationService

   }

   protected ListAccess<User> create(Query state) throws Exception
   {
      ExoContainer container = PortalContainer.getInstance();
      OrganizationService service = (OrganizationService)container.getComponentInstance(OrganizationService.class);
      PageList<User> pageList = service.getUserHandler().findUsers(state);
      return Safe.unwrap(pageList);
   }
View Full Code Here

Examples of org.exoplatform.services.organization.OrganizationService

   @Override
   protected ListAccess<UIMembershipType> connect() throws Exception
   {
      ExoContainer container = PortalContainer.getInstance();
      OrganizationService service = (OrganizationService)container.getComponentInstance(OrganizationService.class);
      List<MembershipType> memberships = (List<MembershipType>)service.getMembershipTypeHandler().findMembershipTypes();
     
      return new ListAccessImpl<UIMembershipType>(UIMembershipType.class, convertMembershipTypes(memberships));
   }
View Full Code Here

Examples of org.exoplatform.services.organization.OrganizationService

   public void setValue(Membership memberShip, Group selectedGroup) throws Exception
   {
      this.membershipId = memberShip.getId();
      this.groupId = selectedGroup.getId();
      getUIStringInput(USER_NAME).setValue(memberShip.getUserName());
      OrganizationService service = getApplicationComponent(OrganizationService.class);
      List<?> collection = (List<?>)service.getMembershipTypeHandler().findMembershipTypes();
      for (Object ele : collection)
      {
         MembershipType mt = (MembershipType)ele;
         SelectItemOption<String> option =
            new SelectItemOption<String>(mt.getName(), mt.getName(), mt.getDescription());
View Full Code Here

Examples of org.exoplatform.services.organization.OrganizationService

      public void execute(Event<UIGroupEditMembershipForm> event) throws Exception
      {
         UIGroupEditMembershipForm uiForm = event.getSource();
         UIApplication uiApp = event.getRequestContext().getUIApplication();
         UIPopupWindow uiPopup = uiForm.getParent();
         OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
        
         Membership formMembership =  service.getMembershipHandler().findMembership(uiForm.membershipId);
         if (formMembership == null)
         {
            uiApp.addMessage(new ApplicationMessage("UIGroupEditMembershipForm.msg.membership-delete", null));
            uiPopup.setUIComponent(null);
            uiPopup.setShow(false);
            return;
         }
         String userName = formMembership.getUserName();
         Group group = service.getGroupHandler().findGroupById(uiForm.groupId);
         User user = service.getUserHandler().findUserByName(userName);
         MembershipHandler memberShipHandler = service.getMembershipHandler();
         String memberShipTypeStr = uiForm.getUIFormSelectBox(MEMBER_SHIP).getValue();
         MembershipType membershipType = service.getMembershipTypeHandler().findMembershipType(memberShipTypeStr);
         Membership membership =
            memberShipHandler.findMembershipByUserGroupAndType(userName, group.getId(), membershipType.getName());
         if (membership != null)
         {
            uiApp.addMessage(new ApplicationMessage("UIGroupEditMembershipForm.msg.membership-exist", null));
View Full Code Here

Examples of org.exoplatform.services.organization.OrganizationService

            if (log.isDebugEnabled())
               log.debug("Conversation State found, save user profile to Conversation State.");

            if (state.getAttribute(USER_PROFILE) == null)
            {
               OrganizationService orgService =
                  (OrganizationService)getContainer().getComponentInstanceOfType(OrganizationService.class);

               begin(orgService);
               User user = orgService.getUserHandler().findUserByName(state.getIdentity().getUserId());
               end(orgService);
               state.setAttribute(USER_PROFILE, user);

            }
View Full Code Here

Examples of org.exoplatform.services.organization.OrganizationService

     * Add given user to our group with given membershipType.
     *
     * @param userId
     */
    private void addUserToPlatformUsers(String userId) throws Exception {
        OrganizationService orgService = (OrganizationService) getContainer().getComponentInstanceOfType(
                OrganizationService.class);
        try {
            begin(orgService);
            User user = orgService.getUserHandler().findUserByName(userId);
            MembershipType memberType = orgService.getMembershipTypeHandler().findMembershipType(membershipType);
            Group platformUsersGroup = orgService.getGroupHandler().findGroupById(groupId);
            orgService.getMembershipHandler().linkMembership(user, platformUsersGroup, memberType, true);
        } catch (Exception e) {
            log.error("Failed to add user " + userId + " to group " + groupId + ".", e);
            // don't rethrow login exception in case of failure.
            // throw e;
        } finally {
View Full Code Here

Examples of org.exoplatform.services.organization.OrganizationService

    @SuppressWarnings("unchecked")
    public void setUser(User user) throws Exception {
        user_ = user.getUserName();
        membership_.clear();
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        Collection<org.exoplatform.services.organization.Membership> collection = service.getMembershipHandler()
                .findMembershipsByUser(user_);
        for (org.exoplatform.services.organization.Membership membership : collection) {
            addMembership(new Membership(membership.getUserName(), membership.getId(), membership.getGroupId(),
                    membership.getMembershipType()));
        }
View Full Code Here

Examples of org.exoplatform.services.organization.OrganizationService

        public void execute(Event<UIUserMembershipSelector> event) throws Exception {
            UIUserMembershipSelector uiUserMembershipSelector = event.getSource();
            String id = event.getRequestContext().getRequestParameter(OBJECTID);
            UIPageIterator pageIterator = uiUserMembershipSelector.getChild(UIGrid.class).getUIPageIterator();
            int currentPage = pageIterator.getCurrentPage();
            OrganizationService service = uiUserMembershipSelector.getApplicationComponent(OrganizationService.class);
            service.getMembershipHandler().removeMembership(id, true);
            User user = service.getUserHandler().findUserByName(uiUserMembershipSelector.getUser());
            uiUserMembershipSelector.setUser(user);
            while (currentPage > pageIterator.getAvailablePage())
                currentPage--;
            pageIterator.setCurrentPage(currentPage);
        }
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.