Package evolaris.framework.um.datamodel

Examples of evolaris.framework.um.datamodel.UserSet


    long[] sourceUserSetIds = f.getSourceUserSetIds();
    if (sourceUserSetIds != null){
      long[] selectedUserSetIds = f.getSelectedUserSetIds();
      for (int i = 0; i < sourceUserSetIds.length; i++){
        long sourceUserSetId = sourceUserSetIds[i];
        UserSet sourceUserSet = userSetManager.getUserSet(sourceUserSetId);
        if (sourceUserSet == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceUserSetNotAvailableAnymore"),"user set #" + sourceUserSetId + " not found",null,null);
        }
        checkAccessRights(req,sourceUserSet.getGroup());
        long selectedUserSetId = selectedUserSetIds[i];
        if (selectedUserSetId >= 1){  // mapping entry => assign; no entry => create
          UserSet selectedUserSet = userSetManager.getUserSet(selectedUserSetId);
          if (selectedUserSet == null){
            throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedUserSetNotAvaliableAnymore"),"user set #" + selectedUserSetId + " not found",null,null);
          }
          checkAccessRights(req,selectedUserSet.getGroup());
          mappingSet.add(new Entry(sourceUserSet), new Entry(selectedUserSet));
        }
      }
    }
   
View Full Code Here


    UserSetManager userSetManager = new UserSetManager(locale, session);
    Set<UserSet> userSets = new HashSet<UserSet>();
    if (selectedUserSetIds != null) {
      for (String selectedUserSetId : selectedUserSetIds) {
        UserSet userSet = userSetManager.getUserSet(Long.parseLong(selectedUserSetId));
        if (userSet == null) {
          throw new BugException("illegal user set id `"+selectedUserSetId + "`");
        }
        userSets.add(userSet);
      }
View Full Code Here

   
    Long selectedUserSetId = sendForm.getUserSetId();
    if (selectedUserSetId == null || selectedUserSetId <= 0){
      return null;
    }
    UserSet userSet = userSetManager.getUserSet(selectedUserSetId);
    if (userSet.getGroup() != group){
      sendForm.setUserSetId(-1L);
      return null;
    }
    return userSet;
  }
View Full Code Here

   
    Long selectedUserSetId = sendForm.getUserSetId();
    if (selectedUserSetId == null || selectedUserSetId <= 0){
      return null;
    }
    UserSet userSet = userSetManager.getUserSet(selectedUserSetId);
    if (userSet.getGroup() != group){
      sendForm.setUserSetId(-1L);
      return null;
    }
    return userSet;
  }
View Full Code Here

    MessageResources resources = getResources(req);
   
 
    UserSet[] extendesUserSets = new  UserSet[userSets.length+1];
   
    UserSet noSelection = new UserSet();
    noSelection.setId(-1);
    noSelection.setName("("+resources.getMessage(locale, "um.noUserSet")+")");
   
    extendesUserSets[0] = noSelection;
    for (int i = 0; i < userSets.length; i++) {
      extendesUserSets[i+1] = userSets[i];
  }
View Full Code Here

   
    if(userSetId == null){
      throw new InputException(resources.getMessage(locale, "smssvc.missingUserSetSelection"));
    }
    UserSetManager userSetMgm = new UserSetManager(locale,session);
    UserSet userSet = userSetMgm.getUserSet(userSetId);
   
    if(userSet == null){
      throw new InputException(resources.getMessage(locale, "um.userSetNotFound",userSetId));
    }
   
    checkAccessRights(req, userSet.getGroup());
   
    FormFile csvFile = userImportForm.getCsvFile();
    if (csvFile != null && csvFile.getFileName() != null && csvFile.getFileName().length() != 0){
      try {
        InputStream inputStream = csvFile.getInputStream();
View Full Code Here

   * This could be implemented more generally but also more complicated with reflection.
   * @param user set source user object
   * @return cloned user set object
   */
       public static UserSet clone(UserSet userSet) {
    UserSet newUserSet = new UserSet();
    newUserSet.setCreationdate(userSet.getCreationdate());
    newUserSet.setEditedAt(userSet.getEditedAt());
    newUserSet.setName(userSet.getName());
    newUserSet.setDescription(userSet.getDescription());
    newUserSet.setGroup(userSet.getGroup());
    return newUserSet;
  }
View Full Code Here

   
    // delete old references
    UserSetManager userSetManager = new UserSetManager(locale,session);
    Set<UserSet> oldUserSets = user.getUserSets();
    for (Iterator iterator = oldUserSets.iterator(); iterator.hasNext();) {
      UserSet userSet = (UserSet) iterator.next();
      userSet.getUsers().remove(user);
      userSetManager.modifyUserSet(userSet);
    }
   
    return super.modify(mapping, form, req, resp);
  }
View Full Code Here

   */
  public UserSet duplicate(UserSet userSet, Group destinationGroup, String newName, boolean includeUsers){
    if (destinationGroup == userSet.getGroup() && newName == null){
      throw new InputException(ResourceBundle.getBundle("UserManagement", locale).getString("userSetExists"));
    }
    UserSet newUserSet = clone(userSet);
    newUserSet.setCreationdate(new Date());
    newUserSet.setEditedAt(null);
    newUserSet.setGroup(destinationGroup);
    if (newName != null){
      newUserSet.setName(newName);
    }
    if (includeUsers){
      Set<User> users = userSet.getUsers();
      Set<User> newUsers = new HashSet<User>(users.size());
      for (User user : users) {
        if (newUserSet.getGroup() != userSet.getGroup()){
          user = userMgr.duplicate(user, destinationGroup);
        }
        newUsers.add(user);
      }
      newUserSet.setUsers(newUsers);
    }
    createUserSet(newUserSet);
    return newUserSet;
  }
View Full Code Here

   * @param setName the user set name
   * */
  public void assignUserToSet(long msisdn, String operator, String mobilePhoneProducer, Group group, String setName){
   
    User registeredUser = userMgr.getUserDetails(msisdn,group);
    UserSet userSet = getUserSet(setName,group);
   
    if(registeredUser == null){ // user does not exist in group
      User newUser = new User();
      newUser.setMsisdn(msisdn);
      newUser.setOperator(operator);
      newUser.setGroup(group);
      newUser.setMobilePhoneProducer(mobilePhoneProducer);
      newUser.getUserSets().add(userSet);
      userMgr.createUser(newUser,null);  
     
      Set<User> users = userSet.getUsers();
      users.add(newUser);
      userSet.setUsers(users);
      modifyUserSet(userSet);
     
    } else { // user exists
     
      if(operator != null && operator != "" && !operator.equals(registeredUser.getOperator())){
        registeredUser.setOperator(operator);
      }
      if(mobilePhoneProducer != null && mobilePhoneProducer != "" && !mobilePhoneProducer.equals(registeredUser.getMobilePhoneProducer())){
        registeredUser.setMobilePhoneProducer(mobilePhoneProducer);
      }
     
      registeredUser.getUserSets().add(userSet);
      userMgr.modifyUser(registeredUser);
     
      Set<User> users = userSet.getUsers();
      users.add(registeredUser);
      userSet.setUsers(users);
      modifyUserSet(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.