Example usage for com.liferay.portal.kernel.dao.orm ActionableDynamicQuery setParallel

List of usage examples for com.liferay.portal.kernel.dao.orm ActionableDynamicQuery setParallel

Introduction

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

Prototype

public void setParallel(boolean parallel);

Source Link

Usage

From source file:com.liferay.calendar.web.internal.upgrade.v1_0_3.UpgradeEventsDisplayPortletId.java

License:Open Source License

@Override
protected void updateInstanceablePortletPreferences(final String oldRootPortletId,
        final String newRootPortletId) throws Exception {

    ActionableDynamicQuery actionableDynamicQuery = _portletPreferencesLocalService.getActionableDynamicQuery();

    actionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {

        @Override/*from ww  w .ja v a  2 s.c om*/
        public void addCriteria(DynamicQuery dynamicQuery) {
            Junction junction = RestrictionsFactoryUtil.disjunction();

            Property property = PropertyFactoryUtil.forName("portletId");

            junction.add(property.eq(oldRootPortletId));
            junction.add(property.like(oldRootPortletId + "_INSTANCE_%"));
            junction.add(property.like(oldRootPortletId + "_USER_%_INSTANCE_%"));

            dynamicQuery.add(junction);
        }

    });
    actionableDynamicQuery.setParallel(true);
    actionableDynamicQuery
            .setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<PortletPreferences>() {

                @Override
                public void performAction(PortletPreferences portletPreference) throws PortalException {

                    updatePortletPreferences(portletPreference, oldRootPortletId, newRootPortletId);
                }

            });

    actionableDynamicQuery.performActions();
}