本文整理匯總了Java中javax.faces.application.FacesMessage.Severity類的典型用法代碼示例。如果您正苦於以下問題:Java Severity類的具體用法?Java Severity怎麽用?Java Severity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Severity類屬於javax.faces.application.FacesMessage包,在下文中一共展示了Severity類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: decorateBean
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
public void decorateBean() {
doReturn(sdm).when(bean).getServiceDetailsModel();
doNothing().when(bean).addMessage(any(FacesMessage.Severity.class),
anyString());
when(ui.getRequest()).thenReturn(new HttpServletRequestStub());
when(ui.getViewLocale()).thenReturn(Locale.ENGLISH);
when(jsonConverter.getServiceParametersAsJsonString(anyList(), anyBoolean(), anyBoolean())).thenReturn("someJsonString");
model.setService(new Service(new VOService()));
bean.setModel(model);
bean.setConversation(conversation);
bean.setUi(ui);
bean.setUserGroupService(userGroupService);
bean.setSubscriptionService(subscriptionService);
bean.setMenuBean(menuBean);
bean.setSessionBean(sessionBean);
bean.setSubscriptionServiceInternal(subscriptionServiceInternal);
bean.setJsonConverter(jsonConverter);
bean.setUserBean(userBean);
bean.setAccountingService(accountService);
bean.setPaymentAndBillingVisibleBean(pabv);
bean.setSubscriptionUnitCtrl(unitCtrl);
List<UdaRow> udaRows = new ArrayList<>();
model.setSubscriptionUdaRows(udaRows);
}
示例2: selectServiceHIDE_PAYMENT_INFO
import javax.faces.application.FacesMessage.Severity; //導入依賴的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);
}
示例3: testConnection_VerifyFailure
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
@Test
public void testConnection_VerifyFailure() throws Exception {
doReturn(Boolean.FALSE).when(ums).canConnect();
ArgumentCaptor<String> clientId = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<Severity> severity = ArgumentCaptor
.forClass(Severity.class);
ArgumentCaptor<String> key = ArgumentCaptor.forClass(String.class);
doNothing().when(lcc).addMessage(anyString(), any(Severity.class),
anyString());
String result = lcc.testConnection();
verify(lcc, times(1)).addMessage(clientId.capture(),
severity.capture(), key.capture());
assertEquals("", result);
assertNull(clientId.getValue());
assertEquals(FacesMessage.SEVERITY_ERROR, severity.getValue());
assertEquals("error.ldap.connectionfailure", key.getValue());
}
示例4: setup
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
@Before
public void setup() {
bean = spy(new ManageUdaDefinitionBean() {
private static final long serialVersionUID = 1L;
@Override
protected AccountService getAccountingService() {
return delegate;
}
@Override
protected void addMessage(final String clientId,
final FacesMessage.Severity severity, final String key,
final Object[] params) {
facesSeverity = severity;
message = key;
passedParams = params;
}
});
bean.setController(controller);
}
示例5: setup
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
@Before
public void setup() {
accountServiceStub = new AccountServiceStub() {
@Override
public void deleteBillingContact(VOBillingContact billingContact)
throws ObjectNotFoundException,
ConcurrentModificationException,
OperationNotPermittedException {
if (concurrentDeletion) {
// throw exception to simulate concurrent deletion
throw new ObjectNotFoundException();
}
}
};
bean = new BillingContactEditBean();
bean.setAccountService(accountServiceStub);
bean.setBillingContactBean(billingBeanMock);
bean.setBaseBean(baseBean);
doNothing().when(billingBeanMock).setBillingContacts((Set<VOBillingContact>)anySet());
doNothing().when(baseBean).addMessage(anyString(), any(Severity.class), anyString());
}
示例6: setup
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
@Before
public void setup() throws Exception {
nmpb = spy(new NewMarketplaceBean());
mb = mock(MenuBean.class);
mps = mock(MarketplaceService.class);
mts = mock(ManageTenantService.class);
tub = new TenantsUtilBean();
tub.setManageTenantService(mts);
doReturn(mps).when(nmpb).getMarketplaceService();
doNothing().when(nmpb).addMessage(anyString(), any(Severity.class),
anyString(), anyString());
doAnswer(new Answer<VOMarketplace>() {
@Override
public VOMarketplace answer(InvocationOnMock invocation)
throws Throwable {
VOMarketplace mp = (VOMarketplace) invocation.getArguments()[0];
mp.setMarketplaceId("marketplaceId");
return mp;
}
}).when(mps).createMarketplace(any(VOMarketplace.class));
nmpb.menuBean = mb;
}
示例7: getSeverity
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
/**
* メッセージの內容から、メッセージの重要度を決定する.
* @param message
* メッセージ
* @return メッセージの重要度
*/
protected Severity getSeverity(Message message) {
String messageCode = message.getMessageCode();
char mType = messageCode.charAt(0);
switch (mType) {
case 'I':
return FacesMessage.SEVERITY_INFO;
case 'E':
return FacesMessage.SEVERITY_ERROR;
case 'W':
return FacesMessage.SEVERITY_WARN;
case 'F':
return FacesMessage.SEVERITY_FATAL;
default:
throw new IllegalArgumentException(String.format("Severity for %s is undefined.",
messageCode));
}
}
示例8: copyNode
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
/**
*
*
*/
public void copyNode() {
final boolean showCaseMode = Cfg.inst().getProp(PropertiesFile.MAIN_CONFIG, PropBool.SHOWCASE_MODE);
if (!showCaseMode) {
if (exerciseNode != null) {
if (exerciseNode.isExerciseGroup()) {
copyExercise(true);
} else if (exerciseNode.isScenario()) {
copyGroup(true);
}
}
} else {
Severity sev = FacesMessage.SEVERITY_ERROR;
FacesMessage message1 = new FacesMessage(sev, Cfg.inst().getText("EX.SERVER_MESSAGE"), Cfg.inst().getText("SHOWCASE_ERROR"));
FacesContext.getCurrentInstance().addMessage(null, message1);
}
}
示例9: handleSQLScriptUpload
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
/**
*
*
* @param event
*/
public void handleSQLScriptUpload(FileUploadEvent event) {
String folder = "0";
if (scenario != null) {
folder = String.valueOf(scenario.getId());
}
scriptFile = uploader.handleUpload(event, folder);
scriptPath = scriptFile.getName();
Severity sev = FacesMessage.SEVERITY_INFO;
FacesMessage msg = new FacesMessage(sev, Cfg.inst().getProp(DEF_LANGUAGE, "EDIT_SC.UPLOAD_SUCCESS"),
scriptPath != null ? Cfg.inst().getProp(DEF_LANGUAGE, "EDIT_SC.NEW_NAME")
+ ": " + scriptPath : "");
FacesContext.getCurrentInstance().addMessage(null, msg);
scriptStream = uploader.getFileToDownload(scriptFile);
}
示例10: handleImageUpload
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
/**
*
*
* @param event
*/
public void handleImageUpload(FileUploadEvent event) {
String folder = "0";
if (scenario != null) {
folder = String.valueOf(scenario.getId());
}
imageFile = uploader.handleUpload(event, folder);
imagePath = imageFile.getName();
Severity sev = FacesMessage.SEVERITY_INFO;
FacesMessage msg = new FacesMessage(sev, Cfg.inst().getProp(DEF_LANGUAGE, "EDIT_SC.UPLOAD_SUCCESS"),
imagePath != null ? Cfg.inst().getProp(DEF_LANGUAGE, "EDIT_SC.NEW_NAME")
+ ": " + imagePath : "");
FacesContext.getCurrentInstance().addMessage(null, msg);
imageStream = uploader.getFileToDownload(imageFile);
}
示例11: reloadTree
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
/**
*
*
*/
public void reloadTree() {
initTree();
String msg = Cfg.inst().getProp(DEF_LANGUAGE, "ASSERTION.FILTER5");
Severity sev = FacesMessage.SEVERITY_ERROR;
if (countEntries > 0) {
if (countEntries == 1) {
msg = countEntries + " " + Cfg.inst().getProp(DEF_LANGUAGE, "ASSERTION.FILTER3");
} else {
msg = countEntries + " " + Cfg.inst().getProp(DEF_LANGUAGE, "ASSERTION.FILTER2");
}
sev = FacesMessage.SEVERITY_INFO;
}
this.filterMessage = new FacesMessage(sev, Cfg.inst().getProp(DEF_LANGUAGE, "ASSERTION.FILTER1"), msg);
}
示例12: delete
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
/**
*
*
*/
@SuppressWarnings("unused")
public void delete() {
UserEntry userEntry = delRow.getUserEntry();
String message = null;
String details = null;
Severity sev = null;
FacesMessage msg = null;
boolean deleted = false;
if (userEntry != null) {
deleted = userEntryDao.deleteInstance(userEntry);
}
if (deleted) {
sev = FacesMessage.SEVERITY_INFO;
message = Cfg.inst().getProp(DEF_LANGUAGE, "SAVED.SUCCESS");
} else {
sev = FacesMessage.SEVERITY_ERROR;
message = Cfg.inst().getProp(DEF_LANGUAGE, "SAVED.FAIL");
}
initTree();
}
示例13: deleteSelectedRight
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
/**
*
*
*/
public void deleteSelectedRight() {
String message = null;
Severity sev = null;
FacesMessage msg = null;
if (selectedRight != null) {
if (showCaseModeError()) {
sev = FacesMessage.SEVERITY_ERROR;
message = Cfg.inst().getText("SHOWCASE_ERROR_2");
} else if (userRightDao.deleteInstance(selectedRight)) {
rights.remove(selectedRight);
selectedRight = null;
sev = FacesMessage.SEVERITY_INFO;
message = Cfg.inst().getProp(DEF_LANGUAGE, "RIGHTS.RIGHTS_REMOVED");
}
}
msg = new FacesMessage(sev, message, null);
FacesContext.getCurrentInstance().addMessage(null, msg);
}
示例14: toggleAssertRight
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
/**
*
*
* @param rightToModify
*/
public void toggleAssertRight(UserRight rightToModify) {
if (rightToModify != null) {
String message = null;
String details = null;
Severity sev = null;
FacesMessage msg = null;
if (showCaseModeError(rightToModify)) {
sev = FacesMessage.SEVERITY_ERROR;
message = Cfg.inst().getText("SHOWCASE_ERROR_2");
} else if (!userRights.isAdmin(rightToModify.getUser())
&& !userRights.isLecturer(rightToModify.getUser())) {
rightToModify.setHasRatingRights(!rightToModify.getHasRatingRights());
userRightDao.updateInstance(rightToModify);
}
if (sev != null && message != null) {
msg = new FacesMessage(sev, message, details);
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
}
示例15: toggleScenarioEditingRight
import javax.faces.application.FacesMessage.Severity; //導入依賴的package包/類
/**
*
*
* @param rightToModify
*/
public void toggleScenarioEditingRight(UserRight rightToModify) {
if (rightToModify != null) {
String message = null;
String details = null;
Severity sev = null;
FacesMessage msg = null;
if (showCaseModeError(rightToModify)) {
sev = FacesMessage.SEVERITY_ERROR;
message = Cfg.inst().getText("SHOWCASE_ERROR_2");
} else {
boolean newValue = !rightToModify.getHasScenarioEditingRights();
rightToModify.setHasScenarioEditingRights(newValue);
if (newValue) {
rightToModify.setHasGroupEditingRights(true);
}
userRightDao.updateInstance(rightToModify);
}
if (sev != null && message != null) {
msg = new FacesMessage(sev, message, details);
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
}