Examples of MembershipType


Examples of org.exoplatform.services.organization.MembershipType

         OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
         MembershipHandler memberShipHandler = service.getMembershipHandler();
         UIApplication uiApp = event.getRequestContext().getUIApplication();
         List<String> userNames = Arrays.asList(uiForm.getUserName().trim().split("\\s*,\\s*"));
         Group group = userInGroup.getSelectedGroup();
         MembershipType membershipType = service.getMembershipTypeHandler().findMembershipType(uiForm.getMembership());
         if (group == null)
         {
            uiApp.addMessage(new ApplicationMessage("UIGroupMembershipForm.msg.group-not-select", null));
            return;
         }

         // add new
         for (int i0 = 0; i0 < userNames.size() - 1; i0++)
         {
            String user0 = userNames.get(i0);
            if (user0 == null || user0.trim().length() == 0)
               continue;
            for (int i1 = i0 + 1; i1 < userNames.size(); i1++)
               if (user0.equals(userNames.get(i1)))
               {
                  uiApp.addMessage(new ApplicationMessage("UIGroupMembershipForm.msg.duplicate-user",
                     new String[]{user0}));
                  return;
               }
         }
         // check user
         boolean check = false;
         String listNotExist = null;
         for (String username : userNames)
         {
            if (username == null || username.trim().length() == 0)
               continue;
            User user = service.getUserHandler().findUserByName(username);
            if (user == null)
            {
               check = true;
               if (listNotExist == null)
                  listNotExist = username;
               else
                  listNotExist += ", " + username;
            }
         }
         if (check)
         {
            uiApp.addMessage(new ApplicationMessage("UIGroupMembershipForm.msg.user-not-exist",
               new String[]{listNotExist}));
            return;
         }

         // check membership
         String listUserMembership = null;
         for (String username : userNames)
         {
            if (username == null || username.trim().length() == 0)
               continue;
            Membership membership =
               memberShipHandler.findMembershipByUserGroupAndType(username, group.getId(), membershipType.getName());
            if (membership != null)
            {
               check = true;
               if (listUserMembership == null)
                  listUserMembership = username;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.