本文整理汇总了Java中org.springframework.extensions.surf.util.I18NUtil.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java I18NUtil.getMessage方法的具体用法?Java I18NUtil.getMessage怎么用?Java I18NUtil.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.extensions.surf.util.I18NUtil
的用法示例。
在下文中一共展示了I18NUtil.getMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateFolderLink
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
/**
* Tests the creation of a folder link
*
* @throws Exception
*/
public void testCreateFolderLink() throws Exception
{
// create a link of file site1File1_1 in folder site1Folder2
NodeRef linkNodeRef = documentLinkService.createDocumentLink(site1Folder1, site1Folder2);
assertNotNull(linkNodeRef);
// test if the link node is listed as a child of site1Folder2
String site1Folder1LinkName = I18NUtil.getMessage("doclink_service.link_to_label", (site1Folder1Name + ".url"));
NodeRef linkNodeRef2 = fileFolderService.searchSimple(site1Folder2, site1Folder1LinkName);
assertNotNull(linkNodeRef2);
assertEquals(linkNodeRef, linkNodeRef2);
// check the type of the link
assertEquals(nodeService.getType(linkNodeRef), ApplicationModel.TYPE_FOLDERLINK);
// check if the link destination is site1File1_1
NodeRef linkDestination = documentLinkService.getLinkDestination(linkNodeRef);
assertNotNull(linkDestination);
assertEquals(linkDestination, site1Folder1);
}
示例2: resolveMessage
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
private String resolveMessage(String messageId, Object[] params)
{
String message = I18NUtil.getMessage(messageId, params);
if (message == null)
{
message = messageId;
if (params != null)
{
message += " - " + Arrays.toString(params);
}
}
return message;
}
示例3: applyInternal
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
@Override
protected String applyInternal() throws Exception
{
StoreRef storeRef = importerBootstrap.getStoreRef();
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
List<NodeRef> results = searchService.selectNodes(rootNodeRef, copyPath, null, namespaceService, true);
if (results.size() > 1)
{
throw new PatchException(ERR_MULTIPLE_FOUND, copyPath);
}
else if (results.size() == 1)
{
makeCopy(results.get(0));
return I18NUtil.getMessage(MSG_CREATED);
}
return null;
}
示例4: describe
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
@Override
public String describe()
{
if (matches.size() > SHOW_MAX_MATCHES)
{
return I18NUtil.getMessage(
"system.schema_comp.redundant_obj.many_matches",
matches.size(),
dbObject,
describeMatches(),
matches.size() - SHOW_MAX_MATCHES);
}
else
{
return I18NUtil.getMessage(
"system.schema_comp.redundant_obj",
matches.size(),
dbObject,
describeMatches());
}
}
示例5: evaluateSingleValue
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
protected void evaluateSingleValue(Object value)
{
// convert the value to a String
String valueStr = DefaultTypeConverter.INSTANCE.convert(String.class, value);
Matcher matcher = patternMatcher.matcher(valueStr);
boolean matches = matcher.matches();
if (matches != requiresMatch)
{
// Look for a message corresponding to this constraint name
String messageId = CONSTRAINT_REGEX_MSG_PREFIX + getShortName();
if (I18NUtil.getMessage(messageId, value) != null)
{
throw new ConstraintException(messageId, value);
}
// Otherwise, fall back to a generic (but unfriendly) message
else if (requiresMatch)
{
throw new ConstraintException(RegexConstraint.CONSTRAINT_REGEX_NO_MATCH, value, expression);
}
else
{
throw new ConstraintException(RegexConstraint.CONSTRAINT_REGEX_MATCH, value, expression);
}
}
}
示例6: applyInternal
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
@Override
protected String applyInternal() throws Exception
{
List<NodeRef> refs = searchService.selectNodes(
repository.getRootHome(),
target,
null,
namespaceService,
false);
if (refs.size() < 1)
{
// skip as it can be deleted
return I18NUtil.getMessage(MSG_SKIP);
}
else
{
updateContent(refs.get(0));
}
return I18NUtil.getMessage(MSG_SUCCESS);
}
示例7: getMessage
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
@Override
public String getMessage()
{
String message = I18NUtil.getMessage(getKey(), getArgs());
if(message == null)
{
return key;
}
return message;
}
示例8: applyInternal
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
@Override
protected String applyInternal() throws Exception
{
// NOTE: SiteService is not currently MT-enabled (eg. getSiteRoot) so skip if applied to tenant
if (AuthenticationUtil.isRunAsUserTheSystemUser() || !AuthenticationUtil.isMtEnabled())
{
// Set all the sites in the repository
List<SiteInfo> sites = this.siteService.listSites(null, null);
renameDispayNames(sites);
}
// Report status
return I18NUtil.getMessage(SUCCESS_MSG);
}
示例9: validateImportedM2Model
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
private void validateImportedM2Model(M2Model m2Model)
{
List<M2Namespace> namespaces = m2Model.getNamespaces();
if (namespaces.size() > 1)
{
throw new ConstraintViolatedException(I18NUtil.getMessage("cmm.rest_api.model.import_namespace_multiple_found", namespaces.size()));
}
else if (namespaces.isEmpty())
{
throw new ConstraintViolatedException("cmm.rest_api.model.import_namespace_undefined");
}
checkUnsupportedModelElements(m2Model.getTypes());
checkUnsupportedModelElements(m2Model.getAspects());
}
示例10: getBaseTemplate
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
@Override
protected NodeRef getBaseTemplate()
{
List<NodeRef> refs = searchService.selectNodes(
repository.getRootHome(),
XPATH,
null,
namespaceService,
false);
if (refs.size() != 1)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage("patch.updateFollowingEmailTemplatesPatch.error"));
}
return refs.get(0);
}
示例11: resolveMessage
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
/**
* Resolves the message id to the localised string.
* <p>
* If a localised message can not be found then the message Id is
* returned.
*
* @param messageId the message Id
* @param params message parameters
* @return the localised message (or the message id if none found)
*/
private static String resolveMessage(String messageId, Object[] params)
{
String message = I18NUtil.getMessage(messageId, params);
if (message == null)
{
// If a localized string cannot be found then return the messageId and the params
message = messageId;
if (params != null)
{
message += " - " + Arrays.toString(params);
}
}
return buildErrorLogNumber(message);
}
示例12: getUrls
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
/**
* Retrieve registered search engines
*
* @return set of search engines
*/
private Set<UrlTemplate> getUrls(String urlType)
{
if (logger.isDebugEnabled())
logger.debug("Search Engine parameters: urltype=" + urlType);
Set<UrlTemplate> urls = new HashSet<UrlTemplate>();
Config config = configService.getConfig("OpenSearch");
OpenSearchConfigElement searchConfig = (OpenSearchConfigElement)config.getConfigElement(OpenSearchConfigElement.CONFIG_ELEMENT_ID);
for (OpenSearchConfigElement.EngineConfig engineConfig : searchConfig.getEngines())
{
Map<String, String> engineUrls = engineConfig.getUrls();
for (Map.Entry<String, String> engineUrl : engineUrls.entrySet())
{
String type = engineUrl.getKey();
String url = searchProxy.createUrl(engineConfig, type);
if ((urlType.equals(URL_ARG_ALL)) ||
(urlType.equals(URL_ARG_DESCRIPTION) && type.equals(MimetypeMap.MIMETYPE_OPENSEARCH_DESCRIPTION)) ||
(urlType.equals(URL_ARG_TEMPLATE) && !type.equals(MimetypeMap.MIMETYPE_OPENSEARCH_DESCRIPTION)))
{
String label = engineConfig.getLabel();
String labelId = engineConfig.getLabelId();
if (labelId != null && labelId.length() > 0)
{
String i18nLabel = I18NUtil.getMessage(labelId);
if (i18nLabel == null && label == null)
{
label = (i18nLabel == null) ? "$$" + labelId + "$$" : i18nLabel;
}
}
urls.add(new UrlTemplate(label, type, url));
}
// TODO: Extract URL templates from OpenSearch description
else if (urlType.equals(URL_ARG_TEMPLATE) &&
type.equals(MimetypeMap.MIMETYPE_OPENSEARCH_DESCRIPTION))
{
}
}
}
if (logger.isDebugEnabled())
logger.debug("Retrieved " + urls.size() + " engine registrations");
return urls;
}
示例13: getCodeName
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
/**
* Gets the short name of the status code
*
* @return status code name
*/
public String getCodeName()
{
String codeName = I18NUtil.getMessage("webscript.code." + code + ".name");
return codeName == null ? "" : codeName;
}
示例14: getMessage
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
@Override
@NotAuditable
public String getMessage(String messageKey)
{
return I18NUtil.getMessage(messageKey);
}
示例15: deleteMailbox
import org.springframework.extensions.surf.util.I18NUtil; //导入方法依赖的package包/类
public void deleteMailbox(AlfrescoImapUser user, String mailboxName)
{
if (logger.isDebugEnabled())
{
logger.debug("Deleting mailbox: mailboxName=" + mailboxName);
}
if (mailboxName == null)
{
throw new IllegalArgumentException(I18NUtil.getMessage(ERROR_MAILBOX_NAME_IS_MANDATORY));
}
AlfrescoImapFolder folder = getOrCreateMailbox(user, mailboxName, true, false);
NodeRef nodeRef = folder.getFolderInfo().getNodeRef();
List<FileInfo> childFolders = fileFolderService.listFolders(nodeRef);
if (childFolders.isEmpty())
{
folder.signalDeletion();
// Delete child folders and messages
fileFolderService.delete(nodeRef);
}
else
{
if (folder.isSelectable())
{
// Delete all messages for this folder
// Don't delete subfolders and their messages
List<FileInfo> messages = fileFolderService.listFiles(nodeRef);
for (FileInfo message : messages)
{
fileFolderService.delete(message.getNodeRef());
}
nodeService.addAspect(nodeRef, ImapModel.ASPECT_IMAP_FOLDER_NONSELECTABLE, null);
}
else
{
throw new AlfrescoRuntimeException(mailboxName + " - Can't delete a non-selectable store with children.");
}
}
}