Example usage for com.liferay.portal.kernel.dao.orm Property ge

List of usage examples for com.liferay.portal.kernel.dao.orm Property ge

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.orm Property ge.

Prototype

public Criterion ge(Object value);

Source Link

Usage

From source file:com.liferay.akismet.util.AkismetUtil.java

License:Open Source License

public static WikiPage getWikiPage(long nodeId, String title, double version, boolean previous) {

    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(WikiPage.class);

    Property summaryProperty = PropertyFactoryUtil.forName("summary");

    dynamicQuery.add(summaryProperty.ne(AkismetConstants.WIKI_PAGE_MARKED_AS_SPAM));
    dynamicQuery.add(summaryProperty.ne(AkismetConstants.WIKI_PAGE_PENDING_APPROVAL));

    Property nodeIdProperty = PropertyFactoryUtil.forName("nodeId");

    dynamicQuery.add(nodeIdProperty.eq(nodeId));

    Property titleProperty = PropertyFactoryUtil.forName("title");

    dynamicQuery.add(titleProperty.eq(title));

    Property statusProperty = PropertyFactoryUtil.forName("status");

    dynamicQuery.add(statusProperty.eq(WorkflowConstants.STATUS_APPROVED));

    Property versionProperty = PropertyFactoryUtil.forName("version");

    if (previous) {
        dynamicQuery.add(versionProperty.lt(version));
    } else {// ww  w  .  j  ava2  s  . c  o m
        dynamicQuery.add(versionProperty.ge(version));
    }

    OrderFactoryUtil.addOrderByComparator(dynamicQuery, new PageVersionComparator());

    List<WikiPage> wikiPages = WikiPageLocalServiceUtil.dynamicQuery(dynamicQuery, 0, 1);

    if (wikiPages.isEmpty()) {
        return null;
    }

    return wikiPages.get(0);
}

From source file:com.liferay.exportimport.lar.DeletionSystemEventExporter.java

License:Open Source License

protected void addCreateDateProperty(PortletDataContext portletDataContext, DynamicQuery dynamicQuery) {

    if (!portletDataContext.hasDateRange()) {
        return;//from w  w w.j a v a  2  s  . c  o  m
    }

    Property createDateProperty = PropertyFactoryUtil.forName("createDate");

    Date startDate = portletDataContext.getStartDate();

    dynamicQuery.add(createDateProperty.ge(startDate));

    Date endDate = portletDataContext.getEndDate();

    dynamicQuery.add(createDateProperty.le(endDate));
}

From source file:com.liferay.exportimport.lar.PortletDataContextImpl.java

License:Open Source License

@Override
public Criterion getDateRangeCriteria(String propertyName) {
    if (!hasDateRange()) {
        return null;
    }/*w w  w . j  a  va2  s . c o  m*/

    Conjunction conjunction = RestrictionsFactoryUtil.conjunction();

    Property property = PropertyFactoryUtil.forName(propertyName);

    conjunction.add(property.le(_endDate));
    conjunction.add(property.ge(_startDate));

    return conjunction;
}

From source file:com.liferay.polls.service.persistence.PollsQuestionExportActionableDynamicQuery.java

License:Open Source License

protected long getModelDeletionCount() throws PortalException, SystemException {
    ActionableDynamicQuery actionableDynamicQuery = new SystemEventActionableDynamicQuery() {
        @Override/*from  w  w w  .  j av  a2  s .  co m*/
        protected void addCriteria(DynamicQuery dynamicQuery) {
            Property classNameIdProperty = PropertyFactoryUtil.forName("classNameId");

            dynamicQuery.add(classNameIdProperty.eq(PortalUtil.getClassNameId(PollsQuestion.class.getName())));

            Property typeProperty = PropertyFactoryUtil.forName("type");

            dynamicQuery.add(typeProperty.eq(SystemEventConstants.TYPE_DELETE));

            _addCreateDateProperty(dynamicQuery);
        }

        @Override
        protected void performAction(Object object) {
        }

        private void _addCreateDateProperty(DynamicQuery dynamicQuery) {
            if (!_portletDataContext.hasDateRange()) {
                return;
            }

            Property createDateProperty = PropertyFactoryUtil.forName("createDate");

            Date startDate = _portletDataContext.getStartDate();

            dynamicQuery.add(createDateProperty.ge(startDate));

            Date endDate = _portletDataContext.getEndDate();

            dynamicQuery.add(createDateProperty.le(endDate));
        }
    };

    actionableDynamicQuery.setGroupId(_portletDataContext.getScopeGroupId());

    return actionableDynamicQuery.performCount();
}