Package org.exoplatform.services.organization

Examples of org.exoplatform.services.organization.GroupHandler


      super.tearDown();
   }

   public void testFindGroups() throws Exception
   {
      GroupHandler handler = organizationService.getGroupHandler();
      Collection allGroups = handler.findGroups(null);
      assertTrue(allGroups.size() > 0);
   }
View Full Code Here


      assertTrue(allGroups.size() > 0);
   }

   public void testFindGroupById() throws Exception
   {
      GroupHandler uHandler = organizationService.getGroupHandler();
      Collection group = uHandler.findGroupsOfUser("root");
   }
View Full Code Here

         {
            String groupName = "groupTest";
            assertNull(storage_.getPortalConfig(PortalConfig.GROUP_TYPE, groupName));

            //
            GroupHandler groupHandler = orgService_.getGroupHandler();
            Group group = groupHandler.createGroupInstance();
            group.setGroupName(groupName);
            group.setDescription("this is a group for test");
            groupHandler.addChild(null, group, true);

            //
            PortalConfig cfg = storage_.getPortalConfig(PortalConfig.GROUP_TYPE, "/" + groupName);
            assertNotNull(cfg);
            Container container = cfg.getPortalLayout();
            assertNotNull(container);
            assertEquals(4, container.getChildren().size());
            assertTrue(container.getChildren().get(2) instanceof PageBody);
            assertTrue(((Application)container.getChildren().get(1)).getType() == ApplicationType.PORTLET);
           
            groupHandler.removeGroup(group, true);
         }
      }.execute(null);
   }
View Full Code Here

      assertNotNull("The User layout of " + pConfig.getName() + " is null", pConfig.getPortalLayout());
   }

   public void testGroupLayout() throws Exception
   {
      GroupHandler groupHandler = org.getGroupHandler();
      Group group = groupHandler.findGroupById("groupTest");
      assertNull(group);

      group = groupHandler.createGroupInstance();
      group.setGroupName("groupTest");
      group.setLabel("group label");

      groupHandler.addChild(null, group, true);

      group = groupHandler.findGroupById("/groupTest");
      assertNotNull(group);

      PortalConfig pConfig = storage.getPortalConfig(PortalConfig.GROUP_TYPE, "/groupTest");
      assertNotNull("the Group's PortalConfig is not null", pConfig);
      assertTrue(pConfig.getPortalLayout().getChildren() == null || pConfig.getPortalLayout().getChildren().size() == 4);
     
      /**
       * We need to remove the /groupTest from the groupHandler as the
       * handler is shared between the tests and can cause other tests
       * to fail.
       * TODO: make the tests fully independent
       */
      groupHandler.removeGroup(group, false);
      group = groupHandler.findGroupById("/groupTest");
      assertNull(group);
   }
View Full Code Here

    public void setUIInputValue(Object input) {
        user_ = (String) input;
    }

    public void save(OrganizationService service, boolean broadcast) throws Exception {
        GroupHandler groupHandler = service.getGroupHandler();
        MembershipTypeHandler mtHandler = service.getMembershipTypeHandler();
        User user = service.getUserHandler().findUserByName(user_);
        for (Membership membership : membership_) {
            if (user == null)
                user = service.getUserHandler().findUserByName(membership.getUserName());
            Group group = groupHandler.findGroupById(membership.getGroupId());
            MembershipType mt = mtHandler.findMembershipType(membership.getMembershipType());
            if (service.getMembershipHandler() != null) {
                service.getMembershipHandler().linkMembership(user, group, mt, broadcast);
            }
        }
View Full Code Here

      }
   }

   private void removeGroupNavigation(Group group, DataStorage dataService) throws Exception
   {
      GroupHandler groupHandler = orgService.getGroupHandler();
      Collection<String> descendantGroups = getDescendantGroups(group, groupHandler);
      PageNavigation navigation = null;
      for (String childGroup : descendantGroups)
      {
         navigation = dataService.getPageNavigation(PortalConfig.GROUP_TYPE, childGroup);
View Full Code Here

            RequestLifeCycle.end();
        }
    }

    private void removeGroupNavigation(Group group) throws Exception {
        GroupHandler groupHandler = orgService.getGroupHandler();
        Collection<String> descendantGroups = getDescendantGroups(group, groupHandler);
        Collection<String> deletedNavigationGroups = new ArrayList<String>();
        deletedNavigationGroups.addAll(descendantGroups);
        deletedNavigationGroups.add(group.getId());
        for (String childGroup : deletedNavigationGroups) {
View Full Code Here

            } else {
                currentGroupId = null;
            }
            String groupName = "/" + uiGroupForm.getUIStringInput(GROUP_NAME).getValue();

            GroupHandler groupHandler = service.getGroupHandler();

            if (currentGroupId != null) {
                groupName = currentGroupId + groupName;
            }

            Group newGroup = groupHandler.findGroupById(groupName);
            if (newGroup != null) {
                Object[] args = { groupName };
                UIApplication uiApp = event.getRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIGroupForm.msg.group-exist", args));
                return;
            }
            newGroup = groupHandler.createGroupInstance();
            uiGroupForm.invokeSetBindingBean(newGroup);
            if (newGroup.getLabel() == null || newGroup.getLabel().trim().length() == 0) {
                newGroup.setLabel(newGroup.getGroupName());
            }
            String changeGroupId;
            if (currentGroupId == null) {
                groupHandler.addChild(null, newGroup, true);
                // uiGroupExplorer.changeGroup(groupName) ;
                changeGroupId = groupName;
            } else {
                Group parrentGroup = groupHandler.findGroupById(currentGroupId);
                groupHandler.addChild(parrentGroup, newGroup, true);
                // uiGroupExplorer.changeGroup(currentGroupId) ;
                changeGroupId = currentGroupId;
            }

            // change group
View Full Code Here

         {
            currentGroupId = null;
         }
         String groupName = "/" + uiGroupForm.getUIStringInput(GROUP_NAME).getValue();

         GroupHandler groupHandler = service.getGroupHandler();

         if (currentGroupId != null)
         {
            groupName = currentGroupId + groupName;
         }

         Group newGroup = groupHandler.findGroupById(groupName);
         if (newGroup != null)
         {
            Object[] args = {groupName};
            UIApplication uiApp = event.getRequestContext().getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIGroupForm.msg.group-exist", args));
            return;
         }
         newGroup = groupHandler.createGroupInstance();
         uiGroupForm.invokeSetBindingBean(newGroup);
         if (newGroup.getLabel() == null || newGroup.getLabel().trim().length() == 0)
         {
            newGroup.setLabel(newGroup.getGroupName());
         }
         String changeGroupId;
         if (currentGroupId == null)
         {
            groupHandler.addChild(null, newGroup, true);
            //uiGroupExplorer.changeGroup(groupName) ;
            changeGroupId = groupName;
         }
         else
         {
            Group parrentGroup = groupHandler.findGroupById(currentGroupId);
            groupHandler.addChild(parrentGroup, newGroup, true);
            //uiGroupExplorer.changeGroup(currentGroupId) ;
            changeGroupId = currentGroupId;
         }

         // change group
View Full Code Here

   @SuppressWarnings("unchecked")
   public void onEvent(Event<GroupDAOImpl, Group> event) throws Exception
   {
      LOG.info("Remove all Child of Group: " + event.getData().getId());
      GroupHandler membershipHanler = service_.getGroupHandler();
      List<Group> children = (List<Group>)membershipHanler.findGroups(event.getData());
      for (Group child : children)
      {
         membershipHanler.removeGroup(child, true);
      }
   }
View Full Code Here

TOP

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

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.