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


Java RestrictionsFactoryUtil类代码示例

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


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

示例1: parseStructureData

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入依赖的package包/类
/**
 * Set structure data.
 * 
 * There's no method for fetching
 * structure by key so we are using DynamicQuery here.
 * 
 * @param structureKey
 * @return
 * @throws PortalException 
 */
protected JSONObject parseStructureData(TermCollector tc, Locale locale) throws PortalException {

	DynamicQuery structureQuery = _ddmStructureLocalService.dynamicQuery();
	structureQuery.add(
		RestrictionsFactoryUtil.eq("structureKey", tc.getTerm()));

	List<DDMStructure> structures =
		DDMStructureLocalServiceUtil.dynamicQuery(structureQuery);
	
	DDMStructure structure =  structures.get(0);

	JSONObject item = JSONFactoryUtil.createJSONObject();

	item.put("frequency", tc.getFrequency());
	item.put("groupName", _groupLocalService.getGroup(structure.getGroupId()).getName(
				locale, true));
	item.put("name", structure.getName(locale, true));
	item.put("term", tc.getTerm());
	
	return item;
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:32,代码来源:WebContentStructureFacetTranslator.java

示例2: getMostUsedSearchStringNotNull

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

示例3: getMostViewdApplications

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

示例4: getMostClickedApplications

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

示例5: getRelAppIds

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

示例6: findByclassName_classPK_filterByActions

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

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

示例7: getComunidadesDisponiveis

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

示例8: getMessagesForExport

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

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

示例10: getComunidades

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

示例11: getGruposFilhos

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入依赖的package包/类
/**
 * @param group
 * 
 * @return
 * @throws SystemException
 */
private List<Long> getGruposFilhos(Group group) throws SystemException {
	List<Long> grupos = new ArrayList<Long>();

	long layoutClassNameId = ClassNameLocalServiceUtil
			.getClassNameId(Layout.class);
	DynamicQuery query = DynamicQueryFactoryUtil.forClass(Group.class);
	query.add(RestrictionsFactoryUtil.eq("companyId", group.getCompanyId()));
	query.add(RestrictionsFactoryUtil.eq("classNameId", layoutClassNameId));
	query.add(RestrictionsFactoryUtil.eq("parentGroupId",
			group.getGroupId()));
	query.add(RestrictionsFactoryUtil.eq("active", true));
	@SuppressWarnings("unchecked")
	List<Group> filhos = GroupLocalServiceUtil.dynamicQuery(query);
	for (Group filho : filhos)
		grupos.add(filho.getGroupId());
	return grupos;
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:24,代码来源:ContadorAcessoLocalServiceImpl.java

示例12: getComunidadesDisponiveis

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

示例13: generateSQLCriterion

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入依赖的package包/类
public static Criterion generateSQLCriterion(String sql) {
	if (Validator.isNull(sql)) {
		return null;
	}

	sql = PortalUtil.transformSQL(sql);

	return RestrictionsFactoryUtil.sqlRestriction(sql);
}
 
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:10,代码来源:ModelUtil.java

示例14: getAttributeRangeCriterion

import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入依赖的package包/类
protected Criterion getAttributeRangeCriterion(
	Model model, String attribute, Object value, boolean isStartValue) {

	if (!model.hasAttribute(attribute)) {
		return RestrictionsFactoryUtil.disjunction();
	}

	Property property = model.getProperty(attribute);

	if (isStartValue) {
		return property.ge(value);
	}

	return property.lt(value);
}
 
开发者ID:jorgediaz-lr,项目名称:staging-checker,代码行数:16,代码来源:StagingCheckerModelFactory.java

示例15: getSiteGroupIds

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


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