emailCommandEntry.setDestinationPersonalName(null);
break;
case 1: // message to user set
Long userSetId = f.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);
}
emailCommandEntry.setDestinationUserSet(userSet);
emailCommandEntry.setCurrentUserSetAsDestination(userSetId == -2 ? 1 : 0);
emailCommandEntry.setDestinationUser(null);
emailCommandEntry.setDestinationEmail(null);
emailCommandEntry.setDestinationPersonalName(null);
break;
case 2: // message to user
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);
emailCommandEntry.setDestinationEmail(null);
emailCommandEntry.setDestinationPersonalName(null);
break;
case 3: // message to e-mail
emailCommandEntry.setDestinationEmail(f.getToEmail());
emailCommandEntry.setDestinationPersonalName(f.getToPersonalName());
emailCommandEntry.setDestinationUserSet(null);
emailCommandEntry.setDestinationUser(null);
break;
default:
throw new BugException("illegal destination selection number");
}
return emailCommandEntry;
}