Examples of UserSet


Examples of evolaris.framework.um.datamodel.UserSet

  private void prepareContentForUserSetList(ActionForm form, HttpServletRequest req, Session session,String filter) {
    UserSetAssignmentListForm userSetAssignmentListForm = (UserSetAssignmentListForm) form;

    UserSetManager userSetManager = new UserSetManager(locale, session);

    UserSet userSet = userSetManager.getUserSet(userSetAssignmentListForm.getUserSetId());
    if (userSet == null) {
      String msg = getResources(req).getMessage("um.userSetNotFound", req.getParameter("id"));
      LOGGER.error(msg);
      throw new InputException(msg);
    }
    if (!userSet.getGroup().equals(getCurrentGroup(req))) {
      // due to global group selection, userset should be in current group
      throw new InputException(getResources(req).getMessage("um.userSetNotInCurrentGroup"));
    }
    checkAccessRights(req, userSet.getGroup());
    Group currentGroup = getCurrentGroup(req);
   
    // fetch the list of users
    int pageNumber = 1; // default page size
    if(req.getParameter("page") != null){
      pageNumber = Integer.parseInt(req.getParameter("page"));
    }
   
    String sortCriterion = "username"; // default sort criterion
    if(req.getParameter("sort") != null){
      sortCriterion = req.getParameter("sort");
    }
   
    SortOrderEnum sortOrderDisplayTag = SortOrderEnum.ASCENDING; // default
    evolaris.framework.database.util.SortOrderEnum sortOrderDb = evolaris.framework.database.util.SortOrderEnum.asc;
    if(req.getParameter("dir") != null){
      String order = req.getParameter("dir");
      if("asc".equals(order)){
        sortOrderDisplayTag = SortOrderEnum.ASCENDING;
        sortOrderDb = evolaris.framework.database.util.SortOrderEnum.asc;
      } else {
        sortOrderDisplayTag = SortOrderEnum.DESCENDING;
        sortOrderDb = evolaris.framework.database.util.SortOrderEnum.desc;
      }
    }
   
    User[] users = null;
    int listFullSize = 0; // the size of the complete result list used for paging

    Hibernate.initialize(userSet); // used to fetch the data from db
    userSetAssignmentListForm.setUserSetName(userSet.getName());
    userSetAssignmentListForm.setUserSetId(userSet.getId());
 
     
    String[] choosenUsers = null;
    if(userSetAssignmentListForm.getDisplayAll() != null && userSetAssignmentListForm.getDisplayAll()){
      GroupManager groupMgm = new GroupManager(locale,session);
View Full Code Here

Examples of evolaris.framework.um.datamodel.UserSet

    if (userSetId == null){
      throw new BugException("missing user set id");
    }
    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSet userSet = userSetManager.getUserSet(userSetId);
    checkAccessRights(req, userSet.getGroup());
    String[] choosen = userSetAssociationListForm.getChoosen();
    Long[] userIds = userSetAssociationListForm.getUserId();   
    if (userIds != null) {
      UserManager userManager = new UserManager(locale,session);
      for (Long userId : userIds) {
        User user = userManager.getUserDetails(userId);
        checkAccessRights(req, user.getGroup());       
        if (Arrays.asList(choosen).contains(userId.toString())) {  // in list and checked
          userSet.getUsers().add(user);              // don't care if already there, as it's a set.
        } else {                          // in list and not checked
          userSet.getUsers().remove(user);            // remove from userset, don't mind if it's not there
        }
      }
    }
    userSetManager.modifyUserSet(userSet);
    userSetAssociationListForm.setDisplayAll(false)// show only selected for the user to see the difference
View Full Code Here

Examples of evolaris.framework.um.datamodel.UserSet

   
    // store new references
    Set<UserSet> newUserSets = user.getUserSets();
    UserSetManager userSetManager = new UserSetManager(locale,session);
    for (Iterator iterator = newUserSets.iterator(); iterator.hasNext();) {
      UserSet userSet = (UserSet) iterator.next();
      userSet.getUsers().add(user);
      userSetManager.modifyUserSet(userSet);
    }
  }
View Full Code Here

Examples of evolaris.framework.um.datamodel.UserSet

   
    Set<UserSet> userSets = user.getUserSets();
    Long userSetIds[] = new Long[userSets.size()];
    i = 0;
    for (Iterator iterator = userSets.iterator(); iterator.hasNext();) {
      UserSet userSet = (UserSet) iterator.next();
      userSetIds[i++] = userSet.getId();
    }
   
    f.setUserSets(userSetIds);
    f.setGender(user.getGender() == null ? 0 : user.getGender());
    f.setSalutation(user.getSalutation());
View Full Code Here

Examples of evolaris.framework.um.datamodel.UserSet

    UserSetManager userSetManager = new UserSetManager(locale,session);
   
    // store new references
    Set<UserSet> newUserSets = entry.getUserSets();
    for (Iterator iterator = newUserSets.iterator(); iterator.hasNext();) {
      UserSet userSet = (UserSet) iterator.next();
      userSet.getUsers().add(entry);
      userSetManager.modifyUserSet(userSet);
    }
   
    UserManager userManager = new UserManager(locale,session);
    userManager.modifyUser(entry);
View Full Code Here

Examples of evolaris.framework.um.datamodel.UserSet

   
    UserSetManager userSetMgr = new UserSetManager(locale, session);
    Set<UserSet> userSets = new HashSet<UserSet>();
    if (f.getUserSets() != null) {
      for (Long id : f.getUserSets()) {
        UserSet userSet = userSetMgr.getUserSet(id);
        if (userSet == null || userSet.getGroup() != group) {
          throw new InputException(resources.getMessage("um.userSetNotFound", id));         
        }
        userSets.add(userSet);
      }
    }
View Full Code Here

Examples of evolaris.framework.um.datamodel.UserSet

  // Creates duplicated user set with or without users
  private ActionForward createWithOrWithoutUsers(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp, boolean includeUserAssignments) {
    UserSetEnterOrEditForm userSetEnterOrEditForm = (UserSetEnterOrEditForm) form;
    long originalUserSetId = userSetEnterOrEditForm.getOriginalId();
    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSet originalUserSet = userSetManager.getUserSet(originalUserSetId);
    if (originalUserSet == null){
      throw new InputException(getResources(req).getMessage(locale, "um.userSetNotFound",  originalUserSetId));
    }
    checkAccessRights(req, originalUserSet.getGroup());
    Group group = new GroupManager(locale,session).getGroup(userSetEnterOrEditForm.getGroupId());
    boolean differentGroup = group != originalUserSet.getGroup();
    if (includeUserAssignments && differentGroup && !userSetEnterOrEditForm.isConfirmationPending() && originalUserSet.getUsers().size() >= 1){
      userSetEnterOrEditForm.setConfirmationPending(true);
      String reallyDuplicate1 = getResources(req).getMessage(locale,"um.reallyDuplicate1");
      String reallyDuplicate2 = getResources(req).getMessage(locale,"um.reallyDuplicate2");
      req.setAttribute("generalError",reallyDuplicate1 + " " + originalUserSet.getUsers().size() + " " + reallyDuplicate2);
      return mapping.findForward("confirm");
    }
    userSetEnterOrEditForm.setConfirmationPending(false);
    UserSet newUserSet = userSetManager.duplicate(originalUserSet,group,userSetEnterOrEditForm.getUserSetName(),includeUserAssignments);
    checkAccessRights(req, newUserSet.getGroup());
    newUserSet.setDescription(userSetEnterOrEditForm.getDescription());
    newUserSet.setHidden(userSetEnterOrEditForm.getHidden()==true?1:0);
    userSetManager.modifyUserSet(newUserSet);
    setCurrentGroup(req, resp, group); // switch group in global group selection
    return mapping.findForward("created");
  }
View Full Code Here

Examples of evolaris.framework.um.datamodel.UserSet

    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSetEnterOrEditForm userSetEnterOrEditForm = (UserSetEnterOrEditForm) form;
    if (!userSetEnterOrEditForm.isConfirmationPending()){
      String idParameter = req.getParameter("id");
      long id = Long.valueOf(idParameter);
      UserSet userSet = userSetManager.getUserSet(id);
      if (userSet == null){
        throw new InputException(getResources(req).getMessage(locale, "um.userSetNotFound",  id));
      }
      checkAccessRights(req,userSet.getGroup());
      userSetEnterOrEditForm.setOriginalId(id);
      userSetEnterOrEditForm.setId(id);
      userSetEnterOrEditForm.setDescription(userSet.getDescription());
      userSetEnterOrEditForm.setHidden(userSet.getHidden()==1?true:false);
      userSetEnterOrEditForm.setUserSetName(req.isUserInRole(UserManagerBase.ADMINISTRATOR) ? userSet.getName() :  getResources(req).getMessage(locale, "um.Copy") + ": " + userSet.getName());
      Group group = userSet.getGroup();
      userSetEnterOrEditForm.setGroupId(group.getId());
      userSetEnterOrEditForm.setGroupname(group.getGroupname());
      Group[] groups = groupManager.getGroups();
      req.getSession().setAttribute("groups", groups)// must be in session, because the form may be redisplayed on validation errors
    }
View Full Code Here

Examples of evolaris.framework.um.datamodel.UserSet

        Long userSetId = msgForm.getUserSetId();
        if(userSetId.longValue() == -1){
          throw new BugException("illegal user set id: " + userSetId);
        }
        UserSetManager userSetManager = new UserSetManager(locale,session);
        UserSet userSet =  userSetManager.getUserSet(userSetId);
        if (userSet == null && userSetId != -2) {
          throw new ConfigurationException("illegal user set id: " + userSetId);
        }
        smsCommandEntry.setDestinationUserSet(userSet);
        smsCommandEntry.setCurrentUserSetAsDestination(userSetId == -2 ? 1 : 0);       
View Full Code Here

Examples of evolaris.framework.um.datamodel.UserSet

        Long userSetId = msgForm.getUserSetId();
        if(userSetId.longValue() == -1){
          throw new BugException("illegal user set id: " + userSetId);
        }
        UserSetManager userSetManager = new UserSetManager(locale,session);
        UserSet userSet =  userSetManager.getUserSet(userSetId);
        if (userSet == null&& userSetId != -2) {
          throw new ConfigurationException("illegal user set id: " + userSetId);
        }
        smsCommandEntry.setDestinationUserSet(userSet);
        smsCommandEntry.setCurrentUserSetAsDestination(userSetId == -2 ? 1 : 0);
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.