Example usage for com.liferay.portal.kernel.dao.orm DynamicQuery list

List of usage examples for com.liferay.portal.kernel.dao.orm DynamicQuery list

Introduction

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

Prototype

@SuppressWarnings("rawtypes")
    public List list();

Source Link

Usage

From source file:com.liferay.layout.internal.exportimport.staged.model.repository.StagedLayoutSetStagedModelRepository.java

License:Open Source License

@Override
public List<StagedLayoutSet> fetchStagedModelsByUuidAndCompanyId(String uuid, long companyId) {

    boolean privateLayout = GetterUtil.getBoolean(uuid);

    DynamicQuery dynamicQuery = _layoutSetLocalService.dynamicQuery();

    Property companyIdProperty = PropertyFactoryUtil.forName("companyId");

    dynamicQuery.add(companyIdProperty.eq(companyId));

    Property privateLayoutProperty = PropertyFactoryUtil.forName("privateLayout");

    dynamicQuery.add(privateLayoutProperty.eq(privateLayout));

    List<LayoutSet> layoutSets = dynamicQuery.list();

    Stream<LayoutSet> layoutSetsStream = layoutSets.stream();

    Stream<StagedLayoutSet> stagedLayoutSetsStream = layoutSetsStream
            .map(layoutSet -> ModelAdapterUtil.adapt(layoutSet, LayoutSet.class, StagedLayoutSet.class));

    return stagedLayoutSetsStream.collect(Collectors.toList());
}

From source file:com.liferay.ruon.service.persistence.NetworkPersistenceImpl.java

License:Open Source License

public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery) throws SystemException {
    Session session = null;//from  ww w  . j  a va 2s.  c om

    try {
        session = openSession();

        dynamicQuery.compile(session);

        return dynamicQuery.list();
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.ruon.service.persistence.NetworkPersistenceImpl.java

License:Open Source License

public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end) throws SystemException {
    Session session = null;/* w w  w  .  ja v a2 s  .  c  om*/

    try {
        session = openSession();

        dynamicQuery.setLimit(start, end);

        dynamicQuery.compile(session);

        return dynamicQuery.list();
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}