}
String summarySource = source + SUMMARY_MESSAGE_KEY;
MessageResolver summaryResolver;
if (message.getSeverity() == FacesMessage.SEVERITY_INFO) {
summaryResolver = new MessageBuilder().source(summarySource).defaultText(summaryText.toString()).info()
.build();
} else if (message.getSeverity() == FacesMessage.SEVERITY_WARN) {
summaryResolver = new MessageBuilder().source(summarySource).defaultText(summaryText.toString()).warning()
.build();
} else if (message.getSeverity() == FacesMessage.SEVERITY_ERROR) {
summaryResolver = new MessageBuilder().source(summarySource).defaultText(summaryText.toString()).error()
.build();
} else {
summaryResolver = new MessageBuilder().source(summarySource).defaultText(summaryText.toString()).fatal()
.build();
}
context.getMessageContext().addMessage(summaryResolver);
StringBuffer detailText = new StringBuffer();
if (StringUtils.hasText(message.getDetail())) {
detailText.append(message.getDetail());
}
String detailSource = source + DETAIL_MESSAGE_KEY;
MessageResolver detailResolver;
if (message.getSeverity() == FacesMessage.SEVERITY_INFO) {
detailResolver = new MessageBuilder().source(detailSource).defaultText(detailText.toString()).info()
.build();
} else if (message.getSeverity() == FacesMessage.SEVERITY_WARN) {
detailResolver = new MessageBuilder().source(detailSource).defaultText(detailText.toString()).warning()
.build();
} else if (message.getSeverity() == FacesMessage.SEVERITY_ERROR) {
detailResolver = new MessageBuilder().source(detailSource).defaultText(detailText.toString()).error()
.build();
} else {
detailResolver = new MessageBuilder().source(detailSource).defaultText(detailText.toString()).fatal()
.build();
}
context.getMessageContext().addMessage(detailResolver);
}