protected ActionableDynamicQuery getRecordActionableDynamicQuery(
      final PortletDataContext portletDataContext) {

    ActionableDynamicQuery actionableDynamicQuery =
        _ddlRecordLocalService.getExportActionableDynamicQuery(portletDataContext);

    final ActionableDynamicQuery.AddCriteriaMethod addCriteriaMethod =
        actionableDynamicQuery.getAddCriteriaMethod();

    actionableDynamicQuery.setAddCriteriaMethod(
        new ActionableDynamicQuery.AddCriteriaMethod() {

          @Override
          public void addCriteria(DynamicQuery dynamicQuery) {
            addCriteriaMethod.addCriteria(dynamicQuery);

            Property recordIdProperty = PropertyFactoryUtil.forName("recordId");

            StagedModelDataHandler<?> stagedModelDataHandler =
                StagedModelDataHandlerRegistryUtil.getStagedModelDataHandler(
                    DDLRecord.class.getName());

            Class<?> clazz = stagedModelDataHandler.getClass();

            DynamicQuery recordVersionDynamicQuery =
                DynamicQueryFactoryUtil.forClass(
                    DDLRecordVersion.class, "recordVersion", clazz.getClassLoader());

            recordVersionDynamicQuery.setProjection(ProjectionFactoryUtil.property("recordId"));

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

            recordVersionDynamicQuery.add(
                statusProperty.in(stagedModelDataHandler.getExportableStatuses()));

            recordVersionDynamicQuery.add(
                RestrictionsFactoryUtil.eqProperty("recordVersion.version", "version"));

            recordVersionDynamicQuery.add(
                RestrictionsFactoryUtil.eqProperty("recordVersion.recordId", "recordId"));

            dynamicQuery.add(recordIdProperty.in(recordVersionDynamicQuery));
          }
        });

    return actionableDynamicQuery;
  }
  protected ActionableDynamicQuery getPageActionableDynamicQuery(
      final PortletDataContext portletDataContext, final long nodeId, final String portletId)
      throws SystemException {

    ActionableDynamicQuery actionableDynamicQuery =
        WikiPageLocalServiceUtil.getExportActionableDynamicQuery(portletDataContext);

    final ActionableDynamicQuery.AddCriteriaMethod addCriteriaMethod =
        actionableDynamicQuery.getAddCriteriaMethod();

    actionableDynamicQuery.setAddCriteriaMethod(
        new ActionableDynamicQuery.AddCriteriaMethod() {

          @Override
          public void addCriteria(DynamicQuery dynamicQuery) {
            addCriteriaMethod.addCriteria(dynamicQuery);

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

            dynamicQuery.add(property.eq(nodeId));
          }
        });

    actionableDynamicQuery.setPerformActionMethod(
        new ActionableDynamicQuery.PerformActionMethod() {

          @Override
          public void performAction(Object object) throws PortalException {

            WikiPage page = (WikiPage) object;

            StagedModelDataHandlerUtil.exportReferenceStagedModel(
                portletDataContext, portletId, page);
          }
        });

    return actionableDynamicQuery;
  }