Package org.exoplatform.services.organization

Examples of org.exoplatform.services.organization.OrganizationService


    private Group selectedGroup;

    public UIGroupSelector() throws Exception {
        UIBreadcumbs uiBreadcumbs = addChild(UIBreadcumbs.class, "BreadcumbGroupSelector", "BreadcumbGroupSelector");
        UITree tree = addChild(UITree.class, "UITreeGroupSelector", "TreeGroupSelector");
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        Collection sibblingsGroup = service.getGroupHandler().findGroups(null);

        tree.setSibbling((List) sibblingsGroup);
        tree.setIcon("GroupAdminIcon");
        tree.setSelectedIcon("PortalIcon");
        tree.setBeanIdField("id");
View Full Code Here


    public void setSelectedGroup(Group group) {
        selectedGroup = group;
    }

    public void changeGroup(String groupId) throws Exception {
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        UIBreadcumbs uiBreadcumb = getChild(UIBreadcumbs.class);
        uiBreadcumb.setPath(getPath(null, groupId));

        UITree tree = getChild(UITree.class);
        Collection sibblingGroup;

        if (groupId == null) {
            sibblingGroup = service.getGroupHandler().findGroups(null);
            tree.setSibbling((List) sibblingGroup);
            tree.setChildren(null);
            tree.setSelected(null);
            selectedGroup = null;
            return;
        }

        selectedGroup = service.getGroupHandler().findGroupById(groupId);
        String parentGroupId = null;
        if (selectedGroup != null)
            parentGroupId = selectedGroup.getParentId();
        Group parentGroup = null;
        if (parentGroupId != null)
            parentGroup = service.getGroupHandler().findGroupById(parentGroupId);

        Collection childrenGroup = service.getGroupHandler().findGroups(selectedGroup);
        sibblingGroup = service.getGroupHandler().findGroups(parentGroup);

        tree.setSibbling((List) sibblingGroup);
        tree.setChildren((List) childrenGroup);
        tree.setSelected(selectedGroup);
        tree.setParentSelected(parentGroup);
View Full Code Here

    private 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()));
        getPath(list, group.getParentId());
        return list;
View Full Code Here

    @SuppressWarnings("unchecked")
    public UIGroupSelector() throws Exception {
        UIBreadcumbs uiBreadcumbs = addChild(UIBreadcumbs.class, "BreadcumbGroupSelector", "BreadcumbGroupSelector");
        UITree tree = addChild(UITree.class, "UITreeGroupSelector", "TreeGroupSelector");
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        Collection<?> sibblingsGroup = service.getGroupHandler().findGroups(null);

        tree.setSibbling((List) sibblingsGroup);
        tree.setIcon("GroupAdminIcon");
        tree.setSelectedIcon("PortalIcon");
        tree.setBeanIdField("id");
View Full Code Here

        return selectGroup_;
    }

    @SuppressWarnings("unchecked")
    public void changeGroup(String groupId) throws Exception {
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        UIBreadcumbs uiBreadcumb = getChild(UIBreadcumbs.class);
        uiBreadcumb.setPath(getPath(null, groupId));

        UITree tree = getChild(UITree.class);
        Collection<?> sibblingGroup;

        if (groupId == null) {
            sibblingGroup = service.getGroupHandler().findGroups(null);
            tree.setSibbling((List) sibblingGroup);
            tree.setChildren(null);
            tree.setSelected(null);
            selectGroup_ = null;
            return;
        }

        selectGroup_ = service.getGroupHandler().findGroupById(groupId);
        String parentGroupId = null;
        if (selectGroup_ != null)
            parentGroupId = selectGroup_.getParentId();
        Group parentGroup = null;
        if (parentGroupId != null)
            parentGroup = service.getGroupHandler().findGroupById(parentGroupId);

        Collection childrenGroup = service.getGroupHandler().findGroups(selectGroup_);
        sibblingGroup = service.getGroupHandler().findGroups(parentGroup);

        tree.setSibbling((List) sibblingGroup);
        tree.setChildren((List) childrenGroup);
        tree.setSelected(selectGroup_);
        tree.setParentSelected(parentGroup);
View Full Code Here

    private 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()));
        getPath(list, group.getParentId());
        return list;
View Full Code Here

        return list;
    }

    @SuppressWarnings("unchecked")
    public List<String> getListGroup() throws Exception {
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        List<String> listGroup = new ArrayList<String>();
        if (getCurrentGroup() == null)
            return null;
        Collection<Object> groups = service.getGroupHandler().findGroups(getCurrentGroup());
        if (groups.size() > 0) {
            for (Object child : groups) {
                Group childGroup = (Group) child;
                listGroup.add(childGroup.getId());
            }
View Full Code Here

    public UIUserSelector() throws Exception {
        addUIFormInput(new UIFormStringInput(FIELD_KEYWORD, FIELD_KEYWORD, null));
        addUIFormInput(new UIFormSelectBox(FIELD_FILTER, FIELD_FILTER, getFilters()));
        addUIFormInput(new UIFormStringInput(FIELD_GROUP, FIELD_GROUP, null));
        isShowSearch_ = true;
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        ObjectPageList objPageList = new ObjectPageList(service.getUserHandler().findUsers(new Query()).getAll(), 10);
        uiIterator_ = new UIPageIterator();
        uiIterator_.setPageList(objPageList);
        uiIterator_.setId("UISelectUserPage");

        // create group selector
View Full Code Here

    public void setShowSearchUser(boolean isShowSearchUser) {
        this.isShowSearchUser = isShowSearchUser;
    }

    public void search(String keyword, String filter, String groupId) throws Exception {
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        Query q = new Query();
        if (keyword != null && (keyword = keyword.trim()).length() != 0) {
            if (keyword.indexOf("*") < 0) {
                if (keyword.charAt(0) != '*')
                    keyword = "*" + keyword;
                if (keyword.charAt(keyword.length() - 1) != '*')
                    keyword += "*";
            }
            keyword = keyword.replace('?', '_');
            if (USER_NAME.equals(filter)) {
                q.setUserName(keyword);
            }
            if (LAST_NAME.equals(filter)) {
                q.setLastName(keyword);
            }
            if (FIRST_NAME.equals(filter)) {
                q.setFirstName(keyword);
            }
            if (EMAIL.equals(filter)) {
                q.setEmail(keyword);
            }
        }
        List results = new CopyOnWriteArrayList();
        results.addAll(service.getUserHandler().findUsers(q).getAll());
        // remove if user doesn't exist in selected group
        MembershipHandler memberShipHandler = service.getMembershipHandler();

        if (groupId != null && (groupId = groupId.trim()).length() != 0) {
            for (Object user : results) {
                if (memberShipHandler.findMembershipsByUserAndGroup(((User) user).getUserName(), groupId).size() == 0) {
                    results.remove(user);
View Full Code Here

        public void execute(Event<UIGroupSelector> event) throws Exception {
            UIGroupSelector uiSelectGroupForm = event.getSource();
            UIUserSelector uiSelectUserForm = uiSelectGroupForm.<UIComponent> getParent().getParent();
            String groupId = event.getRequestContext().getRequestParameter(OBJECTID);
            uiSelectUserForm.setSelectedGroup(groupId);
            OrganizationService service = uiSelectGroupForm.getApplicationComponent(OrganizationService.class);
            PageList users = uiSelectUserForm.removeDuplicate(service.getUserHandler().findUsersByGroup(groupId));
            users.setPageSize(10);
            uiSelectUserForm.uiIterator_.setPageList(users);
            uiSelectUserForm.setKeyword(null);
            event.getRequestContext().addUIComponentToUpdateByAjax(uiSelectUserForm);
        }
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.