当前位置: 首页>>代码示例>>Java>>正文


Java ArrayUtil.remove方法代码示例

本文整理汇总了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;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:23,代码来源:DLFolderUtil.java

示例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;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:70,代码来源:CommentLocalServiceImpl.java


注:本文中的com.liferay.portal.kernel.util.ArrayUtil.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。