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


Java ProjectionFactoryUtil.projectionList方法代码示例

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


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

示例1: getMostUsedSearchStringInclNull

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入方法依赖的package包/类
public List<Logging> getMostUsedSearchStringInclNull() {
		
		List<Logging> resultList = new ArrayList<Logging>();
		try {
			DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
								
			ProjectionList projectionList = ProjectionFactoryUtil.projectionList();

			projectionList.add(ProjectionFactoryUtil.groupProperty("searchString"));
			projectionList.add(ProjectionFactoryUtil.sum("passel"));

			dynamicQuery.setProjection(projectionList);			
						
			Order defaultOrder = OrderFactoryUtil.desc("passel");
			dynamicQuery.addOrder(defaultOrder); 
			List  result = dynamicQuery(dynamicQuery);
			_log.info(result.size());
			
			Iterator it = result.iterator();
			
			if(!it.hasNext()) {
			    _log.info("No any data!");
			} else {
				while(it.hasNext()) {
					Logging log = new LoggingImpl();
					Object[] row = (Object[]) it.next();
//					for(int i = 0; i < row.length;i++) {
//					    _log.info(row[i]);
//					}
					log.setSearchString(String.valueOf(row[0]));
					log.setPassel(Long.parseLong(String.valueOf(row[1])));	
					resultList.add(log);
				}
			}
	    } catch (Exception e) {
			_log.info("Exception: " + e.getMessage());
	    }
		return resultList;
	}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:40,代码来源:LoggingLocalServiceImpl.java

示例2: getLoggingsByCategories

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入方法依赖的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

示例3: getLoggingsByRegions

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入方法依赖的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

示例4: getLoggingsByMissingEntitlements

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入方法依赖的package包/类
public List<Logging> getLoggingsByMissingEntitlements() {
	
	List<Logging> resultList = new ArrayList<Logging>();
       List<Logging> tmpApplications = new ArrayList<Logging>();
	try {
		
		List <Entitlement> allEntitlements = EntitlementLocalServiceUtil.getEntitlements(10154);
		
		for (Entitlement entitlement : allEntitlements) {
		
			String entitlementIdString = String.valueOf(entitlement.getEntitlementId());
			
			DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
								
			ProjectionList projectionList = ProjectionFactoryUtil.projectionList();	
			projectionList.add(ProjectionFactoryUtil.sum("passel"));
			dynamicQuery.setProjection(projectionList);			
						
			// only one category
			Criterion criterion = RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", entitlementIdString));
			// categoryId at the beginning
			criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", entitlementIdString + ";" + StringPool.PERCENT)));
			// categoryId at the end
			criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", StringPool.PERCENT + ";" + entitlementIdString)));
			// categoryId in the middle
			criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", StringPool.PERCENT + ";" + entitlementIdString + ";" + 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.setEntitlementIDString(entitlement.getEntitlementName());
				    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.ProjectionFactoryUtil; //导入方法依赖的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.ProjectionFactoryUtil; //导入方法依赖的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


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