Package org.exoplatform.services.organization

Examples of org.exoplatform.services.organization.OrganizationService


    public static class FindGroupActionListener extends EventListener<UIUserSelector> {
        public void execute(Event<UIUserSelector> event) throws Exception {
            UIUserSelector uiSelectUserForm = event.getSource();
            String groupId = uiSelectUserForm.getSelectedGroup();
            OrganizationService service = uiSelectUserForm.getApplicationComponent(OrganizationService.class);

            PageList users = PageList.EMPTY_LIST;
            if (groupId != null && groupId.trim().length() != 0) {
                if (service.getGroupHandler().findGroupById(groupId) != null) {
                    users = uiSelectUserForm.removeDuplicate(service.getUserHandler().findUsersByGroup(groupId));
                }
            } else {
                users = service.getUserHandler().findUsers(new Query());
            }
            users.setPageSize(10);
            uiSelectUserForm.uiIterator_.setPageList(users);
            uiSelectUserForm.setKeyword(null);
            event.getRequestContext().addUIComponentToUpdateByAjax(uiSelectUserForm);
View Full Code Here


    @SuppressWarnings("deprecation")
    public void setUserProfile(String user) throws Exception {
        user_ = user;
        if (user == null)
            return;
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        UserProfile userProfile = service.getUserProfileHandler().findUserProfileByName(user);
        if (userProfile == null) {
            userProfile = service.getUserProfileHandler().createUserProfileInstance();
            userProfile.setUserName(user);
        }

        if (userProfile.getUserInfoMap() == null)
            return;
View Full Code Here

    }

    public static class SaveActionListener extends EventListener<UIAccountForm> {
        public void execute(Event<UIAccountForm> event) throws Exception {
            UIAccountForm uiForm = event.getSource();
            OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
            UIAccountInputSet uiAccountInput = uiForm.getChild(UIAccountInputSet.class);
            String userName = uiAccountInput.getUserName();
            boolean saveAccountInput = uiAccountInput.save(service, true);
            if (saveAccountInput == false)
                return;
View Full Code Here

    public static class SearchUserActionListener extends EventListener<UIAccountForm> {
        public void execute(Event<UIAccountForm> event) throws Exception {
            UIAccountForm uiForm = event.getSource();
            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            UIApplication uiApp = context.getUIApplication();
            OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
            UIFormStringInput usernameInput = uiForm.getChild(UIAccountInputSet.class).getUIStringInput(
                    UIAccountInputSet.USERNAME);
            for (Validator validator : usernameInput.getValidators()) {
                try {
                    validator.validate(usernameInput);
                } catch (MessageException e) {
                    uiApp.addMessage(e.getDetailMessage());
                    return;
                }
            }

            String userName = usernameInput.getValue();
            if (service.getUserHandler().findUserByName(userName) != null) {
                uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.user-exist", null, ApplicationMessage.WARNING));
                return;
            }
            uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.user-not-exist", null, ApplicationMessage.INFO));
        }
View Full Code Here

    /**
     * @see org.exoplatform.webui.core.UIComponent#processRender(org.exoplatform.webui.application.WebuiRequestContext)
     */
    @Override
    public void processRender(WebuiRequestContext context) throws Exception {
        OrganizationService service = getApplicationComponent(OrganizationService.class);
        UITree tree = getChild(UITree.class);
        if (tree != null && tree.getSibbling() == null) {
            Collection<?> sibblingsGroup = service.getGroupHandler().findGroups(null);
            tree.setSibbling((List) sibblingsGroup);
        }

        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

    public Group getCurrentGroup() {
        return selectGroup_;
    }

    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

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

public class UIAccountProfiles extends UIForm {

    public UIAccountProfiles() throws Exception {
        super();
        String username = Util.getPortalRequestContext().getRemoteUser();
        OrganizationService service = this.getApplicationComponent(OrganizationService.class);
        User useraccount = service.getUserHandler().findUserByName(username);

        UIFormStringInput userName = new UIFormStringInput("userName", "userName", username);
        userName.setReadOnly(true);
        addUIFormInput(userName.addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class, 3, 30)
                .addValidator(ResourceValidator.class)
View Full Code Here

    public static class ResetActionListener extends EventListener<UIAccountProfiles> {
        public void execute(Event<UIAccountProfiles> event) throws Exception {
            UIAccountProfiles uiForm = event.getSource();
            String userName = uiForm.getUIStringInput("userName").getValue();
            OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
            User user = service.getUserHandler().findUserByName(userName);
            uiForm.getUIStringInput("firstName").setValue(user.getFirstName());
            uiForm.getUIStringInput("lastName").setValue(user.getLastName());
            uiForm.getUIStringInput("displayName").setValue(user.getDisplayName());
            uiForm.getUIStringInput("email").setValue(user.getEmail());
            event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
View Full Code Here

    }

    public static class SaveActionListener extends EventListener<UIAccountProfiles> {
        public void execute(Event<UIAccountProfiles> event) throws Exception {
            UIAccountProfiles uiForm = event.getSource();
            OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
            WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
            UIApplication uiApp = context.getUIApplication();

            ConversationState state = ConversationState.getCurrent();
            String userName = ((User) state.getAttribute(CacheUserProfileFilter.USER_PROFILE)).getUserName();
            User user = service.getUserHandler().findUserByName(userName);
            if (user != null) {
                String oldEmail = user.getEmail();
                String newEmail = uiForm.getUIStringInput("email").getValue();

                // Check if mail address is already used
                Query query = new Query();
                query.setEmail(newEmail);
                if (service.getUserHandler().findUsers(query).getAll().size() > 0 && !oldEmail.equals(newEmail)) {
                    // Be sure it keep old value
                    user.setEmail(oldEmail);
                    Object[] args = { userName };
                    uiApp.addMessage(new ApplicationMessage("UIAccountInputSet.msg.email-exist", args));
                    return;
                }
                user.setFirstName(uiForm.getUIStringInput("firstName").getValue());
                user.setLastName(uiForm.getUIStringInput("lastName").getValue());
                user.setDisplayName(uiForm.getUIStringInput("displayName").getValue());
                user.setEmail(newEmail);
                uiApp.addMessage(new ApplicationMessage("UIAccountProfiles.msg.update.success", null));
                service.getUserHandler().saveUser(user, true);

                state.setAttribute(CacheUserProfileFilter.USER_PROFILE, user);
                UIWorkingWorkspace uiWorkingWS = Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
                uiWorkingWS.updatePortletsByName("UserInfoPortlet");
                uiWorkingWS.updatePortletsByName("OrganizationPortlet");
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.