• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ProjectionFactoryUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: avgResult

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


示例17: usersStarted

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public long usersStarted(long moduleId) throws SystemException
{
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
	DynamicQuery dq=DynamicQueryFactoryUtil.forClass(LearningActivityTry.class, classLoader);
	java.util.List<Long> actIds=LearningActivityLocalServiceUtil.getLearningActivityIdsOfModule(moduleId);
	long result=0;
	Criterion crit;
	crit = PropertyFactoryUtil.forName("actId").in(actIds.toArray());
	dq.add(crit);
	dq.setProjection(ProjectionFactoryUtil.distinct(ProjectionFactoryUtil.property("userId")));
	result=LearningActivityTryLocalServiceUtil.dynamicQueryCount(dq);
	return result;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:14,代码来源:ModuleLocalServiceImpl.java


示例18: getPublicCoursesByCompanyId

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
public List<Course> getPublicCoursesByCompanyId(Long companyId){
	
	Long classNameId = ClassNameLocalServiceUtil.getClassNameId(Course.class.getName());
	
	if(classNameId!=null){
		try {
			DynamicQuery dq = DynamicQueryFactoryUtil.forClass(AssetEntry.class);
			dq.add(PropertyFactoryUtil.forName("companyId").eq(companyId));
			dq.add(PropertyFactoryUtil.forName("classNameId").eq(classNameId));
			dq.add(PropertyFactoryUtil.forName("visible").eq(true));
			dq.setProjection(ProjectionFactoryUtil.distinct(ProjectionFactoryUtil.property("classPK")));
			List<Long> results = (List<Long>)assetEntryLocalService.dynamicQuery(dq);

			List<Course> courses = new ArrayList<Course>();
			for(Long courseId : results){
				Course course = coursePersistence.fetchByPrimaryKey(courseId);
				if(course!=null)
					courses.add(course);
			}
			
			return courses;
			
		} catch (SystemException e) {
			if(log.isDebugEnabled())e.printStackTrace();
		}
	}
	
	return null;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:30,代码来源:CourseLocalServiceImpl.java


示例19: getUserCount

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
/**
 * Conta a quantidade de usuários que entrou na sala
 */
public final long getUserCount(long roomId) throws SystemException, PortalException {

	DynamicQuery q = DynamicQueryFactoryUtil.forClass(ChatRoomMessage.class).add(PropertyFactoryUtil.forName(CHAT_ROOM_ID_FIELD).eq(roomId))
	        .add(PropertyFactoryUtil.forName(MESSAGE_PUBLIC_FIELD).eq(true)).add(PropertyFactoryUtil.forName(ADMIN_MESSAGE_FIELD).eq(false))
	        .add(PropertyFactoryUtil.forName(MESSAGE_STATUS_FIELD).eq(MessageStatus.Approved.getValue()))
	        .add(PropertyFactoryUtil.forName("messageType").eq(MessageType.UserEntered.getValue()))
	        .setProjection(ProjectionFactoryUtil.countDistinct("senderEmail"));

	List<?> lm = getChatRoomMessageLocalService().dynamicQuery(q);
	long count = ((Number) lm.get(0)).longValue();
	return count;

}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:17,代码来源:ChatRoomServiceImpl.java


示例20: getVotosByPropostaId

import com.liferay.portal.kernel.dao.orm.ProjectionFactoryUtil; //导入依赖的package包/类
/**
 * Conta os votos por identificador de proposta
 * 
 * @param propostaId
 * @return
 * @throws SystemException
 */
@Override
public int getVotosByPropostaId(long propostaId) throws SystemException {
	DynamicQuery dq = DynamicQueryFactoryUtil.forClass(Voto.class);
	dq.add(RestrictionsFactoryUtil.eq("propostaId", propostaId));
	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,代码行数:19,代码来源:VotoLocalServiceImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LdapTestUtils类代码示例发布时间:2022-05-22
下一篇:
Java ExcerptTailer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap