Package evolaris.framework.um.datamodel

Examples of evolaris.framework.um.datamodel.UserSet


  public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    UserSetSplitForm splitForm = (UserSetSplitForm)form;
    LOGGER.info("about to split: users/set="+splitForm.getCount());
    UserSetManager userSetMgm = new UserSetManager(locale, session);
    long id = splitForm.getUserSetId();
    UserSet sourceSet = userSetMgm.getUserSet(id);
    List <UserSet> result = userSetMgm.splitUserSet(sourceSet, splitForm.getCount());
    for (UserSet s : result) {
      userSetMgm.createUserSet(s);
    }
    return mapping.findForward("created");
View Full Code Here


      Role role = userMgr.getRole(element.getKey());
      permissionMgr.setRolePermissions(entry, role, element.getValue().toArray(new Long[0]));
    }
    for (Iterator<Map.Entry<Long, Set<Long>>> iter = userSetPermissions.entrySet().iterator(); iter.hasNext();) {
      Map.Entry<Long, Set<Long>> element = iter.next();
      UserSet userSet = userSetMgr.getUserSet(element.getKey());
      permissionMgr.setUserSetPermissions(entry, userSet, element.getValue().toArray(new Long[0]));
    }
    for (Iterator<Map.Entry<Long, Set<Long>>> iter = userPermissions.entrySet().iterator(); iter.hasNext();) {
      Map.Entry<Long, Set<Long>> element = iter.next();
      User user = userMgr.getUserDetails(element.getKey());
View Full Code Here

    Group groupToDisplay = this.getCurrentGroup(req);
    UserSetManager userSetMgm = new UserSetManager(locale,session);
    UserSet[] userSets = userSetMgm.getUserSets(groupToDisplay);
    List<UserSetListEntry> userSetList = new LinkedList<UserSetListEntry>();
    for (int i = 0; i < userSets.length; i++) {
      UserSet set = userSets[i];
      userSetList.add(new UserSetListEntry(set.getId(),set.getName(),set.getDescription(),set.getUsers().size()));
    }
    req.setAttribute("userSets", userSetList);
    logProcessingTime("List UserSets; total number of fetched objects = " + userSets.length);
    return mapping.findForward("list");
  }
View Full Code Here

    UserSetListForm userSetListForm = (UserSetListForm) form;
    UserSetManager userSetManager = new UserSetManager(locale,session);
    String[] ids = userSetListForm.getChoosen();
    if (ids != null) {
      for (String id : ids) {
        UserSet userSet = userSetManager.getUserSet(Long.parseLong(id));
        if (userSet != null) {
          // security check
          if (UserManager.isUserInRole(webUser, UserManagerBase.ADMINISTRATOR)
            || (UserManager.isUserInRole(webUser, UserManagerBase.GROUP_ADMINISTRATOR)
              && userSet.getGroup().equals(webUser.getGroup()))) {
            userSetManager.deleteUserSet(userSet,false);
          } else {
            throw new BugException("illegal role");
          }
        }       
View Full Code Here

  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

    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

   
    // 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

   
    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

    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

   
    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

TOP

Related Classes of evolaris.framework.um.datamodel.UserSet

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.