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


Java ProjectionFactoryUtil类代码示例

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


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

示例1: count

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
@Override
public long count(Criterion criterion) {
	try {
		List<?> list = executeDynamicQuery(
			criterion, ProjectionFactoryUtil.rowCount());

		if (list != null) {
			return (Long)list.get(0);
		}
	}
	catch (Exception e) {
		_log.error(
			"Error executing count for " + getName() + ": " +
				e.getMessage());
	}

	return -1;
}
 
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:19,代码来源:ModelWrapper.java

示例2: getByGroupIdUserId

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public List<LearningActivityResult> getByGroupIdUserId(long groupId,long userId){
	List<LearningActivityResult> results = new ArrayList<LearningActivityResult>();

	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader"); 
	DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
			.add(PropertyFactoryUtil.forName("groupId").eq(groupId))
			.setProjection(ProjectionFactoryUtil.property("actId"));

	DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
			.add(PropertyFactoryUtil.forName("userId").eq(userId))
			.add(PropertyFactoryUtil.forName("actId").in(dq2));		

	try {
		results = (List<LearningActivityResult>)learningActivityResultPersistence.findWithDynamicQuery(dq);
	} catch (SystemException e) {
		e.printStackTrace();
	}

	log.debug("::getByModuleId:"+results.size());
	return results;			
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:22,代码来源:LearningActivityResultLocalServiceImpl.java

示例3: getMandatoryByGroupIdUserId

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public List<LearningActivityResult> getMandatoryByGroupIdUserId(long groupId,long userId){
	List<LearningActivityResult> results = new ArrayList<LearningActivityResult>();

	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader"); 
	DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
			.add(PropertyFactoryUtil.forName("groupId").eq(groupId))
			.add(PropertyFactoryUtil.forName("weightinmodule").gt(0L))
			.setProjection(ProjectionFactoryUtil.property("actId"));

	DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
			.add(PropertyFactoryUtil.forName("userId").eq(userId))
			.add(PropertyFactoryUtil.forName("actId").in(dq2));

	try {
		results = (List<LearningActivityResult>)learningActivityResultPersistence.findWithDynamicQuery(dq);
	} catch (SystemException e) {
		e.printStackTrace();
	}

	log.debug("::getByModuleIdPassed:"+results.size());
	return results;			
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:23,代码来源:LearningActivityResultLocalServiceImpl.java

示例4: getByModuleIdUserId

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public List<LearningActivityResult> getByModuleIdUserId(long moduleId,long userId){
	List<LearningActivityResult> results = new ArrayList<LearningActivityResult>();

	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader"); 
	DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
			.add(PropertyFactoryUtil.forName("moduleId").eq(moduleId))
			.setProjection(ProjectionFactoryUtil.property("actId"));

	DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
			.add(PropertyFactoryUtil.forName("userId").eq(userId))
			.add(PropertyFactoryUtil.forName("actId").in(dq2));		

	try {
		results = (List<LearningActivityResult>)learningActivityResultPersistence.findWithDynamicQuery(dq);
	} catch (SystemException e) {
		e.printStackTrace();
	}

	log.debug("::getByModuleId:"+results.size());
	return results;			
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:22,代码来源:LearningActivityResultLocalServiceImpl.java

示例5: getByModuleIdUserIdPassed

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public List<LearningActivityResult> getByModuleIdUserIdPassed(long moduleId,long userId){
	List<LearningActivityResult> results = new ArrayList<LearningActivityResult>();

	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader"); 
	DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
			.add(PropertyFactoryUtil.forName("moduleId").eq(moduleId))
			.setProjection(ProjectionFactoryUtil.property("actId"));

	DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
			.add(PropertyFactoryUtil.forName("userId").eq(userId))
			.add(PropertyFactoryUtil.forName("passed").eq(true))
			.add(PropertyFactoryUtil.forName("actId").in(dq2));


	try {
		results = (List<LearningActivityResult>)learningActivityResultPersistence.findWithDynamicQuery(dq);
	} catch (SystemException e) {
		e.printStackTrace();
	}

	log.debug("::getByModuleIdPassed:"+results.size());
	return results;			
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:24,代码来源:LearningActivityResultLocalServiceImpl.java

示例6: getMandatoryByModuleIdUserIdPassed

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public List<LearningActivityResult> getMandatoryByModuleIdUserIdPassed(long moduleId,long userId){
	List<LearningActivityResult> results = new ArrayList<LearningActivityResult>();

	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader"); 
	DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
			.add(PropertyFactoryUtil.forName("moduleId").eq(moduleId))
			.add(PropertyFactoryUtil.forName("weightinmodule").gt(0L))
			.setProjection(ProjectionFactoryUtil.property("actId"));

	DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
			.add(PropertyFactoryUtil.forName("userId").eq(userId))
			.add(PropertyFactoryUtil.forName("passed").eq(true))
			.add(PropertyFactoryUtil.forName("actId").in(dq2));


	try {
		results = (List<LearningActivityResult>)learningActivityResultPersistence.findWithDynamicQuery(dq);
	} catch (SystemException e) {
		e.printStackTrace();
	}

	log.debug("::getByModuleIdPassed:"+results.size());
	return results;			
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:25,代码来源:LearningActivityResultLocalServiceImpl.java

示例7: countMandatoryByModuleIdUserIdPassed

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public int countMandatoryByModuleIdUserIdPassed(long moduleId,long userId){

		ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader"); 
		DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
				.add(PropertyFactoryUtil.forName("moduleId").eq(moduleId))
				.add(PropertyFactoryUtil.forName("weightinmodule").gt(0L))
				.setProjection(ProjectionFactoryUtil.property("actId"));

		DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
				.add(PropertyFactoryUtil.forName("userId").eq(userId))
				.add(PropertyFactoryUtil.forName("passed").eq(true))
				.add(PropertyFactoryUtil.forName("actId").in(dq2));


		try {
			return (int) LearningActivityResultLocalServiceUtil.dynamicQueryCount(dq);
		} catch (SystemException e) {
			e.printStackTrace();
		}
		return 0;			
	}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:22,代码来源:LearningActivityResultLocalServiceImpl.java

示例8: listUsersStartingBy

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
/**
 * Lista os nomes de usuário na sala que começam pelo nome especificado
 * 
 * @param room
 * @param name
 * @return
 * @throws SystemException
 */
@SuppressWarnings("unchecked")
public HashSet<String> listUsersStartingBy(ChatRoom room, String name) throws SystemException {
	int pos;
	StringBuilder like = new StringBuilder(name);
	pos = 0;
	while (pos < like.length()) {
		char chr = like.charAt(pos);
		if (chr == '_' || chr == '%' || chr == '[' || chr == ']') {
			like.replace(pos, pos + 1, "[" + chr + "]");
			pos += 3;
		} else {
			pos++;
		}
	}
	like.append('%');

	DynamicQuery q = DynamicQueryFactoryUtil.forClass(ChatRoomUser.class);
	q.add(PropertyFactoryUtil.forName("chatRoomId").eq(room.getRoomId()));
	q.add(PropertyFactoryUtil.forName("userName").like(like.toString()));
	q.setProjection(ProjectionFactoryUtil.property("userName"));
	return new HashSet<String>(dynamicQuery(q));
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:31,代码来源:ChatRoomLocalServiceImpl.java

示例9: isFullNameInUseInPortal

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
/**
 * Verifica se há usuários no portal com o mesmo fullname
 * 
 * @param fullName
 * @return
 */
@SuppressWarnings("unchecked")
public boolean isFullNameInUseInPortal(long companyId, String fullName) {
	FullNameGenerator fullNameGenerator = new DefaultFullNameGenerator();
	String[] name = fullNameGenerator.splitFullName(fullName);

	DynamicQuery query = DynamicQueryFactoryUtil.forClass(User.class, PortalClassLoaderUtil.getClassLoader());
	query.setProjection(ProjectionFactoryUtil.property("userId"));
	query.add(PropertyFactoryUtil.forName("companyId").eq(companyId));
	query.add(PropertyFactoryUtil.forName("firstName").eq(name[0]));
	query.add(PropertyFactoryUtil.forName("middleName").eq(name[1]));
	query.add(PropertyFactoryUtil.forName("lastName").eq(name[2]));

	List<Long> list = null;

	try {
		list = UserLocalServiceUtil.dynamicQuery(query);
	} catch (SystemException e) {
		LOG.error(e);
	}

	return list != null && !list.isEmpty();
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:29,代码来源:ChatRoomLocalServiceImpl.java

示例10: getVotosByUsuarioId

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
/**
 * Conta os votos por usuário
 * 
 * @param groupId
 * @param userId
 * @return
 * @throws SystemException
 */
public int getVotosByUsuarioId(long groupId, long userId)
		throws SystemException {

	DynamicQuery dqEixo = DynamicQueryFactoryUtil.forClass(Eixo.class);
	dqEixo.setProjection(ProjectionFactoryUtil.property("eixoId"));
	dqEixo.add(RestrictionsFactoryUtil.eq("groupId", groupId));

	DynamicQuery dqProposta = DynamicQueryFactoryUtil
			.forClass(Proposta.class);
	dqProposta.setProjection(ProjectionFactoryUtil.property("propostaId"));
	dqProposta.add(PropertyFactoryUtil.forName("eixoId").in(dqEixo));

	DynamicQuery dq = DynamicQueryFactoryUtil.forClass(Voto.class);
	dq.add(RestrictionsFactoryUtil.eq("userId", userId));
	dq.add(PropertyFactoryUtil.forName("propostaId").in(dqProposta));
	dq.setProjection(ProjectionFactoryUtil.sum("numeroVotos"));
	List<?> ret = dynamicQuery(dq);
	if (ret.isEmpty() || ret.get(0) == null)
		return 0;
	else
		return ((Number) ret.get(0)).intValue();
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:31,代码来源:VotoLocalServiceImpl.java

示例11: 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

示例12: getEvaluations

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Map<Long,Long> getEvaluations(Course course, Element rootElement) throws SystemException,DocumentException{

	Map<Long,Long> evaluations = new HashMap<Long,Long>();
	
	for (Element evaluation : rootElement.elements("evaluation")) {
		long id = GetterUtil.getLong(evaluation.elementText("id"));
		long weight = GetterUtil.getLong(evaluation.elementText("weight"));
		if((id!=0)&&(weight!=0)){
			evaluations.put(id, weight);
		}
	}
	
	List<Long> actIdsInDatabase = 
			LearningActivityLocalServiceUtil.dynamicQuery(
			DynamicQueryFactoryUtil.forClass(LearningActivity.class)
			//.add(PropertyFactoryUtil.forName("typeId").eq(8))
			.add(PropertyFactoryUtil.forName("actId").in((Collection<Object>)(Collection<?>)evaluations.keySet()))
			.setProjection(ProjectionFactoryUtil.property("actId")));
	
	Iterator<Map.Entry<Long,Long>> evaluationsIterator = evaluations.entrySet().iterator();
	while (evaluationsIterator.hasNext()) {
		if(!actIdsInDatabase.contains(evaluationsIterator.next().getKey())){
			evaluationsIterator.remove();
	    }
	}
	
	return evaluations;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:30,代码来源:EvaluationAvgCourseEval.java

示例13: avgResult

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public Double avgResult(long actId) throws SystemException
{
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader"); 
	DynamicQuery dq=DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader);
	Criterion criterion=PropertyFactoryUtil.forName("actId").eq(actId);
	dq.add(criterion);
	criterion=PropertyFactoryUtil.forName("endDate").isNotNull();
	dq.add(criterion);
	dq.setProjection(ProjectionFactoryUtil.avg("result"));
	return (Double)(learningActivityResultPersistence.findWithDynamicQuery(dq).get(0));
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:12,代码来源:LearningActivityResultLocalServiceImpl.java

示例14: getLastEndDateByUserId

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public Date getLastEndDateByUserId(long userId) throws SystemException{
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader"); 
	DynamicQuery dq=DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader);
	Criterion criterion=PropertyFactoryUtil.forName("userId").eq(userId);
	dq.add(criterion);
	criterion=PropertyFactoryUtil.forName("endDate").isNotNull();
	dq.add(criterion);
	dq.setProjection(ProjectionFactoryUtil.max("endDate"));
	return (Date)(learningActivityResultPersistence.findWithDynamicQuery(dq).get(0));
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:11,代码来源:LearningActivityResultLocalServiceImpl.java

示例15: getLastEndDateByUserIdCourseId

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public Date getLastEndDateByUserIdCourseId(long userId, long courseId) throws SystemException
{
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader"); 
	
	DynamicQuery dqCourse=DynamicQueryFactoryUtil.forClass(Course.class, classLoader);
	Criterion criterion=PropertyFactoryUtil.forName("courseId").eq(courseId);
	dqCourse.add(criterion);
	dqCourse.setProjection(ProjectionFactoryUtil.property("groupCreatedId"));
	
	DynamicQuery dqModule=DynamicQueryFactoryUtil.forClass(Module.class, classLoader);
	dqModule.add(PropertyFactoryUtil.forName("groupId").in(dqCourse));
	dqModule.setProjection(ProjectionFactoryUtil.property("moduleId"));
			
	DynamicQuery dqActivity=DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader);
	dqActivity.add(PropertyFactoryUtil.forName("moduleId").in(dqModule));
	dqActivity.setProjection(ProjectionFactoryUtil.property("actId"));
	
	DynamicQuery dq=DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader);
	criterion=PropertyFactoryUtil.forName("userId").eq(userId);
	dq.add(criterion);
	dq.add(PropertyFactoryUtil.forName("actId").in(dqActivity));
	criterion=PropertyFactoryUtil.forName("endDate").isNotNull();
	dq.add(criterion);
	dq.setProjection(ProjectionFactoryUtil.max("endDate"));
	
	return (Date)(learningActivityResultPersistence.findWithDynamicQuery(dq).get(0));
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:28,代码来源:LearningActivityResultLocalServiceImpl.java


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