本文整理汇总了Java中play.i18n.Messages.get方法的典型用法代码示例。如果您正苦于以下问题:Java Messages.get方法的具体用法?Java Messages.get怎么用?Java Messages.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.i18n.Messages
的用法示例。
在下文中一共展示了Messages.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import play.i18n.Messages; //导入方法依赖的package包/类
/**
* Validate the authentication.
*
* @return null if validation ok, string with details otherwise
*/
public String validate() {
User user = null;
try {
user = User.authenticate(email, password);
} catch (AppException e) {
return Messages.get("error.technical");
}
if (user == null) {
return Messages.get("invalid.user.or.password");
} else if (!user.validated) {
return Messages.get("account.not.validated.check.mail");
}
return null;
}
示例2: sendMail
import play.i18n.Messages; //导入方法依赖的package包/类
/**
* Send the Email to confirm ask new password.
*
* @param user the current user
* @param type token type
* @param email email for a change email token
* @throws java.net.MalformedURLException if token is wrong.
*/
private void sendMail(User user, TypeToken type, String email, MailerClient mc) throws MalformedURLException {
Token token = getNewToken(user, type, email);
String externalServer = Configuration.root().getString("server.hostname");
String subject = null;
String message = null;
String toMail = null;
// Should use reverse routing here.
String urlString = urlString = "http://" + externalServer + "/" + type.urlPath + "/" + token.token;
URL url = new URL(urlString); // validate the URL
switch (type) {
case password:
subject = Messages.get("mail.reset.ask.subject");
message = Messages.get("mail.reset.ask.message", url.toString());
toMail = user.email;
break;
case email:
subject = Messages.get("mail.change.ask.subject");
message = Messages.get("mail.change.ask.message", url.toString());
toMail = token.email; // == email parameter
break;
}
Logger.debug("sendMailResetLink: url = " + url);
Mail.Envelop envelop = new Mail.Envelop(subject, message, toMail);
Mail mailer = new Mail(mc);
mailer.sendMail(envelop);
}
示例3: sendFailedPasswordResetAttempt
import play.i18n.Messages; //导入方法依赖的package包/类
/**
* Sends an email to say that the password reset was to an invalid email.
*
* @param email the email address to send to.
*/
private void sendFailedPasswordResetAttempt(String email) {
String subject = Messages.get("mail.reset.fail.subject");
String message = Messages.get("mail.reset.fail.message", email);
Mail.Envelop envelop = new Mail.Envelop(subject, message, email);
Mail mailer = new Mail(mailerClient);
mailer.sendMail(envelop);
}
示例4: sendPasswordChanged
import play.i18n.Messages; //导入方法依赖的package包/类
/**
* Send mail with the new password.
*
* @param user user created
* @throws EmailException Exception when sending mail
*/
private void sendPasswordChanged(User user) throws EmailException {
String subject = Messages.get("mail.reset.confirm.subject");
String message = Messages.get("mail.reset.confirm.message");
Mail.Envelop envelop = new Mail.Envelop(subject, message, user.email);
Mail mailer = new Mail(mailerClient);
mailer.sendMail(envelop);
}
示例5: sendMailAskForConfirmation
import play.i18n.Messages; //导入方法依赖的package包/类
/**
* Send the welcome Email with the link to confirm.
*
* @param user user created
* @throws EmailException Exception when sending mail
*/
private void sendMailAskForConfirmation(User user) throws EmailException, MalformedURLException {
String subject = Messages.get("mail.confirm.subject");
String urlString = "http://" + Configuration.root().getString("server.hostname");
urlString += "/confirm/" + user.confirmationToken;
URL url = new URL(urlString); // validate the URL, will throw an exception if bad.
String message = Messages.get("mail.confirm.message", url.toString());
Mail.Envelop envelop = new Mail.Envelop(subject, message, user.email);
Mail mailer = new Mail(mailerClient);
mailer.sendMail(envelop);
}
示例6: sendMailConfirmation
import play.i18n.Messages; //导入方法依赖的package包/类
/**
* Send the confirm mail.
*
* @param user user created
* @throws EmailException Exception when sending mail
*/
private void sendMailConfirmation(User user) throws EmailException {
String subject = Messages.get("mail.welcome.subject");
String message = Messages.get("mail.welcome.message");
Mail.Envelop envelop = new Mail.Envelop(subject, message, user.email);
Mail mailer = new Mail(mailerClient);
mailer.sendMail(envelop);
}
示例7: createTimeOffForGivenType
import play.i18n.Messages; //导入方法依赖的package包/类
private void createTimeOffForGivenType(int userId, TimeOffType type, DateTime from, DateTime to, String comment) throws Exception {
switch(type) {
case HOLIDAY:
_timeTracking.requestHoliday(userId, from, to, comment);
break;
case BUSINESS_TRIP:
_timeTracking.takeBusinessTrip(userId, from, to, comment);
break;
case EDUCATIONAL_LEAVE:
_timeTracking.requestEducationalLeave(userId, from, to, comment);
break;
case PARENTAL_LEAVE:
_timeTracking.takeParentalLeave(userId, from, to, comment);
break;
case SICK_LEAVE:
_timeTracking.takeSickLeave(userId, from, to, comment);
break;
case SPECIAL_HOLIDAY:
_timeTracking.requestSpecialHoliday(userId, from, to, comment);
break;
case BANK_HOLIDAY:
_timeTracking.createBankHoliday(userId, from, to, comment);
break;
default:
throw new IllegalArgumentException(Messages.get("exceptions.timeoff.error_timeoff_type_unknown") + " : " + type);
}
}
示例8: deleteTimeTrack
import play.i18n.Messages; //导入方法依赖的package包/类
@RequiresAuthentication(clientName = "default", authorizerName = "admin")
public Result deleteTimeTrack(int timetrackId, int userId, String from, String to) throws Exception {
CommonProfile profile = getUserProfile();
int currentUserId = Integer.parseInt(profile.getId());
TimeTrack timeTrack = _timeTracking.readTimeTrackById(timetrackId);
String message = Messages.get("notifications.deleted_timetrack",
profile.getFirstName() + " " + profile.getFamilyName(),
DateTimeUtils.dateTimeToDateString(timeTrack.getFrom())
);
_timeTracking.deleteTimeTrack(timeTrack, currentUserId, message);
return redirect(routes.TimeTrackController.readTimeTracks(userId, from, to));
}
示例9: timeOffToString
import play.i18n.Messages; //导入方法依赖的package包/类
public static String timeOffToString(TimeOffType type) {
String result = null;
switch (type) {
case HOLIDAY:
result = Messages.get("views.timeoff.create.holiday");
break;
case SPECIAL_HOLIDAY:
result = Messages.get("views.timeoff.create.specialholiday");
break;
case SICK_LEAVE:
result = Messages.get("views.timeoff.create.sickleave");
break;
case PARENTAL_LEAVE:
result = Messages.get("views.timeoff.create.parentalleave");
break;
case EDUCATIONAL_LEAVE:
result = Messages.get("views.timeoff.create.educationalleave");
break;
case BUSINESS_TRIP:
result = Messages.get("views.timeoff.create.businesstrip");
break;
case BANK_HOLIDAY:
result = Messages.get("views.timeoff.create.bankholiday");
break;
default:
throw new IllegalArgumentException(Messages.get("exceptions.timeoff.error_timeoff_type_unknown") + " : " + type);
}
return result;
}
示例10: timeOffInvalidInformation
import play.i18n.Messages; //导入方法依赖的package包/类
private InformationViewModel timeOffInvalidInformation(Notification notification) {
return new InformationViewModel(
notification.getId(),
Messages.get("notifications.information_timeoffinvalid"),
notification.getSender().getFirstName() + " " + notification.getSender().getLastName(),
_timeTracking
);
}
示例11: updateConnections
import play.i18n.Messages; //导入方法依赖的package包/类
public static void updateConnections(Api api, List<DatabaseConnection> connections, List<DatabaseIQN> iqns, boolean revert, OperationListener listener) throws ConnectionUpdateException {
if (connections.isEmpty() && iqns.isEmpty()) {
throw new ConnectionUpdateException(Messages.get("drp.db.noconnections"));
}
listener.onMessage(null, Messages.get("drp.db.currentconnections"), OperationListener.MessageType.INFO);
listConnections(api, listener);
updateConnections(api, connections, revert);
updateIQN(api, iqns, revert);
listener.onMessage(null, Messages.get("drp.db.modifiedconnections"), OperationListener.MessageType.SUCCESS);
listConnections(api, listener);
}
示例12: getHeader
import play.i18n.Messages; //导入方法依赖的package包/类
@Override
public String getHeader() {
return Messages.get("notifications.holidaypayout");
}
示例13: getHeader
import play.i18n.Messages; //导入方法依赖的package包/类
@Override
public String getHeader() {
return Messages.get("notifications.holiday");
}
示例14: getVerifyEmailMailingSubject
import play.i18n.Messages; //导入方法依赖的package包/类
@Override
protected String getVerifyEmailMailingSubject(
final MyUsernamePasswordAuthUser user, final Context ctx) {
return Messages.get("songs.password.verify_signup.subject");
}
示例15: getPasswordResetMailingSubject
import play.i18n.Messages; //导入方法依赖的package包/类
protected String getPasswordResetMailingSubject(final User user,
final Context ctx) {
return Messages.get("songs.password.reset_email.subject");
}