本文整理汇总了Java中com.liferay.portal.kernel.util.StringUtil.merge方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.merge方法的具体用法?Java StringUtil.merge怎么用?Java StringUtil.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.util.StringUtil
的用法示例。
在下文中一共展示了StringUtil.merge方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeSettings
import com.liferay.portal.kernel.util.StringUtil; //导入方法依赖的package包/类
public void changeSettings(ActionRequest request , ActionResponse response) throws Exception
{
String redirect = ParamUtil.get(request, "redirect", "");
String sitetemplates=StringUtil.merge(request.getParameterMap().get( "lmsTemplatesCheckbox"));
String activitytypes=StringUtil.merge(request.getParameterMap().get( "activitiesCheckbox"));
String calificationTypes=StringUtil.merge(request.getParameterMap().get( "calificationTypesCheckbox"));
String courseEvalsTypes=StringUtil.merge(request.getParameterMap().get( "courseEvalsCheckbox"));
ThemeDisplay themeDisplay =(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
boolean hasAPILicence = ParamUtil.getBoolean(request, "hasAPILicence");
boolean showHideActivity = ParamUtil.getBoolean(request, "showHideActivity", true);
boolean viewCoursesFinished = ParamUtil.getBoolean(request, "viewCoursesFinished", false);
LmsPrefs prefs=LmsPrefsLocalServiceUtil.getLmsPrefsIni(themeDisplay.getCompanyId());
prefs.setLmsTemplates(sitetemplates);
prefs.setActivities(activitytypes);
prefs.setCourseevals(courseEvalsTypes);
prefs.setScoretranslators(calificationTypes);
prefs.setHasAPILicence(hasAPILicence);
prefs.setShowHideActivity(showHideActivity);
prefs.setViewCoursesFinished(viewCoursesFinished);
LmsPrefsLocalServiceUtil.updateLmsPrefs(prefs);
if (Validator.isNotNull(redirect)) {
response.sendRedirect(redirect);
}
}
示例2: updateComment
import com.liferay.portal.kernel.util.StringUtil; //导入方法依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
@Override
public Comment updateComment(long commentId, String className, String classPK, String email, int upvoteCount,
ServiceContext serviceContext)
throws UnauthenticationException, UnauthorizationException, NotFoundException, NoSuchUserException {
// // authen
// BackendAuthImpl authImpl = new BackendAuthImpl();
//
// boolean isAuth = authImpl.isAuth(serviceContext, StringPool.BLANK,
// StringPool.BLANK);
//
// if (!isAuth) {
// throw new UnauthenticationException();
// }
//
// boolean hasPermission = authImpl.hasResource(serviceContext,
// ModelNameKeys.WORKINGUNIT_MGT_CENTER,
// ActionKeys.EDIT_DATA);
//
// if (!hasPermission) {
// throw new UnauthorizationException();
// }
Date now = new Date();
Comment comment = commentPersistence.fetchByPrimaryKey(commentId);
if (Validator.isNull(comment)) {
throw new NotFoundException();
}
comment.setModifiedDate(serviceContext.getCreateDate(now));
// Other fields
int counter = comment.getUpvoteCount();
String userHasUpvoted = Validator.isNotNull(comment.getUserHasUpvoted()) ? comment.getUserHasUpvoted()
: StringPool.BLANK;
if ((!StringUtil.contains(userHasUpvoted, email) || Validator.isNull(comment.getUserHasUpvoted()))
&& upvoteCount >= 0) {
userHasUpvoted += Validator.isNotNull(userHasUpvoted) ? StringPool.COMMA + email : email;
String[] userVoteds = StringUtil.split(userHasUpvoted);
counter = userVoteds.length;
} else if (StringUtil.contains(userHasUpvoted, email) && upvoteCount < 0) {
String[] emails = StringUtil.split(userHasUpvoted);
emails = ArrayUtil.remove(emails, email);
userHasUpvoted = StringUtil.merge(emails);
counter = emails.length;
}
comment.setUserHasUpvoted(userHasUpvoted);
// comment.setClassName(className);
// comment.setClassPK(classPK);
comment.setUpvoteCount(counter);
comment.setExpandoBridgeAttributes(serviceContext);
commentPersistence.update(comment);
return comment;
}
示例3: getXMLTitleStructure
import com.liferay.portal.kernel.util.StringUtil; //导入方法依赖的package包/类
public static String getXMLTitleStructure(final Map<Locale, String> titles,
final Locale defaultLocale) {
Set<Locale> locales = titles.keySet();
String xmlTitleStructure = "";
XMLOutputFactory factory = XMLOutputFactory.newInstance();
try {
StringWriter sw = new StringWriter();
XMLStreamWriter writer = factory.createXMLStreamWriter(sw);
writer.writeStartDocument();
writer.writeStartElement("root");
String langs = StringUtil.merge(locales, ",");
/*
* TODO remove boolean first = true; for (Locale l : locales) {
* langs += ((!first) ? "," : "") + l.toString(); first = false; }
*/
writer.writeAttribute("default-locale", defaultLocale.toString());
writer.writeAttribute("available-locales", langs);
for (Locale l : locales) {
String title = titles.get(l);
writer.writeStartElement("Title");
writer.writeAttribute("language-id", l.toString());
writer.writeCharacters(title);
writer.writeEndElement();
}
writer.writeEndElement();
writer.writeEndDocument();
writer.flush();
writer.close();
xmlTitleStructure = sw.toString();
sw.close();
} catch (XMLStreamException | IOException e) {
LOG.error("Problem when creating title structure for the following internationalized "
+ "titles: " + titles + "", e);
}
return xmlTitleStructure;
}