• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java OrderFactoryUtil类的典型用法和代码示例

java 1次浏览

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

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

示例1: getMostUsedSearchStringNotNull

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public List<Logging> getMostUsedSearchStringNotNull() {
	
	try {
		DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
		
		Criterion criterion = RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("searchString", "null"));
		dynamicQuery.add(criterion);
				
		Order defaultOrder = OrderFactoryUtil.desc("passel");
		dynamicQuery.addOrder(defaultOrder); 
						
		return dynamicQuery(dynamicQuery);
	} catch (SystemException e) {
		e.printStackTrace();
	}
	return null;
}
 

开发者ID:fraunhoferfokus,
项目名称:govapps,
代码行数:18,
代码来源:LoggingLocalServiceImpl.java

示例2: getMostViewdApplications

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public List<Application> getMostViewdApplications() {
	
	try {
		DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Application.class);
		
		Criterion criterion = RestrictionsFactoryUtil.gt("detailsViewed", new Long(0));
		dynamicQuery.add(criterion);
				
		Order defaultOrder = OrderFactoryUtil.desc("detailsViewed");
		dynamicQuery.addOrder(defaultOrder); 
						
		return dynamicQuery(dynamicQuery);
	} catch (SystemException e) {
		e.printStackTrace();
	}
	return null;
}
 

开发者ID:fraunhoferfokus,
项目名称:govapps,
代码行数:18,
代码来源:ApplicationLocalServiceImpl.java

示例3: getMostClickedApplications

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public List<Application> getMostClickedApplications() {
	
	try {
		DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Application.class);
		
		Criterion criterion = RestrictionsFactoryUtil.gt("linkClicked", new Long(0));
		dynamicQuery.add(criterion);
				
		Order defaultOrder = OrderFactoryUtil.desc("linkClicked");
		dynamicQuery.addOrder(defaultOrder); 
						
		return dynamicQuery(dynamicQuery);
	} catch (SystemException e) {
		e.printStackTrace();
	}
	return null;
}
 

开发者ID:fraunhoferfokus,
项目名称:govapps,
代码行数:18,
代码来源:ApplicationLocalServiceImpl.java

示例4: getPreviusModule

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public Module getPreviusModule(Module theModule) throws SystemException {
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
	DynamicQuery dq=DynamicQueryFactoryUtil.forClass(Module.class, classLoader);
	Criterion criterion=PropertyFactoryUtil.forName("ordern").lt(theModule.getOrdern());
	dq.add(criterion);
	criterion=PropertyFactoryUtil.forName("groupId").eq(theModule.getGroupId());
	dq.add(criterion);
	Order createOrder=OrderFactoryUtil.getOrderFactory().desc("ordern");
	dq.addOrder(createOrder);

	@SuppressWarnings("unchecked")
	List<Module> modulesp=(List<Module>)moduleLocalService.dynamicQuery(dq,0,1);
	if(modulesp!=null&& modulesp.size()>0)
	{
		return modulesp.get(0);
	}
	else
	{
		return null;
	}
}
 

开发者ID:TelefonicaED,
项目名称:liferaylms-portlet,
代码行数:22,
代码来源:ModuleLocalServiceImpl.java

示例5: getNextModule

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public Module getNextModule(Module theModule) throws SystemException {
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
	DynamicQuery dq=DynamicQueryFactoryUtil.forClass(Module.class, classLoader);
	Criterion criterion=PropertyFactoryUtil.forName("ordern").gt(theModule.getOrdern());
	dq.add(criterion);
	criterion=PropertyFactoryUtil.forName("groupId").eq(theModule.getGroupId());
	dq.add(criterion);
	Order createOrder=OrderFactoryUtil.getOrderFactory().asc("ordern");
	dq.addOrder(createOrder);

	@SuppressWarnings("unchecked")
	List<Module> modulesp=(List<Module>)moduleLocalService.dynamicQuery(dq,0,1);
	if(modulesp!=null&& modulesp.size()>0)
	{
		return modulesp.get(0);
	}
	else
	{
		return null;
	}
}
 

开发者ID:TelefonicaED,
项目名称:liferaylms-portlet,
代码行数:22,
代码来源:ModuleLocalServiceImpl.java

示例6: getComunidadesDisponiveis

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
/**
 * Lista todas as comunidades públicas, privadas e restritas da companhia
 * 
 * @throws SystemException
 */
@SuppressWarnings("unchecked")
public List<Group> getComunidadesDisponiveis(final long companyId) throws SystemException {

	final long groupClassNameId = ClassNameLocalServiceUtil.getClassNameId(Group.class);

	final DynamicQuery query = DynamicQueryFactoryUtil.forClass(Group.class, PortalClassLoaderUtil.getClassLoader());
	query.add(RestrictionsFactoryUtil.eq("companyId", companyId));
	query.add(RestrictionsFactoryUtil.eq("classNameId", groupClassNameId));
	query.add(RestrictionsFactoryUtil.in("type", new Object[] { GroupConstants.TYPE_SITE_OPEN, GroupConstants.TYPE_SITE_PRIVATE,
			GroupConstants.TYPE_SITE_RESTRICTED }));
	query.add(RestrictionsFactoryUtil.eq("parentGroupId", GroupConstants.DEFAULT_PARENT_GROUP_ID));
	query.add(RestrictionsFactoryUtil.eq("active", true));
	query.add(RestrictionsFactoryUtil.ne("name", GroupConstants.CONTROL_PANEL));
	query.addOrder(OrderFactoryUtil.asc("name"));

	return (List<Group>) GroupLocalServiceUtil.dynamicQuery(query);
}
 

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

示例7: findScheduledRoomsInGroup

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public final ChatRoomBean[] findScheduledRoomsInGroup(long groupId) throws SystemException {
	DynamicQuery q = DynamicQueryFactoryUtil.forClass(ChatRoom.class).add(PropertyFactoryUtil.forName(GROUP_ID_FIELD).eq(groupId));
	q.add(PropertyFactoryUtil.forName("openPolicy").eq(RoomOpenPolicy.Scheduled.getValue()));
	q.add(PropertyFactoryUtil.forName("openFrom").gt(new Date()));
	q.addOrder(OrderFactoryUtil.desc("groupId"));
	q.addOrder(OrderFactoryUtil.asc("openFrom"));

	@SuppressWarnings("unchecked")
	List<ChatRoom> rs = (List<ChatRoom>) getChatRoomLocalService().dynamicQuery(q);
	List<ChatRoomBean> retorno = new ArrayList<ChatRoomBean>();
	for (ChatRoom chatRoom : rs) {
		ChatPermissionChecker checker = getChatPermissionChecker(chatRoom);
		retorno.add(convertToChatRoomBean(chatRoom, checker.isCanJoin(), checker.isCanSpy(), false));
	}

	ChatRoomBean[] result = new ChatRoomBean[(retorno.size())];
	return retorno.toArray(result);
}
 

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

示例8: getMessagesForExport

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public final ChatRoomMessage[] getMessagesForExport(long roomId) throws SystemException, PortalException {

		ChatRoom room = getChatRoomLocalService().getChatRoom(roomId);
		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(RestrictionsFactoryUtil.or(PropertyFactoryUtil.forName("senderType").eq(UserType.SpecialGuest.getValue()),
		                PropertyFactoryUtil.forName("messageType").in(new Object[] { MessageType.Standard.getValue(), MessageType.Approved.getValue() })));
		if (room.getStatus() != RoomStatus.Exported.getValue()) {
			q.addOrder(OrderFactoryUtil.asc(MESSAGE_TS_FIELD));
		} else {
			q.addOrder(OrderFactoryUtil.asc("exportedPosition"));
		}

		List<?> lm = getChatRoomMessageLocalService().dynamicQuery(q);
		ChatRoomMessage[] result = new ChatRoomMessage[lm.size()];
		return lm.toArray(result);

	}
 

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

示例9: getComunidades

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
/**
 * Lista todas as comunidades públicas, privadas e restritas da companhia
 * 
 * @throws SystemException
 */
private List<Group> getComunidades(long companyId) throws SystemException {

	long groupClassNameId = ClassNameLocalServiceUtil
			.getClassNameId(Group.class);

	DynamicQuery query = DynamicQueryFactoryUtil.forClass(Group.class,
			PortalClassLoaderUtil.getClassLoader());
	query.add(RestrictionsFactoryUtil.eq("companyId", companyId));
	query.add(RestrictionsFactoryUtil.eq("classNameId", groupClassNameId));
	query.add(RestrictionsFactoryUtil.in("type", new Object[] {
			GroupConstants.TYPE_SITE_OPEN,
			GroupConstants.TYPE_SITE_PRIVATE,
			GroupConstants.TYPE_SITE_RESTRICTED }));
	query.add(RestrictionsFactoryUtil.eq("parentGroupId",
			GroupConstants.DEFAULT_PARENT_GROUP_ID));
	query.add(RestrictionsFactoryUtil.eq("active", true));
	query.add(RestrictionsFactoryUtil.ne("name",
			GroupConstants.CONTROL_PANEL));
	query.addOrder(OrderFactoryUtil.asc("name"));

	@SuppressWarnings("unchecked")
	List<Group> ret = GroupLocalServiceUtil.dynamicQuery(query);
	return ret;
}
 

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

示例10: getComunidadesDisponiveis

点赞 3

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
/**
 * Lista todas as comunidades públicas, privadas e restritas da companhia
 * 
 * @throws SystemException
 */
@SuppressWarnings("unchecked")
public List<Group> getComunidadesDisponiveis(final long companyId)
		throws SystemException {

	final long groupClassNameId = ClassNameLocalServiceUtil
			.getClassNameId(Group.class);

	final DynamicQuery query = DynamicQueryFactoryUtil.forClass(
			Group.class, PortalClassLoaderUtil.getClassLoader());
	query.add(RestrictionsFactoryUtil.eq("companyId", companyId));
	query.add(RestrictionsFactoryUtil.eq("classNameId", groupClassNameId));
	query.add(RestrictionsFactoryUtil.in("type", new Object[] {
			GroupConstants.TYPE_SITE_OPEN,
			GroupConstants.TYPE_SITE_PRIVATE,
			GroupConstants.TYPE_SITE_RESTRICTED }));
	query.add(RestrictionsFactoryUtil.eq("parentGroupId",
			GroupConstants.DEFAULT_PARENT_GROUP_ID));
	query.add(RestrictionsFactoryUtil.eq("active", true));
	query.add(RestrictionsFactoryUtil.ne("name",
			GroupConstants.CONTROL_PANEL));
	query.addOrder(OrderFactoryUtil.asc("name"));

	return (List<Group>) GroupLocalServiceUtil.dynamicQuery(query);
}
 

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

示例11: getCompanyList

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<Company> getCompanyList() throws Exception {
	ModelFactory modelFactory = new ModelFactory();

	Model companyModel = modelFactory.getModelObject(Company.class);

	return (List<Company>)
		companyModel.executeDynamicQuery(
			null, OrderFactoryUtil.asc("companyId"));
}
 

开发者ID:jorgediaz-lr,
项目名称:staging-checker,
代码行数:11,
代码来源:StagingCheckerPortlet.java

示例12: getSiteGroupIds

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<Long> getSiteGroupIds() {

	ModelFactory modelFactory = new ModelFactory();

	Model model = modelFactory.getModelObject(Group.class);

	Conjunction stagingSites = RestrictionsFactoryUtil.conjunction();
	stagingSites.add(model.getProperty("site").eq(false));
	stagingSites.add(model.getProperty("liveGroupId").ne(0L));

	Projection projection = model.getPropertyProjection("liveGroupId");

	List<Order> orders = Collections.singletonList(
		OrderFactoryUtil.asc("name"));

	try {
		return (List<Long>)model.executeDynamicQuery(
			stagingSites, projection, orders);
	}
	catch (Exception e) {
		if (_log.isWarnEnabled()) {
			_log.warn(e, e);
		}

		return new ArrayList<Long>();
	}
}
 

开发者ID:jorgediaz-lr,
项目名称:staging-checker,
代码行数:29,
代码来源:StagingCheckerPortlet.java

示例13: getAllLoggings

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public List<Logging> getAllLoggings() {		
	try {
		DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
							
		Order defaultOrder = OrderFactoryUtil.desc("passel");
		dynamicQuery.addOrder(defaultOrder); 
						
		return dynamicQuery(dynamicQuery);
	} catch (SystemException e) {
		e.printStackTrace();
	}
	return null;
}
 

开发者ID:fraunhoferfokus,
项目名称:govapps,
代码行数:14,
代码来源:LoggingLocalServiceImpl.java

示例14: getMostUsedSearchStringInclNull

点赞 2

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

示例15: findByActIdOrderByP2pId

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<P2pActivity> findByActIdOrderByP2pId(long actId)
		throws SystemException {
	try{
		
		ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
		DynamicQuery dq=DynamicQueryFactoryUtil.forClass(P2pActivity.class, classLoader);
		Criterion criterion=PropertyFactoryUtil.forName("actId").eq(actId);
		dq.add(criterion);
		Order createOrder=OrderFactoryUtil.getOrderFactory().asc("p2pActivityId");
		dq.addOrder(createOrder);

		List<P2pActivity> modulesp=(List<P2pActivity>)P2pActivityLocalServiceUtil.dynamicQuery(dq);

		//auditing
		ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
		if(serviceContext!=null){
			AuditingLogFactory.audit(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), P2pActivity.class.getName(), 
					actId, serviceContext.getUserId(), AuditConstants.GET, null);
		}else{
			LearningActivity la = learningActivityPersistence.fetchByPrimaryKey(actId);
			if(la!=null){
				AuditingLogFactory.audit(la.getCompanyId(), la.getGroupId(), P2pActivity.class.getName(), 
						actId, la.getUserId(), AuditConstants.GET, null);
			}
		}
		
		return modulesp;
		

	}
	catch(Exception e){
		if (_log.isErrorEnabled()) { 
			_log.error("Error getting P2pActivityLocalService.findByActIdOrderByP2pId");
			_log.error(e.getMessage());
		}
		return null;
	}
}
 

开发者ID:TelefonicaED,
项目名称:liferaylms-portlet,
代码行数:40,
代码来源:P2pActivityLocalServiceImpl.java

示例16: getP2pActivitiesToCorrect

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<P2pActivity> getP2pActivitiesToCorrect(long actId, long p2pActivityId, int numValidaciones) throws SystemException, PortalException{
	List<P2pActivity> res = new ArrayList<P2pActivity>();
	
	//Seleccionamos las actividades p2p entre ayer y antes de ayer.
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
	DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(P2pActivity.class, classLoader)
			.add(PropertyFactoryUtil.forName("actId").eq(actId))
			.add(PropertyFactoryUtil.forName("p2pActivityId").ne(p2pActivityId))
			.addOrder(OrderFactoryUtil.getOrderFactory().asc("countCorrections"));

	List<P2pActivity> activities = p2pActivityPersistence.findWithDynamicQuery(consulta,0,numValidaciones);
	
	//Si no es null ni esta vacia, la asignamos para devolver, sino devolveremos vacia.
	if(activities!=null && !activities.isEmpty()){
		//auditing
		ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
		if(serviceContext!=null){
			AuditingLogFactory.audit(serviceContext.getCompanyId(), serviceContext.getScopeGroupId(), P2pActivity.class.getName(), 
					actId, serviceContext.getUserId(), AuditConstants.GET, null);
		}else{
			LearningActivity la = learningActivityPersistence.fetchByPrimaryKey(actId);
			if(la!=null){
				AuditingLogFactory.audit(la.getCompanyId(), la.getGroupId(), P2pActivity.class.getName(), 
						actId, la.getUserId(), AuditConstants.GET, null);
			}
		}
		
		res = activities;
	}
			
	return res;
}
 

开发者ID:TelefonicaED,
项目名称:liferaylms-portlet,
代码行数:34,
代码来源:P2pActivityLocalServiceImpl.java

示例17: getNumCorrectsByDayP2P

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public int getNumCorrectsByDayP2P(long actId, Calendar calendar) throws SystemException, PortalException{
	int res = 0;

	Calendar calendarStar = Calendar.getInstance();
	Calendar calendarEnd = Calendar.getInstance();

	calendarStar.set(Calendar.HOUR_OF_DAY, 0);
	calendarStar.set(Calendar.MINUTE, 0);
	calendarStar.set(Calendar.SECOND, 0);
	
	calendarEnd.set(Calendar.HOUR_OF_DAY, 23);
	calendarEnd.set(Calendar.MINUTE, 59);
	calendarEnd.set(Calendar.SECOND, 59);
	
	//Seleccionamos las actividades p2p entre ayer y antes de ayer.
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
	DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(P2pActivity.class, classLoader)
			.add(PropertyFactoryUtil.forName("actId").eq(actId))
			.add(PropertyFactoryUtil.forName("date").between(calendarStar, calendarEnd))
			.addOrder(OrderFactoryUtil.getOrderFactory().asc("countCorrections"));

	List<P2pActivity> activities = (List<P2pActivity>)p2pActivityPersistence.findWithDynamicQuery(consulta,0,1);

	for(P2pActivity activity:activities){
		if(activity!=null)
			return (int)activity.getCountCorrections();
	}
	return res;
}
 

开发者ID:TelefonicaED,
项目名称:liferaylms-portlet,
代码行数:31,
代码来源:P2pActivityLocalServiceImpl.java

示例18: search

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public List<AuditEntry> search(long companyId, long groupId,String className,long classPK, long userId, Date startDate,Date endDate, int start, int end) throws SystemException
{
	DynamicQuery dq=auditEntryLocalService.dynamicQuery();
	Criterion criterion=PropertyFactoryUtil.forName("companyId").eq(companyId);
	dq.add(criterion);
	if(groupId>0)
	{
		criterion=PropertyFactoryUtil.forName("groupId").eq(groupId);
		dq.add(criterion);
	}
	if(userId>0)
	{
		criterion=PropertyFactoryUtil.forName("userId").eq(userId);
		dq.add(criterion);
	}
	if(startDate!=null)
	{
		criterion=PropertyFactoryUtil.forName("auditDate").ge(startDate);
		dq.add(criterion);
	}
	if(endDate!=null)
	{
		criterion=PropertyFactoryUtil.forName("auditDate").le(endDate);
		dq.add(criterion);
	}
	if(className!=null)
	{
		criterion=PropertyFactoryUtil.forName("classname").eq(className);
		dq.add(criterion);
		if(classPK>0)
		{
			criterion=PropertyFactoryUtil.forName("classPK").eq(classPK);
			dq.add(criterion);
		}
	}
	dq.addOrder(OrderFactoryUtil.desc("auditDate"));
	return ((List<AuditEntry>)auditEntryLocalService.dynamicQuery(dq, start, end));
}
 

开发者ID:TelefonicaED,
项目名称:liferaylms-portlet,
代码行数:39,
代码来源:AuditEntryLocalServiceImpl.java

示例19: findByActIdAndUserIdOrderByDate

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<P2pActivityCorrections> findByActIdAndUserIdOrderByDate(Long actId, Long userId) throws SystemException{
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
	DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(P2pActivityCorrections.class, classLoader)
			.add(PropertyFactoryUtil.forName("actId").eq(actId))
			.add(PropertyFactoryUtil.forName("userId").eq(userId))
			.addOrder(OrderFactoryUtil.getOrderFactory().desc("date"));

	List<P2pActivityCorrections> activities = (List<P2pActivityCorrections>)p2pActivityCorrectionsPersistence.findWithDynamicQuery(consulta);

	return activities;

}
 

开发者ID:TelefonicaED,
项目名称:liferaylms-portlet,
代码行数:14,
代码来源:P2pActivityCorrectionsLocalServiceImpl.java

示例20: findByActIdAndUserIdOrderById

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public List<P2pActivityCorrections> findByActIdAndUserIdOrderById(Long actId, Long userId) throws SystemException{
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
	DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(P2pActivityCorrections.class, classLoader)
			.add(PropertyFactoryUtil.forName("actId").eq(actId))
			.add(PropertyFactoryUtil.forName("userId").eq(userId))
			.addOrder(OrderFactoryUtil.getOrderFactory().desc("p2pActivityCorrectionsId"));

	List<P2pActivityCorrections> activities = (List<P2pActivityCorrections>)p2pActivityCorrectionsPersistence.findWithDynamicQuery(consulta);

	return activities;

}
 

开发者ID:TelefonicaED,
项目名称:liferaylms-portlet,
代码行数:13,
代码来源:P2pActivityCorrectionsLocalServiceImpl.java

示例21: findOpenAndEnterableClosedRooms

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
private ChatRoomBean[] findOpenAndEnterableClosedRooms(DynamicQuery q) throws SystemException {
	// Configurando query

	User user = getCurrentUser();

	if (user != null) {
		q.add(RestrictionsFactoryUtil.or(
		        PropertyFactoryUtil.forName("status").eq(RoomStatus.Opened.getValue()),
		        RestrictionsFactoryUtil.and(PropertyFactoryUtil.forName("status").eq(RoomStatus.Closed.getValue()),
		                PropertyFactoryUtil.forName("openPolicy").eq(RoomOpenPolicy.Manual.getValue()))));
	} else {
		q.add(PropertyFactoryUtil.forName("status").eq(RoomStatus.Opened.getValue()));

	}
	q.addOrder(OrderFactoryUtil.desc("groupId"));
	q.addOrder(OrderFactoryUtil.desc("createDate"));
	q.addOrder(OrderFactoryUtil.desc("roomId"));

	@SuppressWarnings("unchecked")
	List<ChatRoom> rs = (List<ChatRoom>) getChatRoomLocalService().dynamicQuery(q);
	List<ChatRoomBean> retorno = new ArrayList<ChatRoomBean>();

	// Verificando permissões
	for (ChatRoom chatRoom : rs) {
		ChatPermissionChecker checker = getChatPermissionChecker(chatRoom);

		if (checker.isCanJoin() || checker.isCanSpy()) {

			boolean isOpen = chatRoom.getStatus() == RoomStatus.Opened.getValue();
			ChatRoomBean room = convertToChatRoomBean(chatRoom, checker.isCanJoin(), checker.isCanSpy(), isOpen);
			retorno.add(room);
		}
	}

	ChatRoomBean[] result = new ChatRoomBean[(retorno.size())];
	return retorno.toArray(result);
}
 

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

示例22: findExportedRoomsInGroup

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
/**
 * Retorna todas as salas que tiveram seu histórico definido
 * 
 * @param groupId
 * @return
 * @throws SystemException
 */
public final ChatRoomBean[] findExportedRoomsInGroup(long groupId) throws SystemException {
	DynamicQuery q = DynamicQueryFactoryUtil.forClass(ChatRoom.class).add(PropertyFactoryUtil.forName(GROUP_ID_FIELD).eq(groupId));
	q.add(PropertyFactoryUtil.forName("status").eq(RoomStatus.Exported.getValue()));
	q.addOrder(OrderFactoryUtil.desc("groupId"));
	q.addOrder(OrderFactoryUtil.desc("createDate"));
	q.addOrder(OrderFactoryUtil.desc("roomId"));

	@SuppressWarnings("unchecked")
	List<ChatRoom> rs = (List<ChatRoom>) getChatRoomLocalService().dynamicQuery(q);
	List<ChatRoomBean> retorno = new ArrayList<ChatRoomBean>();

	for (ChatRoom chatRoom : rs) {
		// TODO: Verificar
		// if (false) {
		// try {
		// if (canView(chatRoom)) {
		// retorno.add(convertToChatRoomBean(chatRoom, false, false,
		// false));
		// }
		// } catch (PrincipalException e) {
		// throw new
		// SystemException("Erro ao checar permissão de visualizar.", e);
		// }
		// } else {
		retorno.add(convertToChatRoomBean(chatRoom, false, false, false));
		// }
	}

	ChatRoomBean[] result = new ChatRoomBean[(retorno.size())];

	return retorno.toArray(result);
}
 

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

示例23: getUsersInChatRoom

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public final ChatRoomUser[] getUsersInChatRoom(long roomId) throws SystemException, PortalException {

		ChatRoomUser[] result = null;
		DynamicQuery q = DynamicQueryFactoryUtil.forClass(ChatRoomUser.class).add(PropertyFactoryUtil.forName(CHAT_ROOM_ID_FIELD).eq(roomId))
		        .addOrder(OrderFactoryUtil.desc("userType")).addOrder(OrderFactoryUtil.asc("userName"));
		List<?> lr = getChatRoomUserLocalService().dynamicQuery(q);

		result = new ChatRoomUser[lr.size()];
		return lr.toArray(result);
	}
 

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

示例24: getComunidades

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
@Override
protected List<Group> getComunidades(PortletRequest renderRequest, ThemeDisplay td) {
	List<Group> comunidades = Collections.<Group> emptyList();

	try {
		// Consulta feita na mão para evitar cache trashing
		DynamicQuery query = DynamicQueryFactoryUtil.forClass(Group.class, PortalClassLoaderUtil.getClassLoader());
		query.add(RestrictionsFactoryUtil.eq("companyId", td.getCompanyId()));
		query.add(RestrictionsFactoryUtil.eq("active", true));
		query.add(RestrictionsFactoryUtil.in("type", new Object[] {GroupConstants.TYPE_SITE_OPEN, GroupConstants.TYPE_SITE_RESTRICTED} ));
		query.add(RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.in("name", new Object[] {GroupConstants.GUEST, GroupConstants.CONTROL_PANEL, ""})));
		query.add(RestrictionsFactoryUtil.ne("groupId", td.getScopeGroupId()));
		query.add(RestrictionsFactoryUtil.eq("classNameId", PortalUtil.getClassNameId(Group.class)));
		query.addOrder(OrderFactoryUtil.asc("name"));
		
		@SuppressWarnings("unchecked")
		List<Group> groups = GroupLocalServiceUtil.dynamicQuery(query) ;
		
		comunidades = new ArrayList<Group>(groups.size());
		for (Group grp : groups) {
			if (grp.getPublicLayoutsPageCount() != 0)
				comunidades.add(grp);
		}
	} catch (SystemException e) {
		_log.error(e);
	}
	return comunidades;
}
 

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

示例25: getComunidadesAtivas

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
private List<Group> getComunidadesAtivas(PortletRequest renderRequest, ThemeDisplay td) {

	List<Group> comunidades = Collections.<Group> emptyList();

	try {

	    DynamicQuery query = DynamicQueryFactoryUtil.forClass(Group.class, PortalClassLoaderUtil.getClassLoader());
	    query.add(RestrictionsFactoryUtil.eq("companyId", td.getCompanyId()));
	    query.add(RestrictionsFactoryUtil.eq("active", true));
	    query.add(RestrictionsFactoryUtil.in("type", new Object[] { GroupConstants.TYPE_SITE_OPEN, GroupConstants.TYPE_SITE_RESTRICTED }));
	    query.add(RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.in("name", new Object[] { GroupConstants.GUEST, GroupConstants.CONTROL_PANEL, "" })));
	    // query.add(RestrictionsFactoryUtil.ne("groupId",
	    // td.getScopeGroupId()));
	    query.add(RestrictionsFactoryUtil.eq("classNameId", PortalUtil.getClassNameId(Group.class)));
	    query.addOrder(OrderFactoryUtil.desc("name"));

	    @SuppressWarnings("unchecked")
	    List<Group> groups = GroupLocalServiceUtil.dynamicQuery(query);

	    comunidades = new ArrayList<Group>(groups.size());

	    for (Group grp : groups) {

		if (grp.getPublicLayoutsPageCount() != 0) {
		    Boolean finished = (Boolean) grp.getExpandoBridge().getAttribute("Encerrada");
		    if (finished == null || !finished)
			comunidades.add(grp);
		}

	    }

	} catch (SystemException e) {
	    _log.error(e);
	}

	return comunidades;
    }
 

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

示例26: getComunidadesEncerradas

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
private List<Group> getComunidadesEncerradas(PortletRequest renderRequest, ThemeDisplay td) {

	List<Group> comunidades = Collections.<Group> emptyList();

	try {

	    DynamicQuery query = DynamicQueryFactoryUtil.forClass(Group.class, PortalClassLoaderUtil.getClassLoader());
	    query.add(RestrictionsFactoryUtil.eq("companyId", td.getCompanyId()));
	    query.add(RestrictionsFactoryUtil.eq("active", true));
	    query.add(RestrictionsFactoryUtil.in("type", new Object[] { GroupConstants.TYPE_SITE_OPEN, GroupConstants.TYPE_SITE_RESTRICTED }));
	    query.add(RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.in("name", new Object[] { GroupConstants.GUEST, GroupConstants.CONTROL_PANEL, "" })));
	    // query.add(RestrictionsFactoryUtil.ne("groupId",
	    // td.getScopeGroupId()));
	    query.add(RestrictionsFactoryUtil.eq("classNameId", PortalUtil.getClassNameId(Group.class)));
	    query.addOrder(OrderFactoryUtil.desc("name"));

	    @SuppressWarnings("unchecked")
	    List<Group> groups = GroupLocalServiceUtil.dynamicQuery(query);

	    comunidades = new ArrayList<Group>(groups.size());

	    for (Group grp : groups) {
		if (grp.getPublicLayoutsPageCount() != 0) {
		    Boolean finished = (Boolean) grp.getExpandoBridge().getAttribute("Encerrada");
		    if (finished != null && finished)
			comunidades.add(grp);
		}
	    }

	} catch (SystemException e) {
	    _log.error(e);
	}

	return comunidades;
    }
 

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

示例27: getLoggingsByCategories

点赞 2

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

示例28: getLoggingsByRegions

点赞 2

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

示例29: getLoggingsByMissingEntitlements

点赞 2

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

示例30: getLoggingsByPlatforms

点赞 2

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

示例31: getLoggingsByTargetCategories

点赞 2

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

示例32: getNewApplications

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
public List<List> getNewApplications(long companyId, int year, int month, int day, int count) throws SystemException {	
	_log.debug("getNewApplications2: ");
	List<List> result  = new ArrayList<List>();
	try {
		Date modifiedDate = PortalUtil.getDate(month, day, year);
		Date now = new Date();
		
		DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Application.class);
		Criterion criterion = null;
		
		criterion = RestrictionsFactoryUtil.between("modifiedDate",modifiedDate,now);

		dynamicQuery.add(criterion);
		dynamicQuery.add(PropertyFactoryUtil.forName("lifeCycleStatus").eq(E_Stati.APPLICATION_STATUS_VERIFIED.getIntStatus()));
		
		Order defaultOrder = OrderFactoryUtil.desc("modifiedDate");
		dynamicQuery.addOrder(defaultOrder); 
				
		dynamicQuery.setLimit(0, count);
		
		List<Application> applications = ApplicationLocalServiceUtil.dynamicQuery(dynamicQuery);
		
	
		for (Application application: applications) {
			List toAdd = new ArrayList();
			toAdd.add(application);
						
			if (application.getLogoImageId() != 0) {
				DLFileEntry fe;
				fe = DLFileEntryLocalServiceUtil.getDLFileEntry(application.getLogoImageId());
							//String iconUrl = "http://localhost/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true);
				String iconUrl = "http://localhost/documents/10180/0/" + 
					HttpUtil.encodeURL(HtmlUtil.unescape(fe.getTitle())) + 
					StringPool.SLASH + 
					fe.getUuid() +
					"?version=" + fe.getVersion() +
					"&t=" + fe.getModifiedDate().getTime() +
					"&imageThumbnail=1";
								
				toAdd.add(iconUrl);
			}
					
			result.add(toAdd);				
		}
	} catch (Exception e) {
		_log.error(e.getMessage());
		e.printStackTrace();
	}
	return result;		
}
 

开发者ID:fraunhoferfokus,
项目名称:govapps,
代码行数:51,
代码来源:ApplicationServiceImpl.java

示例33: getUsersToCorrectP2P

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<User> getUsersToCorrectP2P(long actId, long userId, int numUsers, Calendar calendar) throws SystemException, PortalException{
	List<User> users = new ArrayList<User>();
	
	Calendar calendarStar = Calendar.getInstance();
	calendarStar.setTime(calendar.getTime());
	Calendar calendarEnd = Calendar.getInstance();
	calendarEnd.setTime(calendar.getTime());

	calendarStar.set(Calendar.HOUR_OF_DAY, 0);
	calendarStar.set(Calendar.MINUTE, 0);
	calendarStar.set(Calendar.SECOND, 0);
	
	calendarEnd.set(Calendar.HOUR_OF_DAY, 23);
	calendarEnd.set(Calendar.MINUTE, 59);
	calendarEnd.set(Calendar.SECOND, 59);
	
	int selected = 0;

	//Seleccionamos las actividades p2p entre ayer y antes de ayer.
	ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
	DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(P2pActivity.class, classLoader)
			.add(PropertyFactoryUtil.forName("actId").eq(actId))
			.add(PropertyFactoryUtil.forName("userId").ne(userId))
			.add(PropertyFactoryUtil.forName("date").between(calendarStar.getTime(), calendarEnd.getTime()))
			.addOrder(OrderFactoryUtil.getOrderFactory().asc("countCorrections"));

	List<P2pActivity> activities = (List<P2pActivity>)p2pActivityPersistence.findWithDynamicQuery(consulta);

	for(P2pActivity activity:activities){

		Long uId = activity.getUserId();
		User u = UserLocalServiceUtil.getUserById(uId.longValue());
		int correctionsAsigned = P2pActivityCorrectionsLocalServiceUtil.getNumCorrectionsAsignToP2P(activity.getP2pActivityId());

		if(u!=null && !users.contains(u) ){
			users.add(u);
			selected++;
		}
		if(selected >= numUsers){
			return users;
		}
	}
	
	//Si no tenemos suficientes usuarios, buscamos otras 24 horas atras. Llamada recursiva con un dia menos.
	LearningActivity l = LearningActivityLocalServiceUtil.getLearningActivity(actId);

	Calendar calendarAct = Calendar.getInstance();
	calendarAct.setTime(calendar.getTime());

	calendarAct.set(Calendar.HOUR_OF_DAY,23);
	calendarAct.set(Calendar.MINUTE, 59);
	calendarAct.set(Calendar.SECOND, 59);
	
	Calendar dayBefore = Calendar.getInstance();
	dayBefore.setTime(calendarAct.getTime());
	dayBefore.set(Calendar.DAY_OF_YEAR, dayBefore.get(Calendar.DAY_OF_YEAR)-1);
	
	Calendar endDay =  Calendar.getInstance();
	endDay.setTime(l.getStartdate());
	
	//Paramos la recursividad cuando no tengamos mas dias en los que buscar.
	if(l.getStartdate().compareTo(dayBefore.getTime())<=0){
		
		List<User> usersBefore = getUsersToCorrectP2P(actId, userId, numUsers, dayBefore);
		
		for(User usu:usersBefore){
			if(usu!=null && !users.contains(usu))
				users.add(usu);
			
			selected++;
			if(selected >= numUsers){
				return users;
			}
		}
	}
	
	return users;
}
 

开发者ID:TelefonicaED,
项目名称:liferaylms-portlet,
代码行数:80,
代码来源:P2pActivityLocalServiceImpl.java

示例34: getGroups

点赞 2

import com.liferay.portal.kernel.dao.orm.OrderFactoryUtil; //导入依赖的package包/类
private List<Group> getGroups(long groupId) throws SystemException {
	DynamicQuery query = DynamicQueryFactoryUtil.forClass(GroupModel.class, PortalClassLoaderUtil.getClassLoader()).addOrder(OrderFactoryUtil.asc("groupId"));
	query.add(RestrictionsFactoryUtil.or(PropertyFactoryUtil.forName("groupId").eq(groupId), PropertyFactoryUtil.forName("parentGroupId").eq(groupId)));
	
	return (List<Group>) GroupLocalServiceUtil.dynamicQuery(query);
}
 

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


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)