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


Java RestrictionsFactoryUtil.or方法代码示例

本文整理汇总了Java中com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil.or方法的典型用法代码示例。如果您正苦于以下问题:Java RestrictionsFactoryUtil.or方法的具体用法?Java RestrictionsFactoryUtil.or怎么用?Java RestrictionsFactoryUtil.or使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil的用法示例。


在下文中一共展示了RestrictionsFactoryUtil.or方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRelAppIds

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
public List<Long>  getRelAppIds(long appId) throws SystemException {
	List<Long> result = new ArrayList<Long>();
	
	DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RelatedApplications.class);
	Criterion criterionOr   = null;
	criterionOr = RestrictionsFactoryUtil.or(RestrictionsFactoryUtil.eq("applicationId", appId), RestrictionsFactoryUtil.eq("applicationId2", appId));
	dynamicQuery.add(criterionOr);		
	List<RelatedApplications> relatedApplicationsList = dynamicQuery(dynamicQuery);
	
	for (RelatedApplications relatedApplications: relatedApplicationsList) {
		if (relatedApplications.getApplicationId() == appId && !result.contains(relatedApplications.getApplicationId2() )) {
			result.add(relatedApplications.getApplicationId2());
		}
		if (relatedApplications.getApplicationId2() == appId && !result.contains(relatedApplications.getApplicationId() )) {
			result.add(relatedApplications.getApplicationId());
		}			
	}
	
	return result;
	
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:22,代码来源:RelatedApplicationsLocalServiceImpl.java

示例2: findByclassName_classPK_filterByActions

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public List<AuditEntry> findByclassName_classPK_filterByActions(String className, long classPK, List<String> actions) 
		throws SystemException
{
	DynamicQuery dq = auditEntryLocalService.dynamicQuery();
	Criterion criterion=PropertyFactoryUtil.forName("classname").eq(className);
	if(classPK>0)
	{
		criterion=RestrictionsFactoryUtil.and(criterion, PropertyFactoryUtil.forName("classPK").eq(classPK));
	}
	Criterion criterionAux = criterion;
	for (int i=0; i<actions.size(); i++) {
		if(i==0){
			criterion = RestrictionsFactoryUtil.and(criterion, PropertyFactoryUtil.forName("action").eq(actions.get(i))); 
		}else{
			Criterion criterionAnd =  RestrictionsFactoryUtil.and(criterionAux , PropertyFactoryUtil.forName("action").eq(actions.get(i)));
			criterion = RestrictionsFactoryUtil.or(criterion, criterionAnd);
		}
	}
	dq.add(criterion);

	return auditEntryLocalService.dynamicQuery(dq);
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:24,代码来源:AuditEntryLocalServiceImpl.java

示例3: getLoggingsByCategories

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
public List<Logging> getLoggingsByCategories() {
		
		List<Logging> resultList = new ArrayList<Logging>();
        List<Logging> tmpApplications = new ArrayList<Logging>();
		try {
			
			List <Category> allCategories = CategoryLocalServiceUtil.getCategories(10154);
			
			for (Category category : allCategories) {
			
				String catIdString = String.valueOf( category.getCategoryId());
				
				DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
									
				ProjectionList projectionList = ProjectionFactoryUtil.projectionList();	
				projectionList.add(ProjectionFactoryUtil.sum("passel"));
				dynamicQuery.setProjection(projectionList);			
							
				// only one category
				Criterion criterion = RestrictionsFactoryUtil.like("categoryIDString", catIdString);
				// categoryId at the beginning
				criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("categoryIDString", catIdString + ";" + StringPool.PERCENT));
				// categoryId at the end
				criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("categoryIDString", StringPool.PERCENT + ";" + catIdString));
				// categoryId in the middle
				criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("categoryIDString", StringPool.PERCENT + ";" + catIdString + ";" + StringPool.PERCENT));
				
				dynamicQuery.add(criterion);
	
				Order defaultOrder = OrderFactoryUtil.desc("passel");
				dynamicQuery.addOrder(defaultOrder); 

				List<Long>  result = dynamicQuery(dynamicQuery);
//				_log.info("catIdString::result.size(): " + catIdString + "::" + result.size());
				
				if (result.size() > 0) {
					
//				    _log.info("result.get(0): " + result.get(0));
					if (result.get(0) != null) {
						Logging log = new LoggingImpl();
						log.setCategoryIDString(category.getCategoryName());
						
					    long _p = result.get(0);
//					    _log.info("_p: " + _p);
						log.setPassel(_p);	
						tmpApplications.add(log);
//						_log.info("tmpApplications.size(): " + tmpApplications.size());
					} else {
						continue;
					}
				}
			}
			resultList.addAll(tmpApplications);
			
			OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc");			
			Collections.sort(resultList, orderByComparator);
			
	    } catch (Exception e) {
			_log.info("Exception: " + e.getMessage());
			e.printStackTrace();
	    }
		return resultList;
	}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:64,代码来源:LoggingLocalServiceImpl.java

示例4: getLoggingsByRegions

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
public List<Logging> getLoggingsByRegions() {
	
	List<Logging> resultList = new ArrayList<Logging>();
       List<Logging> tmpApplications = new ArrayList<Logging>();
	try {
		
		List <Region> allRegions = RegionLocalServiceUtil.findByc(10154);
		
		for (Region region : allRegions) {
		
			String regIdString = String.valueOf(region.getRegionId());
			
			DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
								
			ProjectionList projectionList = ProjectionFactoryUtil.projectionList();	
			projectionList.add(ProjectionFactoryUtil.sum("passel"));
			dynamicQuery.setProjection(projectionList);			
						
			// only one category
			Criterion criterion = RestrictionsFactoryUtil.like("regionIDString", regIdString);
			// categoryId at the beginning
			criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("regionIDString", regIdString + ";" + StringPool.PERCENT));
			// categoryId at the end
			criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("regionIDString", StringPool.PERCENT + ";" + regIdString));
			// categoryId in the middle
			criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("regionIDString", StringPool.PERCENT + ";" + regIdString + ";" + StringPool.PERCENT));
			
			dynamicQuery.add(criterion);

			Order defaultOrder = OrderFactoryUtil.desc("passel");
			dynamicQuery.addOrder(defaultOrder); 

			List<Long>  result = dynamicQuery(dynamicQuery);
			
			if (result.size() > 0) {					
				if (result.get(0) != null) {
					Logging log = new LoggingImpl();
					log.setRegionIDString(region.getName());
				    long _p = result.get(0);
					log.setPassel(_p);	
					tmpApplications.add(log);
				} else {
					continue;
				}
			}
		}
		resultList.addAll(tmpApplications);
		
		OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc");			
		Collections.sort(resultList, orderByComparator);
		
    } catch (Exception e) {
		_log.info("Exception: " + e.getMessage());
		e.printStackTrace();
    }
	return resultList;
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:58,代码来源:LoggingLocalServiceImpl.java

示例5: getLoggingsByPlatforms

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
public List<Logging> getLoggingsByPlatforms() {
	
	List<Logging> resultList = new ArrayList<Logging>();
       List<Logging> tmpApplications = new ArrayList<Logging>();
	try {
		
		List <String> allPlatforms = new ArrayList<String>();
		allPlatforms.add("android");
		allPlatforms.add("ios");
		allPlatforms.add("webapp");
		allPlatforms.add("windows");
		allPlatforms.add("blackberry");
		allPlatforms.add("ubuntu");
		
		for (String platform : allPlatforms) {
		
			DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
								
			ProjectionList projectionList = ProjectionFactoryUtil.projectionList();	
			projectionList.add(ProjectionFactoryUtil.sum("passel"));
			dynamicQuery.setProjection(projectionList);			
						
			// only one category
			Criterion criterion = RestrictionsFactoryUtil.like("targetOS", platform);
			// categoryId at the beginning
			criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetOS", platform + ";" + StringPool.PERCENT));
			// categoryId at the end
			criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetOS", StringPool.PERCENT + ";" + platform));
			// categoryId in the middle
			criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetOS", StringPool.PERCENT + ";" + platform + ";" + StringPool.PERCENT));
			
			dynamicQuery.add(criterion);

			Order defaultOrder = OrderFactoryUtil.desc("passel");
			dynamicQuery.addOrder(defaultOrder); 

			List<Long>  result = dynamicQuery(dynamicQuery);
			
			if (result.size() > 0) {					
				if (result.get(0) != null) {
					Logging log = new LoggingImpl();
					log.setTargetOS(platform);
				    long _p = result.get(0);
					log.setPassel(_p);	
					tmpApplications.add(log);
				} else {
					continue;
				}
			}
		}
		resultList.addAll(tmpApplications);
		
		OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc");			
		Collections.sort(resultList, orderByComparator);
		
    } catch (Exception e) {
		_log.info("Exception: " + e.getMessage());
		e.printStackTrace();
    }
	return resultList;
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:62,代码来源:LoggingLocalServiceImpl.java

示例6: getLoggingsByTargetCategories

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
public List<Logging> getLoggingsByTargetCategories() {
	
	List<Logging> resultList = new ArrayList<Logging>();
       List<Logging> tmpApplications = new ArrayList<Logging>();
	try {
		
		List <String> allTargetCategories = new ArrayList<String>();
		allTargetCategories.add("Smartphone");
		allTargetCategories.add("Tablet");
		
		for (String targetCategory : allTargetCategories) {
		
			DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
								
			ProjectionList projectionList = ProjectionFactoryUtil.projectionList();	
			projectionList.add(ProjectionFactoryUtil.sum("passel"));
			dynamicQuery.setProjection(projectionList);			
						
			// only one category
			Criterion criterion = RestrictionsFactoryUtil.like("targetCategory", targetCategory);
			// categoryId at the beginning
			criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetCategory", targetCategory + ";" + StringPool.PERCENT));
			// categoryId at the end
			criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetCategory", StringPool.PERCENT + ";" + targetCategory));
			// categoryId in the middle
			criterion = RestrictionsFactoryUtil.or(criterion, RestrictionsFactoryUtil.like("targetCategory", StringPool.PERCENT + ";" + targetCategory + ";" + StringPool.PERCENT));
			
			dynamicQuery.add(criterion);

			Order defaultOrder = OrderFactoryUtil.desc("passel");
			dynamicQuery.addOrder(defaultOrder); 

			List<Long>  result = dynamicQuery(dynamicQuery);
			
			if (result.size() > 0) {					
				if (result.get(0) != null) {
					Logging log = new LoggingImpl();
					log.setTargetCategory(targetCategory);
				    long _p = result.get(0);
					log.setPassel(_p);	
					tmpApplications.add(log);
				} else {
					continue;
				}
			}
		}
		resultList.addAll(tmpApplications);
		
		OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc");			
		Collections.sort(resultList, orderByComparator);
		
    } catch (Exception e) {
		_log.info("Exception: " + e.getMessage());
		e.printStackTrace();
    }
	return resultList;
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:58,代码来源:LoggingLocalServiceImpl.java

示例7: alreadyAreRelated

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
public boolean alreadyAreRelated(long appId1, long appId2) throws SystemException {

/*		
		boolean areRelated = false;
		List<RelatedApplications> relatedApplicationsList =  relatedApplicationsPersistence.findBya(appId1);
		for (RelatedApplications relatedApps: relatedApplicationsList) {
			if (relatedApps.getApplicationId2() == appId2) {
				return true;				
			}
		}
		relatedApplicationsList =  relatedApplicationsPersistence.findBya2(appId1);
		for (RelatedApplications relatedApps: relatedApplicationsList) {
			if (relatedApps.getApplicationId() == appId2) {
				return true;				
			}
		}		
		return areRelated;
*/		

		DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RelatedApplications.class);
		Criterion criterionOr   = null;
		Criterion criterionAnd1 = null;
		Criterion criterionAnd2 = null;
		
		criterionAnd1 = RestrictionsFactoryUtil.eq("applicationId", appId1);
		criterionAnd1 = RestrictionsFactoryUtil.and(criterionAnd1, RestrictionsFactoryUtil.eq("applicationId2", appId2));
		
		criterionAnd2 = RestrictionsFactoryUtil.eq("applicationId", appId2);
		criterionAnd2 = RestrictionsFactoryUtil.and(criterionAnd2, RestrictionsFactoryUtil.eq("applicationId2", appId1));
		
		criterionOr = RestrictionsFactoryUtil.or(criterionAnd1, criterionAnd2);
		dynamicQuery.add(criterionOr);
					
		List<RelatedApplications> relatedApplications = dynamicQuery(dynamicQuery);
		
		if (relatedApplications.size() == 0) {
			return false;
		} 
		if (relatedApplications.size() == 1) {
			return true;			
		}
		if (relatedApplications.size() > 1) {
			_log.info("too many related entries for appId1: " + appId1 + " and appId2: " + appId2) ;
			throw new SystemException("too many related entries for appId1: " + appId1 + " and appId2: " + appId2);
		}
		return false;
	}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:48,代码来源:RelatedApplicationsLocalServiceImpl.java


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