Locale pervLocale = localeSelector.getLocale();
localeSelector.setLocale(new Locale("en"));
try {
if (emailType.equals(EMAIL_TYPE_CONTACT_ADMIN)) {
EmailStrategy strategy = new ContactAdminEmailStrategy(
fromLoginName, fromName, replyEmail,
subject, htmlMessage);
String msg = emailServiceImpl.sendToAdmins(strategy);
FacesMessages.instance().add(msg);
conversationScopeMessages.setMessage(
FacesMessage.SEVERITY_INFO, msg);
return SUCCESS;
} else if (emailType.equals(EMAIL_TYPE_CONTACT_COORDINATOR)) {
String localeNativeName = locale.retrieveNativeName();
EmailStrategy strategy = new ContactLanguageCoordinatorEmailStrategy(
fromLoginName, fromName, replyEmail, subject,
locale.getLocaleId().getId(),
localeNativeName, htmlMessage);
String msg = emailServiceImpl.sendToLanguageCoordinators(
locale, strategy);
FacesMessages.instance().add(msg);
conversationScopeMessages.setMessage(
FacesMessage.SEVERITY_INFO, msg);
return SUCCESS;
} else if (emailType.equals(EMAIL_TYPE_REQUEST_JOIN)) {
String localeNativeName = locale.retrieveNativeName();
EmailStrategy strategy = new RequestToJoinLanguageEmailStrategy(
fromLoginName, fromName, replyEmail,
locale.getLocaleId().getId(),
localeNativeName, htmlMessage,
languageJoinUpdateRoleAction.getRequestAsTranslator(),
languageJoinUpdateRoleAction.getRequestAsReviewer(),
languageJoinUpdateRoleAction.getRequestAsCoordinator());
String msg = emailServiceImpl.sendToLanguageCoordinators(
locale, strategy);
FacesMessages.instance().add(msg);
conversationScopeMessages.setMessage(
FacesMessage.SEVERITY_INFO, msg);
return SUCCESS;
} else if (emailType.equals(EMAIL_TYPE_REQUEST_ROLE)) {
String localeNativeName = locale.retrieveNativeName();
EmailStrategy strategy = new RequestRoleLanguageEmailStrategy(
fromLoginName, fromName, replyEmail,
locale.getLocaleId().getId(),
localeNativeName, htmlMessage,
languageJoinUpdateRoleAction.requestingTranslator(),
languageJoinUpdateRoleAction.requestingReviewer(),
languageJoinUpdateRoleAction.requestingCoordinator());
String msg = emailServiceImpl.sendToLanguageCoordinators(
locale, strategy);
FacesMessages.instance().add(msg);
conversationScopeMessages.setMessage(
FacesMessage.SEVERITY_INFO, msg);
return SUCCESS;
} else if (emailType.equals(EMAIL_TYPE_REQUEST_TO_JOIN_GROUP)) {
String groupSlug = versionGroupJoinAction.getSlug();
String groupName = versionGroupJoinAction.getGroupName();
Collection<ProjectIterationId> projectIterIds = Lists.newArrayList();
for (VersionGroupJoinAction.SelectableProject version : versionGroupJoinAction.getProjectVersions()) {
if (version.isSelected()) {
HProjectIteration projIter =
version.getProjectIteration();
projectIterIds.add(new ProjectIterationId(
projIter.getProject().getSlug(),
projIter.getSlug(),
projIter.getProjectType()));
}
}
EmailStrategy strategy = new RequestToJoinVersionGroupEmailStrategy(
fromLoginName, fromName, replyEmail,
groupName, groupSlug,
projectIterIds, htmlMessage);
String msg =
emailServiceImpl