本文整理汇总了Java中org.springframework.extensions.surf.util.I18NUtil类的典型用法代码示例。如果您正苦于以下问题:Java I18NUtil类的具体用法?Java I18NUtil怎么用?Java I18NUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
I18NUtil类属于org.springframework.extensions.surf.util包,在下文中一共展示了I18NUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateFileLink
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
/**
* Tests the creation of a file link
*
* @throws Exception
*/
public void testCreateFileLink() throws Exception
{
// create a link of file site1File1_1 in folder site1Folder2
NodeRef linkNodeRef = documentLinkService.createDocumentLink(site1File1, site1Folder2);
assertNotNull(linkNodeRef);
// test if the link node is listed as a child of site1Folder2
String site1File1LinkName = I18NUtil.getMessage("doclink_service.link_to_label", (site1File1Name + ".url"));
NodeRef linkNodeRef2 = fileFolderService.searchSimple(site1Folder2, site1File1LinkName);
assertNotNull(linkNodeRef2);
assertEquals(linkNodeRef, linkNodeRef2);
// check the type of the link
assertEquals(nodeService.getType(linkNodeRef), ApplicationModel.TYPE_FILELINK);
// check if the link destination is site1File1_1
NodeRef linkDestination = documentLinkService.getLinkDestination(linkNodeRef);
assertNotNull(linkDestination);
assertEquals(linkDestination, site1File1);
}
示例2: applyInternal
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
@Override
protected String applyInternal() throws Exception
{
// We don't need to catch the potential InvalidQNameException here as it will be caught
// in AbstractPatch and correctly handled there
QName qnameBefore = QName.createQName(this.qnameStringBefore);
QName qnameAfter = QName.createQName(this.qnameStringAfter);
Long maxNodeId = patchDAO.getMaxAdmNodeID();
Pair<Long, QName> before = qnameDAO.getQName(qnameBefore);
if (before != null)
{
for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE)
{
Work work = new Work(before.getFirst(), i);
retryingTransactionHelper.doInTransaction(work, false, true);
}
qnameDAO.updateQName(qnameBefore, qnameAfter);
}
return I18NUtil.getMessage(MSG_SUCCESS, qnameBefore, qnameAfter);
}
示例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: applyInternal
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
@Override
protected String applyInternal() throws Exception
{
// We don't need to catch the potential InvalidQNameException here as it will be caught
// in AbstractPatch and correctly handled there
QName qnameType = QName.createQName(this.qnameStringType);
QName qnameAspect = QName.createQName(this.qnameStringAspect);
Long maxNodeId = patchDAO.getMaxAdmNodeID();
Pair<Long, QName> type = qnameDAO.getQName(qnameType);
Pair<Long, QName> aspect = qnameDAO.getQName(qnameAspect);
if (type != null && aspect != null)
{
for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE)
{
Work work = new Work(type, aspect, i);
retryingTransactionHelper.doInTransaction(work, false, true);
}
}
return I18NUtil.getMessage(MSG_SUCCESS, qnameAspect, qnameType);
}
示例6: makeTransientFieldDefinition
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
@Override
protected FieldDefinition makeTransientFieldDefinition()
{
AssociationFieldDefinition fieldDef = new AssociationFieldDefinition(
KEY, KEY, Direction.TARGET);
fieldDef.setLabel(I18NUtil.getMessage(MSG_LABEL));
fieldDef.setDescription(I18NUtil.getMessage(MSG_DESCRIPTION));
fieldDef.setProtectedField(false);
fieldDef.setEndpointMandatory(false);
fieldDef.setEndpointMany(true);
// define the data key name and set
String dataKey = ASSOC_DATA_PREFIX + KEY;
fieldDef.setDataKeyName(dataKey);
return fieldDef;
}
示例7: sendNotification
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
/**
* @see org.alfresco.service.cmr.notification.NotificationService#sendNotification(java.lang.String, org.alfresco.service.cmr.notification.NotificationContext)
*/
@Override
public void sendNotification(String notificationProvider, NotificationContext notificationContext)
{
// Check the mandatory params
ParameterCheck.mandatory("notificationProvider", notificationProvider);
ParameterCheck.mandatory("notificationContext", notificationContext);
// Check that the notificaiton provider exists
if (exists(notificationProvider) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NP_DOES_NOT_EXIST, notificationProvider));
}
// Get the notification provider and send notification
NotificationProvider provider = providers.get(notificationProvider);
provider.sendNotification(notificationContext);
}
示例8: onBootstrap
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
@Override
protected void onBootstrap(ApplicationEvent event)
{
String majorVersion = I18NUtil.getMessage("version.major");
String minorVersion = I18NUtil.getMessage("version.minor");
// Internationalizes the message
String errorMsg = I18NUtil.getMessage("system.err.lucene_not_supported", majorVersion + "." + minorVersion);
log.error(errorMsg);
List<StoreRef> storeRefs = nodeService.getStores();
for (StoreRef storeRef : storeRefs)
{
fullTextSearchIndexer.requiresIndex(storeRef);
}
}
示例9: getLabelByCode
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
public String getLabelByCode(String code)
{
// get the translated language label
String label;
label = I18NUtil.getMessage(MESSAGE_PREFIX + code);
// if not found, get the default name (found in content-filter-lang.xml)
if(label == null || label.length() == 0)
{
label = languagesByCode.get(code);
}
// if not found, return the language code
if(label == null || label.length() == 0)
{
label = code + " (label not found)";
}
return label;
}
示例10: getLocalizedSubject
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
/**
* Attempt to localize the subject, using the subject parameter as the message key.
*
* @param subject Message key for subject lookup
* @param params Parameters for the message
* @param locale Locale to use
* @return The localized message, or subject if the message format could not be found
*/
private String getLocalizedSubject(String subject, Object[] params, Locale locale)
{
String localizedSubject = null;
if (locale == null)
{
localizedSubject = I18NUtil.getMessage(subject, params);
}
else
{
localizedSubject = I18NUtil.getMessage(subject, locale, params);
}
if (localizedSubject == null)
{
return subject;
}
else
{
return localizedSubject;
}
}
示例11: getDisplayLabel
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
@Override
public String getDisplayLabel(String constraintAllowableValue, MessageLookup messageLookup)
{
if (constraintAllowableValue.startsWith("N"))
{
Serializable nameProperty = nodeService.getProperty(new NodeRef(constraintAllowableValue.substring(1)),
ContentModel.PROP_NAME);
return nameProperty.toString();
}
else if (constraintAllowableValue.equals(SystemTemplateLocationsConstraint.NULL_SYSTEM_TEMPLATE))
{
String message = messageLookup.getMessage(SystemTemplateLocationsConstraint.NULL_SYSTEM_TEMPLATE_MESSAGE,
I18NUtil.getLocale());
return message == null ? constraintAllowableValue : message;
}
else
{
return constraintAllowableValue.substring(constraintAllowableValue.lastIndexOf("/") + 1);
}
}
示例12: getSortLocale
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
public Locale getSortLocale()
{
List<Locale> locales = getLocales();
if (((locales == null) || (locales.size() == 0)))
{
locales = Collections.singletonList(I18NUtil.getLocale());
}
if (locales.size() > 1)
{
throw new AlfrescoRuntimeException("Order on text/mltext properties with more than one locale is not curently supported");
}
Locale sortLocale = locales.get(0);
return sortLocale;
}
示例13: addTitledAspect
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
/**
* Adds titled aspect to the specified node.
*
* @param nodeRef Target node.
* @param title Title
*/
private void addTitledAspect(NodeRef nodeRef, String title, String from)
{
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>();
titledProps.put(ContentModel.PROP_TITLE, title);
titledProps.put(ContentModel.PROP_DESCRIPTION, I18NUtil.getMessage(MSG_RECEIVED_BY_SMTP, from));
getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, titledProps);
if (log.isDebugEnabled())
{
log.debug("Titled aspect has been added.");
}
}
示例14: getDisplayLabel
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
public String getDisplayLabel()
{
String label = I18NUtil.getMessage(MSG_PREFIX + getPeriodType());
if (label == null)
{
label = getPeriodType();
}
return label;
}
示例15: DuplicateChildNodeNameException
import org.springframework.extensions.surf.util.I18NUtil; //导入依赖的package包/类
public DuplicateChildNodeNameException(NodeRef parentNodeRef, QName assocTypeQName, String name, Throwable e)
{
super(I18NUtil.getMessage(ERR_DUPLICATE_NAME, name), e);
this.parentNodeRef = parentNodeRef;
this.assocTypeQName = assocTypeQName;
this.name = name;
}