本文整理汇总了Java中com.liferay.portal.kernel.util.ArrayUtil.contains方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.contains方法的具体用法?Java ArrayUtil.contains怎么用?Java ArrayUtil.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.util.ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil.contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isRelatedEntry
import com.liferay.portal.kernel.util.ArrayUtil; //导入方法依赖的package包/类
@Override
protected boolean isRelatedEntry(Data data) {
long groupId = data.getGroupId();
long repositoryId = data.get("repositoryId", -1L);
boolean hiddenFolder = isHiddenFolder(groupId, repositoryId);
if (!hiddenFolder) {
return false;
}
long classNameId = data.get("classNameId", 0L);
if (classNameId == 0) {
return false;
}
String permissionsClassName = PortalUtil.getClassName(classNameId);
return ArrayUtil.contains(
validPermissionClassNames, permissionsClassName);
}
示例2: isRelatedEntry
import com.liferay.portal.kernel.util.ArrayUtil; //导入方法依赖的package包/类
@Override
protected boolean isRelatedEntry(Data data) {
long categoryId = data.get("categoryId", 0L);
if (categoryId != MBCategoryConstants.DISCUSSION_CATEGORY_ID) {
return false;
}
long classNameId = data.get("classNameId", 0L);
if (classNameId == 0) {
return false;
}
String permissionsClassName = PortalUtil.getClassName(classNameId);
return ArrayUtil.contains(
validPermissionClassNames, permissionsClassName);
}
示例3: getClassTypes
import com.liferay.portal.kernel.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public Map<Long, String> getClassTypes(long[] groupId, Locale locale)
throws Exception {
Map<Long, String> classTypes = new LinkedHashMap<Long, String>();
if(CourseLocalServiceUtil.dynamicQueryCount(CourseLocalServiceUtil.dynamicQuery().
add(PropertyFactoryUtil.forName("groupCreatedId").in(ArrayUtil.toArray(groupId))))>0){
LearningActivityTypeRegistry learningActivityTypeRegistry = new LearningActivityTypeRegistry();
ResourceBundle resourceBundle = PortletBagPool.get(getPortletId()).getResourceBundle(locale);
long[] invisibleTypes = StringUtil.split(PropsUtil.get("lms.learningactivity.invisibles"), StringPool.COMMA,-1L);
for(LearningActivityType learningActivityType:learningActivityTypeRegistry.getLearningActivityTypesForCreating()){
if(learningActivityType != null && !ArrayUtil.contains(invisibleTypes, learningActivityType.getTypeId())){
String learningActivityTypeName = learningActivityTypeRegistry.getLearningActivityType(learningActivityType.getTypeId()).getName();
classTypes.put(learningActivityType.getTypeId(), (resourceBundle.containsKey(learningActivityTypeName)?
resourceBundle.getString(learningActivityTypeName):learningActivityTypeName));
}
}
}
return classTypes;
}
示例4: appendPortletIds
import com.liferay.portal.kernel.util.ArrayUtil; //导入方法依赖的package包/类
protected String[] appendPortletIds(
String[] portletIds, String[] newPortletIds, String portletsMergeMode) {
for (String portletId : newPortletIds) {
if (ArrayUtil.contains(portletIds, portletId)) {
continue;
}
if (portletsMergeMode.equals(
PortletDataHandlerKeys.PORTLETS_MERGE_MODE_ADD_TO_BOTTOM)) {
portletIds = ArrayUtil.append(portletIds, portletId);
}
else {
portletIds = ArrayUtil.append(
new String[] {portletId}, portletIds);
}
}
return portletIds;
}
示例5: getDocuments
import com.liferay.portal.kernel.util.ArrayUtil; //导入方法依赖的package包/类
/**
* Gets the documents.
*
* @param searchHits the search hits
* @param searchContext the search context
* @return the documents
*/
private Document[] getDocuments(SearchHits searchHits, SearchContext searchContext) {
if (_log.isInfoEnabled()) {
_log.info("Getting document objects from SearchHits");
}
String[] types = searchContext.getEntryClassNames();
int total = Integer.parseInt((searchHits != null)? String.valueOf(searchHits.getTotalHits()) : "0");
int failedJsonCount = 0;
String className = null;
if (total > 0) {
List<Document> documentsList = new ArrayList<Document>(total);
@SuppressWarnings("rawtypes")
Iterator itr = searchHits.iterator();
while (itr.hasNext()) {
Document document = new DocumentImpl();
SearchHit hit = (SearchHit) itr.next();
JSONObject json;
try {
json = JSONFactoryUtil.createJSONObject(hit.getSourceAsString());
@SuppressWarnings("rawtypes")
Iterator jsonItr = json.keys();
while (jsonItr.hasNext()) {
String key = (String) jsonItr.next();
String value = (String) json.getString(key);
if (_log.isDebugEnabled()) {
_log.debug(">>>>>>>>>> " + key + " : " + value);
}
document.add(new Field(key, value));
if (key.equalsIgnoreCase("entryClassName")) {
className = value;
}
}
if (ArrayUtil.contains(types, className)) {
documentsList.add(document);
}
} catch (JSONException e) {
failedJsonCount++;
_log.error("Error while processing the search result json objects", e);
}
}
if (_log.isInfoEnabled()) {
_log.info("Total size of the search results: " + documentsList.size());
}
return documentsList.toArray(new Document[documentsList.size()-failedJsonCount]);
} else {
if (_log.isInfoEnabled()) {
_log.info("No search results found");
}
return new Document[0];
}
}