Package org.exoplatform.services.organization

Examples of org.exoplatform.services.organization.OrganizationService


   {
      public void execute(Event<UIListUsers> event) throws Exception
      {
         String username = event.getRequestContext().getRequestParameter(OBJECTID);
         UIListUsers uiListUsers = event.getSource();
         OrganizationService service = uiListUsers.getApplicationComponent(OrganizationService.class);
         if (service.getUserHandler().findUserByName(username) == null)
         {
            uiListUsers.search(new Query());
            return;
         }
         uiListUsers.setRendered(false);
View Full Code Here


   {
      public void execute(Event<UIListUsers> event) throws Exception
      {
         UIListUsers uiListUser = event.getSource();
         String userName = event.getRequestContext().getRequestParameter(OBJECTID);
         OrganizationService service = uiListUser.getApplicationComponent(OrganizationService.class);
         UserACL userACL = uiListUser.getApplicationComponent(UserACL.class);
         if (userACL.getSuperUser().equals(userName))
         {
            UIApplication uiApp = event.getRequestContext().getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIListUsers.msg.DeleteSuperUser", new String[]{userName},
               ApplicationMessage.WARNING));
            return;
         }
         UIPageIterator pageIterator = uiListUser.getChild(UIGrid.class).getUIPageIterator();
         int currentPage = pageIterator.getCurrentPage();
         service.getUserHandler().removeUser(userName, true);
         uiListUser.search(uiListUser.lastQuery_);
         while (currentPage > pageIterator.getAvailablePage())
            currentPage--;
         pageIterator.setCurrentPage(currentPage);
         UIComponent uiToUpdateAjax = uiListUser.getAncestorOfType(UIUserManagement.class);
View Full Code Here

         if (groupForm.getGroupId() != null)
         {
            uiApp.addMessage(new ApplicationMessage("UIGroupManagement.msg.Delete", null));
            return;
         }
         OrganizationService service = uiGroupManagement.getApplicationComponent(OrganizationService.class);
         UserACL acl = uiGroupManagement.getApplicationComponent(UserACL.class);
         List<String> mandatories = acl.getMandatoryGroups();
         if (!mandatories.isEmpty() && isMandatory(service.getGroupHandler(), currentGroup, mandatories))
         {
            uiApp.addMessage(new ApplicationMessage("UIGroupManagement.msg.DeleteMandatory", null));
            return;
         }
         String parentId = currentGroup.getParentId();
         service.getGroupHandler().removeGroup(currentGroup, true);
         uiGroupExplorer.changeGroup(parentId);
      }
View Full Code Here

      public void execute(Event<UIListMembershipType> event) throws Exception
      {
         UIListMembershipType uiMembership = event.getSource();
         String name = event.getRequestContext().getRequestParameter(OBJECTID);

         OrganizationService service = uiMembership.getApplicationComponent(OrganizationService.class);
         MembershipType mt = service.getMembershipTypeHandler().findMembershipType(name);
         if(mt.getDescription()==null)
         {
            mt.setDescription("");
         }
         UIMembershipManagement uiMembershipManager = uiMembership.getParent();
View Full Code Here

            UIApplication uiApp = event.getRequestContext().getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIMembershipList.msg.DeleteMandatory", null));
            return;
         }

         OrganizationService service = uiMembership.getApplicationComponent(OrganizationService.class);
         MembershipType membershipType = service.getMembershipTypeHandler().findMembershipType(name);
         UIPageIterator pageIterator = uiMembership.getChild(UIGrid.class).getUIPageIterator();
         int currentPage = -1;
         if (membershipType != null)
         {
            currentPage = pageIterator.getCurrentPage();
            service.getMembershipTypeHandler().removeMembershipType(name, true);
            membership.deleteOptions(membershipType);
         }
         uiMembership.loadData();
         if (currentPage >= 0)
         {
View Full Code Here

   @Override
   protected ListAccess<Membership> create(String state) throws Exception
   {
      ExoContainer container = PortalContainer.getInstance();
      OrganizationService service = (OrganizationService)container.getComponentInstance(OrganizationService.class);
      MembershipHandler handler = service.getMembershipHandler();
      Group group = service.getGroupHandler().findGroupById(state);
      List<Membership> memberships = (List<Membership>)handler.findMembershipsByGroup(group);
      return new ListAccessImpl<Membership>(Membership.class, memberships);
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   public UIGroupExplorer() throws Exception
   {
      UITree tree = addChild(UITree.class, null, "TreeGroupExplorer");
      OrganizationService service = getApplicationComponent(OrganizationService.class);
      sibblingsGroup_ = service.getGroupHandler().findGroups(null);

      //  if not administrator
      if (!GroupManagement.isAdministrator(null))
         sibblingsGroup_ = GroupManagement.getRelatedGroups(null, sibblingsGroup_);
View Full Code Here

   }

   @SuppressWarnings("unchecked")
   public void changeGroup(String groupId) throws Exception
   {
      OrganizationService service = getApplicationComponent(OrganizationService.class);

      UIGroupManagement uiGroupManagement = this.getParent();
      UIBreadcumbs uiBreadcumb = uiGroupManagement.getChild(UIBreadcumbs.class);
      uiBreadcumb.setPath(getPath(null, groupId));

      UITree uiTree = getChild(UITree.class);
      UIGroupDetail uiGroupDetail = uiGroupManagement.getChild(UIGroupDetail.class);
      UIGroupInfo uiGroupInfo = uiGroupDetail.getChild(UIGroupInfo.class);

      if (groupId == null)
      {
         sibblingsGroup_ = service.getGroupHandler().findGroups(null);
         //    if not administrator
         if (!GroupManagement.isAdministrator(null))
            sibblingsGroup_ = GroupManagement.getRelatedGroups(null, sibblingsGroup_);
         uiTree.setSibbling((List)convertGroups(sibblingsGroup_));
         uiTree.setSelected(null);
         uiTree.setChildren(null);
         uiTree.setParentSelected(null);
         selectedGroup_ = null;
         uiGroupInfo.setGroup(null);
         return;
      }

      if (groupId != null)
      {
         selectedGroup_ = service.getGroupHandler().findGroupById(groupId);
      }
      else
      {
         selectedGroup_ = null;
      }

      String parentGroupId = null;
      if (selectedGroup_ != null)
         parentGroupId = selectedGroup_.getParentId();
      Group parentGroup = null;
      if (parentGroupId != null)
         parentGroup = service.getGroupHandler().findGroupById(parentGroupId);
      childrenGroup_ = service.getGroupHandler().findGroups(selectedGroup_);
      sibblingsGroup_ = service.getGroupHandler().findGroups(parentGroup);

      // if not administrator
      if (!GroupManagement.isAdministrator(null))
      {
         childrenGroup_ = GroupManagement.getRelatedGroups(null, childrenGroup_);
View Full Code Here

   {
      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

   {
      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

TOP

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

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.