@Override
public boolean sendNotifications(EmailModel emailModel) {
boolean success = false;
if (emailModel != null) {
try {
DomainUserRequestModel domainUserRequestModel;
Map<String, Object> modelMap = (Map<String, Object>) emailModel.getParams().get("domainUserRequestModel");
if (modelMap != null) {
Map<String, Object> groupModelMap = (Map<String, Object>) modelMap.get("domain");
if (groupModelMap != null) {
domainUserRequestModel = new DomainUserRequestModel();
Integer domainUserRequestId = (Integer) modelMap.get("id");
if (domainUserRequestId != null) {
domainUserRequestModel.setId(domainUserRequestId.longValue());
}
UserModel userModel = null;
Map<String, Object> userModelMap = (Map<String, Object>) modelMap.get("user");
if (userModelMap != null) {
userModel = new UserModel();
userModel.setEmail((String) userModelMap.get("email"));
Integer id = (Integer) userModelMap.get("id");
if (id != null) {
userModel.setId(id.longValue());
}
userModel.setFirstName((String) userModelMap.get("firstName"));
userModel.setLastName((String) userModelMap.get("lastName"));
userModel.setUserName((String) userModelMap.get("userName"));
domainUserRequestModel.setUser(userModel);
}
GroupModel groupModel = new GroupModel();
Integer groupId = (Integer) groupModelMap.get("id");
if (groupId != null) {
groupModel.setId(groupId.longValue());
}
groupModel.setName((String) groupModelMap.get("name"));
domainUserRequestModel.setDomain(groupModel);
domainUserRequestModel.setStatus(Status.valueOf((String) modelMap.get("status")));
if (domainUserRequestModel != null && domainUserRequestModel.getUser() != null) {
success = emailService.sendDomainUserAccessConfirmationEmail(domainUserRequestModel);
}
}
}