Package org.exoplatform.services.organization

Examples of org.exoplatform.services.organization.OrganizationService


      String containerConf = getClass().getResource(configPath).toString();

      StandaloneContainer.addConfigurationURL(containerConf);
      container = StandaloneContainer.getInstance();

      OrganizationService organizationService =
         (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);

      gHandler = organizationService.getGroupHandler();
      uHandler = organizationService.getUserHandler();
      mHandler = organizationService.getMembershipHandler();
      mtHandler = organizationService.getMembershipTypeHandler();
      upHandler = organizationService.getUserProfileHandler();

      users.add(userName);
      users.add(newUserName);

      groups.add("/" + groupName1);
View Full Code Here


    public static class EditMembershipActionListener extends EventListener<UIListMembershipType> {
        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 == null) {
                UIApplication uiApp = event.getRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIMembershipTypeForm.msg.MembershipNotExist", new String[] { name }));
                uiMembership.loadData();
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) {
                while (currentPage > pageIterator.getAvailablePage())
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);
        return handler.findAllMembershipsByGroup(group);
    }
View Full Code Here

    private Collection childrenGroup_;

    @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

        tree.setMaxTitleCharacter(25);
    }

    @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_);
            sibblingsGroup_ = GroupManagement.getRelatedGroups(null, sibblingsGroup_);
View Full Code Here

    public List<LocalPath> getPath(List<LocalPath> list, String id) throws Exception {
        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 static class SaveActionListener extends EventListener<UIMembershipTypeForm> {
        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).setReadOnly(false);
View Full Code Here

        super(state, pageSize);
    }

    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

        return getUIStringInput("membership").getValue();
    }

    private void loadData() throws Exception {
        listOption.clear();
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        List<MembershipType> memberships = (List<MembershipType>) service.getMembershipTypeHandler().findMembershipTypes();
        Collections.sort(memberships, new Comparator<MembershipType>() {
            @Override
            public int compare(MembershipType o1, MembershipType o2) {
                return (o1.getName()).compareTo(o2.getName());
            }
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.