本文整理汇总了Java中com.liferay.portal.kernel.util.ArrayUtil.remove方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.remove方法的具体用法?Java ArrayUtil.remove怎么用?Java ArrayUtil.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.util.ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil.remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTargetFolder
import com.liferay.portal.kernel.util.ArrayUtil; //导入方法依赖的package包/类
public static DLFolder getTargetFolder(
long groupId, long parentFolderId, String destination) {
DLFolder dlFolder = null;
String[] folderNames =
StringUtil.split(destination, StringPool.FORWARD_SLASH);
if (folderNames != null && folderNames.length > 0) {
String name = folderNames[0];
dlFolder = getFolder(groupId, parentFolderId, name);
folderNames = ArrayUtil.remove(folderNames, name);
if (folderNames.length > 0) {
dlFolder = getTargetFolder(
groupId, dlFolder.getFolderId(),
StringUtil.merge(folderNames, StringPool.FORWARD_SLASH));
}
}
return dlFolder;
}
示例2: updateComment
import com.liferay.portal.kernel.util.ArrayUtil; //导入方法依赖的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;
}