本文整理汇总了Java中javax.faces.application.FacesMessage类的典型用法代码示例。如果您正苦于以下问题:Java FacesMessage类的具体用法?Java FacesMessage怎么用?Java FacesMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FacesMessage类属于javax.faces.application包,在下文中一共展示了FacesMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _getMaximumMessage
import javax.faces.application.FacesMessage; //导入依赖的package包/类
private FacesMessage _getMaximumMessage(
FacesContext context,
UIComponent component,
Object value,
Object max)
{
Object msg = _getRawMaximumMessageDetail();
Object label = ValidatorUtils.getComponentLabel(component);
Object[] params = {label, value, max};
return MessageFactory.getMessage(context,
MAXIMUM_MESSAGE_ID,
msg,
params,
component);
}
示例2: save
import javax.faces.application.FacesMessage; //导入依赖的package包/类
/**
* Save the current organization and user profile
*
* @return the logical outcome.
* @throws SaaSApplicationException
* @throws ImageException
* Thrown in case the access to the uploaded file failed.
*/
public String save() throws SaaSApplicationException {
VOUserDetails user = null;
if (currentUser != null) {
user = currentUser.getVOUserDetails();
}
getAccountingService().updateAccountInformation(organization, user,
getMarketplaceId(), getImageUploader().getVOImageResource());
currentUser = null;
if (user != null) {
// update the value object in the session
setUserInSession(getCurrentUser().getVOUserDetails());
addMessage(null, FacesMessage.SEVERITY_INFO,
INFO_USER_PROFILE_SAVED, getUserFromSession().getUserId());
} else if (organization != null) {
addMessage(null, FacesMessage.SEVERITY_INFO,
INFO_ORGANIZATION_SAVED, getUserFromSession()
.getOrganizationId());
}
organization = null; // load the organization again
return OUTCOME_SUCCESS;
}
示例3: cadastrarCategoria
import javax.faces.application.FacesMessage; //导入依赖的package包/类
public void cadastrarCategoria(){
NetgifxCommand command = new NetgifxCommand();
if (command.buscarCategoria(descricaoCategoria) == null) {
command.cadastrarCategoria(new Categoria(descricaoCategoria));
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,
"Categoria cadastrada com sucesso!", "Categoria cadastrada com sucesso!"));
this.descricaoCategoria = null;
} else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Categoria j� cadastrada!", "Categoria j� cadastrada!"));
}
}
示例4: cadastrarUsuario
import javax.faces.application.FacesMessage; //导入依赖的package包/类
public void cadastrarUsuario(){
NetgifxCommand command = new NetgifxCommand();
if(command.buscarUsuario(usuario.getApelido()) == null){
command.cadastrarUsuario(usuario);
FacesContext.getCurrentInstance().addMessage(
null, new FacesMessage(FacesMessage.SEVERITY_INFO,
"Usu�rio cadastrado com sucesso!", "Usu�rio cadastrado com sucesso!"));
this.usuario = new Usuario();
}else{
FacesContext.getCurrentInstance().addMessage(
null, new FacesMessage(FacesMessage.SEVERITY_ERROR,
"J� existe cadastro com este apelido!", "J� existe cadastro com este apelido!"));
}
}
示例5: deleteMarketplace
import javax.faces.application.FacesMessage; //导入依赖的package包/类
/**
* Deletes a marketplace.
*/
public String deleteMarketplace() throws SaaSApplicationException {
try {
if (isTokenValid()) {
getMarketplaceService().deleteMarketplace(
marketplace.getMarketplaceId());
addMessage(null, FacesMessage.SEVERITY_INFO,
INFO_MARKETPLACE_DELETED,
marketplace.getMarketplaceId());
resetToken();
}
} finally {
checkMarketplaceDropdownAndMenuVisibility(null);
}
return null;
}
示例6: xmlImport
import javax.faces.application.FacesMessage; //导入依赖的package包/类
/**
* Import an XML file with technical service definitions
*
* @return the logical outcome.
* @throws SaaSApplicationException
* Thrown from the business logic.
*/
public String xmlImport() throws SaaSApplicationException {
if (PartHandler.isEmpty(uploadedFile)) {
addMessage(null, FacesMessage.SEVERITY_ERROR, ERROR_EMPTY_FILE);
return OUTCOME_ERROR;
}
try {
byte[] buffer = PartHandler.getBuffer(uploadedFile);
getProvisioningService().importTechnicalServices(buffer);
selectedTechnicalService = null;
technicalServices = null;
addMessage(null, FacesMessage.SEVERITY_INFO,
INFO_TECH_SERVICE_IMPORTED);
} catch (IOException e) {
ImportException ex = new ImportException(e.getLocalizedMessage());
logger.logError(Log4jLogger.SYSTEM_LOG, ex,
LogMessageIdentifier.ERROR_IMPORT_XML_FAILED);
throw ex;
}
return OUTCOME_SUCCESS;
}
示例7: message
import javax.faces.application.FacesMessage; //导入依赖的package包/类
/**
* <p>Add a localized message to the
* <code>FacesContext</code> for the current request.</p>
*
* @param clientId Client identifier of the component this message relates
* to, or <code>null</code> for global messages
* @param key Message key of the message to include
*/
protected void message(String clientId, String key) {
// Look up the requested message text
String text;
try {
ResourceBundle bundle = ResourceBundle.getBundle(
"javaeetutorial.dukesbookstore.web.messages.Messages",
context().getViewRoot().getLocale());
text = bundle.getString(key);
} catch (Exception e) {
text = "???" + key + "???";
}
// Construct and add a FacesMessage containing it
context().addMessage(clientId, new FacesMessage(text));
}
示例8: importUsers_MessageOnInvalidMail
import javax.faces.application.FacesMessage; //导入依赖的package包/类
/**
* Bug 9177 - show a more specific error message on import error with user
* with leading/trailing blanks on email.
*/
@Test
public void importUsers_MessageOnInvalidMail() throws Exception {
final String email = " [email protected] ";
// given
givenClassicPortalUserAndRoleSelection();
willThrow(
new ValidationException(ReasonEnum.EMAIL, "email",
new Object[] { email })).given(identityService)
.importLdapUsers(anyListOf(VOUserDetails.class), anyString());
// when
bean.importUsers();
// then
verify(bb, times(1)).addMessage(eq((String) null),
eq(FacesMessage.SEVERITY_ERROR),
eq(UserImportBean.ERROR_IMPORT_EMAIL), eq(email));
}
示例9: selectServiceHIDE_PAYMENT_INFO
import javax.faces.application.FacesMessage; //导入依赖的package包/类
@Test
public void selectServiceHIDE_PAYMENT_INFO() {
// given
initDataForSelectServiceWithoutParams();
doNothing().when(bean).addMessage(any(FacesMessage.Severity.class),
anyString());
doReturn(true).when(subscriptionService).isPaymentInfoHidden();
VOUserDetails voUserDetails = new VOUserDetails();
voUserDetails.setKey(1000L);
Set<UserRoleType> userRoles = new HashSet<>();
userRoles.add(UserRoleType.ORGANIZATION_ADMIN);
voUserDetails.setUserRoles(userRoles);
doReturn(voUserDetails).when(ui).getUserFromSessionWithoutException();
VOSubscriptionDetails subscription = new VOSubscriptionDetails();
bean.getModel().setSubscription(subscription);
// when
String result = bean.selectService();
// then
assertEquals("success", result);
}
示例10: upload
import javax.faces.application.FacesMessage; //导入依赖的package包/类
public void upload(VOServiceDetails service) {
try {
PriceModel priceModel = getExternalPriceModelService()
.getExternalPriceModelForService(service);
if (priceModel == null) {
throw new ExternalPriceModelException();
}
loadPriceModelContent(priceModel);
addMessage(null, FacesMessage.SEVERITY_INFO,
INFO_EXTERNAL_PRICE_UPLOADED);
} catch (ExternalPriceModelException e) {
addMessage(null, FacesMessage.SEVERITY_ERROR,
ERROR_EXTERNAL_PRICEMODEL_NOT_AVAILABLE);
}
}
示例11: getInitialize_Success
import javax.faces.application.FacesMessage; //导入依赖的package包/类
@Test
public void getInitialize_Success() throws Exception {
// given
ctrl.setModel(null);
List<ServiceInstance> serviceInstances = givenServiceInstances();
EnumSet<InstanceOperation> operaions = EnumSet.of(
InstanceOperation.DELETE, InstanceOperation.RESUME);
doReturn(session).when(request).getSession();
doReturn("1").when(session).getAttribute(
SessionConstants.SESSION_CTRL_ID);
doReturn(serviceInstances).when(serviceInstanceService)
.getInstancesForController(anyString());
doReturn(operaions).when(serviceInstanceService)
.listOperationsForInstance(any(ServiceInstance.class));
// when
ctrl.getInitialize();
// then
verify(facesContext, times(0)).addMessage(anyString(),
any(FacesMessage.class));
}
示例12: delete
import javax.faces.application.FacesMessage; //导入依赖的package包/类
/**
* Delete the current organization
*
* @return the logical outcome.
* @throws DeletionConstraintException
* Thrown if the organization has active subscriptions
*/
public String delete() throws DeletionConstraintException {
if (logger.isDebugLoggingEnabled()) {
}
try {
getAccountingService().deregisterOrganization();
} catch (TechnicalServiceNotAliveException
| TechnicalServiceOperationException e) {
logger.logError(Log4jLogger.SYSTEM_LOG, e,
LogMessageIdentifier.ERROR_ORGANIZATION_DELETION_FAILED);
addMessage(null, FacesMessage.SEVERITY_ERROR,
ERROR_DELETE_USER_FROM_EXPIRED_SUBSCRIPTION);
return "";
}
if (logger.isDebugLoggingEnabled()) {
}
return OUTCOME_LOGIN;
}
示例13: initSpecificSets
import javax.faces.application.FacesMessage; //导入依赖的package包/类
@Override
protected void initSpecificSets(boolean reset) {
moneyTransferModel.setProbandId(in.getProbandId());
moneyTransferModel.updateRowCount();
filterBankAccounts = new ArrayList<SelectItem>(bankAccounts);
filterBankAccounts.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
filterTrials = WebUtil.getReimbursementTrials(probandId, null, null, null);
filterTrials.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
reimbursementTrials = WebUtil.getReimbursementTrials(probandId, null, payOffPaymentMethod, false);
filterCostTypes = WebUtil.getMoneyTransferFilterCostTypes(null, null, null, probandId);
openSummary = WebUtil.getProbandOpenReimbursementSummary(null, probandId, payOffPaymentMethod);
proband = WebUtil.getProband(this.in.getProbandId(), null, null, null);
trial = WebUtil.getTrial(this.in.getTrialId());
if (proband != null) { // this bean is postconstructed for soem reason
if (!WebUtil.isProbandPerson(proband)) {
Messages.addLocalizedMessage(FacesMessage.SEVERITY_INFO, MessageCodes.PROBAND_NOT_PERSON);
} else {
if (WebUtil.isProbandLocked(proband)) {
Messages.addLocalizedMessage(FacesMessage.SEVERITY_WARN, MessageCodes.PROBAND_LOCKED);
}
if (WebUtil.isTrialLocked(trial)) {
Messages.addLocalizedMessage(FacesMessage.SEVERITY_WARN, MessageCodes.TRIAL_LOCKED);
}
}
}
}
示例14: _getDefaultFacesMessageBundle
import javax.faces.application.FacesMessage; //导入依赖的package包/类
private static ResourceBundle _getDefaultFacesMessageBundle(
Locale locale,
ClassLoader loader
)
{
ResourceBundle bundle = null;
try
{
bundle =
ResourceBundle.getBundle(FacesMessage.FACES_MESSAGES, locale, loader);
}
catch (MissingResourceException missingResource)
{
_LOG.severe("UNABLE_LOAD_FACES_BUNDLE", FacesMessage.FACES_MESSAGES);
_LOG.severe(missingResource);
}
return bundle;
}
示例15: showBillingData
import javax.faces.application.FacesMessage; //导入依赖的package包/类
public String showBillingData() throws IOException {
if (model.getBillingData() == null) {
JSFUtils.addMessage(null, FacesMessage.SEVERITY_ERROR,
ERROR_SHOW_BILLING_DATA, null);
logger.logError(LogMessageIdentifier.ERROR_EXECUTE_SHOW_BILLING_DATA_WITH_NULL_DATA);
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd");
String filename = sdf.format(Calendar.getInstance().getTime())
+ "_BillingData.xml";
String contentType = "text/xml";
JSFUtils.writeContentToResponse(model.getBillingData(), filename,
contentType);
return "success";
}