Package evolaris.framework.um.datamodel

Examples of evolaris.framework.um.datamodel.User


   */
  public void deleteUserSet(UserSet userSet, boolean deleteUsers) {
    if (deleteUsers){
      Set<User> users = userSet.getUsers();
      for (Iterator<User> iter = users.iterator(); iter.hasNext();) {
        User user = (User) iter.next();
        iter.remove();
        userMgr.deleteUser(user);
      }
    }
    session.delete(userSet);
View Full Code Here


    List<User> userList = new ArrayList<User>();
    userList.addAll(source.getUsers());
    int size = userList.size();
    number = Math.min(number, size);
    for (int i=0; i<number; i++) {
      User user = null;
      int pos = (int)Math.floor(Math.random() * userList.size());
      user = userList.get(pos);
      add(target, user);
      userList.remove(pos);
    }
View Full Code Here

      }
      f.setSelectedRoleIds(roleIds);
    }
   
    UserManager userManager = new UserManager(locale,session);
    User user = userManager.getUserDetails(f.getId());
   
    if (user == null){
      throw new InputException(getLocalizedMessage("SystemWeb", "sys.entryNotAvailable"));
    }
   
    // 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);
    }
View Full Code Here

    setFromEmail(entry.getSourceEmail());
    setFromPersonalName(entry.getSourcePersonalName());
   
    // destination selection
    UserSet destinationUserSet = entry.getDestinationUserSet();
    User destinationUser = entry.getDestinationUser();
   
    if(destinationUserSet != null || entry.getCurrentUserSetAsDestination() == 1) {
      setDestinationSelection(1);
      setUserSetId(destinationUserSet != null ? destinationUserSet.getId() : -2);
    } else if(destinationUser != null){
      setDestinationSelection(2);
      setUserId(destinationUser.getId());
    } else if (entry.getDestinationEmail() != null){
      setDestinationSelection(3);
      setUserSetId(-1L);
      setToEmail(entry.getDestinationEmail());
      setToPersonalName(entry.getDestinationPersonalName());
    } else { // the sender of the request is also the receiver
      setDestinationSelection(0);
    }
   
    setUserId(destinationUser == null ? null : destinationUser.getId());
    setUserName(destinationUser == null ? null : destinationUser.getUsername());
    setUserSetId(destinationUserSet == null ? null : destinationUserSet.getId());
  }
View Full Code Here

    setFromPersonalName(entry.getSourcePersonalName());
    // destination selection
    String destinationEmail = entry.getDestinationEmail();
    String destinationPersonalName = entry.getDestinationPersonalName();
    UserSet destinationUserSet = entry.getDestinationUserSet();
    User destinationUser = entry.getDestinationUser();
    if (destinationUser != null){
      destinationUserSet = null;
      destinationEmail = null;
      destinationPersonalName = null;
      setDestinationSelection(2);
    } else if (destinationUserSet != null || entry.getCurrentUserSetAsDestination() == 1){
      destinationUser = null;
      destinationEmail = null;
      destinationPersonalName = null;
      setDestinationSelection(1);
    } else if (destinationEmail != null){
      destinationUserSet = null;
      destinationUser = null;
      setDestinationSelection(3);
    } else { // default: requesting user
      destinationUserSet = null;
      destinationUser = null;
      destinationEmail = null;
      destinationPersonalName = null;
      setDestinationSelection(0);
    }
    setToEmail(destinationEmail);
    setToPersonalName(destinationPersonalName);
    setUserId(destinationUser == null ? -1 : destinationUser.getId());
    setUserSetId(destinationUserSet == null ? entry.getCurrentUserSetAsDestination() == 1 ? -2 : -1 : destinationUserSet.getId());
  }
View Full Code Here

        Long userId = f.getUserId();
        if (userId.longValue() == -1){
          throw new InputException(resources.getMessage(locale,"smssvc.MessageNotSentBecauseNoUserSelected"));
        }
        UserManager userManager = new UserManager(locale,session);
        User user = userManager.getUserDetails(userId);
        if (user == null){
          throw new ConfigurationException("illegal user id: " + user);
        }
        emailCommandEntry.setDestinationUser(user);
        emailCommandEntry.setDestinationUserSet(null);
View Full Code Here

     * @return the user object
     */
    public User getUser(List<String> errorMessages){
      ResourceBundle messages = ResourceBundle.getBundle("UserManagement", currentLocale);
     
      User user = new User();
     
      user.setAddress(address);
      user.setCity(city);
      user.setCreationdate(new Date(System.currentTimeMillis()));
           
      if(email!= null && !email.equals("") && !email.matches(".*@[a-zA-Z0-9-]*.[a-zA-Z0-9.]*$")){
        errorMessages.add(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("InvalidEmailAddress"));
        LOGGER.info(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("InvalidEmailAddress"));
        return null;
      }
      user.setEmail(email);
     
      user.setFirstName(firstName);
      user.setLastName(lastName);
      if(mobilePhoneProducer != null && !mobilePhoneProducer.equals("Nokia") && !mobilePhoneProducer.equals("Not Nokia")){
        errorMessages.add(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("InvalidMobilePhoneProducer"));
        LOGGER.info(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("InvalidMobilePhoneProducer"));
        return null;
      }
      user.setMobilePhoneProducer(mobilePhoneProducer);
     
      if(msisdn != null && msisdn.length() > 0){
        Long parsedMsisdn = parseMsisdn(msisdn, errorMessages);
        if(parsedMsisdn == null){
          return null;
        }
        user.setMsisdn(parsedMsisdn);
      }
     
      user.setPersonalNumber(personalNumber);
      user.setPostalCode(postalCode);
      user.setTitle(title);
     
      if(username != null && username.length() > 0){
        if(username.length() < 3 || username.length() > 20 || !username.matches("^[0-9a-z._]*$")){
          errorMessages.add(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("InvalidUserName"));
          LOGGER.info(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("InvalidUserName"));
          return null;
        }
        user.setUsername(username);
      }
     
      if(password != null && password.length() > 0){
        if(password.length() < 3 || password.length() > 15){
          errorMessages.add(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("InvalidPassword"));
          LOGGER.info(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("InvalidPassword"));
          return null;
        }
        user.setPassword(password);
      }
     
      if((username != null && password == null) || (username == null && password != null)){
        errorMessages.add(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("EitherUsernameAndPasswordMustBeProvidedOrNothing"));
        LOGGER.info(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("EitherUsernameAndPasswordMustBeProvidedOrNothing"));
        return null;
      }
     
      if((username == null || username.equals(""))
          && (msisdn == null || msisdn.equals(""))
          && (firstName == null || firstName.equals(""))
          && (lastName == null || lastName.equals(""))
          && (email == null || email.equals("")) ){
        errorMessages.add(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("EitherUsernameOrMsisdnOrFirstnameOrLastnameOrEmailMustBeProvided"));
        LOGGER.info(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("EitherUsernameOrMsisdnOrFirstnameOrLastnameOrEmailMustBeProvided"));
        return null;
      }
     
      if(gender != null){
        try {
          int genderValue = Integer.parseInt(gender);
       
          if (genderValue < 1 || genderValue > 2 ){
            errorMessages.add(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("GenderMustBe1ForMaleOr2ForFemale"));
            LOGGER.info(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("GenderMustBe1ForMaleOr2ForFemale"));
            return null;
          } else {
            user.setGender(genderValue);
          }
        } catch(NumberFormatException e){
          errorMessages.add(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("GenderMustBe1ForMaleOr2ForFemale"));
          LOGGER.info(messages.getString("ErrorInLine") +" " + lineNumber + ": " + messages.getString("GenderMustBe1ForMaleOr2ForFemale"));        
        }
      }
     
      user.setCustomerNumber(customerNumber);
      user.setSalutation(salutation);
      user.setConsultantName(consultantName);
      user.setConsultantOrganization(consultantOrganization);
     
           
      return user;
    }
View Full Code Here

      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());
      permissionMgr.setUserPermissions(entry, user, element.getValue().toArray(new Long[0]));
    }
   
    return mapping.findForward("modified");
  }
View Full Code Here

//      ret.add((User)iter.next());
//    }
  }
 
  public static boolean amIInUserSet(long userId, long setId,Session hibernateSession) {
    User u=findUser(userId, hibernateSession);
    Set<UserSet> us=u.getUserSets();
    for (UserSet userSet : us) {
      if (userSet.getId()==setId) return true;
    }
    return false;
  }
View Full Code Here

    return false;
  }

  public static boolean amIInUserRole(long userId,String roleName,Session hibernateSession) {
    try {
      User u=findUser(userId, hibernateSession);
      Set<Role> roles=u.getRoles();
      for (Role role : roles) {
        if (role.getRolename().equals(roleName)) return true;
      }
    } catch (Exception e) {
    }
View Full Code Here

TOP

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

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.