本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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>();
}
}